Example #1
0
        public ActionResult Details(int OrderNumber)
        {
            #region Prep Utilities

            myHandler = new BusinessLogicHandler();
            OrderLineModel model = new OrderLineModel();

            #endregion

            #region Get Order Details

            model.OrderLineDetails = myHandler.GetOrderItemsList(OrderNumber);
            model.OrderDetails = myHandler.GetOrder(OrderNumber);
            model.SupplierDetails = myHandler.GetSupplier(model.OrderDetails.SupplierID);

            #endregion

            #region Get Order Total
            model.totally = 0;
            foreach(var item in model.OrderLineDetails)
            {
                if(myHandler.CheckProductType(item.ProductID))
                {
                    Book myBook = new Book();
                    myBook = myHandler.GetBook(item.ProductID);
                    model.totally += (myBook.SellingPrice*item.Quantity);
                }
                else
                {
                    Technology device = new Technology();
                    device = myHandler.GetTechnologyDetails(item.ProductID);
                    model.totally += (device.SellingPrice * item.Quantity);
                }
            }
            #endregion

            return PartialView(model);
        }
Example #2
0
        public ActionResult Search(FormCollection collector)
        {
            #region Prep Utilities

            string Query = collector.GetValue("query").AttemptedValue;
            myHandler = new BusinessLogicHandler();
            Supplier supplier = new Supplier();
            InvoiceModel model = new InvoiceModel();

            #endregion

            #region Get User(Supplier)

            string userName = User.Identity.GetUserName();
            ApplicationDbContext dataSocket = new ApplicationDbContext();
            UserStore<ApplicationUser> myStore = new UserStore<ApplicationUser>(dataSocket);
            _userManager = new ApplicationUserManager(myStore);
            var user = _userManager.FindByEmail(userName);

            #endregion

            #region Get Supplier Details

            supplier = myHandler.GetSupplier(user.Id);

            #endregion


            #region Get the data

            model.Order = new Order();
            model.Invoice = new Invoice();
            try
            {
                model.Order = myHandler.GetOrder(Convert.ToInt32(Query));
            }
            catch
            { model.Order = null; }
            try
            {
                model.Invoice = myHandler.GetInvoice(Convert.ToInt32(Query));
            }
            catch
            { model.Invoice = null; }
            ///get product
            #endregion


            return View(model);
        }