예제 #1
0
        public ViewResult ZapisnikList(string sortOrder, string currentFilter, string searchString, string datumOd, string datumDo, int?page)
        {
            try
            {
                string wp = new WindowsPrincipal((WindowsIdentity)HttpContext.User.Identity).Identity.Name;

                Zaposlenici idzap = (from z in Db.Zaposlenici where z.ad == wp select z).FirstOrDefault();

                if (idzap == null)
                {
                    // Redirect("../../Shared/Error.aspx");
                    return(Error("Niste prijavljeni na sistem " + wp));
                }

                List <Rezervacije> rezervacije = (from r in Db.Rezervacije
                                                  where r.Status == 1 && r.id_zaposlenik == idzap.id_zaposlenici &&
                                                  r.datum_dolaska <= DateTime.Now
                                                  orderby r.datum_kreiranja descending
                                                  select r).ToList();
                if (wp.ToLower() == "hypo\\zeljkoc" ||
                    wp.ToLower() == "hypo\\nadad" ||
                    wp.ToLower() == "hypo\\damirs" ||
                    wp.ToLower() == "hypo\\dariom" ||
                    wp.ToLower() == "hypo\\igorp" ||
                    wp.ToLower() == "hypo\\igorj" ||
                    wp.ToLower() == "hypo\\suhretaz" ||
                    wp.ToLower() == "hypo\\sonjas" ||
                    wp.ToLower() == "hypo\\ilfadm" ||
                    wp.ToLower() == "hypo\\merisas" ||
                    wp.ToLower() == "hypo\\snjezanav"
                    )
                {
                    rezervacije = (from r in Db.Rezervacije
                                   where r.Status == 1 && r.datum_dolaska <= DateTime.Now
                                   orderby r.datum_kreiranja descending
                                   select r).ToList();
                }

                SrchObrada(searchString, sortOrder, currentFilter, ref datumOd, ref page, ref rezervacije);

                int pageNumber = (page ?? 1);
                return(View(rezervacije.ToPagedList(pageNumber, PageSize)));
            }
            catch (Exception ex)
            {
                return(Error(ex.ToString()));
            }
        }