Example #1
0
        public DepartmentFormModel GetDepartmentFormData(BaseViewModel arg)
        {
            ICountryService scon;
            IBranchService  sbrn;
            //IDivisionService sdiv;
            IUnitOfWork         uwork = new UnitOfWork();
            DepartmentFormModel model = new DepartmentFormModel();

            scon = new CountryService(new CountryRepository(uwork));
            sbrn = new BranchService(new BranchRepository(uwork));
            //sdiv = new DivisionService(new DivisionRepository(uwork));

            try
            {
                model.countryList = scon.GetAllCountryList(arg);
                model.branchList  = sbrn.GetAllBranchList(arg);
                // model.divisionList = sdiv.GetDivisionList(arg);
            }
            catch (Exception ex)
            {
                model = null;
                IErrorLogService errorLog = new ErrorLogService();
                string           message  = ex.InnerException != null ? ex.InnerException.InnerException.Message : ex.Message;
                errorLog.SetErrorLog(arg.CurrentUserID, "Department", message);
                throw new Exception(ex.Message);
            }
            return(model);
        }
Example #2
0
        public TeamFormModel?GetTeamFormData(BaseViewModel dataModel)
        {
            IUnitOfWork        uwork = new UnitOfWork();
            IDivisionService   sdiv;
            ICountryService    scon;
            IBranchService     sbrn;
            IDepartmentService sdep;

            TeamFormModel?data;
            TeamFormModel model;

            sdiv = new DivisionService(new DivisionRepository(uwork));
            scon = new CountryService(new CountryRepository(uwork));
            sbrn = new BranchService(new BranchRepository(uwork));
            sdep = new DepartmentService(new DepartmentRepository(uwork));

            try
            {
                model.divisionList   = sdiv.GetDivisionList(dataModel);
                model.countryList    = scon.GetAllCountryList(dataModel);
                model.branchList     = sbrn.GetAllBranchList(dataModel);
                model.departmentList = sdep.GetAllDepartmentList(dataModel);
                data = model;
            }
            catch (Exception ex)
            {
                data = null;
                string message = LogException(ex, dataModel.CurrentUserID);
                throw new Exception(message);
            }
            return(data);
        }
Example #3
0
        public EmployeeFormModel GetEmployeeFormData(BaseViewModel model)
        {
            IUnitOfWork       uwork    = new UnitOfWork();
            EmployeeFormModel formData = new EmployeeFormModel();

            ICountryService countrySerivce = new CountryService(new CountryRepository(uwork));
            //  IDivisionService divisionService = new DivisionService(new DivisionRepository(uwork));
            IDepartmentService  departmentService = new DepartmentService(new DepartmentRepository(uwork));
            IRoleService        roleService       = new RoleService(new RoleRepository(uwork));
            IBranchService      branchService     = new BranchService(new BranchRepository(uwork));
            IBankService        bankService       = new BankService(new BankRepository(uwork));
            IBankBranchService  bankBranchService = new BankBranchSerivce(new BankBranchRepository(uwork));
            IBankAccountService banAccService     = new BankAccountService(new BankAccountRepository(uwork));
            ILanguageService    langService       = new LanguageService(new LanguageRepository(uwork));
            IApplicationService appService        = new ApplicationService(new ApplicationRepository(uwork));

            basemodel.CurrentCulture = model.CurrentCulture;
            basemodel.CurrentUserID  = model.CurrentUserID;

            var  LastEmployee = GetEmployeeList(basemodel).LastOrDefault();
            long NextID       = LastEmployee == null ? 0 : LastEmployee.RegistrationID + 1;

            try
            {
                formData.countries = countrySerivce.GetAllCountryList(model).Where(c => c.IsActive == true).ToList();
                // formData.divisions = divisionService.GetDivisionList(model);
                formData.departments      = departmentService.GetAllDepartmentList(model).Where(c => c.IsActive == true).ToList();
                formData.roles            = roleService.GetAllRoleList(model).Where(c => c.IsActive == true).ToList();
                formData.branches         = branchService.GetAllBranchList(model).Where(c => c.IsActive == true).ToList();
                formData.banks            = bankService.GetAllBankList(model).Where(c => c.IsActive == true).ToList();
                formData.bankbranches     = bankBranchService.GetAllBankBranchList(model).Where(c => c.IsActive == true).ToList();
                formData.bankAccountTypes = banAccService.GetAllBankAccountType(model).Where(c => c.IsActive == true).ToList();
                formData.languages        = langService.GetAllLanguageList(model).Where(c => c.IsActive == true).ToList();
                //formData.EmployeeNo = Helper.GenerateUniqueID(appService.GetApplicationCode(model.ApplicationId), NextID.ToString());
            }
            catch (Exception ex)
            {
                string message = LogException(ex, model.CurrentUserID);
                throw new Exception(message);
            }
            return(formData);
        }