protected void btnSave_Click(object sender, EventArgs e) { foreach (GridViewRow row in myManageGridView.Rows) { string strId = ((Label)row.FindControl(STR_LABEL_ID)).Text; TextBox uptWebsiteCategoryName = (TextBox)row.FindControl("txtUptWebsiteCategoryName"); //validation if (!CheckInputEmptyAndLength(uptWebsiteCategoryName, "E00801", "E00802", false)) { return; } //update Johnny.CMS.OM.SeH.WebsiteCategory model = new Johnny.CMS.OM.SeH.WebsiteCategory(); model.WebsiteCategoryId = DataConvert.GetInt32(strId); model.WebsiteCategoryName = uptWebsiteCategoryName.Text; Johnny.CMS.BLL.SeH.WebsiteCategory bll = new Johnny.CMS.BLL.SeH.WebsiteCategory(); bll.Update(model); } SetMessage(GetMessage("C00003")); //update grid getData(); }
protected void btnSave_Click(object sender, EventArgs e) { foreach (GridViewRow row in myManageGridView.Rows) { string strId = ((Label)row.FindControl(STR_LABEL_ID)).Text; TextBox uptWebsiteCategoryName = (TextBox)row.FindControl("txtUptWebsiteCategoryName"); //validation if (!CheckInputEmptyAndLength(uptWebsiteCategoryName, "E00801", "E00802", false)) return; //update Johnny.CMS.OM.SeH.WebsiteCategory model = new Johnny.CMS.OM.SeH.WebsiteCategory(); model.WebsiteCategoryId = DataConvert.GetInt32(strId); model.WebsiteCategoryName = uptWebsiteCategoryName.Text; Johnny.CMS.BLL.SeH.WebsiteCategory bll = new Johnny.CMS.BLL.SeH.WebsiteCategory(); bll.Update(model); } SetMessage(GetMessage("C00003")); //update grid getData(); }
protected void btnAdd_Click(object sender, System.EventArgs e) { //validation if (!CheckInputEmptyAndLength(txtWebsiteCategoryName, "E00801", "E00802", false)) return; Johnny.CMS.BLL.SeH.WebsiteCategory bll = new Johnny.CMS.BLL.SeH.WebsiteCategory(); Johnny.CMS.OM.SeH.WebsiteCategory model = new Johnny.CMS.OM.SeH.WebsiteCategory(); if (Request.QueryString["action"] == "modify") { //update model.WebsiteCategoryId = DataConvert.GetInt32(Request.QueryString["id"]); model.WebsiteCategoryName = txtWebsiteCategoryName.Text; bll.Update(model); SetMessage(GetMessage("C00003")); } else { //insert model.WebsiteCategoryName = txtWebsiteCategoryName.Text; if (bll.Add(model) > 0) { SetMessage(GetMessage("C00001")); txtWebsiteCategoryName.Text = ""; } else SetMessage(GetMessage("C00002")); } }
protected void btnAdd_Click(object sender, System.EventArgs e) { //validation if (!CheckInputEmptyAndLength(txtWebsiteCategoryName, "E00801", "E00802", false)) { return; } Johnny.CMS.BLL.SeH.WebsiteCategory bll = new Johnny.CMS.BLL.SeH.WebsiteCategory(); Johnny.CMS.OM.SeH.WebsiteCategory model = new Johnny.CMS.OM.SeH.WebsiteCategory(); if (Request.QueryString["action"] == "modify") { //update model.WebsiteCategoryId = DataConvert.GetInt32(Request.QueryString["id"]); model.WebsiteCategoryName = txtWebsiteCategoryName.Text; bll.Update(model); SetMessage(GetMessage("C00003")); } else { //insert model.WebsiteCategoryName = txtWebsiteCategoryName.Text; if (bll.Add(model) > 0) { SetMessage(GetMessage("C00001")); txtWebsiteCategoryName.Text = ""; } else { SetMessage(GetMessage("C00002")); } } }