/// <summary> /// 绑定分类属性 /// </summary> void BindProperty(int categoryID) { rpProperties.DataSource = ProductProperties.GetPropertiesByCategoryID(categoryID); rpParentProperties.DataSource = ProductProperties.GetParentPropertiesByCategoryID(categoryID); rpProperties.DataBind(); rpParentProperties.DataBind(); }
public void Delete(int productPropertiesId) { ProductProperties productProperties = GetById(productPropertiesId); _productPropertiesRepository.Delete(productProperties); _unitOfWork.Complete(); }
protected async void Page_Load(object sender, EventArgs e) { Title = StringsLocal.ViewAllProducts; ProductsResponse Products; try { Products = await Backend.GetAllProductsAsync(); } catch { StateMessage = "An Error occured while loading the data. Please try again"; return; } List<Product> list = Products.dataSet; // Convert the Users to a properties-based representation for the databinding List<ProductProperties> plist = list.ConvertAll<ProductProperties>((x) => { ProductProperties u = new ProductProperties(); u.comment = x.comment; u.price = x.price; u.product = x.product; u.id = x.ID; return u; }); repUsers.DataSource = plist; repUsers.DataBind(); }
private string DeleteProperty(HHPrincipal principal, HttpContext context, ref bool result) { string msg = string.Empty; if (principal.IsInRole("ProductCategoryModule-Delete")) { DataActionStatus s = ProductProperties.Delete(context.Request["propertyID"]); switch (s) { case DataActionStatus.Success: msg = "已成功删除所选的产品分类属性!"; result = true; break; case DataActionStatus.RelationshipExist: result = false; msg = "产品分类属性下存在关联数据[子分类],无法被删除!"; break; case DataActionStatus.UnknownFailure: result = false; msg = "删除产品分类属性时发生了未知的错误!"; break; } } else { throw new Exception("您没有执行此操作的权限!"); } return(msg); }
void BindData() { ProductProperty property = ProductProperties.GetProperty(id); ProductCategory category = null; if (property != null) { btnPost.Text = "修改"; this.txtPropertyDesc.Text = property.PropertyDesc; this.txtPropertyName.Text = property.PropertyName; this.txtDisplayOrder.Text = property.DisplayOrder.ToString(); this.scHidden.SelectedValue = property.SubCategoryHidden; category = ProductCategories.GetCategory(property.CategoryID); } if (category == null) { category = ProductCategories.GetCategory(categoryID); } if (category != null) { ltParCategory.Text = category.CategoryName; ltParCategoryDesc.Text = category.CategoryDesc; } else { parentName.Visible = false; parentDesc.Visible = false; } }
//Test function delete it during depolyement protected static List <object> returnSetWithProperties(DataSet dataset, object dataObjectType) { List <object> resultProperties = new List <object>(); if (dataObjectType is ManufacturerProperties) { List <ProductProperties> listOfPropperties = new List <ProductProperties>(); foreach (DataRow row in dataset.Tables[0].Rows) { ProductProperties propertyvalue = new ProductProperties(); propertyvalue.Product_Id = row["Product_Id"].ToString(); propertyvalue.Product_Type = row["Product_Id"].ToString(); propertyvalue.Product_Name = row["Product_Name"].ToString(); propertyvalue.Price_Per_Unit = double.Parse(row["Price_Per_Unit"].ToString()); propertyvalue.Product_Current_Count = int.Parse(row["Product_Current_Count"].ToString()); propertyvalue.Manufacturer_Name = row["Manufacturer_Name"].ToString(); propertyvalue.Manufacturer_Id = row["Manufacturer_Id"].ToString(); resultProperties.Add(propertyvalue); } } return(resultProperties); }
private void AddToList(Product P) { ShoppingCart.Add(P); ProductProperties.ClearProperties(); RefreshCart(); IB_Text_Search.ResetInputValue(); IB_Text_Search.Focus(); }
private void _cbbSize_SelectedIndexChanged_1(object sender, EventArgs e) { var cbb = sender as System.Windows.Forms.ComboBox; if (_sizes != null && cbb.SelectedIndex < _sizes.Count) { _size = _sizes.ElementAtOrDefault(cbb.SelectedIndex); } }
private void comboBoxProductName_SelectedIndexChanged(object sender, EventArgs e) { try { ProductProperties singleproductInformations = _orderHandler.getProductInformation(_productList, comboBoxManufacturer.SelectedItem.ToString(), comboBoxProductType.SelectedItem.ToString(), comboBoxProductName.SelectedItem.ToString()); textBoxProductId.Text = singleproductInformations.Product_Id.ToString(); textBoxPricePerUnit.Text = singleproductInformations.Price_Per_Unit.ToString(); }catch (Exception ex) { MessageBox.Show("WRONG SELECTION, PLEASE SELECT RIGHT MANUFACTURER AND PRODUCT", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); Console.WriteLine(ex.Message); } }
private bool CreatePropertyControl() { List <ProductProperty> selectedProperties = ProductProperties.GetPropertiesByProductID(ProductID); List <ProductProperty> properties = ProductProperties.GetAllPropertyByCategoryIDList(CategoryIDList); if (properties.Count > 0) { foreach (ProductProperty property in properties) { Literal ltBegin = new Literal(); ltBegin.Text = "<li>"; this.phProperty.Controls.Add(ltBegin); //label Label lblText = new Label(); lblText.Text = property.PropertyName; this.phProperty.Controls.Add(lblText); //textbox TextBox txtValue = new TextBox(); txtValue.ID = GenerateID(property.PropertyID); foreach (ProductProperty p in selectedProperties) { if (p.PropertyID == property.PropertyID) { txtValue.Text = p.PropertyValue; break; } } this.phProperty.Controls.Add(txtValue); List <ProductCategory> subCategories = ProductCategories.GetCategoriesByPropertyID(property.PropertyID); if (subCategories.Count > 0) { //ddl DropDownList ddlSubCategory = new DropDownList(); ddlSubCategory.Items.Add(new ListItem("请选择", "0")); foreach (ProductCategory category in subCategories) { ddlSubCategory.Items.Add(new ListItem(category.CategoryName, category.CategoryName.ToString())); } ddlSubCategory.Attributes.Add("onchange", "changeProperty(this)"); this.phProperty.Controls.Add(ddlSubCategory); } Literal ltEnd = new Literal(); ltEnd.Text = "</li>"; this.phProperty.Controls.Add(ltEnd); } return(true); } else { return(false); } }
protected void btnPost_Click(object sender, EventArgs e) { ProductProperty property = null; if (action == OperateType.Add) { property = new ProductProperty(); property.CategoryID = categoryID; } else { property = ProductProperties.GetProperty(id); } property.PropertyName = this.txtPropertyName.Text; property.PropertyDesc = this.txtPropertyDesc.Text; property.SubCategoryHidden = this.scHidden.SelectedValue; property.DisplayOrder = Convert.ToInt32(txtDisplayOrder.Text); if (action == OperateType.Add) { DataActionStatus status = ProductProperties.Create(property); switch (status) { case DataActionStatus.DuplicateName: mbMsg.ShowMsg("新增产品分类属性失败,在该分类下存在同名产品分类属性!"); break; case DataActionStatus.UnknownFailure: mbMsg.ShowMsg("新增产品分类属性失败,请联系管理员!"); break; case DataActionStatus.Success: default: base.ExecuteJs("msg('操作成功,已成功增加一个新的产品分类属性!',true);", false); break; } } else { DataActionStatus status = ProductProperties.Update(property); switch (status) { case DataActionStatus.DuplicateName: mbMsg.ShowMsg("修改产品分类属性失败,在该分类下存在同名产品分类属性!"); break; case DataActionStatus.UnknownFailure: mbMsg.ShowMsg("修改产品分类属性失败,请联系管理员!"); break; case DataActionStatus.Success: default: base.ExecuteJs("msg('操作成功,已成功修改产品分类属性!',true);", false); break; } } }
public bool submitOrder(List <OrderProperties> purchaseOrderInfo) { int numberOfRowsInserted = 0; bool result = false; string insertQueryString = "INSERT INTO SALES_ORDER(ORDER_ID,VENDOR_ID,USER_ID,MANUFACTURER_NAME,PRODUCT_ID,PRODUCT_TYPE,PRODUCT_NAME,COUNT,PRICE_PER_UNIT,TOTAL_PRICE,PAID_AMOUNT,BALANCE_AMOUNT,DISCOUNT_RATE,ORDER_STATUS,DESCRIPTION,CREATED_BY,CREATED_DATE,MODIFY_BY,MODIFY_DATE) VALUES(@ORDER_ID,@VENDOR_ID,@USER_ID,@MANUFACTURER_NAME,@PRODUCT_ID,@PRODUCT_TYPE,@PRODUCT_NAME,@COUNT,@PRICE_PER_UNIT,@TOTAL_PRICE,@PAID_AMOUNT,@BALANCE_AMOUNT,@DISCOUNT_RATE,@ORDER_STATUS,@DESCRIPTION,@CREATED_BY,@CREATED_DATE,@MODIFY_BY,@MODIFY_DATE);"; List <ProductProperties> reduceProductCountList = new List <ProductProperties>(); foreach (OrderProperties orderdetail in purchaseOrderInfo) { ProductProperties productList = new ProductProperties(); List <KeyValuePair <string, string> > queryParameter = new List <KeyValuePair <string, string> >(); queryParameter.Add(new KeyValuePair <string, string>("@ORDER_ID", orderdetail.Order_Id)); queryParameter.Add(new KeyValuePair <string, string>("@VENDOR_ID", orderdetail.Vendor_Id)); queryParameter.Add(new KeyValuePair <string, string>("@USER_ID", orderdetail.User_ID)); queryParameter.Add(new KeyValuePair <string, string>("@MANUFACTURER_NAME", orderdetail.Manufacturer_Name)); queryParameter.Add(new KeyValuePair <string, string>("@PRODUCT_ID", orderdetail.Product_Id)); queryParameter.Add(new KeyValuePair <string, string>("@PRODUCT_TYPE", orderdetail.Product_Type)); queryParameter.Add(new KeyValuePair <string, string>("@PRODUCT_NAME", orderdetail.Product_Name)); queryParameter.Add(new KeyValuePair <string, string>("@COUNT", Convert.ToString(orderdetail.Count))); queryParameter.Add(new KeyValuePair <string, string>("@PRICE_PER_UNIT", Convert.ToString(orderdetail.Price_Per_Unit))); queryParameter.Add(new KeyValuePair <string, string>("@TOTAL_PRICE", Convert.ToString(orderdetail.Total_Price))); queryParameter.Add(new KeyValuePair <string, string>("@PAID_AMOUNT", Convert.ToString(orderdetail.Paid_Amount))); queryParameter.Add(new KeyValuePair <string, string>("@BALANCE_AMOUNT", Convert.ToString(orderdetail.Balance_Amount))); queryParameter.Add(new KeyValuePair <string, string>("@DISCOUNT_RATE", orderdetail.Discount_Rate)); queryParameter.Add(new KeyValuePair <string, string>("@ORDER_STATUS", orderdetail.Order_Status)); queryParameter.Add(new KeyValuePair <string, string>("@DESCRIPTION", orderdetail.Description)); queryParameter.Add(new KeyValuePair <string, string>("@CREATED_BY", orderdetail.User_ID)); queryParameter.Add(new KeyValuePair <string, string>("@CREATED_DATE", BusinessUtlities.getCurrentDateTime)); queryParameter.Add(new KeyValuePair <string, string>("@MODIFY_BY", orderdetail.User_ID)); queryParameter.Add(new KeyValuePair <string, string>("@MODIFY_DATE", BusinessUtlities.getCurrentDateTime)); productList.Product_Id = orderdetail.Product_Id; productList.Product_Current_Count = orderdetail.Count; reduceProductCountList.Add(productList); result = DatabaseConnectionHandler.executeInsertDbQuery(insertQueryString, queryParameter); if (result == true) { ++numberOfRowsInserted; } } if (numberOfRowsInserted.Equals(purchaseOrderInfo.Count())) { InventoryDBProcessHandler reduceProductCount = new InventoryDBProcessHandler(); reduceProductCount.reduceProductCount(reduceProductCountList); Console.WriteLine("Order placed sucessfully"); result = true; } else { Console.WriteLine("Order submission failed"); result = false; } return(result); }
private void IB_Text_Search_InputChanged(object sender, EventArgs e) { Search(); if (Products.Count.Equals(0)) { ProductProperties.SemiSetObject(IsEmptyTextSearch ? null : new Product() { Description = TextSearch }); } }
public void SaveProductProperties(ProductProperties PP) { if (PP.Id == 0) { context.ProductProperties.Add(PP); } else { context.Entry(PP).State = EntityState.Modified; } context.SaveChanges(); }
public ProductProperties getProductInformation(List <ProductProperties> productDetails, string manufacturer, string productType, string productName) { ProductProperties selectedProductInfo = new ProductProperties(); foreach (ProductProperties products in productDetails) { if ((products.Manufacturer_Name.Equals(manufacturer) && products.Product_Type.Equals(productType) && (products.Product_Name.Equals(productName)))) { selectedProductInfo = products; } } return(selectedProductInfo); }
protected override void ViewIsAppearing(object sender, EventArgs e) { base.ViewIsAppearing(sender, e); if (ProductProperties != null && ProductProperties.Any()) { foreach (var item in ProductProperties) { if (item.PropertyType == PropertyType.IsPicker || item.PropertyType == PropertyType.IsBoolean) { item.PropertyChanged += Handle_PropertyChanged; } } } }
void BindProperty(int pId) { List <ProductProperty> props = ProductProperties.GetPropertiesByProductID(pId); if (props == null || props.Count == 0) { msgBox.ShowMsg("--", System.Drawing.Color.Gray); } else { msgBox.HideMsg(); rpProperties.DataSource = props; rpProperties.DataBind(); } }
public List <ProductProperty> GetProperties() { List <ProductProperty> properties = ProductProperties.GetAllPropertyByCategoryIDList(CategoryIDList); if (properties.Count > 0) { foreach (ProductProperty property in properties) { TextBox txtValue = this.FindControl(GenerateID(property.PropertyID)) as TextBox; if (txtValue != null) { property.PropertyValue = txtValue.Text.Trim(); } } } return(properties); }
void UnsubscribeToEvents() { if (ProductProperties != null && ProductProperties.Any()) { foreach (var item in ProductProperties) { if (item.PropertyType == PropertyType.IsPicker || item.PropertyType == PropertyType.IsBoolean) { item.PropertyChanged -= Handle_PropertyChanged; } } } if (ProductProperties != null && ProductProperties.Any()) { if (saleOrderLine?.ProductKind == ProductKind.accessory.ToString()) { var Cat = ProductProperties.Where((arg) => arg.PropertyName == "Parent Category"); var subCat = ProductProperties.Where((arg) => arg.PropertyName == "Category"); var name = ProductProperties.Where((arg) => arg.PropertyName == "Name"); if (Cat.Any()) { var selected = Cat.First().PropertyValue; Cat.First().ItemSource = Cat.First().AllSource; Cat.First().PropertyValue = selected; } if (subCat.Any()) { var selected = subCat.First().PropertyValue; subCat.First().ItemSource = subCat.First().AllSource; subCat.First().PropertyValue = selected; } if (name.Any()) { var selected = name.First().PropertyValue; name.First().ItemSource = name.First().AllSource; name.First().PropertyValue = selected; } } } }
private void BTT_AddToList_Click(object sender, EventArgs e) { try { Product P = ProductProperties.GetObject(); if (ShoppingCart.Contains(P)) { throw new ProductRepeatedException(); } else { AddToList(P); } } catch (ProductException ex) { PremadeMessage.Notification(ex.Message); } }
void BindData() { ProductCategory category = ProductCategories.GetCategory(id); ProductCategory parent = null; ProductProperty property = null; if (category != null) { btnPost.Text = "修改"; txtCategoryName.Text = category.CategoryName; txtCategoryDesc.Text = category.CategoryDesc; txtDisplayOrder.Text = category.DisplayOrder.ToString(); parent = ProductCategories.GetCategory(category.ParentID); property = ProductProperties.GetProperty(category.PropertyID); } if (parent == null) { parent = ProductCategories.GetCategory(parentID); } if (parent != null) { ltParCategory.Text = parent.CategoryName; ltParCategoryDesc.Text = parent.CategoryDesc; } else { parentName.Visible = false; parentDesc.Visible = false; } if (property == null) { property = ProductProperties.GetProperty(propertyID); } if (property != null) { ltPropertyName.Text = property.PropertyName; } else { propertyName.Visible = false; } }
public void Save() { var product = new ProductProperties[1]; product[0] = new ProductProperties() { InteropID = InteropID, NewInteropID = NewInteropID, ProductID = ID, Name = Name, UNSPSC = UNSPSC, UnitOfMeasure = UnitOfMeasure, Description = Description, Type = Type, StandardOrders = StandardOrders, ReplenishmentOrders = ReplenishmentOrders, PriceRequests = PriceRequests, QuantityMultiplier = QuantityMultiplier, ShipWeight = ShipWeight, TrackInventory = TrackInventory, AllowOrdersToExceedInventory = AllowOrdersToExceedInventory, UseVariantLevelInventoryTracking = UseVariantLevelInventoryTracking, InventoryNotificationPoint = InventoryNotificationPoint, DisplayInventoryToBuyer = DisplayInventoryToBuyer, SmallImage = SmallImage == null ? null : SmallImage.ToFile(), LargeImage = LargeImage == null ? null : LargeImage.ToFile(), Active = Active }; var error = _product.SaveProducts(product, this.SharedSecret); if (error.Length > 0) { throw new Exception(error[0].InteropID + " failed: " + error[0].ErrorMessage); } Variants.ForEach(v => v.Save(product[0])); PriceSchedules.ForEach(p => p.Save(product[0])); if (TrackInventory) { UpdateInventory(); } PriceScheduleAssignments.ForEach(p => p.Save(this.InteropID)); }
string RenderHTML() { if (_Cache.ContainsKey(_CategoryID)) { return(_Cache[_CategoryID]); } List <ProductCategory> pcs = ProductCategories.GetCategories(); StringBuilder sb = new StringBuilder(); if (_CategoryID == 0) { return("无"); } else { List <ProductProperty> props = ProductProperties.GetAllPropertyByCategoryID(_CategoryID); if (props == null || props.Count == 0) { return("无"); } sb.Append("<div class=\"" + _CssClass + "\">"); for (int i = 0; i < props.Count; i++) { sb.AppendFormat(_href, GlobalSettings.Encrypt(_CategoryID.ToString()), GlobalSettings.Encrypt(props[i].PropertyID.ToString()), props[i].PropertyName); } sb.Append("</div>"); if (!_Cache.ContainsKey(_CategoryID)) { lock (_lock) { if (!_Cache.ContainsKey(_CategoryID)) { _Cache.Add(_CategoryID, sb.ToString()); } } } } return(sb.ToString()); }
void LoadListProduct(IProduct product, ProductProperties color = null) { if (product == null) { return; } List <ProductSale> products; if (color == null) { products = ProductSaleRepository.Instance.GetSellProduct(product.Id); } else { products = ProductSaleRepository.Instance.GetSellProduct(product.Id, color.Id); } _currentListProductModel = new List <InputProductModel>(); foreach (var item in products) { _currentListProductModel.Add(new InputProductModel() { Id = item.Id, ProductName = product.Name, Quantity = item.Quantity, ItemPrice = product.Price.ToCurrency(), InputPrice = item.Price, ColorName = color != null ? color.Name : _allColors.Where(p => p.Id == item.ColorId).FirstOrDefault()?.Name, ColorId = color != null ? color.Id : _allColors.Where(p => p.Id == item.ColorId).FirstOrDefault().Id, SizeName = _allSizes.Where(p => p.Id == item.SizeId).FirstOrDefault().Name, SizeId = _allSizes.Where(p => p.Id == item.SizeId).FirstOrDefault().Id, }); } BindingList <InputProductModel> dataSource = new BindingList <InputProductModel>(_currentListProductModel); _gridProduct.DataSource = dataSource; }
public void LoadProperties() { List <string> propertyFileLines = File.ReadAllLines(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"\settings.ini").ToList(); foreach (string prop in propertyFileLines) { ProductProperties product = new ProductProperties(); string[] data = prop.Split(new string[] { "||" }, StringSplitOptions.None); if (data.Length == 5) { product.ProductName = data[0]; product.BarcodeExample = data[1]; product.BarcodeMask = data[2]; product.FirmwareFile = data[3]; product.NfcFile = data[4]; productsDataList.Add(product); } else { MessageBox.Show("Please check settings.ini file! There should not be empty or incorrect filled lines!"); } } }
private void _btnAdd_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(_txtValue.Text)) { ProductProperties entity = new ProductProperties() { Name = _txtValue.Text, Type = _fColor ? ProductType.Color : ProductType.Size }; try { ProductPropertiesRepository.Instance.Insert(entity); this.Close(); DialogResult = DialogResult.Yes; } catch (Exception) { string message = "Can not replace name"; string caption = "Error"; MessageBoxButtons buttons = MessageBoxButtons.OK; DialogResult result; result = MessageBox.Show(message, caption, buttons); } } }
protected async void Page_Load(object sender, EventArgs e) { Title = StringsLocal.EditAllProducts; try { if (this.IsPostBack) { // First, handle updates! var dirty = CheckDirtyElements(); UpdateProductsRequest request = new UpdateProductsRequest(); request.dataSet = dirty; try { if (request.dataSet.Count < 1) { throw new Exception("No Data updated"); } var answer = await Backend.UpdateProducts(request); if (answer.status) StateMessage = "Data was updated"; else throw new Exception(answer.errorDescription); } catch (Exception ex) { StateMessage = "Error while updating data: " + ex.Message; } // Second, handle deletions var deletions = CheckDeleteElements(); if (!(deletions.Count < 1)) { // There are Deletions DeleteRequest delRequest = new DeleteRequest(); delRequest.dataSet = deletions; StateMessage += " - "; var answer = await Backend.DeleteProducts(delRequest); if (answer.status) StateMessage += "Data was deleted"; else StateMessage += "Error while deleting items: " + answer.errorDescription; } } } catch { StateMessage = "Internal Error - maybe the Database did not answer"; } ProductsResponse Products; try { Products = await Backend.GetAllProductsAsync(); } catch { StateMessage = "An Error occured while loading the data. Please try again"; return; } List<Product> list = Products.dataSet; // Convert the Users to a properties-based representation for the databinding List<ProductProperties> plist = list.ConvertAll<ProductProperties>((x) => { ProductProperties u = new ProductProperties(); u.comment = x.comment; u.id = x.ID; u.price = x.price; u.product = x.product; return u; }); EntryCount = plist.Count.ToString("D2"); entryCount.Attributes.Add("value", EntryCount); repProd.DataSource = plist; repProd.DataBind(); }
public Task SetProperties(ProductProperties properties) => SetPropertiesStateAsync(properties);
private Task SetPropertiesStateAsync(ProductProperties properties) => this.StateManager.SetStateAsync(PropertiesStateKey, properties);
List <ProductProperty> GetProperties() { return(ProductProperties.GetAllPropertyByCategoryIDList(GetCategoryIds())); }
/// <summary> /// Create a new ProductProperties object. /// </summary> /// <param name="productId">Initial value of ProductId.</param> /// <param name="productPropertyId">Initial value of ProductPropertyId.</param> public static ProductProperties CreateProductProperties(int productId, int productPropertyId) { ProductProperties productProperties = new ProductProperties(); productProperties.ProductId = productId; productProperties.ProductPropertyId = productPropertyId; return productProperties; }
/// <summary> /// There are no comments for ProductProperties in the schema. /// </summary> public void AddToProductProperties(ProductProperties productProperties) { base.AddObject("ProductProperties", productProperties); }
private void buttonAddProducts_Click(object sender, EventArgs e) { ProductProperties newProduct = new ProductProperties(); //***************testing bool result = false; if (radioButtonAddNewProduct.Checked) { try { if (comboBoxManufacturerName.SelectedItem.ToString() != null) { foreach (ManufacturerProperties manufacturerProperties in _MANUFACTURER_LIST) { if (manufacturerProperties.Manufacturer_Name.Equals(comboBoxManufacturerName.SelectedItem.ToString())) { newProduct.Manufacturer_Id = manufacturerProperties.Manufacturer_Id; break; } } if (checkBoxNewProductType.Checked == true) { newProduct.Product_Type = textBoxNewProductType.Text; } else { newProduct.Product_Type = comboBoxProductType.SelectedItem.ToString(); } newProduct.Product_Id = textBoxProductId.Text; newProduct.Product_Name = textBoxProductName.Text.ToUpper(); int initialCount = Convert.ToInt16(textBoxProductCurrentCount.Text); double productPrice = Convert.ToDouble(textBoxProductPerUnit.Text.Replace("$", "")); int minimumCount = Convert.ToInt16(textBoxMinimumCount.Text); if (minimumCount <= 0) { MessageBox.Show("PLEASE SET THE MINIMUM COUNT", "PRODUCT", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if ((initialCount > 0) && (productPrice > 0) && (minimumCount > 0)) { newProduct.Product_Current_Count = initialCount; newProduct.Price_Per_Unit = productPrice; newProduct.Minimum_Count = minimumCount; result = inventoryManagementHandler.addNewProductInInventory(newProduct, _userSessionInformation.User_Id); if (result) { MessageBox.Show("NEW PRODUCT ADDED IN INVENTORY SUCCESSFULLY", "INVENTORY", MessageBoxButtons.OK, MessageBoxIcon.Information); refreshFormData(); refreshProductList(); fillProductsGridView(_PRODUCT_LIST_COMMMON); } else { MessageBox.Show("NEW PRODUCT INSERTION FAILED, PLEASE CHECK THE FIELDS", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("INVALID COUNT"); } } } catch (Exception exp) { MessageBox.Show("INPUT ERROR, PLEASE PROVIDE PROPERVALUES", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); Console.WriteLine(exp.StackTrace); } } else if (radioButtonUpdateProductUnit.Checked) { try { double existingProductPrice = 0.0, newPrice = 0.0; int existingProductCount = 0, newUnitsCount = 0; ProductProperties updateProducts = new ProductProperties(); foreach (ProductProperties props in _PRODUCT_LIST_COMMMON) { if (props.Manufacturer_Name.Equals(comboBoxManufacturerName.SelectedItem.ToString())) { updateProducts.Manufacturer_Id = props.Manufacturer_Id; existingProductCount = props.Product_Current_Count; existingProductPrice = props.Price_Per_Unit; break; } } updateProducts.Product_Type = comboBoxProductType.Text; updateProducts.Product_Name = comboBoxProductName.Text; updateProducts.Product_Id = textBoxProductId.Text; updateProducts.Minimum_Count = Convert.ToInt16(textBoxMinimumCount.Text); newPrice = Convert.ToDouble(textBoxProductPerUnit.Text.Replace("$", "")); newUnitsCount = Convert.ToInt16(textBoxProductCurrentCount.Text); if ((newUnitsCount > 0) && ((newPrice > 0))) { newPrice = existingProductPrice; newUnitsCount = existingProductCount; updateProducts.Product_Current_Count = newUnitsCount; updateProducts.Price_Per_Unit = newPrice; result = inventoryManagementHandler.updateProductFromInventory(updateProducts, _userSessionInformation.User_Id); if (result) { MessageBox.Show("ITEM DETAILS UPDATED SUCCESSFULLY", "PRODUCT", MessageBoxButtons.OK, MessageBoxIcon.Information); refreshFormData(); refreshProductList(); fillProductsGridView(_PRODUCT_LIST_COMMMON); } } else { MessageBox.Show("PLEASE PROVIDE PROPER VALUE", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (radioButtonRemoveProduct.Checked) { try { if (!textBoxProductId.Text.Equals(null)) { ProductProperties removedProductProperty = new ProductProperties(); removedProductProperty.Product_Id = textBoxProductId.Text; result = inventoryManagementHandler.removeProductFromInventory(removedProductProperty); if (result) { MessageBox.Show("PRODUCT REMOVED SUCCESSFULLY", "PRODUCT", MessageBoxButtons.OK, MessageBoxIcon.Information); refreshFormData(); refreshProductList(); fillProductsGridView(_PRODUCT_LIST_COMMMON); } else { MessageBox.Show("SELECT THE ITEM TO BE REMOVED FROM INVENTORY", "PRODUCT", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }catch (Exception ex) { ///********** MessageBox.Show("", ex.Message); } } }
internal Product(ProductProperties properties) { Properties = properties; }