示例#1
0
        public ActionResult MenuLogs(string Selection)
        {
            int Month = 1;

            if (Selection != "" && Selection != null)
            {
                string[] S = Selection.Split(';');
                int      Y = Convert.ToInt16(S[0]);

                Month = Opr.MonthObratno(S[1]);
                List <string> Day = new List <string>();
                for (int i = 1; i <= DateTime.DaysInMonth(Y, Month); i++)
                {
                    Day.Add(i.ToString());
                }
                ViewBag.Day = Day;
            }
            else
            {
                List <string> Day = new List <string>();
                for (int i = 1; i <= DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month); i++)
                {
                    Day.Add(i.ToString());
                }
                ViewBag.Day = Day;
            }
            List <string> M = new List <string> {
                "Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"
            };

            M.RemoveAt(Month - 1);
            M.Insert(0, Opr.MonthOpred(Month));
            ViewBag.Month = M;
            List <string> Year = new List <string>();

            for (int i = DateTime.Now.Year; i >= 2018; i--)
            {
                Year.Add(i.ToString());
            }

            ViewBag.Year = Year;

            return(View());
        }
示例#2
0
        public ActionResult SpisokLogs(string Selection)
        {
            DateTime D = DateTime.Now;

            if (Selection != null && Selection != "")
            {
                string[]   s     = Selection.Split(';');
                int        Day   = Convert.ToInt16(s[0]);
                int        Month = Opr.MonthObratno(s[1]);
                int        Year  = Convert.ToInt16(s[2]);
                List <Log> L     = db.Logs.Where(x => x.Date.Year == Year && x.Date.Month == Month && x.Date.Day == Day).ToList();
                return(View(L));
            }
            else
            {
                List <Log> L = db.Logs.Where(x => x.Date.Year == D.Year && x.Date.Month == D.Month && x.Date.Day == D.Day - 1).ToList();
                return(View(L));
            }
        }