private void OKButton_Click(object sender, EventArgs e) { General.CreateCounterpartyAccount(Counterparty); SaledShopMaterials SaledMaterials = new SaledShopMaterials(); SaledMaterials.InsertRecords(titlebox.Text, textBox3.Text, textBox1.Text, textBox2.Text, textBox5.Text, DateTime.Today.ToString(), "Vella", Counterparty); SaledMaterials.Close(); General.DeleteFromSQLDataBase("ResidueShopMaterials", "Имя", titlebox.Text); CounterpartyAccount CpAcc = new CounterpartyAccount(); CpAcc.LoadString = Counterparty; CpAcc.ProductName = titlebox.Text; CpAcc.PriceString = textBox1.Text; CpAcc.CountString = textBox2.Text; CpAcc.SumString = textBox4.Text; CpAcc.InsertRecordsBoolean = true; CpAcc.Date = dateTimePicker1.Text; CpAcc.ShowDialog(this); }
private void OKButton_Click(object sender, EventArgs e) { try { Price = PriceValue; Count = Count - CountValue; Summ = Summ - SummValue; CratesCount = CratesCount - CratesCountBalue; Mass = Mass - MassValue; if (!File.Exists(Application.StartupPath + "//Shop.Residue.Data.xml")) { General.ShowErrorBox("Список продуктов цеха отсутствует!\nВозможно была потеря данных, обратитесь к администрации программы!"); } else { XmlDocument xDoc = new XmlDocument(); xDoc.Load(Application.StartupPath + "//Shop.Residue.Data.xml"); XmlElement xRoot = xDoc.DocumentElement; XmlNode childnode = xRoot.SelectSingleNode(String.Format("ShopResidue[Имя='{0}']", titlebox.Text)); if (childnode != null) { XmlNode nameChildNode = childnode.SelectSingleNode("Имя"); string elemNameStr = "NONE"; if (nameChildNode != null) { elemNameStr = nameChildNode.InnerText; XmlNode massElem = childnode.SelectSingleNode("Масса"); XmlNode countElem = childnode.SelectSingleNode("Количество"); XmlNode cratesElem = childnode.SelectSingleNode("КоличествоКаробок"); XmlNode pricesElem = childnode.SelectSingleNode("Цена"); XmlNode summElem = childnode.SelectSingleNode("Сумма"); if (massElem != null && countElem != null && cratesElem != null && pricesElem != null && summElem != null) { massElem.InnerText = Mass.ToString(); countElem.InnerText = Count.ToString(); cratesElem.InnerText = CratesCount.ToString(); pricesElem.InnerText = Price.ToString(); summElem.InnerText = Summ.ToString(); } } } xDoc.Save(Application.StartupPath + "//Shop.Residue.Data.xml"); } //General.UpdateCellData("ResidueShopMaterials", "Масса", textBox3.Text, Convert.ToInt32(ID)); //General.UpdateCellData("ResidueShopMaterials", "Цена", textBox1.Text, Convert.ToInt32(ID)); //General.UpdateCellData("ResidueShopMaterials", "Количество", textBox2.Text, Convert.ToInt32(ID)); //General.UpdateCellData("ResidueShopMaterials", "КоличествоКаробок", textBox5.Text, Convert.ToInt32(ID)); //General.UpdateCellData("ResidueShopMaterials", "Сумма", textBox4.Text, Convert.ToInt32(ID)); Date = DateControl.Text.ToString(); if (ProviderTextBox.Text != null) { Provider = ProviderTextBox.Text; } if (RecipientTextBox.Text != null) { Recipient = RecipientTextBox.Text; } SaledShopMaterials RRMF = new SaledShopMaterials(); RRMF.InsertRecords(titlebox.Text, textBox3.Text, textBox1.Text, textBox2.Text, textBox5.Text, Date, Provider, Recipient); RRMF.ShowDialog(this); try { General.CreateTable(Recipient, String.Format("ID int IDENTITY (1, 1) not null, Продукт nchar(25) not null, Цена float not null, Количество float not null, Сумма float not null, Дата nvarchar(15), constraint PK_{0} primary key clustered([ID] ASC)", Recipient)); InsertRecordsToCouterparty(titlebox.Text, PriceValue, CountValue, SummValue, Date); } catch (Exception) { General.Connection.Close(); } this.Close(); } catch (Exception) { } }