Beispiel #1
0
 /// <summary>
 /// 修改用户
 /// </summary>
 /// <param name="Account">用户实体对象</param>
 /// <returns></returns>
 public int Update_Account(UserModel user)
 {
     return dal.Update_Account(user);
 }
Beispiel #2
0
 /// <summary>
 /// 添加账号
 /// </summary>
 /// <param name="Group">账号对象</param>
 /// <returns></returns>
 public int Insert_Account(UserModel user)
 {
     return dal.Insert_Account(user);
 }
Beispiel #3
0
 /// <summary>
 /// 获取用户对象
 /// </summary>
 /// <param name="acountName">用户编号</param>
 /// <returns></returns>
 public UserModel Get_UserModel(int ID)
 {
     string strWhere = "Power_Accounts.ID=" + ID;
     DataSet ds = Get_AccountList(strWhere);
     UserModel user = new UserModel();
     if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
     {
         DataTable dt = ds.Tables[0];
         user.ID = int.Parse(dt.Rows[0]["ID"].ToString());
         user.AccountNO = dt.Rows[0]["AccountNO"].ToString();
         user.AcountName = dt.Rows[0]["AcountName"].ToString();
         user.TrueName = dt.Rows[0]["TrueName"].ToString();
         user.GroupID = int.Parse(dt.Rows[0]["GroupID"].ToString());
         user.DEPT_ID = int.Parse(dt.Rows[0]["DEPT_ID"].ToString());
         user.Remark = dt.Rows[0]["Remark"].ToString();
         user.BYNAME = dt.Rows[0]["BYNAME"].ToString();
         user.Sex = bool.Parse(dt.Rows[0]["Sex"].ToString());
         user.BIRTHDAY = dt.Rows[0]["BIRTHDAY"].ToString().Equals("") ? DateTime.Parse("1900-01-01 00:00:00") : DateTime.Parse(dt.Rows[0]["BIRTHDAY"].ToString());
         user.MOBIL_NO = dt.Rows[0]["MOBIL_NO"].ToString();
         user.MOBIL_NO_HIDDEN = bool.Parse(dt.Rows[0]["MOBIL_NO_HIDDEN"].ToString());
         return user;
     }
     else
     {
         return null;
     }
 }
Beispiel #4
0
        /// <summary>
        /// 修改用户
        /// </summary>
        /// <param name="Account">用户实体对象</param>
        /// <returns></returns>
        public int Update_Account(UserModel user)
        {
            SqlParameter[] paras =
                {
                    new SqlParameter("@ID",SqlDbType.Int),
                    new SqlParameter("@TrueName",SqlDbType.NVarChar,20),
                    new SqlParameter("@AccountNO",SqlDbType.NVarChar,20),
                    new SqlParameter("@GroupID",SqlDbType.Int),
                    new SqlParameter("@DEPT_ID",SqlDbType.Int),
                    new SqlParameter("@Remark",SqlDbType.NVarChar,500),
                    new SqlParameter("@BYNAME",SqlDbType.NVarChar,20),
                    new SqlParameter("@Sex",SqlDbType.Bit),
                    new SqlParameter("@BIRTHDAY",SqlDbType.DateTime),
                    new SqlParameter("@MOBIL_NO",SqlDbType.NVarChar,50),
                    new SqlParameter("@MOBIL_NO_HIDDEN",SqlDbType.Bit),
                };

            paras[0].Value = user.ID;
            paras[1].Value = user.TrueName;
            paras[2].Value = user.AccountNO;
            paras[3].Value = user.GroupID;
            paras[4].Value = user.DEPT_ID;
            paras[5].Value = user.Remark;
            paras[6].Value = user.BYNAME;
            paras[7].Value = user.Sex;
            paras[8].Value = user.BIRTHDAY;
            paras[9].Value = user.MOBIL_NO;
            paras[10].Value = user.MOBIL_NO_HIDDEN;

            try
            {
                int iReturn;
                int i = DbHelperSQL.RunProcedure("Power_Update_Account", paras, out iReturn);
                return iReturn;
            }
            catch
            {
                return -1;
            }
        }
Beispiel #5
0
    public void OnLogin()
    {
        Session["Account"] = txtAccount.Text.Trim();

        //userEntity.Account = txtAccount.Text.Trim();
        Session["User_Account"] = txtAccount.Text.Trim();
        //userEntity.User_Account = txtAccount.Text.Trim();

        Session["User_Password"] = txtPassword.Text.Trim();
        //userEntity.User_Password = txtPassword.Text.Trim();

        //将Ip地址转换成十进制调用WebServers访问数据库
        if (txtAccount.Text.Trim().Length == 0)
        {

            txtPassword.Text = "";
            txtAccount.Focus();
        }
        else
        {

            //用户登录,并写入登录日志
            accountModel = accountbll.Login(txtAccount.Text.Trim(), DESEncrypt.EncryptMD5(txtPassword.Text.Trim()), Page.Request.UserHostAddress.ToString());
            switch (accountModel.LoginState)
            {
                case  ShineKJ.Model.Power.Account.AccountState.Succeed:
                    Session.Add("GroupID", accountModel.GroupID.ToString());
                    //userEntity.GroupID = accountMould.GroupID.ToString();
                    Session.Add("AccountID", accountModel.ID.ToString());
                    //userEntity.AccountID = accountMould.ID.ToString();

                    usermodel = accountbll.Get_UserModel(accountModel.ID);

                    Session.Add("UserName", usermodel.AcountName);
                    Session.Add("User_Account", usermodel.AcountName);
                    Session.Add("Account", usermodel.AcountName);
                    Session.Add("UserPwd", usermodel.Password);
                    Session.Add("DEPT_ID", usermodel.DEPT_ID);
                    DataSet DS = dalDept.Querys(" and DEPT_ID=" + usermodel.DEPT_ID);
                    if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0)
                    {
                        Session.Add("DEPT_NAME", DS.Tables[0].Rows[0]["DEPT_NAME"].ToString() == null ? "" : DS.Tables[0].Rows[0]["DEPT_NAME"].ToString());
                    }
                    else
                        Session.Add("DEPT_NAME", "");
                    Session.Add("GroupID", usermodel.GroupID);

                    Session.Add("ID", usermodel.ID);

                    // 是否记住用户名密码

                    Response.Write("<script type='text/javascript' language='javascript'>window.open('../main.html','_self');</script>");
                    break;
                case ShineKJ.Model.Power.Account.AccountState.Password:
                    Response.Write("<script type='text/javascript' language='javascript'>alert('请检查密码是否正确');</script>");
                    break;
                case ShineKJ.Model.Power.Account.AccountState.DataError:
                    Response.Write("<script type='text/javascript' language='javascript'>alert('数据类型有误');</script>");
                    break;

                default:
                    Response.Write("<script type='text/javascript' language='javascript'>alert('请检查帐户是否正确');</script>");
                    break;
            }

        }
    }