Esempio n. 1
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btn_UpCompany_Click(object sender, EventArgs e)
 {
     if (user == null)
     {
         if (Session["User"] != null)
         {
             user = (ETS.GGGETSApp.Domain.Application.Entities.User)Session["User"];
         }
         else
         {
             user = _userService.FindUserByLoginName(Request.QueryString["LoginName"].ToString());
         }
     }
     if (Txt_LoginName.Text.Trim() == "")
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('用户名不能为空!')</script>");
         Txt_LoginName.Focus();
     }
     else if (Txt_RealName.Text.Trim() == "")
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('真实姓名不能为空!')</script>");
         Txt_RealName.Focus();
     }
     else if (Txt_FeeDiscountRate.Text.Trim() == "")
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('费用折扣率不能为空!')</script>");
         Txt_FeeDiscountRate.Focus();
     }
     else if (Txt_WeightDiscountRate.Text.Trim() == "")
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('重量折扣率不能为空!')</script>");
         Txt_WeightDiscountRate.Focus();
     }
     else
     {
         if (!Rnubel.IsMatch(Txt_FeeDiscountRate.Text.Trim()))
         {
             Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('只能输入0.01-1的数字!')</script>");
             Txt_FeeDiscountRate.Focus();
         }
         else if (!Rnubel.IsMatch(Txt_WeightDiscountRate.Text.Trim()))
         {
             Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('只能输入0.01-1的数字!')</script>");
             Txt_WeightDiscountRate.Focus();
         }
         else if (Txt_Email.Text.Trim() != "" && !REmail.IsMatch(Txt_Email.Text.Trim()))
         {
             Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('邮箱格式不正确!')</script>");
             Txt_Email.Focus();
         }
         else
         {
             if (Txt_CompanyCode.Text.Trim() != "" && Txt_DepCode.Text.Trim() != "")
             {
                 Department depar = _deparService.FindDepartmentByDepCodeAndCompanyCode(Txt_DepCode.Text.Trim(), Txt_CompanyCode.Text.Trim());
                 user.DID = depar.DID;
             }
             user.LoginName = Txt_LoginName.Text.Trim();
             user.RealName = Txt_RealName.Text.Trim();
             user.Phone = Txt_Phone.Text.Trim();
             user.Email = Txt_Email.Text.Trim();
             user.UpdateTime = DateTime.Now;
             user.Remark = Txt_Remark.Text.Trim();
             user.FeeDiscountType = int.Parse(ddl_FeeDiscountType.SelectedValue);
             user.FeeDiscountRate = decimal.Parse(Txt_FeeDiscountRate.Text.Trim());
             user.WeightDiscountType = int.Parse(ddl_WeightDiscountType.SelectedValue);
             user.WeightDiscountRate = decimal.Parse(Txt_WeightDiscountRate.Text.Trim());
             user.SettleType = int.Parse(ddl_SettleType.SelectedValue);
             user.WeightCalType = int.Parse(ddl_WeightCalType.SelectedValue);
             user.Status = int.Parse(DDL_Status.SelectedValue);
             _userService.ModifyUser(user);
             Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "show", "<script>alert('修改成功!');location='UserManagemnet.aspx'</script>");
         }
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 页面控件赋值
 /// </summary>
 /// <param name="loginname">登录名</param>
 protected void Storage(string loginname)
 {
     user = _userService.FindUserByLoginName(loginname);
     if (user != null)
     {
         if (user.DID != null)
         {
             Department depar = _deparService.FindDepartmentByDID(user.DID.ToString());
             if (depar != null)
             {
                 Txt_CompanyCode.Text = depar.CompanyCode;
                 Txt_DepCode.Text = depar.DepCode;
             }
         }
         Txt_LoginName.Text = user.LoginName;
         Txt_Phone.Text = user.Phone;
         Txt_RealName.Text = user.RealName;
         Txt_Email.Text = user.Email;
         ddl_FeeDiscountType.SelectedValue = user.FeeDiscountType.ToString();
         Txt_FeeDiscountRate.Text = user.FeeDiscountRate.ToString();
         ddl_WeightDiscountType.SelectedValue = user.WeightDiscountType.ToString();
         Txt_WeightDiscountRate.Text = user.WeightDiscountRate.ToString();
         ddl_SettleType.SelectedValue = user.SettleType.ToString();
         ddl_WeightCalType.SelectedValue = user.WeightCalType.ToString();
         Txt_Remark.Text = user.Remark;
         DDL_Status.SelectedValue = user.Status.ToString();
         Session["User"] = user;
     }
 }
Esempio n. 3
0
        private bool LoginName()
        {
            bool ok = false;
            if (Txt_LoginName.Text.Trim() != "")
            {
                user = _userService.FindUserByLoginName(Txt_LoginName.Text.Trim());
                if (user != null)
                {
                    ok = true;
                    Session["User"] = user.UID;
                    Txt_DeliverName.Focus();
                    //Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('没有该用户名,请重新输入!')</script>");

                }
                else
                { ok = false; }
            }
            else
            {
                ok = true;
            }
            return ok;
        }