Example #1
0
        /// <summary>
        /// 增、改K_SysAccount表

        /// </summary>
        /// <param Name="tranType">操作类型,NEW=增,EDIT=改</param>
        /// <param Name="paramsModel"></param>
        /// <returns>返回大于0的数字操作正常,返回非数字表示操作错误,返回的是系统错误说明</returns>
        public string Save(string tranType, KingTop.Model.SysManage.Account paramsModel)
        {
            string isOk = "";

            try
            {
                SqlParameter returnValue = new SqlParameter("@ReturnValue", SqlDbType.Int, 4);
                returnValue.Direction = ParameterDirection.Output;

                string cmdText = "proc_K_SysAccountSave";

                SqlParameter[] paras = new SqlParameter[] {
                    new SqlParameter("tranType", tranType),
                    new SqlParameter("UserId", paramsModel.UserID),
                    new SqlParameter("UserName", paramsModel.UserName),
                    new SqlParameter("Password", paramsModel.PassWord),
                    new SqlParameter("Orders", paramsModel.Orders),
                    new SqlParameter("IsValid", paramsModel.IsValid),
                    returnValue
                };

                SQLHelper.ExecuteNonQuery(SQLHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, cmdText, paras);
                isOk = returnValue.Value.ToString();
            }
            catch (Exception ex)
            {
                isOk = ex.Message;
            }

            return(isOk);
        }
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            string returnMsg = string.Empty;

            if (GetLoginAccountId() == "0" && string.IsNullOrEmpty(UserID))  //如果用户ID=0和用户ID的参数为空(超级管理员修改用户密码)
            {
                string SuperUserPassword = ConfigurationManager.AppSettings[SystemConst.CONFIG_SUPERUSER_PASSWORD];
                if (!SecurityHelper.MD5(txtAccountPwd.Text).Equals(SuperUserPassword))
                {
                    Utils.RunJavaScript(this, "alert({msg:'输入的旧密码不正确,请重新输入!',title:'提示信息'})");
                    return;
                }
                else
                {
                    UpdateWebConfig_appSettings("SuperUserPassword", SecurityHelper.MD5(txtAccountNewPwd1.Text).ToString());
                    returnMsg = "1";
                }
            }
            else
            {
                if (string.IsNullOrEmpty(UserID))  //如果是用户自己修改自己的密码,需要比对旧密码是否输入正确
                {
                    DataTable dt     = BllAccount.GetList("ONE", Utils.getOneParams(GetLoginAccountId()));
                    string    oldPwd = string.Empty;
                    if (dt.Rows.Count > 0)
                    {
                        oldPwd = dt.Rows[0]["PassWord"].ToString();
                    }
                    if (SecurityHelper.MD5(txtAccountPwd.Text) != oldPwd)
                    {
                        Utils.RunJavaScript(this, "alert({msg:'输入的旧密码不正确,请重新输入!',title:'提示信息'})");
                        return;
                    }
                }

                KingTop.Model.SysManage.Account mode = new KingTop.Model.SysManage.Account();
                mode.UserID   = Utils.ParseInt(this.UserID, Utils.ParseInt(GetLoginAccountId(), 0));
                mode.PassWord = SecurityHelper.MD5(txtAccountNewPwd1.Text).ToString();
                returnMsg     = BllAccount.Save("CHANGEPWD", mode);
            }

            try
            {
                if (Convert.ToInt32(returnMsg) > 0)
                {
                    Utils.RunJavaScript(this, "alert({msg:'修改密码成功!',title:'提示信息'})");
                    WriteLog("修改" + txtAccountName.Text + "密码成功", "", 2);// 写入操作日志
                    PageInit();
                }
            }
            catch
            {
                Utils.RunJavaScript(this, "alert({msg:" + returnMsg + ",title:'提示信息'})");
                WriteLog("修改" + txtAccountName.Text + "密码失败", "", 2);// 写入操作日志
            }
        }
Example #3
0
        public KingTop.Model.SysManage.Account GetAccountByName(string UserName, string SiteID)
        {
            DataTable DTAccount = dal.GetList("LOGININFO", Utils.getTwoParams(UserName, SiteID));

            KingTop.Model.SysManage.Account clsAcc = new KingTop.Model.SysManage.Account();
            if (DTAccount.Rows.Count >= 1)
            {
                clsAcc.UserID        = Utils.ParseInt(DTAccount.Rows[0]["UserID"], 1);
                clsAcc.UserName      = DTAccount.Rows[0]["UserName"].ToString();
                clsAcc.PassWord      = DTAccount.Rows[0]["Password"].ToString();
                clsAcc.Orders        = Utils.ParseInt(DTAccount.Rows[0]["Orders"], 0);
                clsAcc.IsValid       = Utils.ParseBool(DTAccount.Rows[0]["IsValid"]);
                clsAcc.UserGroupCode = DTAccount.Rows[0]["UserGroupCode"].ToString();
            }
            return(clsAcc);
        }
Example #4
0
 /// <summary>
 /// 保存备忘录
 /// </summary>
 private string UpdateMorandum(string content)
 {
     try
     {
         string strMessage = "";
         //先判断是不是超级用户
         if (userID == "0")
         {
             string xml = Server.MapPath("~/SysAdmin/Configuraion/adminLoginInfo.config");
             try
             {
                 Utils.XmlUpdate(xml, "/root/Morandum", "", content);
             }
             catch (Exception exp)
             {
                 strMessage = exp.ToString();
             }
         }
         else
         {
             KingTop.Model.SysManage.Account modelAccount = new KingTop.Model.SysManage.Account();
             Account bllAccount = new Account();
             modelAccount.UserID     = int.Parse(userID);
             modelAccount.Memorandum = content;
             strMessage = bllAccount.Save("MEMORANDUM", modelAccount);
             //如数据操作出现异常,这行将报错
             int.Parse(strMessage);
         }
         //写日志
         WriteLog(GetLogValue("", "EDIT", "Memorandum", true), "", 2);
         return("保存成功!");
     }
     catch
     {
         return("数据操作失败!");
     }
 }
Example #5
0
        /// <summary>
        /// 增、改K_SysAccount表

        /// </summary>
        /// <param name="tranType">操作类型,NEW=增,EDIT=改</param>
        /// <param name="AutModel"></param>
        /// <returns>返回大于0的数字操作正常,返回非数字表示操作错误,返回的是系统错误说明</returns>
        public string Save(string trantype, KingTop.Model.SysManage.Account AccountModel)
        {
            return(dal.Save(trantype, AccountModel));
        }