/// <summary>
        /// Report No.2 for contracts that are no longer active
        /// </summary>
        /// <returns>sends inactiveOwners list to View</returns>
        public ActionResult InactiveOwners()
        {
            PrinterTonerContext db = new PrinterTonerContext();

            var inactiveOwners = from i in db.Contracts select i;
            var Today          = DateTime.Now.Date; //.Date is not suported by LINQ

            inactiveOwners = inactiveOwners.Where(a => DbFunctions.AddMonths(a.ContractDate, a.ContactDuration) < Today);

            return(View(inactiveOwners.ToList()));
        }
示例#2
0
        public ActionResult SalesReportByOwner(string searchByOwner)
        {
            PrinterTonerContext db = new PrinterTonerContext();
            var sales = db.Sales.Where(s => s.Printer.Owner.OwnerName == "EPC DOO").OrderBy(s => s.Contract.Owner.OwnerName).ThenBy(s => s.Contract.ContractName);

            if (!string.IsNullOrEmpty(searchByOwner))
            {
                sales = sales.Where(s => s.Contract.Owner.OwnerName.Contains(searchByOwner)).OrderBy(s => s.Contract.Owner.OwnerName).ThenBy(s => s.Contract.ContractName);// && s.printer.isepcprinter==true);
            }

            return(View(sales.ToList()));
        }
示例#3
0
        public ActionResult Index(string searchByOwner)
        {
            PrinterTonerContext db = new PrinterTonerContext();
            var owners             = from o in db.Owners
                                     orderby o.OwnerName
                                     select o;

            if (!String.IsNullOrEmpty(searchByOwner))
            {
                owners = owners.Where(o => o.OwnerName.Contains(searchByOwner)).OrderBy(o => o.OwnerName);
            }
            return(View(owners.ToList()));
        }
示例#4
0
        public ActionResult Index()
        {
            //Izračunava ukupan broj EPC štampača na iznajmljivanju
            PrinterTonerContext db = new PrinterTonerContext();
            var sales = from s in db.Sales
                        where s.Printer.Owner.OwnerName == "EPC DOO"
                        select s;
            var CountRentedPrinters = sales.Count();

            ViewData["CountRentedPrinters"] = CountRentedPrinters;

            //list of opened todoes (without closing date), shown on top of the HomeIndexView
            var openedTasks = db.ToDoes.Include(t => t.User).Where(c => c.Closed == null).OrderBy(c => c.Created).ToList();

            return(View(openedTasks));
        }