private string GenerateEstimationNumber(long appid)
        {
            string              RegistrationIdNext;
            string              Today, AppCode;
            StringBuilder       buffer     = new StringBuilder();
            IApplicationService appService = new ApplicationService(new ApplicationRepository(new UnitOfWork()));

            RegistrationIdNext = GetNextRegistrationID();
            AppCode            = appService.GetApplicationCode(appid);
            Today = DateTime.Now.ToString("yyyyMMdd", CultureInfo.CurrentCulture);
            buffer.Append(Today);
            buffer.Append(AppCode);
            buffer.Append(RegistrationIdNext);
            return(buffer.ToString());
        }
Ejemplo n.º 2
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);
        }
        public string GetEstimationProjectNextNumber(BaseViewModel model)
        {
            string NexrProjectNumer = string.Empty;

            try
            {
                IUnitOfWork           uwork = new UnitOfWork();
                IEstimationRepository estimationRepository = new EstimationRepository(uwork);
                IApplicationService   appService           = new ApplicationService(new ApplicationRepository(uwork));
                //var NextID = estimationRepository.GetEstimationProjectNextNumber(model);
                var NextID = 1;
                NextID           = NextID == null ? 0 : NextID;
                NextID           = NextID + 1;
                NexrProjectNumer = Helper.GenerateUniqueID(appService.GetApplicationCode(model.ApplicationId), NextID.ToString());
            }
            catch (Exception ex)
            {
            }
            return(NexrProjectNumer);
        }
Ejemplo n.º 4
0
        public string GetNextStaffNumber(BaseViewModel model)
        {
            string StaffNo = string.Empty;

            try
            {
                IUnitOfWork         unitWork   = new UnitOfWork();
                IApplicationService appService = new ApplicationService(new ApplicationRepository(unitWork));

                long?NextID = _StaffRepository.GetStaffNextRegistrationID(model);
                NextID  = NextID == null ? 0 : NextID;
                NextID  = NextID + 1;
                StaffNo = Helper.GenerateUniqueID(appService.GetApplicationCode(model.ApplicationId), NextID.ToString());
            }
            catch (Exception ex)
            {
            }

            return(StaffNo);
        }