using MESClassLibrary.BLL.Log;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Reflection;
using System.Text;

namespace MESClassLibrary.DAL
{
    public class BasicDAL
    {
        public bool Del_Info(string tableName,string id, string userid)
        {
            try
            {
                string sql = @"update " + tableName + @" set 
                                 IsUseing = @IsUseing,
                                 DisableUserID = @DisableUserID,
                                 DisableTime = @DisableTime
                                 where ID=@ID";

                SqlParameter[] param = new SqlParameter[4];
                param[0] = new SqlParameter("@IsUseing", SqlDbType.Int);
                param[0].Value = 0;

                param[1] = new SqlParameter("@DisableUserID", SqlDbType.VarChar);
                param[1].Value = userid;

                param[2] = new SqlParameter("@DisableTime", SqlDbType.DateTime);
                param[2].Value = DateTime.Now;

                param[3] = new SqlParameter("@ID", SqlDbType.VarChar);
                param[3].Value = id;

                if (SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, sql, param) > 0)
                {
                    return true;
                }
                return false;
            }
            catch (Exception ex)
            {
                LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
                return false;
            }

        }
    }
}