public void InsertCustomerInformation(CustomerInfo info)
        {
            db_1525596_co5027Entities db = new db_1525596_co5027Entities();

            db.CustomerInfoes.Add(info);
            db.SaveChanges();
        }
Exemplo n.º 2
0
        public void UpdateQuantity(int id, int quantity)
        {
            db_1525596_co5027Entities db = new db_1525596_co5027Entities();
            BootCart cart = db.BootCarts.Find(id);

            cart.Price = quantity;

            db.SaveChanges();
        }
        public CustomerInfo GetCustomerInformation(string guId)
        {
            db_1525596_co5027Entities db = new db_1525596_co5027Entities();
            CustomerInfo info            = (from x in db.CustomerInfoes
                                            where x.GUID == guId
                                            select x).FirstOrDefault();

            return(info);
        }
Exemplo n.º 4
0
        public List <BootCart> GetOrdersInCart(string userId)
        {
            db_1525596_co5027Entities db     = new db_1525596_co5027Entities();
            List <BootCart>           orders = (from x in db.BootCarts
                                                where x.CustomerID == userId &&
                                                x.InsideCart
                                                orderby x.DateBought
                                                select x).ToList();

            return(orders);
        }
Exemplo n.º 5
0
 public BootProduct GetProducts(int id)
 {
     try
     {
         using (db_1525596_co5027Entities db = new db_1525596_co5027Entities())
         {
             BootProduct product = db.BootProducts.Find(id);
             return(product);
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemplo n.º 6
0
        public string InsertProduct(BootProduct product)
        {
            try
            {
                db_1525596_co5027Entities db = new db_1525596_co5027Entities();
                db.BootProducts.Add(product);
                db.SaveChanges();

                return(product.ShoeName + " Inserted Successfull");
            }
            catch (Exception e)
            {
                return("Error:" + e);
            }
        }
Exemplo n.º 7
0
        public void MarkBootsAsPaid(List <BootCart> carts)
        {
            db_1525596_co5027Entities db = new db_1525596_co5027Entities();

            if (carts != null)
            {
                foreach (BootCart cart in carts)
                {
                    BootCart PreviousCart = db.BootCarts.Find(cart.ID);
                    PreviousCart.DateBought = DateTime.Now;
                    PreviousCart.InsideCart = false;
                }
                db.SaveChanges();
            }
        }
Exemplo n.º 8
0
        public string InsertCart(BootCart cart)
        {
            try
            {
                db_1525596_co5027Entities db = new db_1525596_co5027Entities();
                db.BootCarts.Add(cart);
                db.SaveChanges();

                return(cart.DateBought + " Inserted Successfull");
            }
            catch (Exception e)
            {
                return("Error:" + e);
            }
        }
Exemplo n.º 9
0
 public List <BootProduct> RetrieveAllProduct()
 {
     try
     {
         using (db_1525596_co5027Entities db = new db_1525596_co5027Entities())
         {
             List <BootProduct> product = (from x in db.BootProducts
                                           select x).ToList();
             return(product);
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemplo n.º 10
0
 public int GetTotalOfOrders(string userId)
 {
     try
     {
         db_1525596_co5027Entities db = new db_1525596_co5027Entities();
         int amount = (from x in db.BootCarts
                       where x.CustomerID == userId &&
                       x.InsideCart
                       select x.Price).Sum();
         return(amount);
     }
     catch
     {
         return(0);
     }
 }
Exemplo n.º 11
0
 public List <BootProduct> SortProductByType(int shoetype)
 {
     try
     {
         using (db_1525596_co5027Entities db = new db_1525596_co5027Entities())
         {
             List <BootProduct> product = (from x in db.BootProducts
                                           where x.ShoeType == shoetype
                                           select x).ToList();
             return(product);
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemplo n.º 12
0
        public string DeleteProduct(int id)
        {
            try
            {
                db_1525596_co5027Entities db = new db_1525596_co5027Entities();
                BootProduct product          = db.BootProducts.Find(id);

                db.BootProducts.Attach(product);
                db.BootProducts.Remove(product);
                db.SaveChanges();

                return(product.ShoeName + "Deleted Successfull");
            }
            catch (Exception e)
            {
                return("Error:" + e);
            }
        }
Exemplo n.º 13
0
        public string DeleteCart(int id)
        {
            try
            {
                db_1525596_co5027Entities db = new db_1525596_co5027Entities();
                BootCart cart = db.BootCarts.Find(id);

                db.BootCarts.Attach(cart);
                db.BootCarts.Remove(cart);
                db.SaveChanges();

                return(cart.DateBought + "Deleted Successfull");
            }
            catch (Exception e)
            {
                return("Error:" + e);
            }
        }
Exemplo n.º 14
0
        public string UpdateProductType(int id, BootType bootType)
        {
            try
            {
                db_1525596_co5027Entities db = new db_1525596_co5027Entities();
                //get the info from the db
                BootType p = db.BootTypes.Find(id);

                p.ShoeName = bootType.ShoeName;

                db.SaveChanges();
                return(bootType.ShoeName + " Updated Successfull");
            }
            catch (Exception e)
            {
                return("Error:" + e);
            }
        }
Exemplo n.º 15
0
        public string UpdateProduct(int id, BootProduct product)
        {
            try
            {
                db_1525596_co5027Entities db = new db_1525596_co5027Entities();
                //get the info from the db
                BootProduct p = db.BootProducts.Find(id);

                p.ShoeName    = product.ShoeName;
                p.Price       = product.Price;
                p.ShoeType    = product.ShoeType;
                p.Description = product.Description;
                p.Image       = product.Image;

                db.SaveChanges();
                return(product.ShoeName + " Updated Successfull");
            }
            catch (Exception e)
            {
                return("Error:" + e);
            }
        }
Exemplo n.º 16
0
        public string UpdateCart(int id, BootCart cart)
        {
            try
            {
                db_1525596_co5027Entities db = new db_1525596_co5027Entities();
                //get the info from the db
                BootCart p = db.BootCarts.Find(id);

                p.DateBought = cart.DateBought;
                p.CustomerID = cart.CustomerID;
                p.Price      = cart.Price;
                p.InsideCart = cart.InsideCart;
                p.ProductID  = cart.ProductID;

                db.SaveChanges();
                return(cart.DateBought + " Updated Successfull");
            }
            catch (Exception e)
            {
                return("Error:" + e);
            }
        }