Esempio n. 1
0
 public bool addOffer(Offer model)
 {
     AdminDal obj = new AdminDal();
     if (obj.AddOffer(model))
         return true;
     return false;
 }
Esempio n. 2
0
 public List<AddApparel> GetApparelsByBrandAndName(string name, string brand)
 {
     AdminDal obj = new AdminDal();
     List<AddApparel> result = new List<AddApparel>();
     result = obj.GetApparelsByBrandAndName(name, brand);
     return result;
 }
Esempio n. 3
0
        public List<Apparel> fetchProductByCategory(string category)
        {
            string cat = UtilityFunctions.parseInputCategoryToDBFormat(category);
            AdminDal obj = new AdminDal();

            List<Apparel> result = new List<Apparel>();
            result = obj.GetProductByCategory(cat);
            return result;
        }
Esempio n. 4
0
 public List<DropDownFormat> GetApparelNameByBrand(string brand)
 {
     AdminDal obj = new AdminDal();
     List<string> result = new List<string>();
     List<DropDownFormat> res = new List<DropDownFormat>();
     result = obj.GetApparelNameByBrand(brand.Trim());
     foreach (var item in result)
     {
         res.Add(new DropDownFormat(){ name=item, value=item });
     }
     return res;
 }
Esempio n. 5
0
        public bool addApparel(AddApparel model, out string AppID)
        {
            AdminDal obj = new AdminDal();
            model.apparel.ApparelCategory = UtilityFunctions.parseInputCategoryToDBFormat(model.apparel.ApparelCategory);
            model.apparel.ApparelImage = "/"+AdminController.ImagePath;
            string fullPath = HttpContext.Current.Server.MapPath("~/") + AdminController.ImagePath;
            if (model.apparel.ApparelImage == null)
                model.apparel.ApparelImage = string.Empty;
            if (obj.AddProduct(model, out AppID))
            {
                System.IO.File.Move( fullPath+"TempImage.jpg", fullPath + AppID + ".jpg");
                return true;
            }

            return false;
        }
Esempio n. 6
0
        public List<CartItem> getUserCart(string UserID)
        {
            bool status = false;
            HttpContext.Current.Session["status"] = "DefaultMessage";
            string conStr = ConfigurationManager.ConnectionStrings["FashionableMeDB"].ConnectionString;
            SqlConnection conn = new SqlConnection(conStr);
            List<CartItem> cartItems = new List<CartItem>();
            try
            {
                conn.Open();

                SqlCommand cmd = new SqlCommand("SELECT * FROM SavedCart WHERE UserID=@UserID", conn);
                cmd.Parameters.AddWithValue("UserID", UserID.Trim());
                var reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        CartItem cartItem = new CartItem();

                        string apparelID = reader.GetString(reader.GetOrdinal("ApparelID"));
                        string apparelSize = reader.GetString(reader.GetOrdinal("ApparelSize"));
                        string offerID = reader.GetString(reader.GetOrdinal("OfferID"));
                        int quantity = reader.GetInt32(reader.GetOrdinal("Quantity"));
                        cartItem.OfferID = offerID;
                        cartItem.Apparel.ApparelSize = apparelSize;
                        cartItem.Apparel.ApparelID = Convert.ToInt32(apparelID);

                        CustomerDal custDal = new CustomerDal();
                        Quantity quantityDetails = custDal.GetQuantityDetailForApparel(Convert.ToInt32(apparelID), apparelSize);

                        int availableQuantity = (quantityDetails.ApparelQuantity >= quantity) ? quantity : quantityDetails.ApparelQuantity;
                        if(availableQuantity!=quantity)
                            HttpContext.Current.Session["cartUpdated"] = "true";

                        if(availableQuantity >0 )
                        {
                            cartItem.Quantity = availableQuantity;
                            Apparel apparel = new Apparel();
                            apparel = custDal.GetApparelByID(Convert.ToInt32(apparelID))[0];

                            cartItem.Apparel.ApparelName = apparel.ApparelName;
                            cartItem.Apparel.ApparelCost = quantityDetails.ApparelCost;
                            cartItem.Apparel.ApparelDiscount = quantityDetails.ApparelDiscount;
                            if(!(offerID.Trim().Equals("NOOFF")))
                            {
                                AdminDal adminDal = new AdminDal();
                                Offer offer = new Offer();
                                offer = adminDal.GetOfferDateAndDiscountByID(offerID);
                                if(System.DateTime.Equals(offer.OfferDate, DateTime.Now.Date))
                                    cartItem.Apparel.ApparelDiscount += offer.Discount;
                            }
                            cartItems.Add(cartItem);
                        }

                    }

                }
                conn.Close();
                conn.Open();
                SqlCommand cmd2 = new SqlCommand("DELETE FROM SavedCart WHERE UserID=@UserID", conn);
                cmd2.Parameters.AddWithValue("UserID", UserID.Trim());
                var reader2 = cmd2.ExecuteNonQuery();

            }
            catch (Exception exc)
            {
                HttpContext.Current.Session["ErrorMessage"] = exc.Message;
            }
            conn.Close();
            return cartItems;
        }
Esempio n. 7
0
 public List<DropDownFormat> GetBrandNames()
 {
     AdminDal obj = new AdminDal();
     List<string> result = new List<string>();
     List<DropDownFormat> res = new List<DropDownFormat>();
     result = obj.GetBrandNames();
     foreach (var item in result)
     {
         res.Add(new DropDownFormat(){ name=item, value=item });
     }
     return res;
 }
Esempio n. 8
0
 public Offer fetchOfferByDate(string dateToProcess)
 {
     AdminDal obj = new AdminDal();
     string dateFormatted = UtilityFunctions.parseInputDateToDBFormat(dateToProcess);
     return obj.GetOfferDetails(dateFormatted);
 }
Esempio n. 9
0
 public bool DeleteOffer(string offerDate)
 {
     AdminDal obj = new AdminDal();
     return obj.DeleteOfferByDate(UtilityFunctions.parseInputDateToDBFormat(offerDate));
 }
Esempio n. 10
0
 public bool UpdateOffer(string offerDate, string offerName, string offerDescription, string offerDiscount)
 {
     AdminDal obj = new AdminDal();
     return obj.UpdateOfferByDate(UtilityFunctions.parseInputDateToDBFormat(offerDate), offerName, offerDescription, offerDiscount);
 }
Esempio n. 11
0
 public bool UpdateApparel(string apparelID, string cost, string discount, string quantity, string category, string size)
 {
     AdminDal obj = new AdminDal();
     return obj.UpdateApparel(Convert.ToInt32(apparelID), Convert.ToDecimal(cost), Convert.ToDecimal(discount), Convert.ToInt32(quantity), category, size);
 }