Ejemplo n.º 1
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     if (this.FormCheck())
     {
         try
         {
             tb_GusetInfo model = new tb_GusetInfo();
             model.ZhuTel    = txtZhuTel.Text;
             model.tel2      = txttel2.Text;
             model.tel1      = txttel1.Text;
             model.LinkMan   = txtLinkMan.Text;
             model.GuestName = txtGuestName.Text;
             if (txtAccount.Text != "")
             {
                 model.Account = Convert.ToDecimal(txtAccount.Text);
             }
             model.CreateTime = DateTime.Now;
             model.CreateUser = Convert.ToInt32(Session["currentUserId"]);
             model.Id         = Convert.ToInt32(base.Request["Id"]);
             if (this.guestSer.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>");
         }
     }
 }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         if (base.Request["Id"] != null)
         {
             this.btnAdd.Visible = false;
             tb_GusetInfo guestModel = this.guestSer.GetModel(Convert.ToInt32(base.Request["Id"]));
             if (guestModel.Account != null)
             {
                 txtAccount.Text = guestModel.Account.Value.ToString();
             }
             txtGuestName.Text = guestModel.GuestName;
             txtLinkMan.Text   = guestModel.LinkMan;
             txttel1.Text      = guestModel.tel1;
             txttel2.Text      = guestModel.tel2;
             txtZhuTel.Text    = guestModel.ZhuTel;
         }
         else
         {
             this.btnUpdate.Visible = false;
         }
     }
 }