public override int GetHashCode() { int hash = 1; if (ProductName.Length != 0) { hash ^= ProductName.GetHashCode(); } if (ProductType.Length != 0) { hash ^= ProductType.GetHashCode(); } if (ProductDesc.Length != 0) { hash ^= ProductDesc.GetHashCode(); } if (Price != 0) { hash ^= Price.GetHashCode(); } if (UserName.Length != 0) { hash ^= UserName.GetHashCode(); } if (UserWelcome.Length != 0) { hash ^= UserWelcome.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
private async Task <IActionResult> DoSell(SellToCustomerViewModel model) { var loginUser = await GetCurrentUserAsync(); ProductDesc productDesc = await _applicationDbContext.ProductDesc .Where(m => m.ID.Equals(model.MattressTypeID, StringComparison.InvariantCultureIgnoreCase)) .FirstOrDefaultAsync(); Mattress mattress = new Mattress { ID = model.MattressID, TypeDesc = productDesc, RegisterDate = model.SaleDate, SaleDate = model.SaleDate, }; SaleToCustomerDetail saleToCustomerDetail = new SaleToCustomerDetail { Gifts = model.Gifts, DeliveryAddress = model.DeliveryAddress, Prodect = mattress, Price = productDesc.Price }; SaleToCustomer saleToCustomer = new SaleToCustomer { ID = IDGenerator.GetSaleToCustomerIDGenerator(_applicationDbContext).GetNext(), Customer = new Member { MemberID = model.CustomerID }, SellingAgents = new Member { MemberID = loginUser.UserName }, DealDate = model.SaleDate, }; saleToCustomerDetail.Sale = saleToCustomer; saleToCustomer.DetailItems.Add(saleToCustomerDetail); _applicationDbContext.Mattress.Add(mattress); _applicationDbContext.SaleToCustomer.Add(saleToCustomer); _applicationDbContext.SaleToCustomeDetails.Add(saleToCustomerDetail); var pointItems = await AddMemberPoint(saleToCustomerDetail); _applicationDbContext.SaveChanges(); return(Json(new { saleToCustomerID = saleToCustomer.ID, memberPointItems = pointItems, sellMattressData = new { MattressID = mattress.ID, MattressTypeName = mattress.TypeDesc.Name, DeliveryAddress = saleToCustomerDetail.DeliveryAddress, CustomerID = saleToCustomer.Customer.MemberID, SaleDate = saleToCustomer.DealDate.Date.ToString("yyyy'-'MM'-'dd"), Gifts = saleToCustomerDetail.Gifts } })); }
public void GetFrom(Product product, ProductDesc productDesc, List<ProductPhoto> productPhotoList, List<Sku> skuList, StringBuilder errorMsg) { //基本信息 FormItem<int> ProductIdItem = new FormItem<int>("ProductId", "产品编号", 0, 10, 0); FormItem<int> ProductTypeItem = new FormItem<int>("ProductType", "所属类型", 0, 3, 0); FormItem<string> ProductNameItem = new FormItem<string>("ProductName", "商品名称", 2, 30); FormItem<string> SubNameItem = new FormItem<string>("SubName", "商品卖点", 0, 30, ""); FormItem<string> ZscItem = new FormItem<string>("Zsc", "商品编码", 0, 10,""); FormItem<decimal> PriceItem = new FormItem<decimal>("Price", "一口价", 0, 100000); FormItem<decimal> AmountItem = new FormItem<decimal>("Amount", "商品数量", 0, 100000); product.ProductId = ProductIdItem.GetFormValue(errorMsg); product.ProductType = ProductTypeItem.GetFormValue(errorMsg); product.ProductName = ProductNameItem.GetFormValue(errorMsg); product.SubName = SubNameItem.GetFormValue(errorMsg); product.Zsc = ZscItem.GetFormValue(errorMsg); product.Price = PriceItem.GetFormValue(errorMsg); product.Amount = AmountItem.GetFormValue(errorMsg); DateTime dt=DateTime.Now; product.CreateTime = dt; product.UpdateTime = dt; product.StartTime = dt; product.EndTime = dt; //产品说明 FormItem<string> DescItem = new FormItem<string>("Desc", "商品详细", 0, 25000); productDesc.Desc = DescItem.GetFormValue(errorMsg); }
// purchases void OnShopPurchaseComplete(object sender, InstantMessageArgs args) { ProductDesc product = (ProductDesc)args.arg; if (product != null) { decimal coins = GlobalManager.MStorage.CurrentCoins; AddCoins(ref coins, product.value.value); GlobalManager.MStorage.CurrentCoins = coins; GlobalManager.MInstantMessage.DeliverMessage(InstantMessageType.GUIRotoCoinsChanged, this, GlobalManager.MStorage.CurrentCoins); } }
protected override void AwakeInit() { dialogMode = false; ProductDesc product = GlobalManager.MPurchase.ProductById(entryId); if (product != null) { entryNameText.text = product.localizedDescription; entryValueText.text = product.localizedPrice; } registrator.Add( new MessageRegistrationTuple { type = InstantMessageType.GUIOKButtonPressed, handler = OnGUIOKButtonPressed }, new MessageRegistrationTuple { type = InstantMessageType.GUICancelButtonPressed, handler = OnGUICancelButtonPressed } ); }
internal void AddNewProduct() { ExcelLib.PopulateInCollection(InventoryTest.ExcelPath, "ProductPage"); Thread.Sleep(2000); //Select Invenotory menu Invetory.Click(); Thread.Sleep(2000); //Select Product menu Product.Click(); Thread.Sleep(2000); //Select Add New Product from menu AddProduct.Click(); Thread.Sleep(2000); //sending product code ProductCode.SendKeys(ExcelLib.ReadData(2, "ProductCode")); Thread.Sleep(1000); //sending product desc ProductDesc.SendKeys(ExcelLib.ReadData(2, "ProductDesc")); Thread.Sleep(1000); //sending barcode Barcode.SendKeys(ExcelLib.ReadData(2, "Barcode")); Thread.Sleep(1000); //sending Unitof measure //UnitOfMesureClick.Click(); //Thread.Sleep(2000); //UnitOfMesure.SendKeys(ExcelLib.ReadData(2, "UnitOfMesure")); var UnitOfMesure = CommonMethods.driver.FindElement(By.Id("Product_UnitOfMeasureId")); var selectUnitOfMesure = new SelectElement(UnitOfMesure); Thread.Sleep(1000); selectUnitOfMesure.SelectByText(ExcelLib.ReadData(2, "UnitOfMesure")); //sending Product group //ProductGrp.SendKeys(ExcelLib.ReadData(2, "ProductGroup")); var ProductGrpList = CommonMethods.driver.FindElement(By.Id("Product_ProductGroupId")); var selectProGrpVal = new SelectElement(ProductGrpList); Thread.Sleep(1000); selectProGrpVal.SelectByText(ExcelLib.ReadData(2, "ProductGroup")); Thread.Sleep(1000); //sending Pack size PackSize.SendKeys(ExcelLib.ReadData(2, "PackSize")); Thread.Sleep(1000); //Sending Weight ProductWeight.SendKeys(ExcelLib.ReadData(2, "ProductWeight")); Thread.Sleep(1000); //Sending Product width ProductWidth.SendKeys(ExcelLib.ReadData(2, "ProductWidth")); Thread.Sleep(1000); //sending Product Height ProductHeight.SendKeys(ExcelLib.ReadData(2, "ProductHeight")); Thread.Sleep(1000); //sending ProductDepth ProductDepth.SendKeys(ExcelLib.ReadData(2, "ProductDepth")); Thread.Sleep(1000); ////select Types //NeverDimishing.Click(); //Thread.Sleep(1000); ////CommonMethods.driver.SwitchTo().Alert().Dismiss(); //Obsolete.Click(); //Thread.Sleep(1000); ////CommonMethods.driver.SwitchTo().Alert().Dismiss(); //Sending Notes Notes.SendKeys(ExcelLib.ReadData(2, "Notes")); //savedata SaveBtn.Click(); Thread.Sleep(2000); ProductView.Click(); Thread.Sleep(1000); ProductCodeFilter.SendKeys(ExcelLib.ReadData(2, "ProductCode")); Thread.Sleep(1000); //press enter ProductCodeFilter.SendKeys(Keys.Enter); Thread.Sleep(4000); try { //verify record is added if (ExcelLib.ReadData(2, "ProductCode") == CommonMethods.driver.FindElement(By.XPath(".//*[@id='ProductList_tccell0_2']/div/a")).Text) { if (ExcelLib.ReadData(2, "ProductDesc") == CommonMethods.driver.FindElement(By.XPath(".//*[@id='ProductList_tccell0_3']/div/a")).Text) { if (ExcelLib.ReadData(2, "ProductGrp") == CommonMethods.driver.FindElement(By.XPath(".//*[@id='ProductList_tccell0_3']/div/a")).Text) { SaveScreenShotClass.SaveScreenshot(CommonMethods.driver, "Found Added Product "); } } } else { SaveScreenShotClass.SaveScreenshot(CommonMethods.driver, "No record found "); } } catch (Exception e) { Console.WriteLine("Can not find added Product,Test failed" + e.Message); } }
public ActionResult ProductEdit(Product product) { ResultInfo resultInfo = new ResultInfo(1, "验证不通过"); if (ModelState.IsValid) { Product oldProduct = _productService.GetById(product.ProductId); ProductDesc productDetail = new ProductDesc(); List<ProductPhoto> productPhotoList = new List<ProductPhoto>(); List<Sku> skuList = new List<Sku>(); if (oldProduct == null) { return Json(new ResultInfo(1, "该信息已被删除或不存在,请刷新列表!")); } oldProduct.ProductName = product.ProductName; oldProduct.Photo = product.Photo; resultInfo = _productService.Edit(oldProduct, productDetail, productPhotoList, skuList); } return Json(resultInfo); }
public ResultInfo Edit(Product product, ProductDesc productDesc, List<ProductPhoto> productPhotoList, List<Sku> skuList) { _productRepository.Update(product); return new ResultInfo("修改成功"); }
private async Task <ActionResult> DoSell(SellToCustomerViewModel model) { var loginUser = await GetCurrentUserAsync(); ProductDesc productDesc = await AppDbContext.ProductDesc .Where(m => m.ID.Equals(model.MattressTypeID, StringComparison.InvariantCultureIgnoreCase)) .FirstOrDefaultAsync(); Mattress mattress = new Mattress { ID = model.MattressID, TypeDesc = productDesc, RegisterDate = model.SaleDate, SaleDate = model.SaleDate, }; SaleToCustomerDetail saleToCustomerDetail = new SaleToCustomerDetail { Gifts = model.Gifts, DeliveryAddress = model.DeliveryAddress, Prodect = mattress, Price = productDesc.Price, CashCoupon = model.IsUseCashCoupon ? 1000 : 0 }; SaleToCustomer saleToCustomer = new SaleToCustomer { ID = IDGenerator.GetSaleToCustomerIDGenerator(AppDbContext).GetNext(), Customer = this.AppDbContext.FindOrAttachToLocal(model.CustomerID), SellingAgents = this.AppDbContext.FindOrAttachToLocal(loginUser.UserName), DealDate = model.SaleDate, }; saleToCustomerDetail.Sale = saleToCustomer; saleToCustomer.DetailItems.Add(saleToCustomerDetail); // this.AppDbContext.TryToAttach(saleToCustomer.Customer, (l, r) => r.MemberID.Equals(l.MemberID)); // this.AppDbContext.TryToAttach(saleToCustomer.SellingAgents, (l, r) => r.MemberID.Equals(l.MemberID)); //AppDbContext.Members.Attach(saleToCustomer.Customer); // AppDbContext.Members.Attach(saleToCustomer.SellingAgents); AppDbContext.Mattress.Add(mattress); AppDbContext.SaleToCustomer.Add(saleToCustomer); AppDbContext.SaleToCustomeDetails.Add(saleToCustomerDetail); var pointItems = await AddMemberPoint(saleToCustomerDetail); AppDbContext.SaveChanges(); return(Json(new { saleToCustomerID = saleToCustomer.ID, memberPointItems = pointItems, sellMattressData = new { MattressID = mattress.ID, MattressTypeName = mattress.TypeDesc.DisplayName, DeliveryAddress = saleToCustomerDetail.DeliveryAddress, CustomerID = saleToCustomer.Customer.MemberID, SaleDate = saleToCustomer.DealDate.Date.ToString("yyyy'-'MM'-'dd"), Gifts = saleToCustomerDetail.Gifts, IsUseCashCoupon = model.IsUseCashCoupon }, JsonRequestBehavior.AllowGet })); }