예제 #1
0
        public ActionResult MapCreditOfficer(OrgCOMappingViewModel vm)
        {
            int branchId = _userHelper.Get().BranchId;

            if (ModelState.IsValid)
            {
                if (_employeeService.GetEmployeeList(filter: x => x.BranchId == branchId && x.Id == vm.CreditOfficerId && x.IsActive && x.IsCreditOfficer).Count == 0)
                {
                    SystemMessages.Add(CommonStrings.No_Record, true, true);
                    return(RedirectToAction("Index"));
                }

                string validationMessage = String.Empty;
                if (!_orgService.MapCreditOfficer(vm, out validationMessage))
                {
                    SystemMessages.Add(validationMessage, true);
                }
                else
                {
                    SystemMessages.Add(OrganizationStrings.Organization_CO_Map_Successfull_Msg, false, true);
                    return(RedirectToAction("Index"));
                }
            }

            ViewBag.CreditOfficerDropDown = new SelectList(_employeeService.GetEmployeeDropDown(x => x.BranchId == branchId && x.IsCreditOfficer && x.IsActive), "Value", "Text");

            ViewBag.Title = OrganizationStrings.Organization_Credit_Officer_Title;
            return(View());
        }
예제 #2
0
        public ActionResult Edit(BranchEditViewModel vm)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (vm.Id > 0)
                    {
                        _branchService.UpdateBranch(vm);
                        SystemMessages.Add(BranchStrings.Branch_Update_Success_Msg, false, true);
                    }
                    else
                    {
                        _branchService.SaveBranch(vm);
                        SystemMessages.Add(BranchStrings.Branch_Add_Success_Msg, false, true);
                    }

                    return(RedirectToAction("Index"));
                }
                catch (Exception ex)
                {
                    SystemMessages.Add(CommonStrings.Server_Error, true, true);
                }
            }

            return(View(vm));
        }
        public ActionResult Setup(ProductTypeSetupViewModel vm)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (vm.Id > 0)
                    {
                        if (_productTypeService.UpdateProductType(vm))
                        {
                            SystemMessages.Add(ProductStrings.Product_Type_Edit_Update_Success_Msg, false, true);
                        }
                        else
                        {
                            SystemMessages.Add(CommonStrings.No_Record, true, true);
                        }
                    }
                    else
                    {
                        _productTypeService.CreateProductType(vm);
                        SystemMessages.Add(ProductStrings.Product_Type_Edit_Create_Success_Msg, false, true);
                    }

                    return(new XHR_JSON_Redirect());
                }
                catch (Exception ex)
                {
                    SystemMessages.Add(CommonStrings.Server_Error, true, true);
                }
            }

            return(PartialView("_Setup", vm));
        }
예제 #4
0
        public ActionResult Delete(int id, FormCollection fc)
        {
            if (id > 0)
            {
                try
                {
                    if (_employeeTypeService.DeleteEmployeeType(id))
                    {
                        SystemMessages.Add(EmployeeTypeStrings.Employee_Type_Delete_Success_Msg, SystemMessageType.Success, true);
                    }
                    else
                    {
                        SystemMessages.Add(CommonStrings.No_Record, SystemMessageType.Error, true);
                    }
                }
                catch (Exception ex)
                {
                    SystemMessages.Add(CommonStrings.Server_Error, SystemMessageType.Error, true);
                }
            }
            else
            {
                SystemMessages.Add(CommonStrings.POST_NoID, SystemMessageType.Error, true);
            }

            return(new XHR_JSON_Redirect());
        }
        public ActionResult Setup(int?id)
        {
            ProductTypeSetupViewModel vm = null;

            if (!id.HasValue)
            {
                ViewBag.Title = ProductStrings.Product_Type_Create_Title;
                vm            = new ProductTypeSetupViewModel()
                {
                    IsActive = true
                };
            }
            else
            {
                ViewBag.Title = ProductStrings.Product_Type_Edit_Title;
                vm            = _productTypeService.GetProductTypeById(id.Value);
            }

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

            return(PartialView("_Setup", vm));
        }
예제 #6
0
        public ActionResult Edit(OrganizationEditViewModel vm)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (vm.Id > 0)
                    {
                        _orgService.UpdateOrganization(vm);
                        SystemMessages.Add(OrganizationStrings.Organization_Edit_Update_Success_Msg, false, true);
                    }
                    else
                    {
                        _orgService.CreateOrganization(vm);
                        SystemMessages.Add(OrganizationStrings.Organization_Edit_Add_Success_Msg, false, true);
                    }

                    return(RedirectToAction("Index"));
                }
                catch (Exception ex)
                {
                    SystemMessages.Add(CommonStrings.Server_Error, true, true);
                }
            }

            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));
        }
예제 #7
0
        public ActionResult Setup(int?id)
        {
            ComponentSetupViewModel vm = null;

            if (!id.HasValue)
            {
                ViewBag.Title = ComponentStrings.Component_Create_Title;
                vm            = new ComponentSetupViewModel()
                {
                    IsActive = true
                };
            }
            else
            {
                ViewBag.Title = ComponentStrings.Component_Edit_Title;
                vm            = _componentService.GetComponentById(id.Value);
            }

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

            ViewBag.ComponentTypeDropDown = new SelectList(_componentTypeService.GetComponentTypeDropDown(), "Value", "Text");
            ViewBag.DonorDropDown         = new SelectList(_donorService.GetDonorDropDown(), "Value", "Text");

            return(View("Setup", vm));
        }
예제 #8
0
        public ActionResult ComponentMappedList(int id)
        {
            if (_componentService.GetComponentList(filter: x => x.IsActive).Count == 0)
            {
                SystemMessages.Add(CommonStrings.No_Record, true, true);
                return(new XHR_JSON_Redirect());
            }

            var mappedList = _branchService.GetMappedComponentList(id);

            return(PartialView("_ComponentMappedList", mappedList));
        }
예제 #9
0
        public ActionResult MapBranch(ComponentBranchMappingViewModel vm)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (_componentService.GetComponentList(filter: x => x.IsActive).Count == 0)
                    {
                        SystemMessages.Add(CommonStrings.No_Record, true, true);
                        return(RedirectToAction("MapBranch"));
                    }

                    BranchEditViewModel branchVM = _branchService.GetBranchById(vm.BranchId);
                    if (branchVM == null || !branchVM.IsActive || branchVM.IsHeadOffice)
                    {
                        SystemMessages.Add(ComponentStrings.Component_Map_Branch_Validation_InvalidBranch, true, true);
                        return(RedirectToAction("MapBranch"));;
                    }

                    foreach (var i in vm.MappedComponentList)
                    {
                        if (!_componentService.GetComponentById(i.ComponentId).IsActive)
                        {
                            SystemMessages.Add(String.Format(ComponentStrings.Component_Map_Branch_Validation_InvalidComponent, i.ComponentName), true, true);
                            return(RedirectToAction("MapBranch"));
                        }
                    }


                    if (!_branchService.MapComponent(vm))
                    {
                        SystemMessages.Add(CommonStrings.Server_Error, true, true);
                        return(RedirectToAction("MapBranch"));
                    }
                    else
                    {
                        SystemMessages.Add(ComponentStrings.Component_Branch_Map_Successfull_Msg, false, true);
                        return(RedirectToAction("MapBranch"));
                    }
                }
                catch (Exception ex)
                {
                    SystemMessages.Add(CommonStrings.Server_Error, true, true);
                    return(RedirectToAction("MapBranch"));
                }
            }

            ViewBag.Title          = ComponentStrings.Component_Map_Branch_Setup_Title;
            ViewBag.BranchDropDown = new SelectList(_branchService.GetBranchDropDown(x => x.IsActive && !x.IsHeadOffice), "Value", "Text");

            return(View("MapBranch"));
        }
예제 #10
0
        public ActionResult MapComponent(ProductComponentMappingViewModel vm)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (_componentService.GetComponentList(filter: x => x.IsActive).Count == 0)
                    {
                        SystemMessages.Add(CommonStrings.No_Record, true, true);
                        return(RedirectToAction("MapComponent"));
                    }

                    ProductSetupViewModel productVM = _productService.GetProductById(vm.ProductId);
                    if (productVM == null || !productVM.IsActive)
                    {
                        SystemMessages.Add(ProductStrings.Product_Component_Map_Validation_InvalidProduct, true, true);
                        return(RedirectToAction("MapComponent"));;
                    }

                    foreach (var i in vm.MappedComponentList)
                    {
                        if (!_componentService.GetComponentById(i.ComponentId).IsActive)
                        {
                            SystemMessages.Add(String.Format(ComponentStrings.Component_Map_Branch_Validation_InvalidComponent, i.ComponentName), true, true);
                            return(RedirectToAction("MapComponent"));
                        }
                    }

                    if (!_productService.MapComponent(vm))
                    {
                        SystemMessages.Add(CommonStrings.Server_Error, true, true);
                        return(RedirectToAction("MapComponent"));
                    }
                    else
                    {
                        SystemMessages.Add(ProductStrings.Product_Component_Map_Successfull_Msg, false, true);
                        return(RedirectToAction("MapComponent"));
                    }
                }
                catch (Exception ex)
                {
                    SystemMessages.Add(CommonStrings.Server_Error, true, true);
                    return(RedirectToAction("MapComponent"));
                }
            }

            ViewBag.Title           = ProductStrings.Product_Component_Map_Setup_Title;
            ViewBag.ProductDropDown = new SelectList(_productService.GetProductDropDown(), "Value", "Text");

            return(View("MapComponent"));
        }
예제 #11
0
        public ActionResult CreditOfficerMappedList(int id)
        {
            int branchId = _userHelper.Get().BranchId;

            if (_employeeService.GetEmployeeList(filter: x => x.BranchId == branchId && x.Id == id && x.IsActive && x.IsCreditOfficer).Count == 0)
            {
                SystemMessages.Add(CommonStrings.No_Record, true, true);
                return(new XHR_JSON_Redirect());
            }

            var mappedList = _orgService.GetMappedOrganizationList(id);

            return(PartialView("CreditOfficerMappedList", mappedList));
        }
예제 #12
0
 public ActionResult Delete(int id)
 {
     if (id > 0)
     {
         OrganizationEditViewModel vm = _orgService.GetOrganizationById(id);
         if (vm == null)
         {
             SystemMessages.Add(CommonStrings.No_Record, SystemMessageType.Error, true);
             return(RedirectToAction("Index"));
         }
         return(PartialView("_Delete", vm));
     }
     return(RedirectToAction("Index"));
 }
예제 #13
0
        public ActionResult MapCreditOfficer(int?id)
        {
            int branchId = _userHelper.Get().BranchId;

            if (id.HasValue && _employeeService.GetEmployeeList(filter: x => x.BranchId == branchId && x.Id == id && x.IsActive && x.IsCreditOfficer).Count == 0)
            {
                SystemMessages.Add(CommonStrings.No_Record, true, true);
                return(RedirectToAction("Index"));
            }

            ViewBag.CreditOfficerDropDown = new SelectList(_employeeService.GetEmployeeDropDown(x => x.BranchId == branchId && x.IsCreditOfficer && x.IsActive), "Value", "Text", id);

            ViewBag.Title = OrganizationStrings.Organization_Credit_Officer_Title;
            return(View());
        }
예제 #14
0
        public ActionResult Delete(int id)
        {
            if (id > 0)
            {
                EmployeeTypeEditViewModel vm = _employeeTypeService.GetEmployeeTypeById(id);
                if (vm == null)
                {
                    SystemMessages.Add(CommonStrings.No_Record, SystemMessageType.Error, true);
                    return(RedirectToAction("Index"));
                }

                ViewBag.Title = EmployeeTypeStrings.Delete_Title;
                return(PartialView("_Delete", vm));
            }
            return(RedirectToAction("Index"));
        }
예제 #15
0
        public ActionResult Setup(EmployeeEditViewModel vm)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (vm.Id > 0)
                    {
                        ViewBag.Title = EmployeeStrings.Edit_Title;

                        if (_employeeService.UpdateEmployee(vm))
                        {
                            SystemMessages.Add(EmployeeStrings.Employee_Edit_Update_Success_Msg, false, true);
                        }
                        else
                        {
                            SystemMessages.Add(CommonStrings.No_Record, true, true);
                        }
                    }
                    else
                    {
                        ViewBag.Title = EmployeeStrings.Create_Title;

                        _employeeService.CreateEmployee(vm);
                        SystemMessages.Add(EmployeeStrings.Employee_Edit_Create_Success_Msg, false, true);
                    }

                    return(RedirectToAction("Index"));
                }
                catch (Exception ex)
                {
                    SystemMessages.Add(CommonStrings.Server_Error, true, true);
                }
            }

            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));
        }
예제 #16
0
        public ActionResult Delete(int id, FormCollection fc)
        {
            if (id > 0)
            {
                try
                {
                    _orgService.DeleteOrganization(id);
                    SystemMessages.Add(OrganizationStrings.Organization_Delete_Success_Msg, false, true);
                }
                catch (Exception ex)
                {
                    SystemMessages.Add(CommonStrings.Server_Error, true, true);
                }
            }
            else
            {
                SystemMessages.Add(CommonStrings.POST_NoID, SystemMessageType.Error, true);
            }

            return(new XHR_JSON_Redirect());
        }
예제 #17
0
        public ActionResult Setup(ComponentSetupViewModel vm)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (vm.Id > 0)
                    {
                        ViewBag.Title = ComponentStrings.Component_Edit_Title;

                        if (_componentService.UpdateComponent(vm))
                        {
                            SystemMessages.Add(ComponentStrings.Component_Update_Success_Msg, false, true);
                        }
                        else
                        {
                            SystemMessages.Add(CommonStrings.No_Record, true, true);
                        }
                    }
                    else
                    {
                        ViewBag.Title = ComponentStrings.Component_Create_Title;

                        _componentService.CreateComponent(vm);
                        SystemMessages.Add(ComponentStrings.Component_Create_Success_Msg, false, true);
                    }

                    return(RedirectToAction("Index"));
                }
                catch (Exception ex)
                {
                    SystemMessages.Add(CommonStrings.Server_Error, true, true);
                }
            }

            ViewBag.ComponentTypeDropDown = new SelectList(_componentTypeService.GetComponentTypeDropDown(), "Value", "Text", vm.ComponentTypeId);
            ViewBag.DonorDropDown         = new SelectList(_donorService.GetDonorDropDown(), "Value", "Text", vm.DonorId);

            return(View("Setup", vm));
        }
예제 #18
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));
        }
예제 #19
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"));
            }
        }
예제 #20
0
        public ActionResult Edit(int?id)
        {
            if (!id.HasValue)
            {
                ViewBag.Title = "Create Branch";
                return(View(new BranchEditViewModel()
                {
                    OpenDate = DateTime.Now, IsActive = true
                }));
            }

            BranchEditViewModel vm = _branchService.GetBranchById(id.Value);

            if (vm != null)
            {
                ViewBag.Title = "Edit Branch";
                return(View(vm));
            }
            else
            {
                SystemMessages.Add(CommonStrings.No_Record, true, true);
                return(RedirectToAction("Index"));
            }
        }
예제 #21
0
        internal void SendMessage(MsgLevel lvl, string text)
        {
            if (lvl >= (MsgLevel)Config.GetInt("MessageLevel") && text.Length > 0)
            {
                int hue;
                switch (lvl)
                {
                case MsgLevel.Error:
                case MsgLevel.Warning:
                    hue = Config.GetInt("WarningColor");
                    break;

                case MsgLevel.Friend:
                    hue = 63;
                    break;

                default:
                    hue = Config.GetInt("SysColor");
                    break;
                }

                SystemMessages.Add(text);

                if (Config.GetBool("FilterRazorMessages"))
                {
                    if (!MessageQueue.Enqueue(0xFFFFFFFF, null, 0, MessageType.Regular, (ushort)hue, 3,
                                              Language.CliLocName, "System", text))
                    {
                        return;
                    }
                }

                Client.Instance.SendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, hue, 3,
                                                                Language.CliLocName, "System", text));
            }
        }
예제 #22
0
 public override Task OnReceiveSystemMessage(JToken system, string connectionId)
 {
     SystemMessages.Add(system.ToString());
     return(Task.CompletedTask);
 }