Example #1
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     if (this.FormCheck())
     {
         try
         {
             string sqlCheck = string.Format("select count(*) from Invoice_Person where Name='{0}' and id<>{1}",
                                             txtName.Text, Request["Id"]);
             if (Convert.ToInt32(DBHelp.ExeScalar(sqlCheck)) > 0)
             {
                 base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('人员姓名[{0}],已经存在!');</script>", txtName.Text));
                 return;
             }
             Invoice_Person model = getModel();
             if (this.invoicePensonService.Update(model))
             {
                 base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('修改成功!');</script>");
             }
             else
             {
                 base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('修改失败!');</script>");
             }
         }
         catch (Exception ex)
         {
             base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('" + ex.Message + "!');</script>");
         }
     }
 }
Example #2
0
        public Invoice_Person getModel()
        {
            Invoice_Person model = new Invoice_Person();

            model.Name   = txtName.Text;
            model.Phone  = txtPhone.Text;
            model.CardNo = txtCardNo.Text;
            model.IsStop = ddlIsStop.Text == "0" ? false : true;
            if (Request["Id"] != null)
            {
                model.Id = Convert.ToInt32(Request["Id"]);
            }
            return(model);
        }
Example #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         if (base.Request["Id"] != null)
         {
             this.btnAdd.Visible = false;
             Invoice_Person model = this.invoicePensonService.GetModel(Convert.ToInt32(base.Request["Id"]));
             txtName.Text        = model.Name;
             txtCardNo.Text      = model.CardNo;
             txtPhone.Text       = model.Phone;
             this.ddlIsStop.Text = model.IsStop ? "1" : "0";
         }
         else
         {
             this.btnUpdate.Visible = false;
         }
     }
 }