コード例 #1
0
        //private Dictionary<string, string> _normalizedValues = new Dictionary<string, string>();

        public ProductPusher(ProductPusherOptionManager optionManager,
                             ProductProcessor processor,
                             FastAdapter adapter,
                             SoapM1 soap) : base(optionManager, processor, adapter)
        {
            this.soap = soap;
        }
コード例 #2
0
 public ActionResult ListProducts()
 {
     if (IsActiveSession())
     {
         var data = ProductProcessor.LoadProductsAdmin();
         List <ProductModel> products = new List <ProductModel>();
         foreach (var row in data)
         {
             products.Add(new ProductModel
             {
                 Id            = row.Id,
                 ProductCode   = row.ProductCode,
                 Description   = row.Description,
                 UnitOfMeasure = row.UnitOfMeasure,
                 Category      = row.Category,
                 Price         = row.Price,
                 ImageTitle    = row.ImageTitle,
                 ImagePath     = row.ImagePath,
                 IsActive      = row.IsActive
             });
         }
         return(View(products));
     }
     return(RedirectToAction("Login", "Login", null));
 }
コード例 #3
0
        public List <CartProductsModel> GetCartProducts(int userId)
        {
            List <CartProductsModel> cartProducts = new List <CartProductsModel>();
            var   cartData = CartProcessor.LoadCartProducts(userId);
            float total    = 0.0f;

            if (cartData != null)
            {
                foreach (var row in cartData)
                {
                    cartProducts.Add(new CartProductsModel
                    {
                        Id                 = row.Id,
                        ProductId          = row.ProductId,
                        ProductDescription = ProductProcessor.GetProduct(row.ProductId).Description,
                        ProductImagePath   = ProductProcessor.GetProduct(row.ProductId).ImagePath,
                        ProductQty         = row.ProductQty,
                        ProductPrice       = row.ProductPrice,
                        AddedDate          = row.AddedDate
                    });
                    total = total + (row.ProductQty * row.ProductPrice);
                }
            }
            ViewBag.Total = total;
            return(cartProducts);
        }
コード例 #4
0
 public ProductSubCategoryPusher(
     ProductSubCategoryPusherOptionManager optionManager,
     ProductProcessor entityProcessor,
     SubCategoryAttributeProcessor attributeProcessor,
     FastAdapter adapter) : base(optionManager, entityProcessor, attributeProcessor, adapter)
 {
 }
コード例 #5
0
 public ProductMultipleAttributePusher(ProductMultipleAttributePusherOptionManager optionManager,
                                       ProductProcessor entityProcessor,
                                       MultipleAttributeProcessor attributeProcessor,
                                       FastAdapter adapter,
                                       SoapM1 soap) : base(optionManager, entityProcessor, attributeProcessor, adapter)
 {
     this.soap = soap;
 }
コード例 #6
0
ファイル: ProductPusher.cs プロジェクト: FangYuFan/fastSQL
 public ProductPusher(ProductPusherOptionManager optionManager,
                      ProductProcessor processor,
                      FastProvider provider,
                      FastAdapter adapter,
                      EntityRepository entityRepository,
                      ConnectionRepository connectionRepository) : base(optionManager, processor, provider, adapter, entityRepository, connectionRepository)
 {
 }
コード例 #7
0
ファイル: ProductReviews.cs プロジェクト: yuelinsoft/himedi
 public void btnRefer_Click(object sender, EventArgs e)
 {
     if (this.ValidateConvert())
     {
         ProductReviewInfo target = new ProductReviewInfo();
         target.ReviewDate = DateTime.Now;
         target.ProductId  = this.productId;
         target.UserId     = HiContext.Current.User.UserId;
         target.UserName   = this.txtUserName.Text;
         target.UserEmail  = this.txtEmail.Text;
         target.ReviewText = this.txtContent.Text;
         ValidationResults results = Hishop.Components.Validation.Validation.Validate <ProductReviewInfo>(target, new string[] { "Refer" });
         string            msg     = string.Empty;
         if (!results.IsValid)
         {
             foreach (ValidationResult result in (IEnumerable <ValidationResult>)results)
             {
                 msg = msg + Formatter.FormatErrorMessage(result.Message);
             }
             this.ShowMessage(msg, false);
         }
         else if (((HiContext.Current.User.UserRole == UserRole.Member) || (HiContext.Current.User.UserRole == UserRole.Underling)) || this.userRegion(this.txtReviewUserName.Value, this.txtReviewPsw.Value))
         {
             if (string.IsNullOrEmpty(this.txtReviewCode.Value))
             {
                 this.ShowMessage("请输入验证码", false);
             }
             else if (!HiContext.Current.CheckVerifyCode(this.txtReviewCode.Value.Trim()))
             {
                 this.ShowMessage("验证码不正确", false);
             }
             else
             {
                 int buyNum    = 0;
                 int reviewNum = 0;
                 ProductBrowser.LoadProductReview(this.productId, out buyNum, out reviewNum);
                 if (buyNum == 0)
                 {
                     this.ShowMessage("您没有购买此商品,因此不能进行评论", false);
                 }
                 else if (reviewNum >= buyNum)
                 {
                     this.ShowMessage("您已经对此商品进行了评论,请再次购买后方能再进行评论", false);
                 }
                 else if (ProductProcessor.InsertProductReview(target))
                 {
                     this.Page.ClientScript.RegisterClientScriptBlock(base.GetType(), "success", string.Format("<script>alert(\"{0}\");window.location.href=\"{1}\"</script>", "评论成功", Globals.GetSiteUrls().UrlData.FormatUrl("productReviews", new object[] { this.productId })));
                 }
                 else
                 {
                     this.ShowMessage("评论失败,请重试", false);
                 }
             }
         }
     }
 }
コード例 #8
0
 public CategoryController(
     IEntitySerializer serializer,
     ICategoryFetcher categoryFetcher,
     ProductProcessor productProcessor
     )
 {
     _serializer       = serializer;
     _categoryFetcher  = categoryFetcher;
     _productProcessor = productProcessor;
 }
コード例 #9
0
 public ProductStockPusher(ProductStockPusherOptionManager optionManager,
                           ProductProcessor entityProcessor,
                           StockAttributeProcessor attributeProcessor,
                           FastProvider provider,
                           FastAdapter adapter,
                           EntityRepository entityRepository,
                           AttributeRepository attributeRepository,
                           ConnectionRepository connectionRepository) : base(optionManager, entityProcessor, attributeProcessor, provider, adapter, entityRepository, attributeRepository, connectionRepository)
 {
 }
コード例 #10
0
        public List <ProductModel> SearchProductsList()
        {
            if (Price == 0 || ProductType == null)
            {
                return(null);
            }
            List <ProductModel> productsFromType = ProductProcessor.GetProductsByType(ProductType.Id);

            CalculateClassificationValue(productsFromType);
            return(RetrieveValidProducts(3, productsFromType));
        }
コード例 #11
0
        public void btnRefer_Click(object sender, System.EventArgs e)
        {
            ProductConsultationInfo productConsultationInfo = new ProductConsultationInfo();

            productConsultationInfo.ConsultationDate = System.DateTime.Now;
            productConsultationInfo.ProductId        = this.productId;
            productConsultationInfo.UserId           = Hidistro.Membership.Context.HiContext.Current.User.UserId;
            productConsultationInfo.UserName         = this.txtUserName.Text;
            productConsultationInfo.UserEmail        = this.txtEmail.Text;
            productConsultationInfo.ConsultationText = Globals.HtmlEncode(this.txtContent.Text);
            ValidationResults validationResults = Validation.Validate <ProductConsultationInfo>(productConsultationInfo, new string[]
            {
                "Refer"
            });
            string text = string.Empty;

            if (!validationResults.IsValid)
            {
                foreach (ValidationResult current in (System.Collections.Generic.IEnumerable <ValidationResult>)validationResults)
                {
                    text += Formatter.FormatErrorMessage(current.Message);
                }
                this.ShowMessage(text, false);
            }
            else
            {
                if (string.IsNullOrEmpty(this.txtConsultationCode.Value))
                {
                    this.ShowMessage("请输入验证码", false);
                }
                else
                {
                    if (!Hidistro.Membership.Context.HiContext.Current.CheckVerifyCode(this.txtConsultationCode.Value.Trim()))
                    {
                        this.ShowMessage("验证码不正确", false);
                    }
                    else
                    {
                        if (ProductProcessor.InsertProductConsultation(productConsultationInfo))
                        {
                            this.Page.ClientScript.RegisterClientScriptBlock(base.GetType(), "success", string.Format("<script>alert(\"{0}\");window.location.href=\"{1}\"</script>", "咨询成功,管理员回复即可显示", Globals.GetSiteUrls().UrlData.FormatUrl("productConsultations", new object[]
                            {
                                this.productId
                            })));
                        }
                        else
                        {
                            this.ShowMessage("咨询失败,请重试", false);
                        }
                    }
                }
            }
        }
コード例 #12
0
        public async void SubmitButton()
        {
            if (VerifyFields())
            {
                int ProductID = await ProductProcessor.CreateProduct(Product).ConfigureAwait(false);

                //save Product Images
                await ImageProcessor.SaveImage(ImageDisplayPath, ProductID).ConfigureAwait(false);

                ((PostLogInViewModel)Parent).ActiveItem = new UserViewModel(((PostLogInViewModel)Parent)?.User);
            }
        }
コード例 #13
0
 public ProductController(
     ProductProcessor productProcessor,
     IEntitySerializer serializer,
     IEntityDeserializer deserializer,
     IImageFetcher imageFetcher
     )
 {
     _productProcessor = productProcessor;
     _serializer       = serializer;
     _deserializer     = deserializer;
     _imageFetcher     = imageFetcher;
 }
コード例 #14
0
        public List <ProductModel> GetFeatured()
        {
            Apriori ap = new Apriori(OrderProcessor.GetTransactionProductIdList(), 0.5f, 0.3f);
            var     featuredCollection = ap.Calculate();
            var     products           = new List <ProductModel>();

            foreach (var productId in featuredCollection)
            {
                products.Add(ProductProcessor.GetProduct(productId));
            }

            return(products);
        }
コード例 #15
0
        public void AdjustProductToFeatured_WhenRaitingIsEqualToBound_ProducIsNotFeatured()
        {
            //Arrange
            var processor = new ProductProcessor();
            var product   = new Product()
            {
                Rating = Consts.RaitingBoundValue
            };

            //Act
            processor.AdjustProductToFeatured(product);

            //Assert
            Assert.IsFalse(product.Featured);
        }
コード例 #16
0
        public void AdjustProductToFeatured_WhenRaitingIsGreaterThanBound_ProducIsFeatured()
        {
            //Arrange
            var processor = new ProductProcessor();
            var product   = new Product()
            {
                Rating = Consts.RaitingBoundValue + 1d
            };

            //Act
            processor.AdjustProductToFeatured(product);

            //Assert
            Assert.IsTrue(product.Featured);
        }
コード例 #17
0
        /// <summary>
        /// 根据ProductIDo获取商家商品信息
        /// </summary>
        /// <param name="productID"></param>
        /// <returns></returns>
        public virtual SellerProductRequestInfo GetSellerProductInfoByProductID(string productID)
        {
            //CheckSellerProductRequestInfoProcessor.CheckSellerProductRequestInfoSysNo(sysNo);
            if (string.IsNullOrEmpty(productID))
            {
                throw new BizException(ResouceManager.GetMessageString("IM.SellerProductRequest", "SellerProductRequestProductID"));
            }

            ProductProcessor productBp   = new ProductProcessor();
            ProductInfo      productInfo = productBp.GetProductInfoByID(productID);

            if (productInfo == null)
            {
                throw new BizException(ResouceManager.GetMessageString("IM.SellerProductRequest", "SellerProductRequestProductID"));
            }

            var entity = new SellerProductRequestInfo();

            entity.ProductID      = productInfo.ProductID;
            entity.BriefName      = productInfo.ProductBasicInfo.ProductBriefName;
            entity.ProductName    = productInfo.ProductBasicInfo.ProductTitle.Content;
            entity.ProductLink    = productInfo.ProductBasicInfo.ProductLink;
            entity.PackageList    = productInfo.ProductBasicInfo.PackageList.Content;
            entity.Keywords       = productInfo.ProductBasicInfo.Keywords.Content;
            entity.UPCCode        = productInfo.ProductBasicInfo.UPCCode;
            entity.BriefName      = productInfo.ProductBasicInfo.ProductBriefName;
            entity.IsTakePictures = (SellerProductRequestTakePictures)productInfo.ProductBasicInfo.IsTakePicture;
            entity.Attention      = productInfo.ProductBasicInfo.Attention.Content;
            entity.Note           = productInfo.ProductBasicInfo.Note;
            entity.PromotionTitle = productInfo.PromotionTitle.Content;
            //entity.HostWarrantyDay = productInfo.ProductWarrantyInfo.HostWarrantyDay;
            //entity.PartWarrantyDay = productInfo.ProductWarrantyInfo.PartWarrantyDay;
            //entity.Warranty = productInfo.ProductWarrantyInfo.Warranty.Content;
            entity.ServicePhone = productInfo.ProductWarrantyInfo.ServicePhone;
            entity.ServiceInfo  = productInfo.ProductWarrantyInfo.ServiceInfo;
            // entity.IsOfferInvoice = productInfo.ProductWarrantyInfo.OfferVATInvoice== OfferVATInvoice.Yes? SellerProductRequestOfferInvoice.Yes: SellerProductRequestOfferInvoice.No;
            entity.Height          = productInfo.ProductBasicInfo.ProductDimensionInfo.Height;
            entity.Weight          = productInfo.ProductBasicInfo.ProductDimensionInfo.Weight;
            entity.Length          = productInfo.ProductBasicInfo.ProductDimensionInfo.Length;
            entity.Width           = productInfo.ProductBasicInfo.ProductDimensionInfo.Width;
            entity.MinPackNumber   = productInfo.ProductPOInfo.MinPackNumber;
            entity.ProductDescLong = productInfo.ProductBasicInfo.LongDescription.Content;

            entity.SellerProductRequestPropertyList = _SellerProductRequestDA.GetSellerProductPropertyListByProductID(productID);


            return(entity);
        }
コード例 #18
0
        public async void ViewLoaded()
        {
            Product.UserID = ((PostLogInViewModel)Parent).User.Id;
            var productTypes = await ProductProcessor.GetProductTypes();

            SelectionProductTypes = new BindableCollection <ProductType>();
            foreach (ProductType productType in productTypes)
            {
                SelectionProductTypes.Add(productType);
            }

            if (SelectionProductTypes.Count > 0)
            {
                SelectedProductTypes = SelectionProductTypes[0];
            }
        }
コード例 #19
0
        private static List <ProductModel> getProducts()
        {
            var products = (from p in ProductProcessor.GetProducts()
                            select new ProductModel
            {
                id = p.id,
                product_title = p.product_title,
                description = p.description,
                price = p.price,
                availability = p.availability,
                specs = p.specs,
                popularity = p.popularity,
                imagePath = p.imagePath
            }).ToList();

            return(products);
        }
コード例 #20
0
        public ActionResult UpdateProduct(ProductModel model)
        {
            if (ModelState.IsValid)
            {
                List <DataLibrary.Models.ProductModel> products = ProductProcessor.LoadProducts();

                ProductModel sessionModel = (ProductModel)Session["ProductUpdateModel"];

                //recreating list without the session model in it.
                products = products.Where(a => a.ProductID != sessionModel.ProductID).ToList();

                //isolate(if any) duplicates
                products = products.Where(a => a.ProductID == model.ProductID || a.ProductName == model.ProductName).ToList();

                //if the session model's identifying variable is the same as the parameter model, then it is okay to update (same account, same update)
                //if the session model's identifying variable is NOT the same, then it is NOT okay to update (updating the current model to a duplicate that already exists)

                //checking to see if the session model is the same as the parameter model. If same, update, if not, proceed.
                if (sessionModel.ProductName == model.ProductName)
                {
                    //left as int for testing purposes
                    int recordsCreated = ProductProcessor.UpdateProduct(model.ProductID, model.ProductName, model.Manufacturer,
                                                                        model.Style, model.PurchasePrice, model.SalePrice, model.Qty, model.CommissionPercentage);
                    return(RedirectToAction("ViewProduct"));
                }
                else
                {
                    //if duplicates exist, throw alert and deny update.
                    if (products.Count() > 0)
                    {
                        TempData["DuplicateProduct"] = "You have entered a duplicate product, please enter a new product.";
                        return(View());
                    }
                    else
                    {
                        //left as int for testing purposes
                        int recordsCreated = ProductProcessor.UpdateProduct(model.ProductID, model.ProductName, model.Manufacturer,
                                                                            model.Style, model.PurchasePrice, model.SalePrice, model.Qty, model.CommissionPercentage);
                        return(RedirectToAction("ViewProduct"));
                    }
                }
            }

            return(View());
        }
コード例 #21
0
        public ActionResult AddProduct(ProductModel productModel)
        {
            if (ModelState.IsValid)
            {
                //Saving image to folder
                string fileName  = Path.GetFileNameWithoutExtension(productModel.ImageFile.FileName);
                string extension = Path.GetExtension(productModel.ImageFile.FileName);
                fileName = fileName + DateTime.Now.ToString("yymmssfff") + extension;
                productModel.ImagePath = "~/Images/" + fileName;
                fileName = Path.Combine(Server.MapPath("~/Images/"), fileName);
                productModel.ImageFile.SaveAs(fileName);

                //Saving Product to database
                int recordsCreated = ProductProcessor.CreateProduct(productModel.ProductCode, productModel.Description, productModel.UnitOfMeasure,
                                                                    productModel.Category, productModel.Price, productModel.ImageTitle, productModel.ImagePath, productModel.IsActive);
                return(RedirectToAction("ListProducts"));
            }
            return(View());
        }
コード例 #22
0
        public ActionResult ShowProduct(int productId)
        {
            if (IsActiveSession())
            {
                var data = ProductProcessor.GetProduct(productId);
                List <ProductModel> products = new List <ProductModel>();
                ProductModel        product  = new ProductModel
                {
                    Id            = data.Id,
                    ProductCode   = data.ProductCode,
                    Description   = data.Description,
                    UnitOfMeasure = data.UnitOfMeasure,
                    Category      = data.Category,
                    Price         = data.Price,
                    ImageTitle    = data.ImageTitle,
                    ImagePath     = data.ImagePath,
                    IsActive      = data.IsActive
                };
                products.Add(product);
                if (TempData["productAdded"] != null)
                {
                    ViewBag.productAdded = (bool)TempData["productAdded"];
                }
                else
                {
                    ViewBag.productAdded = false;
                }

                //getting cart products
                int userId = (int)Session["userId"];
                List <CartProductsModel> cartProducts = GetCartProducts(userId);

                //setting store products
                StoreViewModel storeViewModel = new StoreViewModel
                {
                    StoreProducts = products,
                    CartProducts  = cartProducts
                };
                return(View(storeViewModel));
            }
            return(RedirectToAction("Login", "Login", null));
        }
コード例 #23
0
ファイル: OrderServices.cs プロジェクト: IdeaFortune/Monaco
        public bool ProcessOrder(Guid userID, Guid cardID, string sku, bool isTest, string sessionID)
        {
            Product product = ProductController.GetProduct(sku);
           
            // create order item...
            OrderItem item = new OrderItem(sku, userID, cardID, isTest, sessionID);

            ProductProcessor processor = new ProductProcessor(item);

            //processor.OrderSuccess += new OrderSuccessEventHandler(processor_OrderSuccess);
            //processor.OrderFailure += new OrderFailureEventHandler(processor_OrderFailure);
            processor.OrderSuccess +=new OrderSuccessEventHandler(processor_OrderSuccess);
            processor.OrderFailure +=new OrderFailureEventHandler(processor_OrderFailure);
            processor.Process();

            ProductType prodType = ProductController.GetProductType(product.TypeId);

            return
                ProductController.Providers[prodType.ProviderName].PassedStatus <= processor.Order.Status;

        }
コード例 #24
0
 public ActionResult ProductDetail(int id)
 {
     if (IsActiveSession())
     {
         var          data    = ProductProcessor.GetProduct(id);
         ProductModel product = new ProductModel
         {
             Id            = data.Id,
             ProductCode   = data.ProductCode,
             Description   = data.Description,
             UnitOfMeasure = data.UnitOfMeasure,
             Category      = data.Category,
             Price         = data.Price,
             ImageTitle    = data.ImageTitle,
             ImagePath     = data.ImagePath,
             IsActive      = data.IsActive
         };
         return(View(product));
     }
     return(RedirectToAction("Login", "Login", null));
 }
コード例 #25
0
        /// <summary>
        ///  更新商品请求
        /// </summary>
        /// <param name="productID"> </param>
        /// <param name="categoryInfo"> </param>
        /// <returns></returns>
        public void ProductChangeCategory(string productID, CategoryInfo categoryInfo, UserInfo operateUser)
        {
            ProductProcessor productBp = new ProductProcessor();

            ProductInfo product = productBp.GetProductInfoByID(productID);

            if (product == null)
            {
                //商品不存在
                throw new BizException(ResouceManager.GetMessageString("IM.Product", "ProductIDNotExist"));
            }



            #region 类别处理

            var group = _productGroupDA.GetProductGroup(product.SysNo);
            group.OperateUser   = operateUser;
            product.OperateUser = operateUser;

            if (product.ProductBasicInfo.ProductCategoryInfo.SysNo != categoryInfo.SysNo)
            {
                if (product.ProductBasicInfo.ProductCategoryInfo.SysNo.HasValue)
                {
                    if (_categoryPropertyDA.GetCategoryPropertyByCategorySysNo(
                            product.ProductBasicInfo.ProductCategoryInfo.SysNo.Value).Any(sourceCategoryProperty => !_categoryPropertyDA.GetCategoryPropertyByCategorySysNo(
                                                                                              product.ProductBasicInfo.ProductCategoryInfo.SysNo.Value).Any(p => p.Property.SysNo == sourceCategoryProperty.Property.SysNo)))
                    {
                        throw new BizException(ResouceManager.GetMessageString("IM.Category", "ProductChangeCategoryResult"));
                    }

                    product.ProductBasicInfo.ProductCategoryInfo = categoryInfo;

                    productBp.UpdateGroupProductCategoryInfo(group, product);
                }
            }

            #endregion
        }
コード例 #26
0
        public void btnRefer_Click(object sender, EventArgs e)
        {
            ProductConsultationInfo target = new ProductConsultationInfo();

            target.ConsultationDate = DateTime.Now;
            target.ProductId        = this.productId;
            target.UserId           = HiContext.Current.User.UserId;
            target.UserName         = this.txtUserName.Text;
            target.UserEmail        = this.txtEmail.Text;
            target.ConsultationText = Globals.HtmlEncode(this.txtContent.Text);
            ValidationResults results = Hishop.Components.Validation.Validation.Validate <ProductConsultationInfo>(target, new string[] { "Refer" });
            string            msg     = string.Empty;

            if (!results.IsValid)
            {
                foreach (ValidationResult result in (IEnumerable <ValidationResult>)results)
                {
                    msg = msg + Formatter.FormatErrorMessage(result.Message);
                }
                this.ShowMessage(msg, false);
            }
            else if (string.IsNullOrEmpty(this.txtConsultationCode.Value))
            {
                this.ShowMessage("请输入验证码", false);
            }
            else if (!HiContext.Current.CheckVerifyCode(this.txtConsultationCode.Value.Trim()))
            {
                this.ShowMessage("验证码不正确", false);
            }
            else if (ProductProcessor.InsertProductConsultation(target))
            {
                this.Page.ClientScript.RegisterClientScriptBlock(base.GetType(), "success", string.Format("<script>alert(\"{0}\");window.location.href=\"{1}\"</script>", "咨询成功,管理员回复即可显示", Globals.GetSiteUrls().UrlData.FormatUrl("productConsultations", new object[] { this.productId })));
            }
            else
            {
                this.ShowMessage("咨询失败,请重试", false);
            }
        }
コード例 #27
0
        public ActionResult Products()
        {
            ViewBag.Message = "Display Products.";

            var data = ProductProcessor.LoadProducts();
            List <ProductModel> products = new List <ProductModel>();

            data.ForEach(row =>
            {
                products.Add(new ProductModel
                {
                    Id           = row.Id,
                    ProductName  = row.ProductName,
                    SupplierName = row.SupplierName,
                    URL          = row.URL,
                    Username     = row.Username,
                    Password     = row.Password
                });
            });


            return(View(products));
        }
コード例 #28
0
        public ActionResult CreateProduct(ProductModel model)
        {
            if (ModelState.IsValid)
            {
                List <DataLibrary.Models.ProductModel> products = ProductProcessor.LoadProducts();

                products = products.Where(a => a.ProductID == model.ProductID || a.ProductName == model.ProductName).ToList();

                if (products.Count() > 0)
                {
                    TempData["DuplicateProduct"] = "You have entered a duplicate product, please enter a new product.";
                    return(View());
                }
                else
                {
                    //left as int for testing purposes
                    int recordsCreated = ProductProcessor.CreateProduct(model.ProductID, model.ProductName, model.Manufacturer,
                                                                        model.Style, model.PurchasePrice, model.SalePrice, model.Qty, model.CommissionPercentage);
                    return(RedirectToAction("ViewProduct"));
                }
            }
            return(View());
        }
コード例 #29
0
        public ActionResult Index()
        {
            if (IsActiveSession())
            {
                //getting store products
                var data = ProductProcessor.LoadProducts();
                List <ProductModel> products = new List <ProductModel>();
                foreach (var row in data)
                {
                    products.Add(new ProductModel
                    {
                        Id            = row.Id,
                        ProductCode   = row.ProductCode,
                        Description   = row.Description,
                        UnitOfMeasure = row.UnitOfMeasure,
                        Category      = row.Category,
                        Price         = row.Price,
                        ImageTitle    = row.ImageTitle,
                        ImagePath     = row.ImagePath,
                        IsActive      = row.IsActive
                    });
                }

                //getting cart products
                int userId = (int)Session["userId"];
                List <CartProductsModel> cartProducts = GetCartProducts(userId);

                //setting store products
                StoreViewModel storeViewModel = new StoreViewModel
                {
                    StoreProducts = products,
                    CartProducts  = cartProducts
                };
                return(View(storeViewModel));
            }
            return(RedirectToAction("Login", "Login", null));
        }
コード例 #30
0
        public ActionResult ViewProduct()
        {
            ViewBag.Message = "View product page.";

            var data = ProductProcessor.LoadProducts();
            List <ProductModel> products = new List <ProductModel>();

            foreach (var row in data)
            {
                products.Add(new ProductModel
                {
                    ProductID            = row.ProductID,
                    ProductName          = row.ProductName,
                    Manufacturer         = row.Manufacturer,
                    Style                = row.Style,
                    PurchasePrice        = row.PurchasePrice,
                    SalePrice            = row.SalePrice,
                    Qty                  = row.Qty,
                    CommissionPercentage = row.CommissionPercentage
                });
            }

            return(View(products));
        }
コード例 #31
0
 public void btnRefer_Click(object sender, EventArgs e)
 {
     if (this.ValidateConvert())
     {
         Dictionary <string, string> dictionary = new Dictionary <string, string>();
         foreach (RepeaterItem item in this.orderItems.Items)
         {
             HtmlTextArea    area   = item.FindControl("txtcontent") as HtmlTextArea;
             HtmlInputHidden hidden = item.FindControl("hdproductId") as HtmlInputHidden;
             if (!string.IsNullOrEmpty(area.Value.Trim()) && !string.IsNullOrEmpty(hidden.Value.Trim()))
             {
                 dictionary.Add(hidden.Value, area.Value);
             }
         }
         if (dictionary.Count <= 0)
         {
             this.ShowMessage("请输入评价内容呀!", false);
         }
         else
         {
             string msg = "";
             foreach (KeyValuePair <string, string> pair in dictionary)
             {
                 int               productId = Convert.ToInt32(pair.Key.Split(new char[] { '&' })[0].ToString());
                 string            str2      = pair.Value;
                 ProductReviewInfo target    = new ProductReviewInfo();
                 target.ReviewDate = DateTime.Now;
                 target.ProductId  = productId;
                 target.UserId     = HiContext.Current.User.UserId;
                 target.UserName   = HiContext.Current.User.Username;
                 target.UserEmail  = HiContext.Current.User.Email;
                 target.ReviewText = str2;
                 ValidationResults results = Hishop.Components.Validation.Validation.Validate <ProductReviewInfo>(target, new string[] { "Refer" });
                 msg = string.Empty;
                 if (!results.IsValid)
                 {
                     foreach (ValidationResult result in (IEnumerable <ValidationResult>)results)
                     {
                         msg = msg + Formatter.FormatErrorMessage(result.Message);
                     }
                     break;
                 }
                 if (!ProductProcessor.ProductExists(productId))
                 {
                     msg = "您要评论的商品已经不存在";
                     break;
                 }
                 int buyNum    = 0;
                 int reviewNum = 0;
                 ProductBrowser.LoadProductReview(productId, out buyNum, out reviewNum);
                 if (buyNum == 0)
                 {
                     msg = "您没有购买此商品,因此不能进行评论";
                     break;
                 }
                 if (reviewNum >= buyNum)
                 {
                     msg = "您已经对此商品进行了评论,请再次购买后方能再进行评论";
                     break;
                 }
                 if (!ProductProcessor.InsertProductReview(target))
                 {
                     msg = "评论失败,请重试";
                     break;
                 }
             }
             if (msg != "")
             {
                 this.ShowMessage(msg, false);
             }
             else
             {
                 this.Page.ClientScript.RegisterClientScriptBlock(base.GetType(), "success", string.Format("<script>alert(\"{0}\");window.location.href=\"{1}\"</script>", "评论成功", Globals.GetSiteUrls().UrlData.FormatUrl("user_UserProductReviews")));
             }
         }
     }
 }
コード例 #32
0
ファイル: Checkout.ascx.cs プロジェクト: IdeaFortune/Monaco
    protected void CheckoutButton_Click(object sender, EventArgs e)
    {
        TermsAndConditionsValidator.Validate();

        //Start processing only if, "Agree to terms and conditions" checkbox is checked.
        if (chkAgree.Checked)
        {
            // get the credit card...
            CreditCardInfo card = GetCreditCard();

            bool testMode = Page.User.IsInRole("Admin");

            try
            {
               Cathexis.Products.Provider.Product product = ProductController.GetProduct(this.Sku);

                //OrderItem item = new OrderItem(this.Sku, (Guid)Membership.GetUser().ProviderUserKey, card.Id, testMode, Globals.Settings.LandingPages.LandingPageID, Session.SessionID, product.TypeId);
               Cathexis.Entities.OrderItem item = new Cathexis.Entities.OrderItem(this.Sku, (Guid)Membership.GetUser().ProviderUserKey, card.Id, MembershipSettings.ConfigSettings.Website.Debug, Session.SessionID);

                ProductProcessor processor = new ProductProcessor(item);

                processor.OrderFailure += new OrderFailureEventHandler(processor_OrderFailure);
                processor.OrderSuccess += new OrderSuccessEventHandler(processor_OrderSuccess);

                processor.Process();

                // this needs to be replaced by some sort of concrete implementation
                // this would only work given that status=4 would compromise a successful completion of the order
                if (item.Status == 4)
                    processor.OnOrderSuccess(new OrderSuccessEventArgs(item));
                else
                    processor.OnOrderFailure(new OrderFailureEventArgs("unable to complete transaction"));
            }
            catch (OrderSaveException ex)
            {
                // raise a critical event...
                if (ex.InnerException != null)
                    this.ErrorMessage.Text = ex.InnerException.Message;
            }
        }
    }
コード例 #33
0
    protected void CreateEnrollmentDialog_OkButtonClicked(object sender, EventArgs e)
    {
        EnrollmentValidator.Validate();
        Guid cardId;
        Guid userId;
        string sku;

        if (base.Page.IsValid)
        {
            if (!string.IsNullOrEmpty(CreditCardDropdown.SelectedValue.ToString()))
                cardId = new Guid(CreditCardDropdown.SelectedValue.ToString());
            else
                cardId = new Guid();

            //userId = (Guid)Membership.GetUser().ProviderUserKey;
            userId = (Guid)Membership.GetUser(UserName).ProviderUserKey;
            sku = SKUDropDownList.SelectedValue.ToString();

            if (!chkFree.Checked)
            {
                try
                {
                    OrderItem item = new OrderItem(sku, userId, false, Guid.NewGuid(), Session.SessionID, Guid.NewGuid());
                    ProductProcessor processor = new ProductProcessor(item);
                    processor.Process();
                }
                catch (Exception ex)
                {
                    // Create the event
                    CriticalTransactionEvent transactionException = new CriticalTransactionEvent(
                                  "Error in the Transaction!!",
                                  this,
                                  System.Web.Management.WebEventCodes.WebExtendedBase + 1230251,
                                  ex);

                    // Raise the event
                    transactionException.Raise();
                }
            }
            else
            {
                ClassroomController.InsertEnrollment(userId, sku);
            }
            OnEnrollmentCreated(e);
            CreateEnrollmentDialog.Reset();
            BindDialog();
            DataBind();
        }
        else
        {

            ValidationHelper.SetFocusToFirstError(this.Page, "create_enrollment");
        }
    }