예제 #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));
        }
예제 #2
0
        public ActionResult createExpanseReportsDateDay(String userName)
        {
            ViewData["userName"] = userName;
            ViewData["month"]    = Convert.ToInt32(Request.Form["Month"]);
            ViewData["year"]     = Convert.ToInt32(Request.Form["Year"]);
            int mois   = Convert.ToInt32(Request.Form["Month"]);
            var userId = User.Identity.GetUserId();

            ExpanseRepportRepositery expRepRepo    = new ExpanseRepportRepositery();
            EmployesRepositery       empRepository = new EmployesRepositery();
            ExpanseReports           exp           = new ExpanseReports();
            var idEmployer = empRepository.GetByIdUser(userId).Employee_ID;
            var actor_id   = idEmployer;

            exp.ExpanseReport_ID = Guid.NewGuid();
            exp.CreationDate     = DateTime.Now;
            exp.Year             = Convert.ToInt32(Request.Form["Year"]);

            exp.Month                      = mois;
            exp.StatusCode                 = Convert.ToInt32(00);
            exp.ManagerValidationDate      = Convert.ToDateTime(Request.Form["CreationDate"]);
            exp.ManagerComment             = Convert.ToString(" no comment");
            exp.AccountingValidatationDate = Convert.ToDateTime(Request.Form["CreationDate"]);
            exp.AccountingComment          = Convert.ToString(" no comment");
            exp.Total_HT                   = Convert.ToDouble(0);
            exp.Total_TTC                  = Convert.ToDouble(0);
            exp.Total_TVA                  = Convert.ToDouble(0);
            exp.Employee_ID                = idEmployer;
            exp.Author_ID                  = actor_id;
            expRepRepo.AddExpansesReports(exp);
            return(RedirectToAction("AllExpanses", "Expanses", new { idExpanseReport = exp.ExpanseReport_ID }));
        }
예제 #3
0
        // GET: Expanses
        public PartialViewResult Index(String userName)
        {
            var userId = User.Identity.GetUserId();
            EmployesRepositery empRepository = new EmployesRepositery();

            ViewData["employer"] = "false";
            if (empRepository.GetByIdUser(userId) == null)
            {
                ViewData["employer"] = "true";
            }

            ViewData["userName"] = userName;
            ExpanseReportsModel model = new ExpanseReportsModel();

            model.Year = DateTime.Now.Year;
            return(PartialView("_MonthYear", model));
        }
예제 #4
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));
        }