protected void btnAdd_Click(object sender, System.EventArgs e) { //validation if (!CheckInputEmptyAndLength(txtBlogCategoryName, "E00801", "E00802", false)) return; Johnny.CMS.BLL.SeH.BlogCategory bll = new Johnny.CMS.BLL.SeH.BlogCategory(); Johnny.CMS.OM.SeH.BlogCategory model = new Johnny.CMS.OM.SeH.BlogCategory(); if (Request.QueryString["action"] == "modify") { //update model.BlogCategoryId = DataConvert.GetInt32(Request.QueryString["id"]); model.BlogCategoryName = txtBlogCategoryName.Text; bll.Update(model); SetMessage(GetMessage("C00003")); } else { //insert model.BlogCategoryName = txtBlogCategoryName.Text; if (bll.Add(model) > 0) { SetMessage(GetMessage("C00001")); txtBlogCategoryName.Text = ""; } else SetMessage(GetMessage("C00002")); } }
protected void btnSave_Click(object sender, EventArgs e) { foreach (GridViewRow row in myManageGridView.Rows) { string strId = ((Label)row.FindControl(STR_LABEL_ID)).Text; TextBox uptBlogCategoryName = (TextBox)row.FindControl("txtUptBlogCategoryName"); //validation if (!CheckInputEmptyAndLength(uptBlogCategoryName, "E00801", "E00802", false)) { return; } //update Johnny.CMS.OM.SeH.BlogCategory model = new Johnny.CMS.OM.SeH.BlogCategory(); model.BlogCategoryId = DataConvert.GetInt32(strId); model.BlogCategoryName = uptBlogCategoryName.Text; Johnny.CMS.BLL.SeH.BlogCategory bll = new Johnny.CMS.BLL.SeH.BlogCategory(); bll.Update(model); } SetMessage(GetMessage("C00003")); //update grid getData(); }
protected override void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { litPageTitle.Text = GetLabelText("BlogCategory_Title"); litBlogCategoryName.Text = GetLabelText("Blogcategory_BlogCategoryName"); txtBlogCategoryName.ToolTip = GetLabelText("Blogcategory_BlogCategoryName"); if (Request.QueryString["action"] == "modify") { //primary key int BlogCategoryId = DataConvert.GetInt32(Request.QueryString["id"]); Johnny.CMS.BLL.SeH.BlogCategory bll = new Johnny.CMS.BLL.SeH.BlogCategory(); Johnny.CMS.OM.SeH.BlogCategory model = new Johnny.CMS.OM.SeH.BlogCategory(); model = bll.GetModel(BlogCategoryId); txtBlogCategoryName.Text = model.BlogCategoryName; btnAdd.ButtonType = Johnny.Controls.Web.Button.Button.EnumButtonType.Save; //btnAdd.Text = CONST_BUTTONTEXT_SAVE; } //RFVldtMenuCategoryName.ErrorMessage = GetMessage("E00801", txtMenuCategoryName.MaxLength.ToString()); } }
protected void btnSave_Click(object sender, EventArgs e) { foreach (GridViewRow row in myManageGridView.Rows) { string strId = ((Label)row.FindControl(STR_LABEL_ID)).Text; TextBox uptBlogCategoryName = (TextBox)row.FindControl("txtUptBlogCategoryName"); //validation if (!CheckInputEmptyAndLength(uptBlogCategoryName, "E00801", "E00802", false)) return; //update Johnny.CMS.OM.SeH.BlogCategory model = new Johnny.CMS.OM.SeH.BlogCategory(); model.BlogCategoryId = DataConvert.GetInt32(strId); model.BlogCategoryName = uptBlogCategoryName.Text; Johnny.CMS.BLL.SeH.BlogCategory bll = new Johnny.CMS.BLL.SeH.BlogCategory(); bll.Update(model); } SetMessage(GetMessage("C00003")); //update grid getData(); }
private void CreateddlCategory() { Johnny.CMS.BLL.SeH.BlogCategory bll = new Johnny.CMS.BLL.SeH.BlogCategory(); ddlCategory.DataSource = bll.GetList(); ddlCategory.DataTextField = "BlogCategoryName"; ddlCategory.DataValueField = "BlogCategoryId"; ddlCategory.DataBind(); }
protected void btnDelete_Click(object sender, EventArgs e) { foreach (GridViewRow row in myManageGridView.Rows) { TableCell cell = row.Cells[0]; Johnny.Controls.Web.CheckBox.CheckBox chkSelect = (Johnny.Controls.Web.CheckBox.CheckBox)cell.FindControl("chkSelect"); if (chkSelect.Checked) { string strId = ((Label)row.FindControl(STR_LABEL_ID)).Text; //delete Johnny.CMS.BLL.SeH.BlogCategory bll = new Johnny.CMS.BLL.SeH.BlogCategory(); bll.Delete(DataConvert.GetInt32(strId)); } } SetMessage(GetMessage("C00005")); //update grid getData(); }
protected void btnAdd_Click(object sender, System.EventArgs e) { //validation if (!CheckInputEmptyAndLength(txtBlogCategoryName, "E00801", "E00802", false)) { return; } Johnny.CMS.BLL.SeH.BlogCategory bll = new Johnny.CMS.BLL.SeH.BlogCategory(); Johnny.CMS.OM.SeH.BlogCategory model = new Johnny.CMS.OM.SeH.BlogCategory(); if (Request.QueryString["action"] == "modify") { //update model.BlogCategoryId = DataConvert.GetInt32(Request.QueryString["id"]); model.BlogCategoryName = txtBlogCategoryName.Text; bll.Update(model); SetMessage(GetMessage("C00003")); } else { //insert model.BlogCategoryName = txtBlogCategoryName.Text; if (bll.Add(model) > 0) { SetMessage(GetMessage("C00001")); txtBlogCategoryName.Text = ""; } else { SetMessage(GetMessage("C00002")); } } }
public override void getData() { Johnny.CMS.BLL.SeH.BlogCategory bll = new Johnny.CMS.BLL.SeH.BlogCategory(); myManageGridView.DataSource = bll.GetList(); myManageGridView.DataBind(); }