コード例 #1
0
        //Save Data
        #region SaveData

        protected void btnSave_Click(object sender, EventArgs e)
        {
            BL_Category  objBL  = new BL_Category();
            EWA_Category objEWA = new EWA_Category();

            try
            {
                lock (this)
                {
                    if (txtCategoryName.Text == "")
                    {
                        msgBox.ShowMessage("Please Enter Category Name !!!", "Information", UserControls.MessageBox.MessageStyle.Information);
                    }

                    else
                    {
                        int chk = CheckData();
                        if (chk > 0)
                        {
                            msgBox.ShowMessage("Record Allready Exist !!!", "Information", UserControls.MessageBox.MessageStyle.Information);
                        }
                        else
                        {
                            Action("Save");
                            GrdCategoryBind();
                            LoadForm();
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
コード例 #2
0
 public ActionResult Category(Category obj)
 {
     try
     {
         BL_Category category2 = new BL_Category();
         if (category2.CheckCategory(obj.CategoryID, obj.CategoryName))
         {
             if (category2.Category(obj))
             {
                 if (obj.CategoryID > 0)
                 {
                     ModelState.Clear();
                     TempData["msg"] = "Category Update Successfully";
                     return(RedirectToAction("Category", "Category"));
                 }
                 else
                 {
                     ModelState.Clear();
                     TempData["msg"] = "Category Saved Successfully";
                     return(RedirectToAction("Category", "Category"));
                 }
             }
         }
         else
         {
             TempData["msg"] = "Category Name Already Exist's";
             return(RedirectToAction("Category", "Category"));
         }
         return(View());
     }
     catch (Exception)
     {
         return(View());
     }
 }
コード例 #3
0
        public JsonResult ShowCategory()
        {
            BL_Category category1 = new BL_Category();

            return(new JsonResult {
                Data = category1.SelectAllCategory(), JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
コード例 #4
0
        public JsonResult EditCategory1(int id)
        {
            BL_Category category1 = new BL_Category();

            ModelState.Clear();

            return(new JsonResult {
                Data = category1.GetCategory(id), JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
            //  return View(db.GetDepartment(id));
        }
コード例 #5
0
        public ActionResult DeleteCategory(int CategoryId)
        {
            string del = "";

            CategoryId = Convert.ToInt32(Request.Form["CategoryId"]);
            BL_Category category1 = new BL_Category();

            if (category1.DeleteCategory(CategoryId))
            {
                del = "Category Deleted Succussfully ";
            }

            return(Json(del, JsonRequestBehavior.AllowGet));
        }