public void SaveProduct(ProductDetailModel p)
        {
            Products entity;

            if (p.ProductId == 0)
            {
                entity = new Products();
            }
            else
            {
                entity = db.Products.Find(p.ProductId);
            }

            entity.ProductName     = p.ProductName;
            entity.CategoryId      = p.CategoryId;
            entity.SupplierId      = p.SupplierId;
            entity.QuantityPerUnit = p.QuantityPerUnit;
            entity.UnitsInStock    = p.UnitsInStock;
            entity.UnitsOnOrder    = p.UnitsOnOrder;

            if (p.ProductId == 0)
            {
                db.Products.Add(entity);
            }

            db.SaveChanges();
        }
Example #2
0
        public ActionResult show(int id)
        {
            ProductDetailModel product = ModelHelper.ProductSummary(new JewelryHandler().GetJewelryById(id));

            ViewBag.produst = product;
            return(View());
        }
        public async Task <IActionResult> UpdateProduct([FromBody] ProductDetailModel model)
        {
            var response = "";

            try
            {
                long pid = Convert.ToInt64(model.productId);
                //model.token = new HomeController().ReturnToken();
                var service = new ProductService(model.shopifyurl, model.token);
                var product = await service.UpdateAsync(pid, new Product()
                {
                    Title       = "Burton Custom Freestlye 151",
                    Vendor      = "Burton",
                    BodyHtml    = "<strong>Good snowboard!</strong>",
                    ProductType = "Snowboard",
                    Images      = new List <ProductImage>
                    {
                        new ProductImage
                        {
                            Attachment = "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="
                        }
                    },
                });

                response = "Product is updated successfuly!";
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }

            return(Ok(response));
        }
Example #4
0
        public async Task <IHttpActionResult> GetProductDetails(int id)
        {
            try
            {
                var product = await _productService.GetProductDetails(id);

                var productRecommendedList = await _productService.GetRandomProducts(6);

                //aynı ürün tavsiyelerde olmasın
                var sameProduct = productRecommendedList.Find(p => p.Id == product.Id);
                if (sameProduct != null)
                {
                    productRecommendedList.Remove(sameProduct);
                }
                else
                {
                    productRecommendedList.RemoveAt(1);
                }


                var productDetails = new ProductDetailModel
                {
                    Product         = product,
                    RecommendedList = productRecommendedList
                };
                return(Ok(productDetails));
            }
            catch (Exception e)
            {
                return(Content(HttpStatusCode.InternalServerError, e.Message));
            }
        }
Example #5
0
        public ActionResult Detail(int id, string title)
        {
            ProductDetailModel detailModel = new ProductDetailModel();

            detailModel.Product = db.Products
                                  .Include(p => p.Category).FirstOrDefault(x => x.Id == id);
            detailModel.ProductProperties = db.ProductProperties.Where(x => x.ProductId == id).Include(x => x.Product).Include(x => x.PropertyPropertyValues).ToList();

            var propIdList = db.CategoryProperties.Where(x => x.CategoryId == detailModel.Product.CategoryId).Select(x => x.Id).ToList();


            detailModel.PropertyPropertyValueses = db.PropertyPropertyValueses
                                                   .Include(x => x.CategoryProperty).Include(x => x.CategoryPropertyValue)
                                                   .Where(x => propIdList.Contains(x.CategoryPropertyId) && x.CategoryProperty.Eligible).ToList();

            detailModel.ProductProperties =
                db.ProductProperties.Where(x => x.ProductId == id).Include(x => x.PropertyPropertyValues).Include(x => x.PropertyPropertyValues.CategoryProperty).Include(x => x.PropertyPropertyValues.CategoryPropertyValue).ToList();

            detailModel.FeaturedProduct = db.Products
                                          .Where(x => x.CategoryId == detailModel.Product.CategoryId && x.Id != id).OrderBy(r => Guid.NewGuid())
                                          .Take(4).ToList();



            detailModel.ProductImageses = db.ProductImageses.Where(x => x.ProductId == id).ToList();

            return(View(detailModel));
        }
        public ActionResult PreviewProductImage(int?productID, int?colorID, int?iconID)
        {
            if (productID == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            ProductDetailModel productDetailModel = new ProductDetailModel();

            if (colorID == null && iconID == null)
            {
                productDetailModel = _productGalleryService.GetColorAndIcon((int)productID).SingleOrDefault();

                if (productDetailModel == null)
                {
                    return(HttpNotFound());
                }
            }
            else
            {
                productDetailModel.ColorID = (int)colorID;
                productDetailModel.IconID  = (int)iconID;
            }

            TempData["ProductDetail"] = productDetailModel;

            IEnumerable <ProductImage> productImages = _productGalleryService.PreviewProductImages((int)productID, productDetailModel.ColorID, productDetailModel.IconID);

            return(PartialView("Partials/_PreviewImage", productImages));
        }
        public async Task <List <ProductDetailModel> > GetDetail(string url)
        {
            var response = await Client.GetAsync(url);

            if (response.IsSuccessStatusCode)
            {
                string html   = "";
                var    stream = await response.Content?.ReadAsStreamAsync();

                using (StreamReader reader = new StreamReader(stream, Encoding.GetEncoding("windows-1254")))
                    html = reader.ReadToEnd();
                Doc.LoadHtml(html);
                List <ProductDetailModel> productDetails = new List <ProductDetailModel>();
                var sellers = Doc.GetElementbyId("PL")?.SelectNodes(".//li");
                foreach (var seller in sellers)
                {
                    ProductDetailModel productDetail = new ProductDetailModel();
                    productDetail.Name     = WebUtility.HtmlDecode(seller.SelectSingleNode(".//b")?.InnerText);
                    productDetail.Price    = WebUtility.HtmlDecode(seller.SelectSingleNode(".//span[@class='pt_v8']")?.InnerText);
                    productDetail.Seller   = WebUtility.HtmlDecode(seller.SelectSingleNode(".//span[@class='v_v8']")?.InnerText?.Replace("Satıcı:", ""));
                    productDetail.Seller   = (productDetail.Seller.Split('/').Count() > 0) ? productDetail.Seller.Split('/')[0] : productDetail.Seller;
                    productDetail.Url      = WebUtility.HtmlDecode(seller.SelectSingleNode(".//a[@class='iC']").GetAttributeValue("href", ""));
                    productDetail.Url      = WebUtility.HtmlDecode("http://www.akakce.com/c" + productDetail.Url.Substring(productDetail.Url.IndexOf("/?c")));
                    productDetail.ImageUrl = WebUtility.HtmlDecode("http:" + seller.SelectSingleNode(".//img").GetAttributeValue("style", "").Replace("background-image:url(", "").Replace(")", ""));

                    productDetails.Add(productDetail);
                }
                return(productDetails);
            }
            return(new List <ProductDetailModel>());
        }
        public async Task <bool> SyncProductsData(string shopifyurl, string storename, string token)
        {
            bool response = true;

            try
            {
                var client = new HttpClient();
                client.Timeout = TimeSpan.FromMinutes(30);
                ProductDetailModel model = new ProductDetailModel();
                model.shopifyurl = shopifyurl;
                model.token      = token;
                List <Product>            products     = await new ProductHandler().GetAllProducts(model);
                List <ProductReturnModel> productsList = await new ProductHandler().GetProductReturnModel(products, storename);
                string apiUrl2 = $"{WebUtil.ResponseUrl}/api/AddShopifyProducts";
                string json    = JsonConvert.SerializeObject(productsList);
                foreach (var item in productsList)
                {
                    List <ProductReturnModel> prdlist = new List <ProductReturnModel>();
                    prdlist.Add(item);
                    var response2 = client.PostAsJsonAsync(apiUrl2, prdlist).Result;
                    response2.EnsureSuccessStatusCode();
                    string responseBody1 = await response2.Content.ReadAsStringAsync();

                    var readString = JObject.Parse(responseBody1)["status"];
                    response = Convert.ToBoolean(readString.ToString());
                }
            }
            catch (Exception ex)
            {
                string msg = ex.Message.ToString();
                return(false);
            }
            return(response);
        }
        public async Task <IActionResult> Index()
        {
            var token      = "";
            var shopifyurl = "";
            //values.Add("shopifyurl", shopifyurl);
            var    client = new HttpClient();
            string apiUrl = "https://localhost:44373/api/Customer/GetAllCustomers?token=" + token + "&shopifyurl=" + shopifyurl + "";
            HttpResponseMessage response = await client.GetAsync(apiUrl);

            response.EnsureSuccessStatusCode();
            string responseBody = await response.Content.ReadAsStringAsync();

            List <Customer> customers = JsonConvert.DeserializeObject <List <Customer> >(responseBody.ToString());
            //Dummy Post Request
            ProductDetailModel model   = new ProductDetailModel();
            string             apiUrl2 = "https://localhost:44373/api/Customer/SendCustomerData";
            // strong typed instance
            ProductDetailModel pdm = new ProductDetailModel();

            pdm.shopifyurl = shopifyurl;
            pdm.token      = token;
            var response2 = client.PostAsJsonAsync(apiUrl2, pdm).Result;

            response2.EnsureSuccessStatusCode();
            string responseBody1 = await response2.Content.ReadAsStringAsync();

            List <Customer> customers2 = JsonConvert.DeserializeObject <List <Customer> >(responseBody1.ToString());

            return(View());
        }
        public Dictionary <int, bool> UploadImage([Bind(Include = "Files, IsDisplayPosition")] ProductDetailModel productDetailModel)
        {
            Image image = new Image();
            Dictionary <int, bool> lstImageID = new Dictionary <int, bool>();
            int position = 1;

            foreach (HttpPostedFileBase file in productDetailModel.Files)
            {
                string fname = FileMng.UploadFile(file, "/Images");
                image.path   = "Images\\" + fname;
                image.IconID = _dbContext.Icon.Max(i => i.IconID);
                _dbContext.Image.Add(image);
                _dbContext.SaveChanges();

                if (position == productDetailModel.IsDisplayPosition)
                {
                    lstImageID.Add(_dbContext.Image.Max(i => i.ImageID), true);  //set us display
                }
                else
                {
                    lstImageID.Add(_dbContext.Image.Max(i => i.ImageID), false);
                }
                position++;
            }
            return(lstImageID);
        }
Example #11
0
        private void BindRecommend(ProductDetailModel info)
        {
            if (info.RecommonItems.Count == 0)
            {
                var items = PROD_MASTERService.PROD_MASTERList.Where(t => t.CategoryCode == info.CategoryCode)
                            .AsEnumerable()
                            .Select(t => new ProductModel
                {
                    ID               = t.ID,
                    ProductNo        = t.ProductNo,
                    ProductName      = t.Item03 == "1" ? t.Item02 : t.ProductName,
                    ProductType      = t.ProductType,
                    StockType        = t.StockType,
                    BigPic           = Common.Util.GetProductImgUrl(t.BigPic, false),
                    MiddlePic        = Common.Util.GetProductImgUrl(t.SmallPic).Replace("Small", "Middl"),
                    SmallPic         = Common.Util.GetProductImgUrl(t.SmallPic),
                    ProdCategoryCode = t.CategoryCode,
                    BaseUOFM         = t.BaseUOFM,
                    ListPrice        = Common.Util.TransformObjToDou(t.ListPrice),
                    SellPrice        = PROD_MASTERService.GetSellPrice(t.ProductNo, Common.Util.TransformObjToDou(t.ListPrice), (double)t.SpecialPrice),
                }).Take(4);

                info.RecommonItems = items.ToList();
            }
        }
Example #12
0
        public bool Post(ProductDetailModel model)
        {
            var entity = new ProductDetailEntity
            {
                Detail = model.Detail,

                ImgUrl1 = model.ImgUrl1,

                ImgUrl2 = model.ImgUrl2,

                ImgUrl3 = model.ImgUrl3,

                ImgUrl4 = model.ImgUrl4,

                ImgUrl5 = model.ImgUrl5,

//				Product = model.Product,
            };

            if (_ProductDetailService.Create(entity).Id > 0)
            {
                return(true);
            }
            return(false);
        }
Example #13
0
        public ActionResult Edit(ProductDetailModel data, FormCollection dat)
        {
            JewelryCategory category = new JewelryCategory();

            category.Id = Convert.ToInt32(dat["Category"]);
            JewelryColor color = new JewelryColor();

            color.Id = Convert.ToInt32(dat["color"]);
            JewelryType type = new JewelryType();

            type.Id = Convert.ToInt32(dat["Type"]);
            JewelryImages images = new JewelryImages();
            //images.Id = Convert.ToInt32(data.ImageUrl);

            Jewelry jewelry = new Jewelry
            {
                Id          = data.Id,
                Name        = data.Name,
                Description = data.Description,
                Price       = data.Price,
                Category    = new JewelryCategory {
                    Id = category.Id
                },
                Color = new JewelryColor {
                    Id = color.Id
                },
                Type = new JewelryType {
                    Id = type.Id
                },
            };

            new JewelryHandler().update(jewelry);

            return(RedirectToAction("home", "admin"));
        }
Example #14
0
        public async Task <bool> SyncProducts(string shopifyurl, string token)
        {
            bool response;

            try
            {
                shopifyurl = "netabc.myshopify.com";
                token      = "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";
                string[]           shosp    = shopifyurl.Split(".");
                string             shopname = shosp[0];
                var                client   = new HttpClient();
                ProductDetailModel model    = new ProductDetailModel();
                model.shopifyurl = shopifyurl;
                model.token      = token;
                List <Product> products = await new ProductHandler().GetAllProducts(model);
                //string msgs = await new ProductHandler().AddMetaFeilds(products, shopifyurl, token);
                List <ProductReturnModel> productReturns = await new ProductHandler().GetProductReturnModel(products, shopname);
                //List<ProductReturnModel> newlist = new List<ProductReturnModel>();
                //newlist.Add(productReturns.FirstOrDefault());
                string apiUrl2   = $"{config.Value.ResponseUrl}/api/AddShopifyProducts";
                string json      = JsonConvert.SerializeObject(productReturns);
                var    response2 = client.PostAsJsonAsync(apiUrl2, productReturns).Result;
                response2.EnsureSuccessStatusCode();
                string responseBody1 = await response2.Content.ReadAsStringAsync();

                var readString = JObject.Parse(responseBody1)["status"];
                response = Convert.ToBoolean(readString);
            }
            catch (Exception ex)
            {
                string msg = ex.Message.ToString();
                return(false);
            }
            return(response);
        }
Example #15
0
        public bool Put(ProductDetailModel model)
        {
            var entity = _ProductDetailService.GetProductDetailById(model.Id);

            if (entity == null)
            {
                return(false);
            }

            entity.Detail = model.Detail;

            entity.ImgUrl1 = model.ImgUrl1;

            entity.ImgUrl2 = model.ImgUrl2;

            entity.ImgUrl3 = model.ImgUrl3;

            entity.ImgUrl4 = model.ImgUrl4;

            entity.ImgUrl5 = model.ImgUrl5;

//			entity.Product = model.Product;

            if (_ProductDetailService.Update(entity) != null)
            {
                return(true);
            }
            return(false);
        }
Example #16
0
 public ActionResult Submit(ProductDetailModel promodel)
 {
     service.Submit(promodel.ProductId, promodel.ProductName, (Decimal)promodel.SellingPrice, (Decimal)promodel.MarketPrice,
                    promodel.Stock, promodel.Description,
                    promodel.DateOfInsert, promodel.Rating, promodel.OperatingSystem, promodel.Color, promodel.IsAvailable, promodel.FirstImage, promodel.SecondImage, promodel.ThirdImage);
     return(View("AddProduct"));
 }
        public bool Post(ProductDetailModel model)
        {
            var entity = new ProductDetailEntity
            {
                Name              = model.Name,
                Detail            = model.Detail,
                Img               = model.Img,
                Img1              = model.Img1,
                Img2              = model.Img2,
                Img3              = model.Img3,
                Img4              = model.Img4,
                SericeInstruction = model.SericeInstruction,
                AddUser           = model.AddUser,
                AddTime           = model.AddTime,
                UpdUser           = model.UpdUser,
                UpdTime           = model.UpdTime,
                Ad1               = model.Ad1,
                Ad2               = model.Ad2,
                Ad3               = model.Ad3,
            };

            if (_productDetailService.Create(entity).Id > 0)
            {
                return(true);
            }
            return(false);
        }
        public HttpResponseMessage Get(int id)
        {
            var entity = _productDetailService.GetProductDetailById(id);
            var model  = new ProductDetailModel
            {
                Id                = entity.Id,
                Name              = entity.Name,
                Detail            = entity.Detail,
                Img               = entity.Img,
                Img1              = entity.Img1,
                Img2              = entity.Img2,
                Img3              = entity.Img3,
                Img4              = entity.Img4,
                SericeInstruction = entity.SericeInstruction,
                AddUser           = entity.AddUser,
                AddTime           = entity.AddTime,
                UpdUser           = entity.UpdUser,
                UpdTime           = entity.UpdTime,
                Ad1               = entity.Ad1,
                Ad2               = entity.Ad2,
                Ad3               = entity.Ad3
            };

            return(PageHelper.toJson(model));
        }
        public bool Put(ProductDetailModel model)
        {
            var entity = _productDetailService.GetProductDetailById(model.Id);

            if (entity == null)
            {
                return(false);
            }
            entity.Name              = model.Name;
            entity.Detail            = model.Detail;
            entity.Img               = model.Img;
            entity.Img1              = model.Img1;
            entity.Img2              = model.Img2;
            entity.Img3              = model.Img3;
            entity.Img4              = model.Img4;
            entity.SericeInstruction = model.SericeInstruction;
            entity.AddUser           = model.AddUser;
            entity.AddTime           = model.AddTime;
            entity.UpdUser           = model.UpdUser;
            entity.UpdTime           = model.UpdTime;
            entity.Ad1               = model.Ad1;
            entity.Ad2               = model.Ad2;
            entity.Ad3               = model.Ad3;
            if (_productDetailService.Update(entity) != null)
            {
                return(true);
            }
            return(false);
        }
        public ActionResult PreviewProductDetails(int?productID)
        {
            if (productID == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            ProductDetailModel productDetailModel = TempData["ProductDetail"] as ProductDetailModel;

            if (productDetailModel == null)
            {
                return(HttpNotFound());
            }

            ViewProductDetailModel viewProductDetailModel = _productGalleryService.ViewListingProductImage((int)productID, productDetailModel.ColorID, productDetailModel.IconID);

            ViewBag.SizeList = _sizeService.SizeList((int)productID, productDetailModel.ColorID, productDetailModel.IconID);

            if (viewProductDetailModel == null)
            {
                return(HttpNotFound());
            }

            return(PartialView("Partials/_PreviewProductDetails", viewProductDetailModel));
        }
Example #21
0
        public ActionResult Index(String product)
        {
            SetSeoInformation(product);
            ViewBag.Scripts = new List <string>()
            {
                "review.js"
            };
            ViewBag.HasNoFollow = true;
            ReviewItemModel reviewItemModel = new ReviewItemModel();

            try
            {
                reviewItemModel.BreadCrumbAndProductId = product;

                ProductDetailModel productDetail = DetailManager.GetProductDetailModel(product);
                reviewItemModel.ProductCode        = productDetail.Code;
                reviewItemModel.ProductDescription = productDetail.Description;
                reviewItemModel.ProductName        = productDetail.Name;
                reviewItemModel.ProductImage       = productDetail.Image;
                reviewItemModel.Rating             = "5";
                reviewItemModel.Average            = DetailManager.GetProductReviewAverage(product);
            }
            catch
            {
                return(RedirectToAction("Index", "Home"));
            }
            return(View(PathFromView("Review"), reviewItemModel));
        }
Example #22
0
        // GET: Product
        public ActionResult Detail(int id)
        {
            var product = _productService.GetProduct(id);

            if (product.IsNull())
            {
                throw new HttpException(404, "Page not found");
            }

            var tbkItem = TaobaoApi.GetProduct(product.ProductIndex);

            if (tbkItem.IsNotNull())
            {
                product.AmountSales = (int)tbkItem.Volume;
                product.Price       = product.Price > Convert.ToDecimal(tbkItem.ZkFinalPrice) ? Convert.ToDecimal(tbkItem.ZkFinalPrice) : product.Price;
            }
            var shop         = _shopService.GetShop(product.ShopId);
            var shopProducts = _productService.GetTopProducts(shop.ID).OrderByRandom().Take(10).ToList();
            var isFaved      = IsFavProduct(product.ID, _userFavProductService.GetListByUser(UserId));

            var model = new ProductDetailModel
            {
                Shop                  = shop,
                Product               = product,
                ShopProducts          = shopProducts,
                ProductCollectionHtml = GetProductCollectActionboxHtml(isFaved, id)
            };

            return(View(model));
        }
Example #23
0
        public HttpResponseMessage productDetail(int id)
        {
            var entity = _ProductDetailService.GetProductDetailById(id);

            if (entity == null)
            {
                return(PageHelper.toJson("Êý¾ÝΪ¿Õ"));
            }
            var model = new ProductDetailModel
            {
                Id = entity.Id,

                Detail = entity.Detail,

                ImgUrl1 = entity.ImgUrl1,

                ImgUrl2 = entity.ImgUrl2,

                ImgUrl3 = entity.ImgUrl3,

                ImgUrl4 = entity.ImgUrl4,

                ImgUrl5 = entity.ImgUrl5,

//		        Product = entity.Product,
            };

            return(PageHelper.toJson(new { List = model }));
        }
Example #24
0
        public ReturnDataModel updateProductDetail(
            string p_detailid,
            ProductDetailModel p_productdetail,
            out string error)
        {
            error = "";
            int             iresult = 1;
            ReturnDataModel retdata = new ReturnDataModel();

            var del_sql    = "delete form productdetail where detailid = @p_detailid ; ";
            var parameters = new DynamicParameters();

            parameters.Add("p_detailid", p_detailid, GetDbType(""));
            try
            {
                iresult = GADB().Execute(del_sql, param: parameters);
                iresult = 1;
                goto insertData;
            }
            catch (Exception e)
            {
                //MMTSALE.WriteLog($"system error-{e.Message}");
                iresult = 0;
                error   = "Please Update Again!!Failed to Detele and Update Records.";
                goto returnData;
            }

insertData:
            var insert_sql = "INSERT INTO productdetail(detailid, price, barcode, isactive, ts, productid, sizeid, " +
                             "colorid) VALUES(@p_detailid, @p_price, @p_barcode, @p_isactive, @p_ts, @p_productid, @p_sizeid, @p_colorid); ";

            parameters = new DynamicParameters();
            parameters.Add("p_detailid", p_productdetail.detailid, GetDbType(""));
            parameters.Add("p_price", p_productdetail.price, GetDbType(0));
            parameters.Add("p_barcode", p_productdetail.barcode, GetDbType(""));
            parameters.Add("p_isactive", true, GetDbType(true));
            parameters.Add("p_ts", DateTime.Now, GetDbType(DateTime.Now));
            parameters.Add("p_productid", p_productdetail.productid, GetDbType(""));
            parameters.Add("p_sizeid", p_productdetail.sizeid, GetDbType(""));
            parameters.Add("p_colorid", p_productdetail.colorid, GetDbType(""));
            try
            {
                iresult = GADB().Execute(insert_sql, param: parameters);
                iresult = 1;
                goto returnData;
            }
            catch (Exception e)
            {
                //MMTSALE.WriteLog($"system error-{e.Message}");
                iresult = 0;
                error   = "Insertion failed.";
                goto returnData;
            }
returnData:
            retdata.errorMsg  = error;
            retdata.retStatus = (iresult == 1) ? true : false;

            return(retdata);
        }
Example #25
0
        public void InsertData(ProductDetailModel model)
        {
            List <string>         sqls     = new List <string>();
            List <SqlParameter[]> cmdParms = new List <SqlParameter[]>();

            int wineID = this.GetWineID();

            #region WineProduct

            StringBuilder str = new StringBuilder();
            str.AppendLine("Insert into WineProduct");
            str.AppendLine(" (WineID, WineCategoryID, ProductYear, Price, Describle, Region, IsDelete, CreateTime, CreateUser, UpdateTime, UpdateUser) ");
            str.AppendLine(" Values (@WineID, @WineCategoryID, @ProductYear, @Price, @Describle, @Region, @IsDelete, getdate(), @CreateUser,getdate(), @UpdateUser);");

            SqlParameter[] paras = new SqlParameter[9];

            paras[0] = new SqlParameter("@WineID", wineID);
            paras[1] = new SqlParameter("@WineCategoryID", model.WineCategoryID);
            paras[2] = new SqlParameter("@ProductYear", model.ProductYear);
            paras[3] = new SqlParameter("@Price", model.Price);

            JsonSerializer myJsonSerializer = new JsonSerializer();
            string         describle        = myJsonSerializer.Serialize <List <ProductDescribleModel> >(model.Describle);
            paras[4] = new SqlParameter("@Describle", describle);

            paras[5] = new SqlParameter("@Region", Common.VariableConvert.ConvertStringToDBValue(model.Region));
            paras[6] = new SqlParameter("@IsDelete", Common.VariableConvert.BitConverter(model.IsDelete));

            paras[7] = new SqlParameter("@CreateUser", Common.VariableConvert.ConvertStringToDBValue(model.CreateUser));
            paras[8] = new SqlParameter("@UpdateUser", Common.VariableConvert.ConvertStringToDBValue(model.UpdateUser));

            sqls.Add(str.ToString());
            cmdParms.Add(paras);

            #endregion

            #region WineImage

            for (int i = 0; i < model.WineImages.Count; i++)
            {
                str = new StringBuilder();
                str.AppendLine("Insert into WineImage");
                str.AppendLine(" (WineID, Url, ImageType) ");
                str.AppendLine(" Values (@WineID, @Url, @ImageType);");

                paras    = new SqlParameter[3];
                paras[0] = new SqlParameter("@WineID", wineID);
                paras[1] = new SqlParameter("@Url", Common.VariableConvert.ConvertStringToDBValue(model.WineImages[i].Url));
                paras[2] = new SqlParameter("@ImageType", model.WineImages[i].ImageType);

                sqls.Add(str.ToString());
                cmdParms.Add(paras);
            }

            #endregion

            SqlAccess mySqlAccess = new SqlAccess();
            mySqlAccess.ExecuteNonQuerys(sqls, cmdParms);
        }
Example #26
0
        //
        // GET: /Admin/Product/Details/5

        public ActionResult Details(int id = 0)
        {
            var model = new ProductDetailModel {
                Product = _productService.GetById(id)
            };

            return(View(model));
        }
Example #27
0
        private static ProductDetailModel GetProductDetailModel(String code, LandauPortalWebAPI client)
        {
            var prod = client.Products.GetByProduct(code);

            var detail = new ProductDetailModel(prod.ProductCode, prod.ProductName, prod.ProductDescription, prod.Image != null ? prod.Image.CatalogImageUri : null, prod.Image != null ? prod.Image.ColorCode : null, prod.Breadcrumb != null ? prod.Breadcrumb.Gender : null, prod.Breadcrumb != null && prod.Breadcrumb.Category != null ? prod.Breadcrumb.Collection : null, prod.Breadcrumb != null ? prod.Breadcrumb.Category : null, prod.Seo.PageTitle, prod.Seo.MetaDescription, prod.FitRiseWaist);

            return(detail);
        }
 private void RemoveOldImage([Bind(Include = "FileToRemove")] ProductDetailModel productDetailModel)    //remove old image from directory
 {
     foreach (var item in productDetailModel.FileToRemove.Where(f => f != 0).ToArray())
     {
         Image image = _dbContext.Image.Find(item);
         FileMng.RemoveFile(System.Web.HttpContext.Current.Server.MapPath("~\\" + image.path));
     }
 }
 public void EditProductDetail([Bind] ProductDetailModel productDetailModel)
 {
     /** UNCOMMENT THOSE LINES BELOW IF THE UPDATE FEATURE FOR THE PRODUCT DETAIL HAS BEEN FINISHED **/
     _productDetailRepository.CreateNewProductSize(productDetailModel);      //check if new size has been added/selected by the admin
     //_productDetailRepository.RemoveProductSize(productDetailModel);
     _productDetailRepository.ChangeImageIcon(productDetailModel);
     _productDetailRepository.ChangeProductColor(productDetailModel);
     _productDetailRepository.ChangeProductImage(productDetailModel);
 }
Example #30
0
        public ActionResult Submit(ProductDetailModel promodel)
        {
            var Add = new MobileSiteServices();

            Add.Submit(promodel.ProductId, promodel.ProductName, (Decimal)promodel.SellingPrice, (Decimal)promodel.MarketPrice,
                       promodel.Stock, promodel.Description,
                       promodel.Rating, promodel.OperatingSystem, promodel.Color, promodel.IsAvailable, promodel.FirstImage, promodel.SecondImage, promodel.ThirdImage, promodel.FeatureType, promodel.PageType);
            return(View("AddProduct"));
        }