Ejemplo n.º 1
0
        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"));
            }
        }        
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        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"));
                }
            }
        }