示例#1
0
 //public static BrandModel GetById(int id)
 //{
 //    var context = new Ecommerce.DbEntity.ecommerceEntities();
 //    var Brand = context.brands.Where(m => m.id == id).FirstOrDefault();
 //    var Brandobj = new BrandModel();
 //    Brandobj.id = Brand.id;
 //    Brandobj.BrandName = Brand.BrandName;
 //    return Brandobj;
 //}
 public static bool Delete(int id)
 {
     bool check = true;
     try
     {
         var context = new Ecommerce.DbEntity.ecommerceEntities();
         var cat = context.brands.Where(m => m.id == id).FirstOrDefault();
         var products = context.products.Where(m => m.brandid == id).ToList();
         foreach (var x in products)
         {
             check = ProductDal.Delete(x.id);
             if (check == false)
             {
                 break;
             }
         }
         if (check)
         {
             context.brands.Remove(cat);
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         check = false;
     }
     return check;
 }
示例#2
0
 public static bool Create(adminUser obj)
 {
     bool check = true;
     try
     {
         var context = new Ecommerce.DbEntity.ecommerceEntities();
         context.users.Add(new DbEntity.user
         {
             Address1 = obj.Address1,
             Address2 = obj.Address2,
             City = obj.City,
             ContactNumber = obj.ContactNumber,
             Country = obj.Country,
             DAddress1 = obj.DAddress1,
             DAddress2 = obj.DAddress2,
             DCity = obj.DCity,
             DCountry = obj.DCountry,
             DName = obj.DName,
             DPostCode = obj.DPostCode,
             DState = obj.DState,
             Email = obj.Email,
             Name = obj.Name,
             Password = obj.Password,
             PostCode = obj.PostCode,
             State = obj.State,
             Isadmin = obj.Isadmin
         });
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         check = false;
     }
     return check;
 }
示例#3
0
 public static bool Create(DeliveryModel obj)
 {
     bool check = true;
     try
     {
         var context = new Ecommerce.DbEntity.ecommerceEntities();
         context.deliverycharges.Add(new DbEntity.deliverycharge
         {
             deliveryAngola = obj.deliveryAngola,
             deliveryDoller = obj.deliveryDoller,
             deliveryEuro = obj.deliveryEuro,
             deliveryGhana = obj.deliveryGhana,
             deliveryNigria = obj.deliveryNigria,
             deliveryPound = obj.deliveryPound,
             freeDeliveryAmountDoller = obj.freeDeliveryAmountDoller,
             freeDeliveryAmountPound = obj.freeDeliveryAmountPound,
             freeDeliveryAmountEuro = obj.freeDeliveryAmountEuro,
             freeDeliveryAmountNigria = obj.freeDeliveryAmountNigria,
             freeDeliveryAmountAngola = obj.freeDeliveryAmountAngola,
             freeDeliveryAmountGhana = obj.freeDeliveryAmountGhana,
             Active=obj.Active,
             Default=obj.Default,
            DeliveryDays=obj.DeliveryDays,
         });
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         check = false;
     }
     return check;
 }
示例#4
0
 public static bool Create(ExtendedCategory obj)
 {
     bool check = true;
     try
     {
         var context = new Ecommerce.DbEntity.ecommerceEntities();
         context.categories.Add(new DbEntity.category {Code=obj.name.Replace(" ","-"),discription=obj.discription,name=obj.name });
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         check = false;
     }
     return check;
 }
示例#5
0
 public static bool Create(ColorModel obj)
 {
     bool check = true;
     try
     {
         var context = new Ecommerce.DbEntity.ecommerceEntities();
         context.colors.Add(new DbEntity.color { name = obj.name });
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         check = false;
     }
     return check;
 }
示例#6
0
 public static bool Create(BrandModel obj)
 {
     bool check = true;
     try
     {
         var context = new Ecommerce.DbEntity.ecommerceEntities();
         context.brands.Add(new DbEntity.brand { BrandName = obj.BrandName});
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         check = false;
     }
     return check;
 }
示例#7
0
 public static bool Create(LengthModel obj)
 {
     bool check = true;
     try
     {
         var context = new Ecommerce.DbEntity.ecommerceEntities();
         context.lengths.Add(new DbEntity.length { value = obj.value + " " + "inch" });
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         check = false;
     }
     return check;
 }
示例#8
0
 public static bool Create(CoupanModel obj)
 {
     bool check = true;
     try
     {
         var context = new Ecommerce.DbEntity.ecommerceEntities();
         context.coupans.Add(new DbEntity.coupan { code = obj.code, discountpercentage = ((decimal)obj.DiscountPercentage), fromDate = obj.fromDate, toDate = obj.toDate });
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         check = false;
     }
     return check;
 }
示例#9
0
 public static bool Update(ImagesModel obj)
 {
     bool check = true;
     try
     {
         var context = new Ecommerce.DbEntity.ecommerceEntities();
         var image = context.images.Where(m => m.id == obj.id).FirstOrDefault();
         image.image1 = obj.image;
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         check = false;
     }
     return check;
 }
示例#10
0
 public static bool Delete(int id)
 {
     bool check = true;
     try
     {
         var context = new Ecommerce.DbEntity.ecommerceEntities();
         var cat = context.users.Where(m => m.id == id).FirstOrDefault();
         context.users.Remove(cat);
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         check = false;
     }
     return check;
 }
示例#11
0
        public static bool Create(ProductModel obj)
        {
            bool check = true;
            try
            {
                var context = new Ecommerce.DbEntity.ecommerceEntities();
                var newProduct = new DbEntity.product();
                newProduct.brandid = obj.BrandId;
                newProduct.catid = obj.CatId;
                newProduct.discription = obj.Discription;
                newProduct.image = obj.Image;
                newProduct.name = obj.Name;
                //newProduct.productCode = +obj.Name.Replace(" ", "-");
                newProduct.keyWord = obj.KeyWord;
                newProduct.isHot = obj.Ishot;

                context.products.Add(newProduct);
                context.SaveChanges();
                foreach (var x in obj.ColorList)
                {

                    var productPricing = new ProductPriceModel();
                    productPricing.ProductId = newProduct.id;
                    productPricing.lengthId = x.LengthId;
                    productPricing.colorId = x.id;
                    productPricing.ourpriceangola = x.ourpriceangola;
                    productPricing.OurPriceDollar = x.OurPriceDollar;
                    productPricing.OurPriceEuro = x.OurPriceEuro;
                    productPricing.ourpriceghana = x.ourpriceghana;
                    productPricing.ourpricenigeria = x.ourpricenigeria;
                    productPricing.OurPricePound = x.OurPricePound;
                    productPricing.priceangola = x.priceangola;
                    productPricing.PriceDollar = x.PriceDollar;
                    productPricing.PriceEuro = x.PriceEuro;
                    productPricing.priceghana = x.priceghana;
                    productPricing.pricenigeria = x.pricenigeria;
                    productPricing.PricePound = x.PricePound;
                    check = ProductPricingDal.Create(productPricing);

                }
            }
            catch (Exception ex)
            {
                check = false;
            }
            return check;
        }
 public static bool DeleteAllForProduct(int ProductId)
 {
     bool check = true;
     try
     {
         var context = new Ecommerce.DbEntity.ecommerceEntities();
         var ProductPrices = context.productpricings.Where(m => m.productid == ProductId).ToList();
         foreach (var ProductPrice in ProductPrices)
         {
             context.productpricings.Remove(ProductPrice);
         }
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         check = false;
     }
     return check;
 }
示例#13
0
 public static bool Update(CoupanModel obj)
 {
     bool check = true;
     try
     {
         var context = new Ecommerce.DbEntity.ecommerceEntities();
         var Coupan = context.coupans.Where(m => m.id == obj.id).FirstOrDefault();
         Coupan.code = obj.code;
         Coupan.fromDate = Convert.ToDateTime(obj.fromDate);
         Coupan.toDate = Convert.ToDateTime(obj.toDate);
         Coupan.discountpercentage = Convert.ToDecimal(obj.DiscountPercentage);
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         check = false;
     }
     return check;
 }
示例#14
0
 public static bool Delete(int ProductId)
 {
     bool check = true;
     try
     {
         var context = new Ecommerce.DbEntity.ecommerceEntities();
         check = ProductPricingDal.DeleteAllForProduct(ProductId);
         if (check)
         {
             var Product = context.products.Where(m => m.id == ProductId).FirstOrDefault();
             context.products.Remove(Product);
             context.SaveChanges();
         }
     }
     catch
     {
         check = false;
     }
     return check;
 }
示例#15
0
        public static bool Create(SignupModel obj, out int  userid)
        {
            bool check = true;
            try
            {
                var context = new Ecommerce.DbEntity.ecommerceEntities();

                var user =new DbEntity.user();

                    user.Address1 = obj.Address1;
                    user.Address2 = obj.Address2;
                    user.City = obj.City;
                    user.ContactNumber = obj.ContactNumber;
                   user. Country = obj.Country;
                   user. DAddress1 = obj.DAddress1;
                   user. DAddress2 = obj.DAddress2;
                   user. DCity = obj.DCity;
                   user. DCountry = obj.DCountry;
                  user.  DName = obj.DName;
                   user. DPostCode = obj.DPostCode;
                  user.  DState = obj.DState;
                  user.  Email = obj.Email;
                  user.  Name = obj.Name;
                  user.  Password = obj.Password;
                  user.  PostCode = obj.PostCode;
                  user.  State = obj.State;
                  user.  Isadmin=obj.Isadmin;
               context.users.Add(user);
                context.SaveChanges();
                userid = user.id;
            }
            catch (Exception ex)
            {
                userid = 0;
                check = false;
            }
            return check;
        }
示例#16
0
 public static bool Create(OrderDetail obj)
 {
     bool check = true;
     try
     {
         var context = new Ecommerce.DbEntity.ecommerceEntities();
         context.orderdetails.Add(new DbEntity.orderdetail
         {
             ActualPriceInUserSeletedCurrency = obj.ActualPriceInUserSeletedCurrency,
             OrderId = obj.OrderId,
             PricePaidInConvertedCurrency = obj.PricePaidInConvertedCurrency,
             ProductPriceId = obj.ProductPriceId,
             Quantity = obj.Quantity,
             ProductName = obj.ProductName
         });
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         check = false;
     }
     return check;
 }
示例#17
0
        public static bool Create(ReviewModel obj)
        {
            bool check = true;
            try
            {
                var context = new Ecommerce.DbEntity.ecommerceEntities();
                context.reviews.Add(new DbEntity.review {
                active=false,
                email=obj.Email,
                message=obj.Message,
                name=obj.Name,
                rating=obj.Rating,
                productid=obj.ProductId,
                });
                context.SaveChanges();
            }

            catch (Exception ex)
            {
                check = false;
            }
            return check;
        }
        public static bool Create(ProductPriceModel obj)
        {
            bool check = true;
            try
            {
                var context = new Ecommerce.DbEntity.ecommerceEntities();

                context.productpricings.Add(
                    new DbEntity.productpricing
                    {
                        ourpriceangola = obj.ourpriceangola,
                        ourpriceDollar = obj.OurPriceDollar,
                        ourpriceeuro = obj.OurPriceEuro,
                        ourpriceghana = obj.ourpriceghana,
                        ourpricenigeria = obj.ourpricenigeria,
                        ourpricepound = obj.OurPricePound,
                        priceangola = obj.priceangola,
                        priceDollar = obj.PriceDollar,
                        priceeuro = obj.PriceEuro,
                        priceghana = obj.priceghana,
                        pricenigeria = obj.pricenigeria,
                        pricepound = obj.PricePound,
                        productid = obj.ProductId,
                        lengthId = obj.lengthId,
                        colorId = obj.colorId

                    });

                context.SaveChanges();

            }
            catch (Exception ex)
            {
                check = false;
            }
            return check;
        }
示例#19
0
 public static bool Update(LengthModel obj)
 {
     bool check = true;
     try
     {
         var context = new Ecommerce.DbEntity.ecommerceEntities();
         var length = context.lengths.Where(m => m.id == obj.id).FirstOrDefault();
         length.value = obj.value+" "+"inch";
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         check = false;
     }
     return check;
 }
示例#20
0
 public static bool Update(BrandModel obj)
 {
     bool check = true;
     try
     {
         var context = new Ecommerce.DbEntity.ecommerceEntities();
         var Brand = context.brands.Where(m => m.id == obj.id).FirstOrDefault();
         Brand.BrandName = obj.BrandName;
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         check = false;
     }
     return check;
 }
示例#21
0
        public static bool RegisterUser(LoginModel loginobj)
        {
            bool check = true;
            try
            {
                var context = new Ecommerce.DbEntity.ecommerceEntities();
                context.users.Add(new DbEntity.user
               {
                 Name=loginobj.FirstName+" "+loginobj.LastName,
                 Password = loginobj.Password,
                 Email = loginobj.RegistrationEmail,

                 Address1 = "",
                    Address2 ="",
                    City = "",
                    ContactNumber = "",
                    Country = "",
                    DAddress1 = "",
                    DAddress2 = "",
                    DCity ="",
                    DCountry = "",
                    DName = "",
                    DPostCode = "",
                    DState = "",

                    PostCode = "",
                    State = "",
                    Isadmin=false
               });
                if (loginobj.SubscribeForNewLetter)
                {
                    context.newletters.Add(new DbEntity.newletter {
                        email = loginobj.RegistrationEmail
                    });
                }
                context.SaveChanges();
            }
            catch (Exception ex)
            {
                check = false;
            }
            return check;
        }
        public static bool Update(ProductPriceModel obj)
        {
            bool check = true;
            try
            {
                var context = new Ecommerce.DbEntity.ecommerceEntities();
                var cat = context.productpricings.Where(m => m.id == obj.Id).FirstOrDefault();
                cat.ourpriceangola = obj.ourpriceangola;
                cat.ourpriceDollar = obj.OurPriceDollar;
                cat.ourpriceeuro = obj.OurPriceEuro;
                cat.ourpriceghana = obj.ourpriceghana;
                cat.ourpricenigeria = obj.ourpricenigeria;
                cat.ourpricepound = obj.OurPricePound;
                cat.priceangola = obj.priceangola;
                cat.priceDollar = obj.PriceDollar;
                cat.priceeuro = obj.PriceEuro;
                cat.priceghana = obj.priceghana;
                cat.pricenigeria = obj.pricenigeria;
                cat.pricepound = obj.PricePound;
                context.SaveChanges();

            }
            catch (Exception ex)
            {
                check = false;
            }
            return check;
        }
示例#23
0
 public static bool Update(ExtendedCategory obj)
 {
     bool check = true;
     try
     {
         var context = new Ecommerce.DbEntity.ecommerceEntities();
         var cat = context.categories.Where(m => m.id == obj.id).FirstOrDefault();
         cat.Code = obj.name.Replace(" ", "-");
         cat.discription = obj.discription;
         cat.name = obj.name;
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         check = false;
     }
     return check;
 }
示例#24
0
 public static bool Update(DeliveryModel obj)
 {
     bool check = true;
     try
     {
         var context = new Ecommerce.DbEntity.ecommerceEntities();
         var delivery = context.deliverycharges.Where(m => m.id == obj.id).FirstOrDefault();
         delivery.deliveryAngola = obj.deliveryAngola;
         delivery.deliveryDoller = obj.deliveryDoller;
         delivery.deliveryEuro = obj.deliveryEuro;
         delivery.deliveryGhana = obj.deliveryGhana;
         delivery.deliveryNigria = obj.deliveryNigria;
         delivery.deliveryPound = obj.deliveryPound;
         delivery.freeDeliveryAmountDoller = obj.freeDeliveryAmountDoller;
         delivery.freeDeliveryAmountPound = obj.freeDeliveryAmountPound;
         delivery.freeDeliveryAmountEuro = obj.freeDeliveryAmountEuro;
         delivery.freeDeliveryAmountNigria = obj.freeDeliveryAmountNigria;
         delivery.freeDeliveryAmountAngola = obj.freeDeliveryAmountAngola;
         delivery.freeDeliveryAmountGhana = obj.freeDeliveryAmountGhana;
         delivery.Active=obj.Active;
             delivery.Default=obj.Default;
             delivery.DeliveryDays = obj.DeliveryDays;
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         check = false;
     }
     return check;
 }
示例#25
0
        public static void EmptyDataBase()
        {
            List<ProductModel> Obj = new List<ProductModel>();
            var context = new Ecommerce.DbEntity.ecommerceEntities();
            var products = context.products.ToList();
            foreach (var x in products)
            {
                context.products.Remove(x);
            }
            context.SaveChanges();

            //var productPrices = context.productpricings.ToList();
            //foreach (var x in productPrices)
            //{
            //    context.productpricings.Remove(x);
            //}
            //context.SaveChanges();

            //var OrderDetail = context.orderdetails.ToList();
            //foreach (var x in OrderDetail)
            //{
            //    context.orderdetails.Remove(x);
            //}
            //context.SaveChanges();

            var OrderHeader = context.orderheaders.ToList();
            foreach (var x in OrderHeader)
            {
                context.orderheaders.Remove(x);
            }
            context.SaveChanges();
        }
示例#26
0
 public static bool Update(adminUser obj)
 {
     bool check = true;
     try
     {
         var context = new Ecommerce.DbEntity.ecommerceEntities();
         var User = context.users.Where(m => m.id == obj.id).FirstOrDefault();
         User.Address1 = obj.Address1;
         User.Address2 = obj.Address2;
         User.City = obj.City;
         User.ContactNumber = obj.ContactNumber;
         User.Country = obj.Country;
         User.DAddress1 = obj.DAddress1;
         User.DAddress2 = obj.DAddress2;
         User.DCity = obj.DCity;
         User.DCountry = obj.DCountry;
         User.DName = obj.DName;
         User.DPostCode = obj.DPostCode;
         User.DState = obj.DState;
         User.Email = obj.Email;
         User.Name = obj.Name;
         User.Password = obj.Password;
         User.PostCode = obj.PostCode;
         User.State = obj.State;
         User.Isadmin = obj.Isadmin;
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         check = false;
     }
     return check;
 }
示例#27
0
 public static bool Update(ReviewModel obj)
 {
     bool check = true;
     try
     {
         var context = new Ecommerce.DbEntity.ecommerceEntities();
         var Review = context.reviews.Where(m => m.id == obj.id).FirstOrDefault();
         Review.active=obj.active;
         Review.email=obj.Email;
         Review.message=obj.Message;
         Review.name=obj.Name;
         Review.rating = obj.Rating;
         Review.productid = obj.ProductId;
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         check = false;
     }
     return check;
 }
示例#28
0
        public static bool Update(ProductModel obj)
        {
            bool check = true;
            try
            {
                var context = new Ecommerce.DbEntity.ecommerceEntities();
                var Product = context.products.Where(m => m.id == obj.Id).FirstOrDefault();
                Product.brandid = obj.BrandId;
                Product.catid = obj.CatId;
                Product.discription = obj.Discription;
                Product.image = obj.Image;
                Product.name = obj.Name;
                Product.keyWord = obj.KeyWord;
                Product.isHot = obj.Ishot;
                context.SaveChanges();
                ProductPricingDal.Delete(obj.Id);
                foreach (var x in obj.ColorList)
                {

                    var productPricing = new ProductPriceModel();
                    productPricing.ProductId = Product.id;
                    productPricing.lengthId = x.LengthId;
                    productPricing.colorId = x.id;
                    productPricing.ourpriceangola = x.ourpriceangola;
                    productPricing.OurPriceDollar = x.OurPriceDollar;
                    productPricing.OurPriceEuro = x.OurPriceEuro;
                    productPricing.ourpriceghana = x.ourpriceghana;
                    productPricing.ourpricenigeria = x.ourpricenigeria;
                    productPricing.OurPricePound = x.OurPricePound;
                    productPricing.priceangola = x.priceangola;
                    productPricing.PriceDollar = x.PriceDollar;
                    productPricing.PriceEuro = x.PriceEuro;
                    productPricing.priceghana = x.priceghana;
                    productPricing.pricenigeria = x.pricenigeria;
                    productPricing.PricePound = x.PricePound;
                    check = ProductPricingDal.Create(productPricing);

                }

            }
            catch (Exception ex)
            {
                check = false;
            }
            return check;
        }