protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { f = FlagReasons.NewFlagReasons(); flagIdString = Request.QueryString["id"]; if ((flagIdString != null && Guid.TryParse(flagIdString, out flagId))) { f = FlagReasons.GetFlagReasons(flagId); } LoadForm(); PopulateForm(f); } }
protected void btnSave_OnClick(object sender, EventArgs e) { if (!ValidateForm()) { return; } else { if (Request.QueryString["id"] == null) { f = FlagReasons.NewFlagReasons(); f.DateCreatedString = DateTime.Now.ToString(); } else { f = FlagReasons.GetFlagReasons(new Guid(Request.QueryString["id"])); f.DateModifiedString = DateTime.Now.ToString(); } f.Bodyname = txtBodyName.Text; f.IsActive = chkIsActive.Checked; if (chkHasOther.Checked) { f.isHasOther = true; f.Description = ""; } else if (!chkHasOther.Checked) { f.isHasOther = false; f.Description = txtDescription.Text; } if (f.IsValid) { f.Save(); Response.Redirect("FlagReasonCMSList.aspx"); } } }