Ejemplo n.º 1
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     if (this.FormCheck())
     {
         try
         {
             string sqlCheck = string.Format("select count(*) from FIN_Property where CostType='{0}' and id<>{1}",
                                             txtCostType.Text, Request["Id"]);
             if (Convert.ToInt32(DBHelp.ExeScalar(sqlCheck)) > 0)
             {
                 base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('类型[{0}],已经存在!');</script>", txtCostType.Text));
                 return;
             }
             FIN_Property model = getModel();
             if (this.goodSer.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;
             FIN_Property model = this.goodSer.GetModel(Convert.ToInt32(base.Request["Id"]));
             this.txtProNo.Text    = model.ProNo;
             this.txtCostType.Text = model.CostType;
             this.ddlPro.Text      = model.MyProperty;
         }
         else
         {
             this.btnUpdate.Visible = false;
         }
     }
 }