Beispiel #1
0
        public ActionResult AllExpansesReports(int?pageIndex)
        {
            var userId = User.Identity.GetUserId();
            EmployesRepositery empRepository = new EmployesRepositery();

            if (empRepository.GetByIdUser(userId) == null)
            {
                ViewData["erreurMessage"] = "Vouns êtes pas encore Employer";
                return(View("ErrorEmptyList"));
            }
            var idEmployer = empRepository.GetByIdUser(userId).Employee_ID;
            ExpanseRepportRepositery expRepRepo = new ExpanseRepportRepositery();
            var countElementPage = 10;
            var expansesReports  = expRepRepo.allExpanseReports(idEmployer);
            List <ExpanseReportsModel> expanseReportModelList = new List <ExpanseReportsModel>();

            if (expansesReports.Count() == 0)
            {
                ViewData["erreurMessage"] = "Vouns n'avez aucune note de frais";
                ViewData["element"]       = "ExpanseReports";
                ViewData["create"]        = "false";
                return(View("ErrorEmptyList"));
            }

            foreach (var exp in expansesReports)
            {
                ExpanseReportsModel expReportModel = new ExpanseReportsModel();
                EmployeesModel      employer       = new EmployeesModel();
                expReportModel.ExpanseReport_ID = exp.ExpanseReport_ID;
                employer.FirstName                        = expRepRepo.GetByIdEmployes(exp.Employee_ID).FirstName;
                expReportModel.Employees                  = employer;
                expReportModel.CreationDate               = exp.CreationDate;
                expReportModel.Year                       = exp.Year;
                expReportModel.Month                      = exp.Month;
                expReportModel.StatusCode                 = exp.StatusCode;
                expReportModel.ManagerValidationDate      = exp.ManagerValidationDate;
                expReportModel.ManagerComment             = exp.ManagerComment;
                expReportModel.AccountingValidatationDate = exp.AccountingValidatationDate;
                expReportModel.AccountingComment          = exp.AccountingComment;
                expReportModel.Total_HT                   = exp.Total_HT;
                expReportModel.Total_TTC                  = exp.Total_TTC;
                expReportModel.Total_TVA                  = exp.Total_TVA;
                expanseReportModelList.Add(expReportModel);
            }
            IQueryable <ExpanseReportsModel>    listExpanseReports = expanseReportModelList.AsQueryable();
            PaginatedList <ExpanseReportsModel> lst = new PaginatedList <ExpanseReportsModel>(listExpanseReports, pageIndex, countElementPage);

            return(View("MyExpanseReports", lst));
        }
Beispiel #2
0
        public ActionResult Searche(String query, int?pageIndex)
        {
            EmployesRepositery empRepository = new EmployesRepositery();
            var userId                      = User.Identity.GetUserId();
            var idEmployer                  = empRepository.GetByIdUser(userId).Employee_ID;
            var countElementPage            = 10;
            ExpanseRepportRepositery expRep = new ExpanseRepportRepositery();
            var expanse                     = expRep.getSerachingExpanseReports(query, idEmployer);
            List <ExpanseReportsModel> expanseReportModelList = new List <ExpanseReportsModel>();

            foreach (var exp in expanse)
            {
                ExpanseReportsModel expReportModel = new ExpanseReportsModel();
                EmployeesModel      employer       = new EmployeesModel();

                expReportModel.ExpanseReport_ID = exp.ExpanseReport_ID;
                employer.FirstName                        = expRep.GetByIdEmployes(exp.Employee_ID).FirstName;
                expReportModel.Employees                  = employer;
                expReportModel.CreationDate               = exp.CreationDate;
                expReportModel.Year                       = exp.Year;
                expReportModel.Month                      = exp.Month;
                expReportModel.StatusCode                 = exp.StatusCode;
                expReportModel.ManagerValidationDate      = exp.ManagerValidationDate;
                expReportModel.ManagerComment             = exp.ManagerComment;
                expReportModel.AccountingValidatationDate = exp.AccountingValidatationDate;
                expReportModel.AccountingComment          = exp.AccountingComment;
                expReportModel.Total_HT                   = exp.Total_HT;
                expReportModel.Total_TTC                  = exp.Total_TTC;
                expReportModel.Total_TVA                  = exp.Total_TVA;

                expanseReportModelList.Add(expReportModel);
            }
            IQueryable <ExpanseReportsModel>    listCust = expanseReportModelList.AsQueryable();
            PaginatedList <ExpanseReportsModel> lst      = new PaginatedList <ExpanseReportsModel>(listCust, pageIndex, countElementPage);

            return(View("MyExpanseReports", lst));
        }