Beispiel #1
0
 /// <summary>
 /// 检查用户密码
 /// </summary>
 /// <param name="Item">model</param>
 /// <returns></returns>
 public static bool CheckPwd(string pass)
 {
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new UsersDAL();
     bool Flag = false;
     SqlParameter[] prams ={
         db.MakeInParam("@Uid",SqlDbType.VarChar,50,LUser.Uid),
         db.MakeInParam("@Pwd",SqlDbType.VarChar,50,pass)
     };
     try
     {
         SqlDataReader dr;
         db.GetDataReader(visitor, prams, out dr, "UserLock");
         if (dr.Read())
         {
             Flag = true;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         db.Dispose();
     }
     return Flag;
 }
Beispiel #2
0
        /// <summary>
        /// 用户登陆
        /// </summary>
        /// <param name="Item">model</param>
        /// <returns></returns>
        public static bool UserLogin(D_User Item)
        {
            DataBase db = new DataBase();
            DataBaseVisitor visitor = new UsersDAL();
            bool Flag = false;
            SqlParameter[] prams ={
                db.MakeInParam("@Uid",SqlDbType.VarChar,50,Item.Uid),
                db.MakeInParam("@Pwd",SqlDbType.VarChar,50,Item.Pwd)
            };
            try
            {
                DataSet ds = new DataSet();
                ds = db.ReturnDataSet(visitor, prams, "UserLogin");
                DataRowCollection drc = ds.Tables[0].Rows;
                if (drc.Count > 0)
                {
                    DataRow dr = drc[0];
                    CUser.Id = Convert.ToInt64(dr["Id"]);
                    CUser.Code = dr["Code"].ToString();
                    CUser.Uid = dr["Uid"].ToString();
                    CUser.Name = dr["Name"].ToString();
                    CUser.Role = dr["Role"].ToString();
                    //PublicFun.IniFile Ini = new PublicFun.IniFile(WSV.Model.FilePath.Config);
                    //if (Ini.ExistIniFile())
                    //{
                    //    LUser.TableNum = Ini.IniReadValue("LoadoMeter", "TableNum");
                    //}
                    //ds = WSV.BLL.SysInfo.LoadoMeterBLL.SelectAll(" where TableNum='" + LUser.TableNum + "'");
                    //drc = ds.Tables[0].Rows;
                    //if (drc.Count > 0)
                    //{
                    //    dr = drc[0];
                    //    LUser.TableName = dr["Name"].ToString();
                    //    LUser.Ip = dr["Ip"].ToString();
                    //    LUser.Port = dr["Port"].ToString();
                    //}
                    //else
                    //{
                    //    LUser.TableNum = "";
                    //}
                    Flag = true;
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                db.Dispose();
            }
            return Flag;
        }
Beispiel #3
0
 /// <summary>
 /// 修改数据
 /// </summary>
 /// <param name="Item">model</param>
 /// <returns></returns>
 public static bool Update(D_User Item)
 {
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new UsersDAL();
     bool Flag= false,ReFlag=false;
     int N= 0;
     SqlParameter[] prams ={
         db.MakeInParam("@Code", SqlDbType.VarChar,50, Item.Code),
         db.MakeInParam("@Name", SqlDbType.VarChar,50, Item.Name),
         db.MakeInParam("@Uid", SqlDbType.VarChar,50, Item.Uid),
         db.MakeInParam("@Pwd", SqlDbType.VarChar,50, Item.Pwd),
         db.MakeInParam("@Role", SqlDbType.VarChar,50, Item.Role),
         db.MakeInParam("@Used", SqlDbType.Bit,0, Item.Used),
         db.MakeInParam("@Id", SqlDbType.BigInt,0,Item.Id)
     };
     try
     {
         ReFlag= db.TransactSql(visitor, "Update", prams, out N);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         db.Dispose();
     }
     if (ReFlag && N > 0)
     {
         Flag = true;
     }
     return Flag;
 }
Beispiel #4
0
 /// <summary>
 /// 查询出所有的数据
 /// </summary>
 /// <returns>返回数据源</returns>
 public static DataSet SelectAll()
 {
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new UsersDAL();
     DataSet ds = new DataSet();
     try
     {
         ds = db.ReturnDataSet(visitor, "Select", "D_User");
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         db.Dispose();
     }
     return ds;
 }