public XElement GenerateAddRq(decimal?TotalValue = null, DateTime?InventoryDate = null) { XElement Add = new XElement(typeof(ItemInventory).Name + "Add"); Add.Add(Name?.ToQBXML(nameof(Name))); Add.Add(BarCode?.ToQBXML(nameof(BarCode))); Add.Add(IsActive.ToQBXML(nameof(IsActive))); Add.Add(ClassRef?.ToQBXML(nameof(ClassRef))); Add.Add(ParentRef?.ToQBXML(nameof(ParentRef))); Add.Add(ManufacturerPartNumber?.ToQBXML(nameof(ManufacturerPartNumber))); Add.Add(UnitOfMeasureSetRef?.ToQBXML(nameof(UnitOfMeasureSetRef))); Add.Add(SalesTaxCodeRef?.ToQBXML(nameof(SalesTaxCodeRef))); Add.Add(SalesDesc?.ToQBXML(nameof(SalesDesc))); Add.Add(SalesPrice?.ToQBXML(nameof(SalesPrice))); Add.Add(IncomeAccountRef?.ToQBXML(nameof(IncomeAccountRef))); Add.Add(PurchaseDesc?.ToQBXML(nameof(PurchaseDesc))); Add.Add(PurchaseCost?.ToQBXML(nameof(PurchaseCost))); Add.Add(COGSAccountRef?.ToQBXML(nameof(COGSAccountRef))); Add.Add(PrefVendorRef?.ToQBXML(nameof(PrefVendorRef))); Add.Add(AssetAccountRef?.ToQBXML(nameof(AssetAccountRef))); Add.Add(ReorderPoint?.ToQBXML(nameof(ReorderPoint))); Add.Add(Max?.ToQBXML(nameof(Max))); Add.Add(QuantityOnHand?.ToQBXML(nameof(QuantityOnHand))); Add.Add(TotalValue?.ToQBXML(nameof(TotalValue))); Add.Add(InventoryDate?.ToQBXML(nameof(InventoryDate))); Add.Add(ExternalGUID?.ToQBXML(nameof(ExternalGUID))); XElement AddRq = new XElement(typeof(ItemInventory).Name + "AddRq", Add); foreach (var value in IncludeRetElement) { AddRq.Add(value.ToQBXML(nameof(IncludeRetElement))); } return(AddRq); }
public override bool Equals(object obj) { var line = obj as SalesTransactionLineVM; if (line == null) { return(false); } return(Item.ID.Equals(line.Item.ID) && Warehouse.ID.Equals(line.Warehouse.ID) && SalesPrice.Equals(line.SalesPrice) && Discount.Equals(line.Discount)); }
public Schema() : base() { InstanceType = typeof(__Frtransact__); Properties.ClearExposed(); City = Add<__TString__>("City$"); City.DefaultValue = ""; City.Editable = true; City.SetCustomAccessors((_p_) => { return ((__Frtransact__)_p_).__bf__City__; }, (_p_, _v_) => { ((__Frtransact__)_p_).__bf__City__ = (System.String)_v_; }, false); Country = Add<__TString__>("Country$"); Country.DefaultValue = ""; Country.Editable = true; Country.SetCustomAccessors((_p_) => { return ((__Frtransact__)_p_).__bf__Country__; }, (_p_, _v_) => { ((__Frtransact__)_p_).__bf__Country__ = (System.String)_v_; }, false); Name = Add<__TString__>("Name$"); Name.DefaultValue = ""; Name.Editable = true; Name.SetCustomAccessors((_p_) => { return ((__Frtransact__)_p_).__bf__Name__; }, (_p_, _v_) => { ((__Frtransact__)_p_).__bf__Name__ = (System.String)_v_; }, false); Number = Add<__TString__>("Number$"); Number.DefaultValue = ""; Number.Editable = true; Number.SetCustomAccessors((_p_) => { return ((__Frtransact__)_p_).__bf__Number__; }, (_p_, _v_) => { ((__Frtransact__)_p_).__bf__Number__ = (System.String)_v_; }, false); Street = Add<__TString__>("Street$"); Street.DefaultValue = ""; Street.Editable = true; Street.SetCustomAccessors((_p_) => { return ((__Frtransact__)_p_).__bf__Street__; }, (_p_, _v_) => { ((__Frtransact__)_p_).__bf__Street__ = (System.String)_v_; }, false); ZipCode = Add<__TString__>("ZipCode$"); ZipCode.DefaultValue = ""; ZipCode.Editable = true; ZipCode.SetCustomAccessors((_p_) => { return ((__Frtransact__)_p_).__bf__ZipCode__; }, (_p_, _v_) => { ((__Frtransact__)_p_).__bf__ZipCode__ = (System.String)_v_; }, false); Date = Add<__TString__>("Date$"); Date.DefaultValue = ""; Date.Editable = true; Date.SetCustomAccessors((_p_) => { return ((__Frtransact__)_p_).__bf__Date__; }, (_p_, _v_) => { ((__Frtransact__)_p_).__bf__Date__ = (System.String)_v_; }, false); SalesPrice = Add<__TLong__>("SalesPrice$"); SalesPrice.DefaultValue = 0L; SalesPrice.Editable = true; SalesPrice.SetCustomAccessors((_p_) => { return ((__Frtransact__)_p_).__bf__SalesPrice__; }, (_p_, _v_) => { ((__Frtransact__)_p_).__bf__SalesPrice__ = (System.Int64)_v_; }, false); Commission = Add<__TLong__>("Commission$"); Commission.DefaultValue = 0L; Commission.Editable = true; Commission.SetCustomAccessors((_p_) => { return ((__Frtransact__)_p_).__bf__Commission__; }, (_p_, _v_) => { ((__Frtransact__)_p_).__bf__Commission__ = (System.Int64)_v_; }, false); Address = Add<__TString__>("Address"); Address.DefaultValue = ""; Address.SetCustomAccessors((_p_) => { return ((__Frtransact__)_p_).__bf__Address__; }, (_p_, _v_) => { ((__Frtransact__)_p_).__bf__Address__ = (System.String)_v_; }, false); }
public Schema() : base() { InstanceType = typeof(__Transact__); Properties.ClearExposed(); Html = Add <__TString__>("Html"); Html.DefaultValue = "/Ahsan/FranchiseDetail/TransactionDetailJson.html"; Html.SetCustomAccessors((_p_) => { return(((__Transact__)_p_).__bf__Html__); }, (_p_, _v_) => { ((__Transact__)_p_).__bf__Html__ = (System.String)_v_; }, false); Date = Add <__TString__>("Date"); Date.DefaultValue = ""; Date.SetCustomAccessors((_p_) => { return(((__Transact__)_p_).__bf__Date__); }, (_p_, _v_) => { ((__Transact__)_p_).__bf__Date__ = (System.String)_v_; }, false); SalesPrice = Add <__TLong__>("SalesPrice"); SalesPrice.DefaultValue = 0L; SalesPrice.SetCustomAccessors((_p_) => { return(((__Transact__)_p_).__bf__SalesPrice__); }, (_p_, _v_) => { ((__Transact__)_p_).__bf__SalesPrice__ = (System.Int64)_v_; }, false); Commission = Add <__TLong__>("Commission"); Commission.DefaultValue = 0L; Commission.SetCustomAccessors((_p_) => { return(((__Transact__)_p_).__bf__Commission__); }, (_p_, _v_) => { ((__Transact__)_p_).__bf__Commission__ = (System.Int64)_v_; }, false); Address = Add <__TString__>("Address"); Address.DefaultValue = ""; Address.SetCustomAccessors((_p_) => { return(((__Transact__)_p_).__bf__Address__); }, (_p_, _v_) => { ((__Transact__)_p_).__bf__Address__ = (System.String)_v_; }, false); }
public Schema() : base() { InstanceType = typeof(__Transact__); Properties.ClearExposed(); Html = Add <__TString__>("Html"); Html.DefaultValue = "/Muhammad/TransactionJson.html"; Html.SetCustomAccessors((_p_) => { return(((__Transact__)_p_).__bf__Html__); }, (_p_, _v_) => { ((__Transact__)_p_).__bf__Html__ = (System.String)_v_; }, false); Date = Add <__TString__>("Date$"); Date.DefaultValue = ""; Date.Editable = true; Date.SetCustomAccessors((_p_) => { return(((__Transact__)_p_).__bf__Date__); }, (_p_, _v_) => { ((__Transact__)_p_).__bf__Date__ = (System.String)_v_; }, false); SalesPrice = Add <__TString__>("SalesPrice$"); SalesPrice.DefaultValue = ""; SalesPrice.Editable = true; SalesPrice.SetCustomAccessors((_p_) => { return(((__Transact__)_p_).__bf__SalesPrice__); }, (_p_, _v_) => { ((__Transact__)_p_).__bf__SalesPrice__ = (System.String)_v_; }, false); Commission = Add <__TString__>("Commission$"); Commission.DefaultValue = ""; Commission.Editable = true; Commission.SetCustomAccessors((_p_) => { return(((__Transact__)_p_).__bf__Commission__); }, (_p_, _v_) => { ((__Transact__)_p_).__bf__Commission__ = (System.String)_v_; }, false); }
private void btnCalculateSalePrice_Click(object sender, EventArgs e) { //Declare Variables decimal OriginalPrice; decimal DiscountPercentage; decimal DiscountAmount; decimal SalesPrice; //Assign input to variables OriginalPrice = decimal.Parse(txtbxOriginalPrice.Text); DiscountPercentage = decimal.Parse(txtbxDiscount.Text); //Covert DiscountPercentage DiscountPercentage = DiscountPercentage / 100; //Calculate the Discount Amount DiscountAmount = OriginalPrice * DiscountPercentage; //Calculate Sales Price SalesPrice = OriginalPrice - DiscountAmount; //Dispaly Sales Price lblSalePrice.Text = SalesPrice.ToString("c"); }
public XElement GenerateModRq(bool?ForceUOMChange = null, bool?ApplyIncomeAccountRefToExistingTxns = null, bool?ApplyCOGSAccountRefToExistingTxns = null) { XElement Mod = new XElement(typeof(ItemInventory).Name + "Mod"); Mod.Add(ListID?.ToQBXML(nameof(ListID))); Mod.Add(EditSequence?.ToQBXML(nameof(EditSequence))); Mod.Add(Name?.ToQBXML(nameof(Name))); Mod.Add(BarCode?.ToQBXML(nameof(BarCode))); Mod.Add(IsActive.ToQBXML(nameof(IsActive))); Mod.Add(ClassRef?.ToQBXML(nameof(ClassRef))); Mod.Add(ParentRef?.ToQBXML(nameof(ParentRef))); Mod.Add(ManufacturerPartNumber?.ToQBXML(nameof(ManufacturerPartNumber))); Mod.Add(UnitOfMeasureSetRef?.ToQBXML(nameof(UnitOfMeasureSetRef))); Mod.Add(ForceUOMChange?.ToQBXML(nameof(ForceUOMChange))); Mod.Add(SalesTaxCodeRef?.ToQBXML(nameof(SalesTaxCodeRef))); Mod.Add(SalesDesc?.ToQBXML(nameof(SalesDesc))); Mod.Add(SalesPrice?.ToQBXML(nameof(SalesPrice))); Mod.Add(IncomeAccountRef?.ToQBXML(nameof(IncomeAccountRef))); Mod.Add(ApplyIncomeAccountRefToExistingTxns?.ToQBXML(nameof(ApplyIncomeAccountRefToExistingTxns))); Mod.Add(PurchaseDesc?.ToQBXML(nameof(PurchaseDesc))); Mod.Add(PurchaseCost?.ToQBXML(nameof(PurchaseCost))); Mod.Add(COGSAccountRef?.ToQBXML(nameof(COGSAccountRef))); Mod.Add(ApplyCOGSAccountRefToExistingTxns?.ToQBXML(nameof(ApplyCOGSAccountRefToExistingTxns))); Mod.Add(PrefVendorRef?.ToQBXML(nameof(PrefVendorRef))); Mod.Add(AssetAccountRef?.ToQBXML(nameof(AssetAccountRef))); Mod.Add(ReorderPoint?.ToQBXML(nameof(ReorderPoint))); Mod.Add(Max?.ToQBXML(nameof(Max))); XElement ModRq = new XElement(typeof(ItemInventory).Name + "ModRq", Mod); foreach (var value in IncludeRetElement) { ModRq.Add(value.ToQBXML(nameof(IncludeRetElement))); } return(ModRq); }
/// <summary> /// Returns a System.String containing an Xml representation of the specified property of the current object /// </summary> /// <param name="property">name of a specific property that is to be written out as Xml. /// If this value is filled in, only the <id/> node and the node for property are output. /// At the time of this writing, this is only used for product_pictures. /// </param> /// <returns></returns> public string ToXml(string property) { var xml = new XElement(_objectName); xml.Add(new XElement("id", Id.ToString())); if ((property == null || property == "product_type_id") && LogBits.BitTest(Enums.Logfield.ProductTypeId)) { xml.Add(new XElement("product_type_id", (int)ProductTypeId)); } if ((property == null || property == "name_nl") && Name_NL != null && LogBits.BitTest(Enums.Logfield.PublicProductName_NL)) { xml.Add(new XElement("name_nl", Name_NL)); } //if ((property == null || property == "name_en") && Name_EN != null && LogBits.BitTest(Enums.Logfield.PublicProductName_EN)) // xml.Add(new XElement("name_en", Name_EN)); if ((property == null || property == "songs") && LogBits.BitTest(Enums.Logfield.SongSortOrder)) { xml.Add(new XElement("songs", from song in Songs select new XElement(XElement.Parse(song.ToXml())))); } if ((property == null || property == "subtitle_nl") && LogBits.BitTest(Enums.Logfield.Subtitle_NL)) { xml.Add(new XElement("subtitle_nl", Subtitle_NL)); } if ((property == null || property == "author_id") && LogBits.BitTest(Enums.Logfield.AuthorId)) { xml.Add(new XElement("author_id", AuthorId.ToString())); } if ((property == null || property == "arranger_id") && LogBits.BitTest(Enums.Logfield.ArrangerId)) { xml.Add(new XElement("arranger_id", ArrangerId.ToString())); } if ((property == null || property == "manufacturer_id") && LogBits.BitTest(Enums.Logfield.ManufacturerId)) { xml.Add(new XElement("manufacturer_id", ManufacturerId.ToString())); } if ((property == null || property == "instrument_id") && LogBits.BitTest(Enums.Logfield.InstrumentId)) { xml.Add(new XElement("instrument_id", InstrumentId.ToString())); } if ((property == null || property == "sell_price") && !SalesPrice.IsNullOrZero() && LogBits.BitTest(Enums.Logfield.SalesPrice)) { xml.Add(new XElement("sell_price", SalesPrice)); } if ((property == null || property == "reference") && LogBits.BitTest(Enums.Logfield.ReferenceNumber)) { xml.Add(new XElement("reference", ReferenceNumber)); } if ((property == null || property == "isbn") && LogBits.BitTest(Enums.Logfield.Isbn)) { xml.Add(new XElement("isbn", Isbn)); } if ((property == null || property == "ismn") && LogBits.BitTest(Enums.Logfield.Ismn)) { xml.Add(new XElement("ismn", Ismn)); } if ((property == null || property == "ean") && LogBits.BitTest(Enums.Logfield.Ean)) { xml.Add(new XElement("ean", Ean)); } if ((property == null || property == "upc") && LogBits.BitTest(Enums.Logfield.Upc)) { xml.Add(new XElement("upc", Upc)); } if ((property == null || property == "language_id") && LogBits.BitTest(Enums.Logfield.LanguageId)) { xml.Add(new XElement("language_id", LanguageId != null ? ((int)LanguageId).ToString() : String.Empty)); } if ((property == null || property == "binding_id") && LogBits.BitTest(Enums.Logfield.BindingId)) { xml.Add(new XElement("binding_id", BindingId.ToString())); } if ((property == null || property == "grade_level") && LogBits.BitTest(Enums.Logfield.GradeLevel)) { xml.Add(new XElement("grade_level", GradeLevel)); } if ((property == null || property == "product_series_id") && LogBits.BitTest(Enums.Logfield.SeriesId)) { xml.Add(new XElement("product_series_id", SeriesId.ToString())); } if ((property == null || property == "nr_of_pages") && LogBits.BitTest(Enums.Logfield.Pages)) { xml.Add(new XElement("nr_of_pages", Pages.ToString())); } if ((property == null || property == "tax_rate_id") && LogBits.BitTest(Enums.Logfield.TaxRateId)) { xml.Add(new XElement("tax_rate_id", ((int)TaxRateId).ToString())); } if ((property == null || property == "product_pictures") && LogBits.BitTest(Enums.Logfield.ProductPictureFilename)) { xml.Add(new XElement("product_pictures", from picture in ProductPictures select new XElement(XElement.Parse(picture.ToXml())))); } if ((property == null || property == "description_nl") && LogBits.BitTest(Enums.Logfield.Description_NL)) { xml.Add(new XElement("description_nl", Description_NL)); } if ((property == null || property == "weight") && LogBits.BitTest(Enums.Logfield.Weight)) { xml.Add(new XElement("weight", Weight.ToString())); } if ((property == null || property == "length") && LogBits.BitTest(Enums.Logfield.Length)) { xml.Add(new XElement("length", Length.ToString())); } if ((property == null || property == "width") && LogBits.BitTest(Enums.Logfield.Width)) { xml.Add(new XElement("width", Width.ToString())); } if ((property == null || property == "height") && LogBits.BitTest(Enums.Logfield.Height)) { xml.Add(new XElement("height", Height.ToString())); } if ((property == null || property == "product_categories") && LogBits.BitTest(Enums.Logfield.ProductCategory)) { xml.Add(new XElement("product_categories", from category in ProductCategories select new XElement("product_category", new XElement("id", category.Id), new XElement("test", Test.ToInt())))); } if ((property == null || property == "internal_stock_qty") && LogBits.BitTest(Enums.Logfield.InternalStock)) { xml.Add(new XElement("internal_stock_qty", InternalStock.ToString())); } if ((property == null || property == "external_stock_qty") && LogBits.BitTest(Enums.Logfield.ExternalStock)) { xml.Add(new XElement("external_stock_qty", ExternalStock != null ? ExternalStock.ToString() : "1")); } if ((property == null || property == "supplier_id") && LogBits.BitTest(Enums.Logfield.SupplierId)) { xml.Add(new XElement("supplier_id", SupplierId.ToString())); } if ((property == null || property == "promotion") && LogBits.BitTest(Enums.Logfield.Promotion)) { xml.Add(new XElement("promotion", Promotion.ToInt().ToString())); } if ((property == null || property == "highlight_on_home") && LogBits.BitTest(Enums.Logfield.HighlightOnHome)) { xml.Add(new XElement("highlight_on_home", HighlightOnHome.ToInt().ToString())); } if ((property == null || property == "available") && LogBits.BitTest(Enums.Logfield.ActiveInWebshop)) { xml.Add(new XElement("available", ActiveInWebshop.ToInt().ToString())); } if ((property == null || property == "bestseller") && LogBits.BitTest(Enums.Logfield.BestSeller)) { xml.Add(new XElement("bestseller", BestSeller.ToInt().ToString())); } if ((property == null || property == "minimum_order_qty") && LogBits.BitTest(Enums.Logfield.MinimumOrderQty)) { xml.Add(new XElement("minimum_order_qty", (MinimumOrderQuantity != 0) ? MinimumOrderQuantity.ToString() : String.Empty)); } if ((property == null || property == "teacher_discount") && LogBits.BitTest(Enums.Logfield.WebshopTeacherDiscount)) { xml.Add(new XElement("teacher_discount", TeacherDiscount.ToString())); } if ((property == null || property == "reseller_discount") && LogBits.BitTest(Enums.Logfield.WebshopResellerDiscount)) { xml.Add(new XElement("reseller_discount", ResellerDiscount.ToString())); } if ((property == null || property == "search_keywords") && LogBits.BitTest(Enums.Logfield.SearchKeywords)) { xml.Add(new XElement("search_keywords", SearchKeywords)); } if ((property == null || property == "store_pickup_only") && LogBits.BitTest(Enums.Logfield.StorePickupOnly)) { xml.Add(new XElement("store_pickup_only", StorePickupOnly.ToInt().ToString())); } if ((property == null || property == "test")) { xml.Add(new XElement("test", Test.ToInt())); } if ((property == null || property == "created") && LogBits.BitTest(Enums.Logfield.CreateDttm)) { xml.Add(new XElement("created", (!CreatedDttm.IsNullOrDefault()) ? ((DateTime)CreatedDttm).ToString("yyyy-MM-dd HH:mm:ss") : String.Empty)); } if ((property == null || property == "updated") && LogBits.BitTest(Enums.Logfield.UpdateDttm)) { xml.Add(new XElement("updated", (!UpdatedDttm.IsNullOrDefault()) ? ((DateTime)UpdatedDttm).ToString("yyyy-MM-dd HH:mm:ss") : String.Empty)); } if ((property == null || property == "deleted") && LogBits.BitTest(Enums.Logfield.DeleteDttm)) { xml.Add(new XElement("deleted", (!DeletedDttm.IsNullOrDefault()) ? ((DateTime)DeletedDttm).ToString("yyyy-MM-dd HH:mm:ss") : String.Empty)); } string xmlString = xml.ToString(); return(xmlString); }
private void button4_Click(object sender, EventArgs e) { SqlConnection Connection = new SqlConnection(Con.ConnectionString()); if (Cat.SelectedIndex == -1) { toolStripStatusLabel1.Text = "Please Select a Catagory"; Cat.Focus(); } else if (SubCat.SelectedIndex == -1) { toolStripStatusLabel1.Text = "Please Select Sub Catagory "; SubCat.Focus(); } else if (ItemNo.Text.ToString().Trim(' ') == "") { toolStripStatusLabel1.Text = "Please Enter Item No"; ItemNo.Text = ""; ItemNo.Focus(); } else if (Units.Text.ToString().Trim(' ') == "") { toolStripStatusLabel1.Text = "Please Enter Units"; Units.Text = ""; Units.Focus(); } else if (StockPrice.Text.ToString().Trim(' ') == "") { toolStripStatusLabel1.Text = "Please Enter Stock Price"; StockPrice.Text = ""; StockPrice.Focus(); } else if (SalesPrice.Text.ToString().Trim(' ') == "") { toolStripStatusLabel1.Text = "Please Enter Sales Price"; SalesPrice.Text = ""; SalesPrice.Focus(); } else if (UnitsInStock.Text.ToString().Trim(' ') == "") { toolStripStatusLabel1.Text = "Please Enter how many Units have in Stock"; UnitsInStock.Text = ""; UnitsInStock.Focus(); } else if (ROL.Text.ToString().Trim(' ') == "") { toolStripStatusLabel1.Text = "Please Enter ReOrder Level"; ROL.Text = ""; ROL.Focus(); } else if (Convert.ToDecimal(Profit.Text) < 0) { MessageBox.Show("Your Stock price larger than Sales Price" + Environment.NewLine + "Enter Correct Value or Change the Discount Rate", "Data Entry Problem", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);; SalesPrice.Focus(); } else { try { Connection.Open(); if (button4.Text.ToString() == "Save") { SqlCommand INSERT = new SqlCommand("INSERT INTO ItemList(ItemNo,Descriptions,Units,Catagory,SubCatagory,StockPrice,SalesPrice,Discount,UnitsInStock,ROL) VALUES(@ItemNo,@Descriptions,@Units,@Catagory,@SubCatagory,@StockPrice,@SalesPrice,@Discount,@UnitsInStock,@ROL)", Connection); INSERT.Parameters.AddWithValue("@ItemNo", ItemNo.Text.ToString()); INSERT.Parameters.AddWithValue("@Descriptions", Des.Text.ToString()); INSERT.Parameters.AddWithValue("@Units", Units.Text.ToString()); INSERT.Parameters.AddWithValue("@Catagory", Cat.SelectedItem.ToString()); INSERT.Parameters.AddWithValue("@SubCatagory", SubCat.SelectedItem.ToString()); INSERT.Parameters.AddWithValue("@StockPrice", Convert.ToDecimal(StockPrice.Text)); INSERT.Parameters.AddWithValue("@SalesPrice", Convert.ToDecimal(SalesPrice.Text)); INSERT.Parameters.AddWithValue("@Discount", Convert.ToInt16(Discount.Text)); INSERT.Parameters.AddWithValue("@UnitsInStock", Convert.ToInt64(UnitsInStock.Text)); INSERT.Parameters.AddWithValue("@ROL", Convert.ToInt32(ROL.Text)); if (INSERT.ExecuteNonQuery() == 1) { toolStripStatusLabel1.Text = "Sucessfully Saved"; ItemNo2.Items.Add(ItemNo.Text.ToString()); ItemNo.Text = ""; Des.Text = ""; Units.Text = ""; StockPrice.Clear(); SalesPrice.Text = ""; Discount.Text = ""; UnitsInStock.Text = ""; ROL.Text = ""; Profit.Text = "0.0"; ItemNo.Focus(); } else { toolStripStatusLabel1.Text = "Error Item Not Saved"; } } else { SqlCommand UPDES = new SqlCommand("UPDATE ItemList SET Descriptions=@Descriptions WHERE ItemNo=@ItemNo", Connection); UPDES.Parameters.AddWithValue("@Descriptions", Des.Text.ToString()); UPDES.Parameters.AddWithValue("@ItemNo", ItemNo.Text.ToString()); SqlCommand UPUNIT = new SqlCommand("UPDATE ItemList SET Units=@Units WHERE ItemNo=@ItemNo", Connection); UPUNIT.Parameters.AddWithValue("@Units", Units.Text.ToString()); UPUNIT.Parameters.AddWithValue("@ItemNo", ItemNo.Text.ToString()); SqlCommand UPCAT = new SqlCommand("UPDATE ItemList SET Catagory=@Catagory WHERE ItemNo=@ItemNo", Connection); UPCAT.Parameters.AddWithValue("@Catagory", Cat.SelectedItem.ToString()); UPCAT.Parameters.AddWithValue("@ItemNo", ItemNo.Text.ToString()); SqlCommand UPSUBCAT = new SqlCommand("UPDATE ItemList SET SubCatagory=@SubCatagory WHERE ItemNo=@ItemNo", Connection); UPSUBCAT.Parameters.AddWithValue("@SubCatagory", SubCat.SelectedItem.ToString()); UPSUBCAT.Parameters.AddWithValue("@ItemNo", ItemNo.Text.ToString()); SqlCommand UPSTOCKPRICE = new SqlCommand("UPDATE ItemList SET StockPrice=@StockPrice WHERE ItemNo=@ItemNo", Connection); UPSTOCKPRICE.Parameters.AddWithValue("@StockPrice", Convert.ToDecimal(StockPrice.Text)); UPSTOCKPRICE.Parameters.AddWithValue("@ItemNo", ItemNo.Text.ToString()); SqlCommand UPSALESPRICE = new SqlCommand("UPDATE ItemList SET SalesPrice=@SalesPrice WHERE ItemNo=@ItemNo", Connection); UPSALESPRICE.Parameters.AddWithValue("@SalesPrice", Convert.ToDecimal(SalesPrice.Text)); UPSALESPRICE.Parameters.AddWithValue("@ItemNo", ItemNo.Text.ToString()); SqlCommand UPDISCOUNT = new SqlCommand("UPDATE ItemList SET Discount=@Discount WHERE ItemNo=@ItemNo", Connection); UPDISCOUNT.Parameters.AddWithValue("@Discount", Convert.ToInt16(Discount.Text)); UPDISCOUNT.Parameters.AddWithValue("@ItemNo", ItemNo.Text.ToString()); SqlCommand UPUNITSINSTOCK = new SqlCommand("UPDATE ItemList SET UnitsInStock=@UnitsInStock WHERE ItemNo=@ItemNo", Connection); UPUNITSINSTOCK.Parameters.AddWithValue("@UnitsInStock", Convert.ToInt64(UnitsInStock.Text)); UPUNITSINSTOCK.Parameters.AddWithValue("@ItemNo", ItemNo.Text.ToString()); SqlCommand UPROL = new SqlCommand("UPDATE ItemList SET ROL=@ROL WHERE ItemNo=@ItemNo", Connection); UPROL.Parameters.AddWithValue("@ROL", Convert.ToInt32(ROL.Text)); UPROL.Parameters.AddWithValue("@ItemNo", ItemNo.Text.ToString()); int a, b, c, d, ei, f, g, h, i; a = UPDES.ExecuteNonQuery(); b = UPUNIT.ExecuteNonQuery(); c = UPSTOCKPRICE.ExecuteNonQuery(); d = UPSALESPRICE.ExecuteNonQuery(); ei = UPDISCOUNT.ExecuteNonQuery(); f = UPUNITSINSTOCK.ExecuteNonQuery(); g = UPROL.ExecuteNonQuery(); h = UPCAT.ExecuteNonQuery(); i = UPSUBCAT.ExecuteNonQuery(); if ((a == 1) && (b == 1) && (c == 1) && (d == 1) && (ei == 1) && (f == 1) && (g == 1) && (h == 1) && (i == 1)) { toolStripStatusLabel1.Text = "Update Sucessfully"; ItemNo.Text = ""; Des.Text = ""; Units.Text = ""; StockPrice.Text = ""; SalesPrice.Text = ""; Discount.SelectedIndex = 0; UnitsInStock.Text = ""; ROL.Text = ""; Profit.Text = "0.0"; Cat.Focus(); } else { toolStripStatusLabel1.Text = "Error, Item Not Updated"; } } Connection.Close(); } catch { } } }