Esempio n. 1
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(Two_WayChecklist_Id))
         {
             Model_Two_WayChecklist model = new Model_Two_WayChecklist();
             BLL_Two_WayChecklist   bll   = new BLL_Two_WayChecklist();
             model = bll.GetModel(Two_WayChecklist_Id);
             model.ParticularYear        = Convert.ToInt32(ddlYear.SelectedValue);
             model.GradeTerm             = ddlGradeTerm.SelectedValue;
             model.Resource_Version      = ddlResource_Version.SelectedValue;
             model.Subject               = ddlSubject.SelectedValue;
             model.Two_WayChecklist_Name = txtTwo_WayChecklist_Name.Text.TrimEnd();
             model.Remark = txtRemark.Text.TrimEnd();
             if (bll.Update(model))
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('修改成功!',{ time: 2000,icon:1},function(){parent.loadData();parent.layer.close(index)});</script>");
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('操作失败!',{ time: 2000,icon:2});</script>");
                 return;
             }
         }
         else
         {
             Model_Two_WayChecklist model = new Model_Two_WayChecklist();
             BLL_Two_WayChecklist   bll   = new BLL_Two_WayChecklist();
             model.Two_WayChecklist_Id   = Guid.NewGuid().ToString();
             model.ParticularYear        = Convert.ToInt32(ddlYear.SelectedValue);
             model.GradeTerm             = ddlGradeTerm.SelectedValue;
             model.Resource_Version      = ddlResource_Version.SelectedValue;
             model.Subject               = ddlSubject.SelectedValue;
             model.Two_WayChecklist_Name = txtTwo_WayChecklist_Name.Text.TrimEnd();
             model.Remark     = txtRemark.Text.TrimEnd();
             model.CreateUser = loginUser.SysUser_ID;
             model.CreateTime = DateTime.Now;
             if (bll.Add(model))
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('新增成功!',{ time: 2000,icon:1},function(){parent.loadData();parent.layer.close(index)});</script>");
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('操作失败!',{ time: 2000,icon:2});</script>");
                 return;
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Esempio n. 2
0
 public void LoadData()
 {
     try
     {
         Model_Two_WayChecklist model = new Model_Two_WayChecklist();
         BLL_Two_WayChecklist   bll   = new BLL_Two_WayChecklist();
         model = bll.GetModel(Two_WayChecklist_Id);
         if (model != null)
         {
             ddlYear.SelectedValue             = model.ParticularYear.ToString();
             ddlGradeTerm.SelectedValue        = model.GradeTerm;
             ddlResource_Version.SelectedValue = model.Resource_Version;
             ddlSubject.SelectedValue          = model.Subject;
             txtRemark.Text = model.Remark;
             txtTwo_WayChecklist_Name.Text = model.Two_WayChecklist_Name;
         }
     }
     catch (Exception ex)
     {
     }
 }