Esempio n. 1
0
    protected void lbtnSave_Click(object sender, EventArgs e)
    {
        BLL.Security.UserBll userBll = new BLL.Security.UserBll();

        DataTable dtUserList = userBll.GetUserInfo(txtUserName.Text.Trim());

        if (dtUserList.Rows[0]["UserPassword"].ToString().Trim() == this.txtOldPwd.Text.Trim())
        {
            userBll.UpdateUserPWD(this.txtUserName.Text.Trim(), this.txtAckPwd.Text.Trim());
            //WMS.App_Code.JScript.ShowMessage(this, "密码修改成功!");
            ClientScript.RegisterClientScriptBlock(ClientScript.GetType(), "myscript", "<script type='text/javascript'>alert('密码修改成功!');</script>");
        }
        else
        {
            JScript.ShowMessage(this, "原密码错误!");
        }
    }
Esempio n. 2
0
    protected void lbtnSave_Click(object sender, EventArgs e)
    {
        //DatabaseOperater dbOperator = new DatabaseOperater();

        //dbOperator.GetModelName = "sys_UserListlogin";
        //dbOperator.GetStrProcParaValue = txtUserName.Text + "," + encrypObject.EncryptMD5(); ;

        BLL.Security.UserBll userBll = new BLL.Security.UserBll();

        DataTable dtUserList = userBll.GetUserInfo(txtUserName.Text.Trim());

        if (dtUserList.Rows[0]["UserPassword"].ToString().Trim() == this.txtOldPwd.Text.Trim())
        {
            userBll.UpdateUserPWD(this.txtUserName.Text.Trim(), this.txtAckPwd.Text.Trim());
            //WMS.App_Code.JScript.ShowMessage(this, "密码修改成功!");
            ClientScript.RegisterClientScriptBlock(ClientScript.GetType(), "myscript", "<script type='text/javascript'>alert('密码修改成功!'); Exit();</script>");
        }
        else
        {
            JScript.ShowMessage(this, "原密码错误!");
        }
    }
Esempio n. 3
0
    protected void lbtnSave_Click(object sender, EventArgs e)
    {
        //DatabaseOperater dbOperator = new DatabaseOperater();

        //dbOperator.GetModelName = "sys_UserListlogin";
        //dbOperator.GetStrProcParaValue = txtUserName.Text + "," + encrypObject.EncryptMD5(); ;

        BLL.Security.UserBll userBll = new BLL.Security.UserBll();

        DataTable dtUserList = userBll.GetUserInfo(txtUserName.Text.Trim());

        if (dtUserList.Rows[0]["UserPassword"].ToString().Trim() == this.txtOldPwd.Text.Trim())
        {

            userBll.UpdateUserPWD(this.txtUserName.Text.Trim(), this.txtAckPwd.Text.Trim());
            //WMS.App_Code.JScript.Instance.ShowMessage(this, "密码修改成功!");
            ClientScript.RegisterClientScriptBlock(ClientScript.GetType(), "myscript", "<script type='text/javascript'>alert('密码修改成功!'); Exit();</script>");
        }
        else
        {
            JScript.Instance.ShowMessage(this, "原密码错误!");
        }
    }
Esempio n. 4
0
        //protected void Page_Load(object sender, EventArgs e)
        //{
        //    if (Page.Request.Url.Query != "")
        //    {
        //        //ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Resize", "alert(\"对不起,操作时限已过,请重新登入!\");window.top.location =\"Login.aspx\";", true);
        //    }
        //}
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            //测试
            Request.Cookies.Clear();
            if (txtUserName.Text.Trim() != "")
            {
                try
                {
                    string key = txtUserName.Text.ToLower();
                    string UserCache = Convert.ToString(Cache[key]);

                    UserBll userBll = new UserBll();

                    DataTable dtUserList = userBll.GetUserInfo(txtUserName.Text.Trim());
                    if (dtUserList != null && dtUserList.Rows.Count > 0)
                    {
                        if (dtUserList.Rows[0]["UserPassword"].ToString().Trim() == txtPassWord.Text.Trim())
                        {
                            FormsAuthentication.SetAuthCookie(this.txtUserName.Text, false);

                            Session["UserID"] = dtUserList.Rows[0]["UserID"].ToString();
                            Session["GroupID"] = dtUserList.Rows[0]["GroupID"].ToString();
                            Session["G_user"] = dtUserList.Rows[0]["UserName"].ToString();

                            string EmployeeCode = dtUserList.Rows[0]["EmployeeCode"].ToString();
                            App_Code.LoginUserInfo.UserName = dtUserList.Rows[0]["UserName"].ToString();
                            App_Code.LoginUserInfo.UserCode = EmployeeCode;

                            Session["EmployeeCode"] = dtUserList.Rows[0]["EmployeeCode"].ToString();

                            //Session["sys_PageCount"] = 15;

                            //Session["grid_ColumnTitleFont"] = "楷体_GB2312,Coral,10,加粗";
                            //Session["grid_ContentFont"] = "宋体,Black,10,正常";

                            //Session["grid_ColumnTextAlign"] = "1";
                            //Session["grid_ContentTextAlign"] = "1";
                            //Session["grid_NumberColumnAlign"] = "1";
                            //Session["grid_MoneyColumnAlign"] = "1";
                            //Session["grid_SelectMode"] = "0";
                            //Session["grid_IsRefreshBeforeAdd"] = "1";
                            //Session["grid_IsRefreshBeforeUpdate"] = "1";
                            //Session["grid_IsRefreshBeforeDelete"] = "1";

                            //Session["grid_OddRowColor"] = "White";
                            //Session["grid_EvenRowColor"] = "AliceBlue";

                            //Session.Timeout = int.Parse(ConfigurationManager.AppSettings["SessionTimeOut"]);
                            #region 添加登录日志

                            BLL.BLLBase bll = new BLL.BLLBase();
                            bll.ExecNonQuery("Security.InsertOperatorLog", new IDAL.DataParameter[]{new IDAL.DataParameter("@LoginUser",App_Code.LoginUserInfo.UserName),new IDAL.DataParameter("@LoginTime",DateTime.Now),
                                                         new IDAL.DataParameter("@LoginModule","登录系统"),new IDAL.DataParameter("@ExecuteOperator","用户登录")});

                            #endregion
                            TimeSpan stLogin = new TimeSpan(0, 0, System.Web.HttpContext.Current.Session.Timeout, 0, 0);
                            HttpContext.Current.Cache.Insert(key, Page.Request.UserHostAddress, null, DateTime.MaxValue, stLogin, System.Web.Caching.CacheItemPriority.NotRemovable, null);

                            Response.Redirect("Default.aspx", false);
                        }
                        else
                        {
                            BLL.BLLBase bll = new BLL.BLLBase();
                            bll.ExecNonQuery("Security.InsertOperatorLog", new IDAL.DataParameter[]{new IDAL.DataParameter("@LoginUser",this.txtUserName.Text.Trim()),new IDAL.DataParameter("@LoginTime",DateTime.Now),
                                                         new IDAL.DataParameter("@LoginModule","登录页面"),new IDAL.DataParameter("@ExecuteOperator","登录(用户密码有误)")});
                            ltlMessage.Text = "对不起,您输入的密码有误!";
                        }
                    }
                    else
                    {
                        ltlMessage.Text = "对不起,您输入的用户名不存在!";
                    }

                }
                catch (Exception exp)
                {
                    System.Diagnostics.StackFrame frame = new System.Diagnostics.StackFrame(0);
                    Session["ModuleName"] = this.Page.Title;
                    Session["FunctionName"] = frame.GetMethod().Name;
                    Session["ExceptionalType"] = exp.GetType().FullName;
                    Session["ExceptionalDescription"] = exp.Message;
                    Response.Redirect("Common/MistakesPage.aspx", false);
                }
            }
            else
            {
                ltlMessage.Text = "请输入用户名!";
            }
        }
Esempio n. 5
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            BLL.Security.UserBll ubll = new BLL.Security.UserBll();
            if (ViewState["OpFlag"].ToString() == "0")//新增
            {
                DataTable dtTemp = ubll.GetUserInfo(this.txtUserName.Text.Trim());
                if (dtTemp.Rows.Count > 0)
                {
                    JScript.Instance.ShowMessage(this.UpdatePanel1, "该用户名已经存在!");
                    return;
                }
                if (this.txtEmployeeCode.Text.Trim() == "")
                {
                    txtEmployeeCode.Text = txtUserName.Text.Trim();
                }
                ubll.InsertUser(this.txtUserName.Text.Trim(), this.txtEmployeeCode.Text, this.txtMemo.Text);

                SetBtnEnabled(int.Parse(ViewState["CurrentPage"].ToString()), SqlCmd, ViewState["filter"].ToString(), pageSize, gvMain, btnFirst, btnPre, btnNext, btnLast, btnToPage, lblCurrentPage, this.UpdatePanel1);
                SwitchView(0);
               JScript.Instance.ShowMessage(this.UpdatePanel1, "数据添加成功!");
                AddOperateLog("用户管理", "添加用户信息");
            }
            else//修改
            {
                foreach (DataRow dr in dtUser.Rows)
                {
                    if (dr["UserID"].ToString() == this.txtUserID.Text.Trim())
                    {
                        DataTable dtTemp = ubll.GetUserList(1, 10, string.Format("UserID<>{0} and UserName='******'", this.txtUserID.Text, this.txtUserName.Text.Trim()), OrderByFields);
                        if (dtTemp.Rows.Count > 0)
                        {
                            JScript.Instance.ShowMessage(this.UpdatePanel1, "该用户名已经存在!");
                            return;
                        }

                        ubll.UpdateUser(this.txtUserName.Text.Trim(), this.txtEmployeeCode.Text.Trim(), this.txtMemo.Text.Trim(), int.Parse(this.txtUserID.Text));
                        break;
                    }
                }
                this.gvMain.EditIndex = -1;

                SetBtnEnabled(int.Parse(ViewState["CurrentPage"].ToString()), SqlCmd, ViewState["filter"].ToString(), pageSize, gvMain, btnFirst, btnPre, btnNext, btnLast, btnToPage, lblCurrentPage, this.UpdatePanel1);
                JScript.Instance.ShowMessage(this.UpdatePanel1, "数据修改成功!");
                SwitchView(0);
                AddOperateLog("用户管理", "修改用户信息");
            }

        }
        catch (Exception exp)
        {
           JScript.Instance.ShowMessage(this.UpdatePanel1, exp.Message);
        }
    }