Ejemplo n.º 1
0
        public ActionResult GetProductsByCategory(int categoryId)
        {
            CakesPosRepository    cpr      = new CakesPosRepository(_connectionString);
            IEnumerable <Product> products = cpr.GetProductsByCategory(categoryId);

            return(Json(products, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public ActionResult DeletePayments(int orderId)
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);

            cpr.DeletePaymentsById(orderId);
            return(null);
        }
Ejemplo n.º 3
0
        public ActionResult AddCategory(string categoryName)
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);

            cpr.AddCategory(categoryName);
            return(RedirectToAction("Admin"));
        }
Ejemplo n.º 4
0
        public ActionResult HistorySearch(string search, string opt, DateTime date, bool all)
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);
            IEnumerable <OrderHistoryViewModel> ordersHistory = cpr.SearchOrders(search, opt, date, all);

            return(Json(ordersHistory, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 5
0
        public ActionResult MakePayment(int customerId, int orderId, decimal amount, string note, string paymentMethod)
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);

            cpr.MakePayment(customerId, orderId, amount, note, paymentMethod);
            return(null);
        }
Ejemplo n.º 6
0
        public ActionResult OpenOrder(int orderId)
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);

            cpr.openOrder(orderId);
            return(null);
        }
Ejemplo n.º 7
0
        public ActionResult SaveEmail(int customerId, string email)
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);

            cpr.SaveEmail(customerId, email);
            return(null);
        }
Ejemplo n.º 8
0
        public ActionResult DeductFromAccount(int customerId, int orderId, decimal amount)
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);

            cpr.MakeAccountTrans(customerId, -amount, "Order #" + orderId + " Withdrawal");
            return(null);
        }
Ejemplo n.º 9
0
        public ActionResult MakeAccountTrans(int customerId, decimal amount, string note)
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);

            cpr.MakeAccountTrans(customerId, amount, note);
            return(null);
        }
Ejemplo n.º 10
0
        public ActionResult AddStatementPayment(int customerId, int statementId, decimal amount, string paymentNote)
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);

            cpr.AddStatementPayment(customerId, statementId, amount, paymentNote);
            return(null);
        }
Ejemplo n.º 11
0
        public ActionResult EditProduct(int?productId, int?categoryId, string productName, decimal?price, decimal?catererDiscount, int?restockAmount, HttpPostedFileBase image, bool?discontinued)
        {
            Product p = new Product();

            p.ProductName     = productName;
            p.Price           = (decimal)price;
            p.CatererDiscount = (decimal)catererDiscount;
            p.RestockAmount   = restockAmount;
            p.CategoryId      = (int)categoryId;
            if (image != null)
            {
                Guid g = Guid.NewGuid();
                image.SaveAs(Server.MapPath("~/Uploads/" + g + ".jpg"));
                p.Image = g + ".jpg";
            }
            else
            {
                p.Image = "";
            }
            p.Discontinued = discontinued;
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);

            cpr.EditProduct(p, (int)productId);
            return(RedirectToAction("Inventory"));
        }
Ejemplo n.º 12
0
        public ActionResult Search(string search)
        {
            CakesPosRepository     cpr       = new CakesPosRepository(_connectionString);
            IEnumerable <Customer> customers = cpr.SearchCustomers(search);

            return(Json(customers, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 13
0
        public ActionResult GetOpenStatements()
        {
            CakesPosRepository            cpr        = new CakesPosRepository(_connectionString);
            IEnumerable <StatementsModel> statements = cpr.GetAllOpenStatements();

            return(Json(statements, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 14
0
        public ActionResult AddOrderDetails(int orderId, int productId, decimal unitPrice, int quantity)
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);

            cpr.AddOrderDetails(orderId, productId, unitPrice, quantity);
            return(null);
        }
Ejemplo n.º 15
0
        public ActionResult GetCustomerById(int id)
        {
            CakesPosRepository cpr      = new CakesPosRepository(_connectionString);
            Customer           customer = cpr.GetCustomerById(id);

            return(Json(customer, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 16
0
        public ActionResult EditCustomer(int customerId, string firstName, string lastName, string address, string city, string state, string zip, string phone1, string phone2, string cell1, string cell2, bool caterer, string email)
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);

            cpr.EditCustomer(customerId, firstName, lastName, address, city, state, zip, phone1, phone2, cell1, cell2, caterer, email);
            return(null);
        }
Ejemplo n.º 17
0
        public ActionResult UpdateInventory(int id, int amount)
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);

            cpr.UpdateInventory(id, amount);
            return(null);
        }
Ejemplo n.º 18
0
        public ActionResult GetTotalByOrderId(int id, int customerId)
        {
            CakesPosRepository cpr   = new CakesPosRepository(_connectionString);
            decimal            total = cpr.GetTotalByOrderId(id, customerId);

            return(Json(total, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 19
0
        public ActionResult GetOrderHistory(int orderId, int customerId)
        {
            CakesPosRepository    cpr          = new CakesPosRepository(_connectionString);
            OrderDetailsViewModel orderHistory = cpr.GetOrderDetails(orderId, customerId);

            return(Json(orderHistory, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 20
0
        public ActionResult StatementDeductFromAccount(int customerId, int statementId, decimal amount, string note)
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);

            cpr.sDeductFromAccount(customerId, statementId, amount, note);
            return(null);
        }
Ejemplo n.º 21
0
        public ActionResult UpdateInvoicesPaid(int statementId)
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);

            cpr.UpdateInvoicesPaid(statementId);
            return(null);
        }
Ejemplo n.º 22
0
        public ActionResult UpdateStatus(int orderId, string status)
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);

            cpr.AddStatus(orderId, status);
            return(null);
        }
Ejemplo n.º 23
0
        public ActionResult AddOrder(int customerId, DateTime requiredDate, string deliveryOpt, string deliveryFirstName, string deliveryLastName, string deliveryAddress, string deliveryCity, string deliveryState, string deliveryZip, string phone1, string phone2, string cell1, string cell2, string creditCard, string expiration, string securityCode, string paymentMethod, decimal discount, string notes, string greetings, string deliveryNote, bool paid, decimal deliveryCharge)
        {
            DateTime           dateTime = DateTime.Now;
            CakesPosRepository cpr      = new CakesPosRepository(_connectionString);
            int orderId = cpr.AddOrder(customerId, dateTime, requiredDate, deliveryOpt, deliveryFirstName, deliveryLastName, deliveryAddress, deliveryCity, deliveryState, deliveryZip, phone1, phone2, cell1, cell2, creditCard, expiration, securityCode, paymentMethod, discount, notes, greetings, deliveryNote, paid, deliveryCharge);

            return(Json(orderId));
        }
Ejemplo n.º 24
0
        public ActionResult OrderHistory()
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);
            //IEnumerable<OrderHistoryViewModel> orders = cpr.GetOrders();
            IEnumerable <OrderHistoryViewModel> orders = cpr.SearchOrders("", "open", DateTime.Today.Date, false);

            return(View(orders));
        }
Ejemplo n.º 25
0
        public ActionResult GetProductAvailabilityByProductId(int productId)
        {
            DateTime           min = DateTime.Today.Date.AddMonths(-1);
            DateTime           max = DateTime.Today.Date.AddDays(7);
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);

            return(Json(cpr.GetProductAvailabilityByProductId(min, max, productId), JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 26
0
        public ActionResult Statements(DateTime min, DateTime max)
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);
            IEnumerable <OrderHistoryViewModel> orders = cpr.GetCatererOrdersByDate(min, max);

            orders = orders.OrderBy(o => o.lastName);
            return(Json(orders, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 27
0
        public ActionResult EmailInvoice(int customerId, int orderId)
        {
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);
            InvoiceManager     i   = new InvoiceManager();
            Customer           c   = cpr.GetCustomerById(customerId);

            i.EmailInvoice(@"C:\inetpub\sites\CakesPos\InvoicesPdf\" + orderId + ".pdf", c.Email);
            return(null);
        }
Ejemplo n.º 28
0
        public ActionResult CreateInvoice(int customerId, int orderId)
        {
            CakesPosRepository    cpr = new CakesPosRepository(_connectionString);
            OrderDetailsViewModel o   = cpr.GetOrderDetails(customerId, orderId);
            InvoiceManager        i   = new InvoiceManager();

            i.CreateInvoicePDF(o);
            return(null);
        }
Ejemplo n.º 29
0
        public ActionResult CreateInvoiceOtherEmail(int customerId, int orderId, string email)
        {
            CakesPosRepository    cpr = new CakesPosRepository(_connectionString);
            OrderDetailsViewModel o   = cpr.GetOrderDetails(customerId, orderId);
            InvoiceManager        i   = new InvoiceManager();

            i.CreateInvoicePDF(o);
            i.EmailInvoice(@"C:\inetpub\sites\CakesPos\InvoicesPdf\" + orderId + ".pdf", email);
            return(null);
        }
Ejemplo n.º 30
0
        public ActionResult Statements()
        {
            //DateTime min = DateTime.Now.AddMonths(-1).Date;
            //DateTime max = DateTime.Now.Date;
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);
            IEnumerable <OrderHistoryViewModel> orders = cpr.GetCatererOrdersForStatements();

            orders = orders.OrderBy(o => o.lastName);
            return(View(orders));
        }