Esempio n. 1
0
 protected void btnCommit_Click(object sender, EventArgs e)
 {
     if (ViewState["Opr"] != null)
     {
         OprInfoEntiy entity = (OprInfoEntiy)ViewState["Opr"];
         entity.ClientID = ddlClient.SelectedValue;
         entity.IsAdmin  = int.Parse(ddlIsAdmin.SelectedValue);
         HYCashierDAL.CahierMgrDAL dal = new HYCashierDAL.CahierMgrDAL();
         if (dal.UpdateOpr(entity))
         {
             Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "customJs", "alert('修改成功'); window.parent.closeDialog();", true);
             //ScriptManager.RegisterStartupScript(this, GetType(), "customJs", "alert('修改成功'); window.parent.closeDialog();", true);
         }
         else
         {
             Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "customJs", "alert('修改失败,请重试');", true);
             //ScriptManager.RegisterStartupScript(this, GetType(), "customJs", "修改失败,请重试", true);
         }
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "customJs", "alert('系统错误,请重试');", true);
         //ScriptManager.RegisterStartupScript(this, typeof(Page), "customJs", "系统错误,请重试", true);
     }
 }
Esempio n. 2
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string oprId    = txtOprID.Text.Trim();
            string pwd      = txtPwd.Text.Trim();
            string clientID = txtClientID.Text.Trim();

            if (string.IsNullOrEmpty(oprId) || string.IsNullOrEmpty(pwd) || string.IsNullOrEmpty(clientID))
            {
                Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "customJs", "alert('请输入操作员编号、商户号、密码');", true);
                return;
            }

            HYCashierDAL.CahierMgrDAL dal = new CahierMgrDAL();
            OprInfoEntiy opr = dal.CheckLoginUsr(oprId, pwd, clientID);

            if (opr != null)
            {
                Session["LoginUser"] = opr;
                Session["ClientID"]  = clientID;
                if (clientID == "180000")
                {
                    Session["AgentLevel"] = 0;
                }
                Response.Redirect("Default.aspx");
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "customJs", "alert('登录信息不正确');", true);
            }
        }
Esempio n. 3
0
        protected void btnCommit_Click(object sender, EventArgs e)
        {
            string name = txtName.Text.Trim();
            // string clientID = ddlClient.SelectedValue;
            string       clientID = txtClient.Value;
            string       js       = "";
            OprInfoEntiy entity   = new OprInfoEntiy();

            entity.OprName  = name;
            entity.ClientID = clientID;
            entity.IsAdmin  = int.Parse(ddlIsAdmin.SelectedValue);
            entity.OprPWD   = HYCashierDAL.CryptographyHelper.MD5Encrypt("123456");
            HYCashierDAL.CahierMgrDAL dal = new HYCashierDAL.CahierMgrDAL();
            string id = dal.GetOprID();

            entity.OprID = id;
            if (dal.AddOpr(entity))
            {
                js = "alert('新增成功'); window.parent.closeDialog();";
            }
            else
            {
                js = "alert('新增失败');";
            }
            Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "customJs", js, true);
            //ScriptManager.RegisterStartupScript(this, GetType(), "customJs", js, true);
        }
Esempio n. 4
0
        public bool UpdateOpr(OprInfoEntiy oprinfo)
        {
            bool flag = false;

            string sql = "update oprinfo set oprname='" + oprinfo.OprName + "',oprpwd='" + oprinfo.OprPWD + "',clientid='" +
                         oprinfo.ClientID + "',status=" + oprinfo.Status + ",IsAdmin=" + oprinfo.IsAdmin + ",updatetime=now() where oprid='" + oprinfo.OprID + "'";

            flag = DbHelper.ExecuteNonQuery(sql) > 0;
            return(flag);
        }
Esempio n. 5
0
        public bool AddOpr(OprInfoEntiy oprinfo)
        {
            bool flag = false;

            string sql = "insert into oprinfo (oprid,oprname,oprpwd,clientid,createtime,status,isadmin) values('";

            sql += oprinfo.OprID + "','" + oprinfo.OprName + "','" + oprinfo.OprPWD + "','"
                   + oprinfo.ClientID + "',now()," + oprinfo.Status + "," + oprinfo.IsAdmin + ")";

            flag = DbHelper.ExecuteNonQuery(sql) > 0;


            return(flag);
        }
Esempio n. 6
0
        protected void btnCommit_Click(object sender, EventArgs e)
        {
            if (txtPwd1.Text.Trim() != txtPwd2.Text.Trim())
            {
                Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "customJs", "alert('密码不匹配,请重新输入');", true);

                return;
            }
            if (Session["LoginUser"] != null)
            {
                OprInfoEntiy usr = (OprInfoEntiy)Session["LoginUser"];
                if (usr != null)
                {
                    if (MD5Encrypt(txtOldPwd.Text.Trim()) != usr.OprPWD)
                    {
                        Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "customJs", "alert('原密码不正确,请重新输入');", true);

                        return;
                    }

                    HYCashierDAL.CahierMgrDAL dal = new HYCashierDAL.CahierMgrDAL();
                    if (dal.UpdateOprPwd(usr.OprID, MD5Encrypt(txtPwd1.Text.Trim())))
                    {
                        Session["LoginUser"] = null;
                        Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "customJs", "alert('修改成功');parent.closeDialog();", true);
                    }
                    else
                    {
                        Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "customJs", "alert('修改失败');", true);
                    }
                }
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "customJs", "alert('系统错误,请重试');", true);
            }
        }