protected void btnSubmit_Click(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(TestPaper_Frame_Id)) { Model_TestPaper_Frame model = new Model_TestPaper_Frame(); BLL_TestPaper_Frame bll = new BLL_TestPaper_Frame(); model = bll.GetModel(TestPaper_Frame_Id); model.ParticularYear = Convert.ToInt32(ddlYear.SelectedValue); model.GradeTerm = ddlGradeTerm.SelectedValue; model.Resource_Version = ddlResource_Version.SelectedValue; model.Subject = ddlSubject.SelectedValue; model.TestPaper_Frame_Name = txtTwo_WayChecklist_Name.Text.TrimEnd(); model.Remark = txtRemark.Text.TrimEnd(); model.Analysis = hidfilebook_cover.Value; 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_TestPaper_Frame model = new Model_TestPaper_Frame(); BLL_TestPaper_Frame bll = new BLL_TestPaper_Frame(); model.TestPaper_Frame_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.TestPaper_Frame_Name = txtTwo_WayChecklist_Name.Text.TrimEnd(); model.Remark = txtRemark.Text.TrimEnd(); model.CreateUser = loginUser.SysUser_ID; model.CreateTime = DateTime.Now; model.Analysis = hidfilebook_cover.Value; 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; } }
public void LoadData() { try { Model_TestPaper_Frame model = new Model_TestPaper_Frame(); BLL_TestPaper_Frame bll = new BLL_TestPaper_Frame(); model = bll.GetModel(TestPaper_Frame_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.TestPaper_Frame_Name; hidfilebook_cover.Value = model.Analysis; book_cover.ImageUrl = model.Analysis; } } catch (Exception ex) { } }