public DesignationFormModel GetDesignationFormData(BaseViewModel arg)
        {
            ICountryService    scon;
            IBranchService     sbrn;
            IDivisionService   sdiv;
            IDepartmentService sdep;
            ITeamService       stem;

            IUnitOfWork          uwork = new UnitOfWork();
            DesignationFormModel model = new DesignationFormModel();

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

            try
            {
                model.countryList    = scon.GetAllCountryList(arg);
                model.branchList     = sbrn.GetAllBranchList(arg);
                model.divisionList   = sdiv.GetDivisionList(arg);
                model.departmentList = sdep.GetAllDepartmentList(arg);
                model.teamList       = stem.GetTeamList(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, "Company Designation", 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);
        }