示例#1
0
 public static List<adminUser> GetAll()
 {
     List<adminUser> returnObj = new List<adminUser>();
     var context = new Ecommerce.DbEntity.ecommerceEntities();
     var UserList = context.users.ToList().OrderByDescending(m => m.id);
     foreach (var obj in UserList)
     {
         returnObj.Add(new adminUser
         {
             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,
             id = obj.id,
             Isadmin = Convert.ToBoolean(obj.Isadmin)
         });
     }
     return returnObj;
 }
示例#2
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;
 }
示例#3
0
        public static List<LengthModel> GetAllLengthByProductId(int id)
        {
            List<LengthModel> returnObj = new List<LengthModel>();
            var context = new Ecommerce.DbEntity.ecommerceEntities();
            var cat = context.productpricings.Where(m => m.productid == id).ToList();
            foreach (var x in cat)
            {
                var length = new LengthModel();
                length.id = Convert.ToInt32(x.lengthId);
                length.value = GetById(Convert.ToInt32(x.lengthId)).value;
                length.IsSelected = true;

                if (returnObj.Count == 0)
                {
                    returnObj.Add(length);
                }
                else
                {
                    if (returnObj.Where(m => m.id == x.lengthId).FirstOrDefault() == null)
                    {
                        returnObj.Add(length);
                    }
                }
            }
            return returnObj.Distinct().ToList();
        }
示例#4
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;
 }
示例#5
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;
 }
示例#6
0
 public static List<DeliveryModel> GetAllActive()
 {
     DeliveryModel obj;
     List<DeliveryModel> Listobj = new List<DeliveryModel>();
     var context = new Ecommerce.DbEntity.ecommerceEntities();
     var cat = context.deliverycharges.Where(m=>m.Active==true).ToList();
     foreach (var x in cat)
     {
         obj = new DeliveryModel();
         obj.id = x.id;
         obj.deliveryAngola = x.deliveryAngola == null ? 0 : x.deliveryAngola;
         obj.deliveryDoller = x.deliveryDoller == null ? 0 : x.deliveryDoller;
         obj.deliveryEuro = x.deliveryEuro == null ? 0 : x.deliveryEuro;
         obj.deliveryGhana = x.deliveryGhana == null ? 0 : x.deliveryGhana;
         obj.deliveryNigria = x.deliveryNigria == null ? 0 : x.deliveryNigria;
         obj.deliveryPound = x.deliveryPound == null ? 0 : x.deliveryPound;
         obj.freeDeliveryAmountDoller = x.freeDeliveryAmountDoller == null ? 0 : x.freeDeliveryAmountDoller;
         obj.freeDeliveryAmountPound = x.freeDeliveryAmountPound == null ? 0 : x.freeDeliveryAmountPound;
         obj.freeDeliveryAmountEuro = x.freeDeliveryAmountEuro == null ? 0 : x.freeDeliveryAmountEuro;
         obj.freeDeliveryAmountNigria = x.freeDeliveryAmountNigria == null ? 0 : x.freeDeliveryAmountNigria;
         obj.freeDeliveryAmountAngola = x.freeDeliveryAmountAngola == null ? 0 : x.freeDeliveryAmountAngola;
         obj.freeDeliveryAmountGhana = x.freeDeliveryAmountGhana == null ? 0 : x.freeDeliveryAmountGhana;
         obj.Active = Convert.ToBoolean(x.Active);
         obj.Default = Convert.ToBoolean(x.Default);
         obj.DeliveryDays = x.DeliveryDays;
         Listobj.Add(obj);
     }
     return Listobj;
 }
示例#7
0
 public static ImagesModel GetById(int id)
 {
     var context = new Ecommerce.DbEntity.ecommerceEntities();
     var col = context.images.Where(m => m.id == id).FirstOrDefault();
     var Image = new ImagesModel();
     Image.id = col.id;
     Image.image = col.image1;
     Image.Type = col.imageType;
     return Image;
 }
示例#8
0
 public static ExtendedCategory GetByCode(string code)
 {
     var context = new Ecommerce.DbEntity.ecommerceEntities();
     var cat = context.categories.Where(m => m.Code == code).FirstOrDefault();
     var category = new ExtendedCategory();
     category.Code = cat.Code;
     category.discription = cat.discription;
     category.id = cat.id;
     category.name = cat.name;
     return category;
 }
示例#9
0
 public static List<ImagesModel> GetAll()
 {
     List<ImagesModel> ListImage=new List<ImagesModel>();
     var context = new Ecommerce.DbEntity.ecommerceEntities();
     var img = context.images.ToList();
     foreach (var x in img)
     {
         ListImage.Add(new ImagesModel {id=x.id,image=x.image1,Type=x.imageType });
     }
     return ListImage;
 }
示例#10
0
 public static List<LengthModel> GetAlllength()
 {
     List<LengthModel> returnObj = new List<LengthModel>();
     returnObj.Add(new LengthModel { id = 0, value = "Select" });
     var context = new Ecommerce.DbEntity.ecommerceEntities();
     var cat = context.lengths.ToList();
     foreach (var x in cat)
     {
         returnObj.Add(new LengthModel { id = x.id, value = x.value });
     }
     return returnObj;
 }
示例#11
0
 public static List<ExtendedCategory> GetAllCategory()
 {
     List<ExtendedCategory> returnObj = new List<ExtendedCategory>();
     returnObj.Add(new ExtendedCategory { id = 0, name ="Select" });
     var context = new Ecommerce.DbEntity.ecommerceEntities();
     var cat = context.categories.ToList();
     foreach (var x in cat)
     {
         returnObj.Add(new ExtendedCategory {Code=x.Code,discription=x.discription,id=x.id,name=x.name });
     }
     return returnObj;
 }
示例#12
0
        public static List<CoupanModel> GetAll()
        {
            List<CoupanModel> returnObj = new List<CoupanModel>();

            var context = new Ecommerce.DbEntity.ecommerceEntities();
            var cat = context.coupans.ToList().OrderByDescending(m=>m.id);
            foreach (var x in cat)
            {
                returnObj.Add(new CoupanModel { code = x.code, fromDate = Convert.ToDateTime(x.fromDate), toDate = Convert.ToDateTime(x.toDate), id = x.id, DiscountPercentage = (decimal)x.discountpercentage });
            }
            return returnObj;
        }
示例#13
0
 public static List<BrandModel> GetAllBrand()
 {
     List<BrandModel> returnObj = new List<BrandModel>();
     returnObj.Add(new BrandModel { id = 0, BrandName = "Select" });
     var context = new Ecommerce.DbEntity.ecommerceEntities();
     var Brand = context.brands.ToList();
     foreach (var x in Brand)
     {
         returnObj.Add(new BrandModel { id = x.id, BrandName = x.BrandName });
     }
     return returnObj;
 }
示例#14
0
 public static List<ColorModel> GetAllColor()
 {
     List<ColorModel> returnObj = new List<ColorModel>();
     returnObj.Add(new ColorModel { id = 0, name = "Select" });
     var context = new Ecommerce.DbEntity.ecommerceEntities();
     var cat = context.colors.ToList();
     foreach (var x in cat)
     {
         returnObj.Add(new ColorModel { id = x.id, name = x.name });
     }
     return returnObj;
 }
示例#15
0
 public static CoupanModel GetById(int id)
 {
     var context = new Ecommerce.DbEntity.ecommerceEntities();
     var cat = context.coupans.Where(m => m.id == id).FirstOrDefault();
     var Coupan = new CoupanModel();
     Coupan.id = cat.id;
     Coupan.code = cat.code;
     Coupan.fromDate = Convert.ToDateTime(cat.fromDate);
     Coupan.toDate = Convert.ToDateTime(cat.toDate);
     Coupan.DiscountPercentage = (decimal)cat.discountpercentage;
     return Coupan;
 }
示例#16
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;
 }
示例#17
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;
 }
示例#18
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;
 }
示例#19
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;
 }
示例#20
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;
 }
示例#21
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;
 }
示例#22
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;
 }
示例#23
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;
        }
示例#24
0
        public static ReviewModel GetById(int id)
        {
            ReviewModel returnObj = null;
            var context = new Ecommerce.DbEntity.ecommerceEntities();
            var obj = context.reviews.Where(m => m.id == id).FirstOrDefault();
            returnObj = new ReviewModel
             {
                 id = obj.id,
                 Email = obj.email,
                 Message = obj.message,
                 Name = obj.name,
                 Rating = Convert.ToInt32(obj.rating),
                 ProductId = Convert.ToInt32(obj.productid),
             };

            return returnObj;
        }
示例#25
0
 public static List<ReviewModel> GetAllbyProductId(int id)
 {
     List<ReviewModel> returnObj = new List<ReviewModel>();
     var context = new Ecommerce.DbEntity.ecommerceEntities();
     var review = context.reviews.Where(m=>m.productid==id).ToList();
     foreach (var obj in review)
     {
         returnObj.Add(new ReviewModel { id = obj.id,
         Email=obj.email,
         Message=obj.message,
         Name=obj.name,
         Rating = Convert.ToInt32(obj.rating),
         ProductId = Convert.ToInt32(obj.productid),
         });
     }
     return returnObj;
 }
示例#26
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;
 }
 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;
 }
示例#28
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;
 }
示例#29
0
        public static List<ColorModel> GetAllColorsByProductId(int productId)
        {
            List<ColorModel> returnObj = new List<ColorModel>();
            //returnObj.Add(new ColorModel { id = 0, name = "Select" });
            var context = new Ecommerce.DbEntity.ecommerceEntities();
            var pricising = context.productpricings.Where(m => m.productid == productId).ToList();
            foreach (var x in pricising)
            {
                var color = new ColorModel();
                color.id = Convert.ToInt32(x.colorId);
                color.IsSelected = true;
                color.LengthId = Convert.ToInt32(x.lengthId);
                color.name = GetById(Convert.ToInt32(x.colorId)).name;
                color.ourpriceangola = Convert.ToDecimal(x.ourpriceangola);
                color.OurPriceDollar = Convert.ToDecimal(x.ourpriceDollar);
                color.OurPriceEuro = Convert.ToDecimal(x.ourpriceeuro);
                color.ourpriceghana = Convert.ToDecimal(x.ourpriceghana);
                color.ourpricenigeria = Convert.ToDecimal(x.ourpricenigeria);
                color.OurPricePound = Convert.ToDecimal(x.ourpricepound);
                color.priceangola = Convert.ToDecimal(x.priceangola);
                color.PriceDollar = Convert.ToDecimal(x.priceDollar);
                color.PriceEuro = Convert.ToDecimal(x.priceeuro);
                color.priceghana = Convert.ToDecimal(x.priceghana);
                color.pricenigeria = Convert.ToDecimal(x.pricenigeria);
                color.PricePound = Convert.ToDecimal(x.pricepound);

                if (returnObj.Count == 0)
                {
                    returnObj.Add(color);
                }
                else
                {
                    if (returnObj.Where(m => m.id == x.colorId).FirstOrDefault() == null)
                    {
                        returnObj.Add(color);
                    }
                }
            }
            return returnObj;
        }
示例#30
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;
        }