예제 #1
0
        public ActionResult Edit(SupplierCategory model)
        {
            model.OrganizationId = OrganizationId;
            model.CreatedDate    = System.DateTime.Now;
            model.CreatedBy      = UserID.ToString();


            var  repo     = new SupplierCategoryRepository();
            bool isexists = repo.IsFieldExists(repo.ConnectionString(), "SupplierCategory", "SupCategoryName", model.SupCategoryName, "SupCategoryId", model.SupCategoryId);

            if (!isexists)

            {
                var result = new SupplierCategoryRepository().UpdateSupplierCategory(model);
                if (result.SupCategoryId > 0)
                {
                    TempData["Success"]          = "Updated Successfully!";
                    TempData["SupCategoryRefNo"] = result.SupCategoryRefNo;
                    return(RedirectToAction("Create"));
                }

                else
                {
                    TempData["error"]            = "Oops!!..Something Went Wrong!!";
                    TempData["SupCategoryRefNo"] = null;
                    return(View("Create", model));
                }
            }
            else
            {
                TempData["error"]            = "This Name Alredy Exists!!";
                TempData["SupCategoryRefNo"] = null;
                return(View("Create", model));
            }
        }
예제 #2
0
        public ActionResult Edit(int Id)
        {
            ViewBag.Title = "Edit";
            SupplierCategory objSupplierCategory = new SupplierCategoryRepository().GetSupplierCategory(Id);

            return(View("Create", objSupplierCategory));
        }
예제 #3
0
        public ActionResult Delete(SupplierCategory model)
        {
            int result = new SupplierCategoryRepository().DeleteSupplierCategory(model);

            if (result == 0)
            {
                TempData["Success"]          = "Deleted Successfully!";
                TempData["SupCategoryRefNo"] = model.SupCategoryRefNo;
                return(RedirectToAction("Create"));
            }
            else
            {
                if (result == 1)
                {
                    TempData["error"]            = "Sorry!! You Cannot Delete This Supplier Category It Is Already In Use";
                    TempData["SupCategoryRefNo"] = null;
                }
                else
                {
                    TempData["error"]            = "Oops!!..Something Went Wrong!!";
                    TempData["SupCategoryRefNo"] = null;
                }
                return(RedirectToAction("Create"));
            }
        }
예제 #4
0
        public ActionResult FillSupplierCategoryList(int?page)
        {
            int itemsPerPage = 10;
            int pageNumber   = page ?? 1;
            var repo         = new SupplierCategoryRepository();
            var List         = repo.FillSupplierCategoryList();

            return(PartialView("SupplierCategoryListView", List));
        }
예제 #5
0
 public SchemaRepositoryContainer()
 {
     #region Entity Repositories
     PurchaseOrderLine          = new PurchaseOrderLineRepository();
     PurchaseOrder              = new PurchaseOrderRepository();
     SupplierCategory           = new SupplierCategoryRepository();
     SupplierCategories_Archive = new SupplierCategories_ArchiveRepository();
     Supplier            = new SupplierRepository();
     Suppliers_Archive   = new Suppliers_ArchiveRepository();
     SupplierTransaction = new SupplierTransactionRepository();
     #endregion
     // If not implemented this method is removed during compilation
     LoadCustomRepositories();
 }