예제 #1
0
 public ActionResult Project()
 {
     if (SessionManager.ActiveUser.Id == 1002 || SessionManager.ActiveUser.Id == 1 || SessionManager.ActiveUser.Id == 5)
     {
         List <ProjectListVM> list = _ws.GetAll()
                                     .Where(x => x.IsActive == true)
                                     .OrderByDescending(x => x.Created)
                                     .Select(x => new ProjectListVM()
         {
             Id          = x.Id,
             CompanyName = x.CompanyName,
             Model       = x.Model,
             StartDate   = x.StartDate,
             EndDate     = x.EndDate,
             BillDate    = x.BillDate,
             BillNumber  = x.BillNumber,
             Price       = Math.Round(x.Price, 2),
             IsPay       = x.IsPay,
             Description = x.Description
         }).ToList();
         return(View(list));
     }
     else
     {
         List <ProjectListVM> list = _ws.GetAll()
                                     .Where(x => x.IsActive == true && x.CreatedBy == SessionManager.ActiveUser.Id)
                                     .OrderByDescending(x => x.Created)
                                     .Select(x => new ProjectListVM()
         {
             Id          = x.Id,
             CompanyName = x.CompanyName,
             Model       = x.Model,
             StartDate   = x.StartDate,
             EndDate     = x.EndDate,
             BillDate    = x.BillDate,
             BillNumber  = x.BillNumber,
             Price       = Math.Round(x.Price, 2),
             IsPay       = x.IsPay,
             Description = x.Description
         }).ToList();
         return(View(list));
     }
 }
예제 #2
0
        public ActionResult Index()
        {
            if (SessionManager.ActiveUser.Id == 1002 || SessionManager.ActiveUser.Id == 1 || SessionManager.ActiveUser.Id == 5)
            {
                ViewBag.MeetCount      = _ms.GetAll().Where(x => x.IsActive == true).Count();
                ViewBag.MeetCountDaily = _ms.GetAll().Where(x => x.IsActive == true && x.Created.Day == DateTime.Now.Day).Count();

                ViewBag.ProjectCount      = _ws.GetAll().Where(x => x.IsActive == true).Count();
                ViewBag.ProjectCountDaily = _ws.GetAll().Where(x => x.IsActive == true && x.Created.Day == DateTime.Now.Day).Count();

                ViewBag.TotalPrice            = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true).Select(x => x.Price).Sum());
                ViewBag.TotalPriceDailyCavcu  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Day == DateTime.Now.Day).Select(x => x.Price).Sum());
                ViewBag.TotalPriceDailyOorkun = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Day == DateTime.Now.Day).Select(x => x.Price).Sum());
                ViewBag.TotalPriceDaily       = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 || x.CreatedBy == 7 && x.Created.Day == DateTime.Now.Day).Select(x => x.Price).Sum());

                ViewBag.TotalPriceMonthCavcu     = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == DateTime.Now.Month).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuJan  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 1).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuFeb  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 2).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuMar  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 3).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuApr  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 4).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuMay  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 5).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuJune = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 6).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuJuly = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 7).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuAgus = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 8).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuSep  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 9).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuOct  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 10).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuNov  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 11).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuDec  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 12).Select(x => x.Price).Sum());

                ViewBag.TotalPriceMonthOorkun     = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == DateTime.Now.Month).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunJan  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 1).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunFeb  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 2).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunMar  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 3).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunApr  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 4).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunMay  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 5).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunJune = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 6).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunJuly = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 7).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunAgus = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 8).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunSep  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 9).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunOct  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 10).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunNov  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 11).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunDec  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 12).Select(x => x.Price).Sum());

                ViewBag.TotalPriceYearCavcu     = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Year == DateTime.Now.Year).Select(x => x.Price).Sum());
                ViewBag.TotalPriceYearCavcu2017 = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Year == 2017).Select(x => x.Price).Sum());
                ViewBag.TotalPriceYearCavcu2018 = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Year == 2018).Select(x => x.Price).Sum());
                ViewBag.TotalPriceYearCavcu2019 = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Year == 2019).Select(x => x.Price).Sum());
                ViewBag.TotalPriceYearCavcu2020 = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Year == 2020).Select(x => x.Price).Sum());

                ViewBag.TotalPriceYearOorkun     = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Year == DateTime.Now.Year).Select(x => x.Price).Sum());
                ViewBag.TotalPriceYearOorkun2017 = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Year == 2017).Select(x => x.Price).Sum());
                ViewBag.TotalPriceYearOorkun2018 = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Year == 2018).Select(x => x.Price).Sum());
                ViewBag.TotalPriceYearOorkun2019 = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Year == 2019).Select(x => x.Price).Sum());
                ViewBag.TotalPriceYearOorkun2020 = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Year == 2020).Select(x => x.Price).Sum());

                ViewBag.CustomerCount      = _cus.GetAll().Where(x => x.IsActive == true).Count();
                ViewBag.CustomerCountDaily = _cus.GetAll().Where(x => x.IsActive == true && x.Created.Day == DateTime.Now.Day).Count();

                List <ProjectListVM> list = _ws.GetAll()
                                            .Where(x => x.IsActive == true)
                                            .OrderByDescending(x => x.Created)
                                            .Select(x => new ProjectListVM()
                {
                    Id          = x.Id,
                    Personnel   = x.Personnel,
                    Model       = x.Model,
                    CompanyName = x.CompanyName,
                    StartDate   = x.StartDate,
                    EndDate     = x.EndDate,
                    BillDate    = x.BillDate,
                    BillNumber  = x.BillNumber,
                    Price       = Math.Round(x.Price, 2),
                    IsPay       = x.IsPay,
                    Description = x.Description,
                }).ToList();
                return(View(list));
            }

            else
            {
                ViewBag.MeetCount      = _ms.GetAll().Where(x => x.IsActive == true && x.CreatedBy == SessionManager.ActiveUser.Id).Count();
                ViewBag.MeetCountDaily = _ms.GetAll().Where(x => x.IsActive == true && x.Created.Day == DateTime.Now.Day && x.CreatedBy == SessionManager.ActiveUser.Id).Count();

                ViewBag.ProjectCount      = _ws.GetAll().Where(x => x.IsActive == true && x.CreatedBy == SessionManager.ActiveUser.Id).Count();
                ViewBag.ProjectCountDaily = _ws.GetAll().Where(x => x.IsActive == true && x.Created.Day == DateTime.Now.Day && x.CreatedBy == SessionManager.ActiveUser.Id).Count();

                ViewBag.TotalPrice            = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == SessionManager.ActiveUser.Id).Select(x => x.Price).Sum());
                ViewBag.TotalPriceDailyCavcu  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Day == DateTime.Now.Day).Select(x => x.Price).Sum());
                ViewBag.TotalPriceDailyOorkun = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Day == DateTime.Now.Day).Select(x => x.Price).Sum());
                ViewBag.TotalPriceDaily       = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 || x.CreatedBy == 7 && x.Created.Day == DateTime.Now.Day).Select(x => x.Price).Sum());

                ViewBag.TotalPriceMonthCavcu     = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == DateTime.Now.Month).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuJan  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 1).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuFeb  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 2).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuMar  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 3).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuApr  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 4).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuMay  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 5).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuJune = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 6).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuJuly = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 7).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuAgus = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 8).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuSep  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 9).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuOct  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 10).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuNov  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 11).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthCavcuDec  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Month == 12).Select(x => x.Price).Sum());

                ViewBag.TotalPriceMonthOorkun     = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == DateTime.Now.Month).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunJan  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 1).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunFeb  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 2).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunMar  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 3).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunApr  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 4).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunMay  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 5).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunJune = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 6).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunJuly = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 7).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunAgus = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 8).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunSep  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 9).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunOct  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 10).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunNov  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 11).Select(x => x.Price).Sum());
                ViewBag.TotalPriceMonthOorkunDec  = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Month == 12).Select(x => x.Price).Sum());

                ViewBag.TotalPriceYearCavcu     = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Year == DateTime.Now.Year).Select(x => x.Price).Sum());
                ViewBag.TotalPriceYearCavcu2017 = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Year == 2017).Select(x => x.Price).Sum());
                ViewBag.TotalPriceYearCavcu2018 = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Year == 2018).Select(x => x.Price).Sum());
                ViewBag.TotalPriceYearCavcu2019 = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Year == 2019).Select(x => x.Price).Sum());
                ViewBag.TotalPriceYearCavcu2020 = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 6 && x.Created.Year == 2020).Select(x => x.Price).Sum());

                ViewBag.TotalPriceYearOorkun     = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Year == DateTime.Now.Year).Select(x => x.Price).Sum());
                ViewBag.TotalPriceYearOorkun2017 = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Year == 2017).Select(x => x.Price).Sum());
                ViewBag.TotalPriceYearOorkun2018 = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Year == 2018).Select(x => x.Price).Sum());
                ViewBag.TotalPriceYearOorkun2019 = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Year == 2019).Select(x => x.Price).Sum());
                ViewBag.TotalPriceYearOorkun2020 = Math.Round(_ws.GetAll().Where(x => x.IsActive == true && x.IsPay == true && x.CreatedBy == 7 && x.Created.Year == 2020).Select(x => x.Price).Sum());

                ViewBag.CustomerCount      = _cus.GetAll().Where(x => x.IsActive == true && x.CreatedBy == SessionManager.ActiveUser.Id).Count();
                ViewBag.CustomerCountDaily = _cus.GetAll().Where(x => x.IsActive == true && x.Created.Day == DateTime.Now.Day && x.CreatedBy == SessionManager.ActiveUser.Id).Count();

                List <ProjectListVM> list = _ws.GetAll()
                                            .Where(x => x.IsActive == true && x.CreatedBy == SessionManager.ActiveUser.Id)
                                            .OrderByDescending(x => x.Created)
                                            .Select(x => new ProjectListVM()
                {
                    Id          = x.Id,
                    Personnel   = x.Personnel,
                    Model       = x.Model,
                    CompanyName = x.CompanyName,
                    StartDate   = x.StartDate,
                    EndDate     = x.EndDate,
                    BillDate    = x.BillDate,
                    BillNumber  = x.BillNumber,
                    Price       = Math.Round(x.Price, 2),
                    IsPay       = x.IsPay,
                    Description = x.Description,
                }).ToList();
                return(View(list));
            }
        }