Example #1
0
        public async Task <IActionResult> _Index(DateProbaDeAfisat selectieAfisareDate, string dataFrom, string dataTo, string ecranMic)
        {
            ViewBag.IsMallScreen = ecranMic;
            // Salvez in ViewBag userName si Rol pentru a folosi in View
            ViewBag.UserName = HttpContext.Session.GetString("UserName");
            ViewBag.Rol      = HttpContext.Session.GetString("Rol");
            // Daca nu e logat redirectionez la Pagina de Login
            if (ViewBag.UserName == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            // Modific datele de afisat in functie de selectie din View
            if (dataFrom == null)
            {
                dataFrom = Auxiliar.GetOneMonthBeforeDate();
            }
            if (dataTo == null)
            {
                dataTo = Auxiliar.GetTomorrowDate();
            }
            IEnumerable <ProbaModel> ListaDeAfisat = await _context.ProbaModels.ToListAsync();

            switch (selectieAfisareDate)
            {
            // Afiseaza toate datele
            case DateProbaDeAfisat.Toate:
                ListaDeAfisat = await _context.ProbaModels.ToListAsync();

                break;

            // Afiseaza doar datele introduse de operator
            case DateProbaDeAfisat.ProbaIntrodusa:
                ListaDeAfisat = _context.ProbaModels.Where(item => item.DataPreluare == "-" && item.DataRaspunsCalitate == "-");
                break;

            // Afiseaza doar datele cu probele prelevate de operator calitate
            case DateProbaDeAfisat.ProbaPreluata:
                ListaDeAfisat = _context.ProbaModels.Where(item => item.DataPreluare != "-" && item.DataRaspunsCalitate == "-");
                break;

            // Afiseaza doar datele cu rezultat la calitate
            case DateProbaDeAfisat.ProbaRezultat:
                ListaDeAfisat = _context.ProbaModels.Where(item => item.DataPreluare != "-" && item.DataRaspunsCalitate != "-");
                break;

            // Afiseaza doar datele cu RNC
            case DateProbaDeAfisat.ProbaRNC:
                ListaDeAfisat = _context.ProbaModels.Where(item => item.RezultatProba == Rezultat.RNC);
                break;

            default:
                break;
            }
            return(PartialView(ListaDeAfisat.Where(item => Auxiliar.IsDateBetween(item.DataPrelevare, dataFrom, dataTo))));
            // return View(await _context.ProbaModels.ToListAsync());
        }
Example #2
0
        public async Task <IActionResult> _IndexPlc(string dataFrom, string dataTo)
        {
            // Modific datele de afisat in functie de selectie din View
            if (dataFrom == null)
            {
                dataFrom = _auxiliar.GetOneMonthBeforeDate();
            }
            if (dataTo == null)
            {
                dataTo = _auxiliar.GetTomorrowDate();
            }
            IEnumerable <PlcModel> ListaDeAfisat = await _context.Plcs.ToListAsync();

            return(PartialView(ListaDeAfisat.Where(item => _auxiliar.IsDateBetween(item.DataCreation.ToString("dd.MM.yyyy HH:mm:ss"), dataFrom, dataTo))));
            // return View(await _context.ProbaModels.ToListAsync());
        }
Example #3
0
        public async Task <IActionResult> Index()
        {
            // Salvez in ViewBag userName si Rol pentru a folosi in View
            ViewBag.UserName = HttpContext.Session.GetString("UserName");
            ViewBag.Rol      = HttpContext.Session.GetString("Rol");
            // Daca nu e logat redirectionez la Pagina de Login
            if (ViewBag.UserName == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            // Logiga afisare date doar pt o luna inainte
            ViewBag.dataFrom = Auxiliar.GetOneMonthBeforeDate();
            ViewBag.dataTo   = Auxiliar.GetTomorrowDate();
            List <ProbaModel> ListaSql = await _context.ProbaModels.ToListAsync();

            IEnumerable <ProbaModel> ListaDeAfisat = ListaSql.Where(item => Auxiliar.IsDateBetween(item.DataPrelevare, ViewBag.dataFrom, ViewBag.dataTo));

            return(View(ListaDeAfisat));
        }