public ActionResult Edit(EmployeeCategory model)
        {
            model.OrganizationId = OrganizationId;
            model.CreatedDate    = System.DateTime.Now;
            model.CreatedBy      = UserID.ToString();

            var  repo     = new EmployeeCategoryRepository();
            bool isexists = repo.IsFieldExists(repo.ConnectionString(), "EmployeeCategory", "EmpCategoryName", model.EmpCategoryName, " EmpCategoryId", model.EmpCategoryId);

            if (!isexists)
            {
                var result = new EmployeeCategoryRepository().UpdateEmployeeCategory(model);
                if (result.EmpCategoryId > 0)
                {
                    TempData["Success"] = "Updated Successfully!";
                    TempData["RefNo"]   = result.EmpCategoryRefNo;
                    return(RedirectToAction("Create"));
                }

                else
                {
                    TempData["error"] = "Oops!!..Something Went Wrong!!";
                    TempData["RefNo"] = null;
                    return(View("Create", model));
                }
            }
            else
            {
                TempData["error"] = "This Name Alredy Exists!!";
                TempData["RefNo"] = null;
                return(View("Create", model));
            }
        }
        public ActionResult Create(EmployeeCategory model)
        {
            model.CreatedBy = UserID.ToString();

            var repo = new EmployeeCategoryRepository();

            bool isexists = repo.IsFieldExists(repo.ConnectionString(), "EmployeeCategory", "EmpCategoryName", model.EmpCategoryName, null, null);

            if (!isexists)
            {
                var result = new EmployeeCategoryRepository().InsertEmployeeCategory(model);
                if (result.EmpCategoryId > 0)
                {
                    TempData["Success"] = "Added Successfully!";
                    TempData["RefNo"]   = result.EmpCategoryRefNo;
                    return(RedirectToAction("Create"));
                }

                else
                {
                    TempData["error"] = "Oops!!..Something Went Wrong!!";
                    TempData["RefNo"] = null;
                    return(View("Create", model));
                }
            }
            else
            {
                TempData["error"] = "This Name Alredy Exists!!";
                TempData["RefNo"] = null;
                return(View("Create", model));
            }
        }
        public ActionResult FillEmployeeCategoryList(int?page)
        {
            int itemsPerPage = 10;
            int pageNumber   = page ?? 1;
            var repo         = new EmployeeCategoryRepository();
            var List         = repo.FillEmployeeCategoryList();

            return(PartialView("EmployeeCategoryListView", List));
        }
        public ActionResult Delete(EmployeeCategory model)
        {
            var result = new EmployeeCategoryRepository().DeleteEmployeeCategory(model);


            if (result.EmpCategoryId > 0)
            {
                TempData["Success"] = "Deleted Successfully!";
                TempData["RefNo"]   = model.EmpCategoryRefNo;
                return(RedirectToAction("Create"));
            }
            else
            {
                TempData["error"] = "Oops!!..Something Went Wrong!!";
                TempData["RefNo"] = null;
                return(View("Create", model));
            }
        }
示例#5
0
        public UnitOfWork(PlutoContext context)
        {
            _ILog = Log.GetInstance;

            _context                  = context;
            AppUsers                  = new UserRepository(context);
            Students                  = new StudentRepository(context);
            PaymentHistories          = new PaymentHistoryRepository(context);
            Payments                  = new PaymentRepository(context);
            studentclasses            = new StudentClassRepository(context);
            departments               = new DepartmentRepository(context);
            regions                   = new RegionRepository(context);
            studentstatuses           = new StudentStatusRepository(context);
            employees                 = new EmployeeRepository(context);
            employeedocuments         = new EmployeeDocumentRepository(context);
            payrollamounts            = new PayrollAmountRepository(context);
            employeecategories        = new EmployeeCategoryRepository(context);
            employeelevelsofeducation = new EmployeeLevelOfEducationRepository(context);
            payrollrates              = new PayrollRateRepository(context);
            taxrates                  = new TaxRateRepository(context);
            ssnitrates                = new SSNITRateRepository(context);
            studentsubjects           = new StudentSubjectRepository(context);
            payrollallowances         = new PayrollAllowancesRepository(context);
            employeetypes             = new EmployeeTypeRepository(context);
            employeeloanhistories     = new EmployeeLoanHistoryRepository(context);
            employeeloans             = new EmployeeLoanRepository(context);
            exams          = new ExamRepository(context);
            marks          = new MarkRepository(context);
            externalhelper = new ExternalHelperRepository(context);

            hostels           = new HostelRepository(context);
            libraries         = new LibraryRepository(context);
            transports        = new TransportRepository(context);
            expenses          = new ExpenseRepository(context);
            expensecategories = new ExpenseCategoryRepository(context);
            incomes           = new IncomeRepository(context);
            incomecategories  = new IncomeCategoryRepository(context);
            books             = new BookRepository(context);
            booktypes         = new BookTypeRepository(context);
            rooms             = new RoomRepository(context);
            payrolldates      = new PayrollDateRepository(context);
            allowances        = new AllowanceRepository(context);
        }
        public ActionResult Edit(int Id)
        {
            EmployeeCategory model = new EmployeeCategoryRepository().GetEmployeeCategory(Id);

            return(View("Create", model));
        }