Example #1
0
        public ActionResult Setup(int?id)
        {
            EmployeeEditViewModel vm = null;

            if (!id.HasValue)
            {
                ViewBag.Title = EmployeeStrings.Create_Title;
                vm            = new EmployeeEditViewModel()
                {
                    JoiningDate = _userHelper.Get().DayOpenClose.SystemDate,
                    IsActive    = true
                };

                if (_userHelper.Get().IsHeadOffice)
                {
                    vm.BranchId = _userHelper.Get().BranchId;
                }
            }
            else
            {
                ViewBag.Title = EmployeeStrings.Edit_Title;
                vm            = _employeeService.GetEmployeeById(id.Value);
            }

            if (vm == null)
            {
                SystemMessages.Add(CommonStrings.No_Record, true, true);
                return(RedirectToAction("Index"));
            }

            ViewBag.GenderDropDown       = new SelectList(_genderService.GetGenderDropDown(), "Value", "Text");
            ViewBag.EmployeeTypeDropDown = new SelectList(_employeeTypeService.GetEmployeeTypeDropDown(), "Value", "Text");

            if (_userHelper.Get().IsHeadOffice)
            {
                ViewBag.BranchDropDown = new SelectList(_branchService.GetBranchDropDown(), "Value", "Text");
            }

            return(View("Setup", vm));
        }
Example #2
0
        public ActionResult Edit(int?id)
        {
            if (!id.HasValue)
            {
                ViewBag.Title = OrganizationStrings.Organization_Edit_Add_Title;

                ViewBag.OrgCategoryDropDown      = new SelectList(_orgCategoryService.GetOrgCategoryDropDown(), "Value", "Text");
                ViewBag.GenderDropDown           = new SelectList(_genderService.GetGenderDropDown(), "Value", "Text");
                ViewBag.CollectionOptionDropDown = new SelectList(_colcOptionService.GetColcOptionDropDown(), "Value", "Text");

                DateTime systemDate = _userHelper.Get().DayOpenClose.SystemDate;
                return(View(new OrganizationEditViewModel()
                {
                    SetupDate = systemDate,
                    MeetingDate = systemDate,
                    IsActive = true
                }));
            }

            OrganizationEditViewModel vm = _orgService.GetOrganizationById(id.Value);

            if (vm != null)
            {
                ViewBag.Title = OrganizationStrings.Organization_Edit_Update_Title;

                ViewBag.OrgCategoryDropDown      = new SelectList(_orgCategoryService.GetOrgCategoryDropDown(), "Value", "Text", vm.OrgCategoryId);
                ViewBag.GenderDropDown           = new SelectList(_genderService.GetGenderDropDown(), "Value", "Text", vm.GenderId);
                ViewBag.CollectionOptionDropDown = new SelectList(_colcOptionService.GetColcOptionDropDown(), "Value", "Text", vm.MeetingFrequencyId);

                return(View(vm));
            }
            else
            {
                SystemMessages.Add(CommonStrings.No_Record, true, true);
                return(RedirectToAction("Index"));
            }
        }