private void StartOrderMethod() { switch (SelectedProduct.ProductOrderState) { case ProductOrderState.Processing: SelectedProduct.IsCanceled = true; return; case ProductOrderState.Done: System.Windows.MessageBox.Show("your order was completed", ""); return; case ProductOrderState.Canceled: SelectedProduct.IsCanceled = true; return; case ProductOrderState.Srart: break; } SelectedProduct.prepare(); SelectedProduct.ProductOrderState = ProductOrderState.Processing; }
//Sepete Ekle public ActionResult AddToCart(Guid id) { //addtocart diye id parametreli bir metot oluşturduk,ve başında bi karar yapısı kıllandık ,dedik ki session[sbasket] null ise basketin instance ını al yeniden oluştur,eğer null değilse sessiona cast işlemi yaparak onun basket tipinde davranması gerektiğini söyledik Basket b = Session["sbasket"] == null ? new Basket() : Session["sbasket"] as Basket; Product eklenecekUrun = productService.GetById(id); SelectedProduct sp = new SelectedProduct(); sp.ID = eklenecekUrun.ID; sp.Name = eklenecekUrun.Name; sp.Price = Convert.ToDecimal(eklenecekUrun.Price); //decimala convert ettik çünkü selectedproducttaki price decimal tanımlanmış.ama product ilk tanımlandığında price decimal tanımlanmamış. b.AddProduct(sp); //basket tipinde b oluşturmuştuk bunun içine ürün attık. Session["sbasket"] = b; //bu toplam ürün basketinide sessiona attık. if (appUserService.Any(x => x.Role == (Role)1))//giren kişinin ziyaretçi olduğu durumda ne yapması gerektiğini söyledim { Session["ziyaretci"] = (Role)1; return(View("Index", "Home")); } return(RedirectToAction("Index", "Home")); }
public string SelectPruduct() { PageNumberButton.Click(); SelectedProduct.Click(); string SelectedProductTitle = webdriver.Title; return(SelectedProductTitle); }
private async Task OnUpdateProductCommandExecuteAsync() { var typeFactory = this.GetTypeFactory(); var viewModel = typeFactory.CreateInstanceWithParametersAndAutoCompletion <ProductUpdateWindowViewModel>(SelectedProduct); if (await _uiVisualizerService.ShowDialogAsync(viewModel) ?? false) { SelectedProduct.Save(); } }
private bool CanExecuteAddProduct() { if (SelectedProduct == null) { return(false); } else { return(SelectedProduct.IsValid()); } }
public virtual async Task <ManageStockPostApiResponse> AllocateUnitsToDsr(SelectedProduct selectedProduct) { ServerResponse <ManageStockPostApiResponse> result = await this._stockAllocationApi.PostObjectAsync <ManageStockPostApiResponse, SelectedProduct>(selectedProduct); if (result == null) { return(null); } return(result.GetObject()); }
public virtual async Task <ManageStockPostApiResponse> ReceiveStockFromDsr(SelectedProduct selectedProducts) { ServerResponse <ManageStockPostApiResponse> result = await this._recieveAllocatedStockApi.PostObjectAsync <ManageStockPostApiResponse, SelectedProduct>(selectedProducts); if (result == null) { return(null); } return(result.GetObject()); }
private async Task DeleteSelectedItemAsync() { if (SelectedProduct.IsNew) { _products.Remove(SelectedProduct); } else { await SelectedProduct.DeleteAsync(); } }
private async void SaveProduct() { if (SelectedProduct == null || !SelectedProduct.IsValid()) { Error = "Product niet toegevoegd of gewijzigd, hou rekening met de meldingen."; return; } else { Error = ""; } SelectedProduct.Available = true; string input = JsonConvert.SerializeObject(SelectedProduct); // check insert (no ID assigned) or update (already an ID assigned) if (SelectedProduct.ID == 0) { using (HttpClient client = new HttpClient()) { client.SetBearerToken(ApplicationVM.token.AccessToken); HttpResponseMessage response = await client.PostAsync("http://localhost:55853/api/product", new StringContent(input, Encoding.UTF8, "application/json")); if (response.IsSuccessStatusCode) { string output = await response.Content.ReadAsStringAsync(); SelectedProduct.ID = Int32.Parse(output); } else { Console.WriteLine("error"); } } } else { using (HttpClient client = new HttpClient()) { client.SetBearerToken(ApplicationVM.token.AccessToken); HttpResponseMessage response = await client.PutAsync("http://localhost:55853/api/product", new StringContent(input, Encoding.UTF8, "application/json")); if (!response.IsSuccessStatusCode) { Console.WriteLine("error"); } } } }
private async void SaveProductEdit() { try { SelectedProduct.CopyFrom(EditableProduct); await _service.UpdateProductAsync((ProductDto)SelectedProduct); } catch (Exception ex) when(ex is NetworkException || ex is HttpRequestException) { OnMessageApplication($"Unexpected error occured! ({ex.Message})"); } LoadProductAsync(SelectedSubCat); FinishingProductEdit?.Invoke(this, EventArgs.Empty); }
public void CalculateSelectedProduct(SelectedProduct selectedProduct) { var isWholesale = HttpContext.Current.User.IsInRole("Wholesale"); if (isWholesale) { selectedProduct.Price = selectedProduct.Product.Price * (1 - WHOLESALE_DISCOUNT_RATE); selectedProduct.CalculatePrice = selectedProduct.Price * selectedProduct.Amount; } else { selectedProduct.Price = selectedProduct.Product.Price; selectedProduct.CalculatePrice = selectedProduct.Price * selectedProduct.Amount; } }
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { ValueProviderResult value = bindingContext.ValueProvider.GetValue(bindingContext.ModelName); SelectedProduct selectedProduct = new SelectedProduct(); if (value.AttemptedValue != null && !"".Equals(value.AttemptedValue)) { selectedProduct.Id = (int)value.ConvertTo(typeof(int)); } else { selectedProduct.Id = null; } return(selectedProduct); }
public void AddProductToCart(int idCustomer, SelectedProduct selectedProduct) { if (selectProductRequestNumber == 0) { startTime = DateTime.Now; } var cart = EnsureCustomerCartExists(idCustomer); cart.CustomerCart.Add(selectedProduct); _logger.LogInformation($"Product with ID {selectedProduct.IdProduct} and {selectedProduct.NumUnits} added to customer {idCustomer}'s cart!"); selectProductRequestNumber++; var totalTime = (DateTime.Now - startTime).TotalSeconds; var averageTime = totalTime / selectProductRequestNumber; _logger.LogInformation($"Average time to process select product request: {averageTime:G2}s"); }
public void UpdateProductQuantity() { if (NewQuantity <= SelectedProduct.QuantityInStock) { SelectedProduct.ItemQuantity = NewQuantity; SelectedProduct.NotifyOfPropertyChange(() => SelectedProduct.Tax); SelectedProduct.NotifyOfPropertyChange(() => SelectedProduct.SubTotal); SelectedProduct.NotifyOfPropertyChange(() => SelectedProduct.Total); NotifyOfPropertyChange(() => Cart); NotifyOfPropertyChange(() => TotalSubTotal); NotifyOfPropertyChange(() => TotalTax); NotifyOfPropertyChange(() => TotalTotal); } else { MessageBox.Show($"{SelectedProduct.QuantityInStock} items left in stock!\nTry different quantity. Thank you!"); } }
public void AddSale() { if (SelectedProduct != null) { ObservableCollection <Data.RecipeItem> recipes = new ObservableCollection <Data.RecipeItem>(_iRecipeRepo.GetRecipes() .Where(recipe => recipe.Product.ID.Equals(SelectedProduct.ID))); bool isAddSalePossible = true; for (int i = 0; i < Amount; i++) { isAddSalePossible = true; foreach (Data.RecipeItem recipe in recipes) { Data.Ingredient ingredient = recipe.Ingredient; if (ingredient.Amount < recipe.Amount) { isAddSalePossible = false; ErrorHandler.ThrowError(0, $"{Properties.Resources.ToLittleOf}: {recipe.Ingredient.Name}"); } } if (isAddSalePossible) { foreach (Data.RecipeItem recipe in recipes) { Data.Ingredient ingredient = recipe.Ingredient; ingredient.Amount -= recipe.Amount; _iIngredientRepo.UpdateIngredient(ingredient); } Data.Sale sale = new Data.Sale() { Cooked = 0, Delivered = 0, Paid = 0, Product = SelectedProduct.ConvertToData() }; _iOccupanciesRepo.AddSale(_occupancy, sale); MessageHandler.InvokeSuccessMessage(Properties.Resources.InformationAddSale, Properties.Resources.InformationSaleAdded.Replace("{product}", $"{SelectedProduct.Name}")); } } ViewBack(); } }
public async Task <ManageStockPostApiResponse> AllocateSelectedUnits() { this.ProgressDialogMessage = this._deviceResource.PleaseWait; this.IsBusy = true; SelectedProduct product = new SelectedProduct { DsrPhone = this.DsrPhoneNumber, PersonId = this.DsrStock.PersonId, PersonRoleId = this.DsrStock.PersonRoleId }; List <string> units = new List <string>(); foreach (var unit in this.SelectedUnits) { units.Add(unit.SerialNumber); } ScmStock scmStock = new ScmStock { ProductTypeId = this.SelectedProduct.ProductTypeId, SerialNumbers = units }; product.Units = new List <ScmStock> { scmStock }; ManageStockPostApiResponse response = await this.DsrStockAllocationService.AllocateUnitsToDsr(product); this.IsBusy = false; if (response == null) { return(new ManageStockPostApiResponse { Success = false, Text = this._deviceResource.UnitsCouldNotBeAllocated }); } return(response); }
public void Create(SelectedProduct s) { _context.SelectedProducts.Add(s); _context.SaveChanges(); }
private void StartEditProduct() { EditableProduct = SelectedProduct.ShallowClone(); StartingProductEdit?.Invoke(this, EventArgs.Empty); }
private void OnDeleteProductCommandExecute() { SelectedProduct.Remove(); Products.Remove(SelectedProduct); SelectedProduct = null; }
private void FormFZC_Load(object sender, EventArgs e) { try { if (AllProduct == null) { List <View_P_AssemblingBom> list = new List <View_P_AssemblingBom>(); DataTable dt = m_preventErrorServer.GetAllAssemblingBom(m_productType); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { View_P_AssemblingBom assembling = new View_P_AssemblingBom(); assembling.父总成名称 = dt.Rows[i]["分总成名称"].ToString(); list.Add(assembling); } } AllProduct = list; } DataGridViewCheckBoxColumn column = new DataGridViewCheckBoxColumn(); column.Visible = true; column.Name = "选中"; column.HeaderText = "选中"; column.ReadOnly = false; dataGridView1.Columns.Add(column); dataGridView1.Columns.Add("分总成名称", "分总成名称"); foreach (DataGridViewColumn item in dataGridView1.Columns) { if (item.Name != "选中") { item.ReadOnly = true; item.Width = item.HeaderText.Length * (int)this.Font.Size + 100; } else { item.Width = 68; item.ReadOnly = false; item.Frozen = false; } } bool selectedFlag = false; int count = 0; foreach (var item in AllProduct) { selectedFlag = false; if (SelectedProduct != null && count < SelectedProduct.Count) { if (SelectedProduct.FindIndex(c => c.父总成名称 == item.父总成名称) >= 0) { selectedFlag = true; count++; } } dataGridView1.Rows.Add(new object[] { selectedFlag, item.父总成名称 }); } m_count = dataGridView1.Rows.Count; if (m_dataLocalizer == null) { m_dataLocalizer = new UserControlDataLocalizer(dataGridView1, this.Name, UniversalFunction.SelectHideFields(this.Name, dataGridView1.Name, BasicInfo.LoginID)); panelTop.Controls.Add(m_dataLocalizer); m_dataLocalizer.Dock = DockStyle.Bottom; } } catch (Exception err) { MessageDialog.ShowErrorMessage(err.Message); } }
private void FormProductType_Load(object sender, EventArgs e) { AllProduct = null; dataGridView1.Rows.Clear(); try { if (AllProduct == null) { IQueryable <View_P_ProductInfo> productInfo = null; if (!m_productInfoServer.GetAllProductInfo(out productInfo, out m_error)) { MessageDialog.ShowErrorMessage(m_error); } AllProduct = productInfo.ToList(); } DataGridViewCheckBoxColumn column = new DataGridViewCheckBoxColumn(); column.Visible = true; column.Name = "选中"; column.HeaderText = "选中"; column.ReadOnly = false; dataGridView1.Columns.Add(column); dataGridView1.Columns.Add("序号", "序号"); dataGridView1.Columns.Add("产品类型编码", "产品类型编码"); dataGridView1.Columns.Add("产品类型名称", "产品类型名称"); dataGridView1.Columns.Add("产品装配简码", "产品装配简码"); dataGridView1.Columns.Add("是否返修专用", "是否返修专用"); dataGridView1.Columns.Add("备注", "备注"); foreach (DataGridViewColumn item in dataGridView1.Columns) { if (item.Name != "选中") { item.ReadOnly = true; item.Width = item.HeaderText.Length * (int)this.Font.Size + 100; } else { item.Width = 68; item.ReadOnly = false; item.Frozen = false; } } bool selectedFlag = false; int count = 0; foreach (var item in AllProduct) { selectedFlag = false; if (SelectedProduct != null && count < SelectedProduct.Count) { if (SelectedProduct.FindIndex(c => c.产品类型编码 == item.产品类型编码) >= 0) { selectedFlag = true; count++; } } dataGridView1.Rows.Add(new object[] { selectedFlag, item.序号, item.产品类型编码, item.产品类型名称, item.产品装配简码, item.是否返修专用, item.备注 }); } m_count = dataGridView1.Rows.Count; if (m_dataLocalizer == null) { m_dataLocalizer = new UserControlDataLocalizer(dataGridView1, this.Name, UniversalFunction.SelectHideFields(this.Name, dataGridView1.Name, BasicInfo.LoginID)); panelTop.Controls.Add(m_dataLocalizer); m_dataLocalizer.Dock = DockStyle.Bottom; } dataGridView1.Columns["序号"].Visible = false; } catch (Exception err) { MessageDialog.ShowErrorMessage(err.Message); } }
public IAsyncResult BeginUpdateChodOrder(long ChODId, WebShopShipment shipment, SelectedProduct selectedProduct, OrderStatus status, AsyncCallback callback, object state) { return(Channel.BeginUpdateChodOrder(ChODId, shipment, selectedProduct, status, callback, state)); }
public Task <OrderOutput> CreateConfirmedOrderAsync(WebShopShipment Shipment, SelectedProduct Product) { using (new OperationContextScope(client.InnerChannel)) { OperationContext.Current.OutgoingMessageHeaders.Add(authheader); return(Task.Factory.FromAsync(client.BeginCreateConfirmedOrder(Shipment, Product, null, null), ar => client.EndCreateConfirmedOrder(ar))); } }
public Task <string> UpdateChodOrderAsync(long ChODId, WebShopShipment shipment, SelectedProduct selectedProduct, OrderStatus status) { using (new OperationContextScope(client.InnerChannel)) { OperationContext.Current.OutgoingMessageHeaders.Add(authheader); return(Task.Factory.FromAsync(client.BeginUpdateChodOrder(ChODId, shipment, selectedProduct, status, null, null), ar => client.EndUpdateChodOrder(ar))); } }
public void Update(SelectedProduct s) { throw new NotImplementedException(); }
public IAsyncResult BeginCreateConfirmedOrder(WebShopShipment Shipment, SelectedProduct Product, AsyncCallback callback, object state) { var _args = new object[] { Shipment, Product }; return(base.BeginInvoke("CreateConfirmedOrder", _args, callback, state)); }
public IAsyncResult BeginCreateConfirmedOrder(WebShopShipment Shipment, SelectedProduct Product, AsyncCallback callback, object state) { return(Channel.BeginCreateConfirmedOrder(Shipment, Product, callback, state)); }
public IAsyncResult BeginUpdateChodOrder(long ChODId, WebShopShipment shipment, SelectedProduct selectedProduct, OrderStatus status, AsyncCallback callback, object state) { var _args = new object[] { ChODId, shipment, selectedProduct, status }; return(base.BeginInvoke("UpdateChodOrder", _args, callback, state)); }