Example #1
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);
            }
        }
Example #2
0
        void AddNewClient()
        {
            HYCashierDAL.CahierMgrDAL dal = new CahierMgrDAL();

            string name = txtName.Text.Trim();

            if (dal.IsClientExist(name))
            {
                ScriptManager.RegisterStartupScript(this, typeof(Page), "customJs", "alert('商户名已存在');", true);

                return;
            }

            string id = dal.GetClientID();

            string          contact    = txtContact.Text.Trim();
            string          address    = txtAddress.Text.Trim();
            string          activeCode = HYCashierDAL.CryptographyHelper.MD5Encrypt(id + DateTime.Now.ToString("yyyyMMddHHmm"));
            ClientInfoEntiy entity     = new ClientInfoEntiy();

            entity.Address       = address;
            entity.PID           = txtPID.Text.Trim();
            entity.PKey          = txtKey.Text.Trim();
            entity.ClientID      = id;
            entity.ClientName    = name;
            entity.Contact       = contact;
            entity.MaxNum        = 10;
            entity.ActiveCode    = activeCode;
            entity.AlipayAccount = txtAlipayAccount.Text.Trim();
            string js = "";

            if (dal.AddClient(entity))
            {
                js = "alert('新增成功'); window.parent.closeDialog();";
            }
            else
            {
                js = "alert('新增失败');";
            }
            Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "customJs", js, true);
            //ScriptManager.RegisterStartupScript(this, typeof(Page), "customJs", js, true);
        }