private void button2_Click(object sender, EventArgs e) { int tbQty = int.Parse(textBox6.Text); if (tbQty != roldQty) { StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient(); TransactionMgnt.TransactionMgntClient client1 = new TransactionMgnt.TransactionMgntClient(); var msg1 = client1.AddRegulatorTx(tbQty); var msg = client.SetRegulators(tbQty + roldQty); if (msg.Equals("OK") && msg1.Equals("OK")) { MessageBox.Show("Your new Regulator stock is " + (tbQty + roldQty)); } else { MessageBox.Show("Some error occured!!"); } } else { MessageBox.Show("You have not changed Regulator stock!!!"); } textBox6.Text = null; }
private void button3_Click(object sender, EventArgs e) { StockMgntRef.Stove stove = new StockMgntRef.Stove(); stove.Product = textBox3.Text; stove.Price = double.Parse(textBox5.Text); stove.Quentity = int.Parse(textBox4.Text); StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient(); TransactionMgnt.TransactionMgntClient client1 = new TransactionMgnt.TransactionMgntClient(); var msg = client.AddStove(stove); var msg1 = client1.AddStoveTx(textBox3.Text, int.Parse(textBox4.Text)); if (msg.Equals("OK") && msg1.Equals("OK")) { MessageBox.Show("Successfully added new product."); } dataGridView1.DataSource = client.GetStoves(); stoves = client.GetStoves().ToList(); string[] stoveTypes = stoves.Where(x => x.Price != 0).Select(x => x.Product).ToArray(); comboBox1.Items.Clear(); comboBox2.Items.Clear(); comboBox2.Items.AddRange(stoveTypes); comboBox1.Items.AddRange(stoveTypes); textBox4.Text = ""; textBox5.Text = ""; }
private void button2_Click(object sender, EventArgs e) { int imageWidth, tbQty = 0; if (Int32.TryParse(textBox17.Text, out imageWidth)) { tbQty = imageWidth; } if (customer.CustomerType.Equals("Industrial") && tbQty == 0) { MessageBox.Show("Please, Enter Quentity of Cylender!!!"); } else if (customer.CustomerType.Equals("Industrial") && tbQty > 10) { MessageBox.Show("At a time at most 10 cylinders can be sold!!!"); } else { button2.Enabled = false; using (TransactionMgnt.TransactionMgntClient client = new TransactionMgnt.TransactionMgntClient()) { TransactionMgnt.TxCylinder txCylinder = client.BookingCylinderTx(cid, tbQty); if (txCylinder.TxId > 0) { MessageBox.Show("Cylinder is Booked Successfully !!! \nCashmemo Number is " + txCylinder.CashMemoNo); //PrintBill(txCylinder); PrintReceipt(txCylinder, customer); button2.Visible = false; TransactionMgnt.TransactionMgntClient client1 = new TransactionMgnt.TransactionMgntClient(); List <TransactionMgnt.TxCylinder> res = client1.GetLastTxs(customer.CustomerId).ToList(); dataGridView1.DataSource = res; } } } }
private void button1_Click(object sender, EventArgs e) { string temp = textBox1.Text; for (int i = 0; i < customersNames.Length; i++) { if (customersNames[i].Equals(temp)) { selectedCname = customersNames[i]; button2.Enabled = true; break; } } if (selectedCname != null) { button2.Visible = true; using (CustomerMgntRef.CustomerMgntClient client = new CustomerMgntRef.CustomerMgntClient()) { customer = client.GetCustomer(selectedCname); cid = customer.CustomerId; } if (customer != null && customer.CustomerType.Equals("Industrial")) { label2.Visible = true; textBox17.Visible = true; } textBox2.Text = customer.CustomerName; textBox12.Text = customer.Gender; textBox16.Text = customer.CustomerType; textBox3.Text = customer.AadharNo; textBox14.Text = customer.RashanCardNo; textBox13.Text = customer.Address; textBox4.Text = customer.City; textBox15.Text = customer.PinNo.ToString(); textBox5.Text = customer.Taluka; textBox6.Text = customer.District; textBox7.Text = customer.State; textBox8.Text = customer.ContactNo; textBox9.Text = customer.Email; textBox10.Text = customer.BankIFSC; textBox11.Text = customer.BankAccountNo; TransactionMgnt.TransactionMgntClient client1 = new TransactionMgnt.TransactionMgntClient(); List <TransactionMgnt.TxCylinder> res = client1.GetLastTxs(customer.CustomerId).ToList(); dataGridView1.DataSource = res; if (res.FirstOrDefault().TxDate.ToShortDateString().Equals(DateTime.Now.ToShortDateString())) { button2.Visible = false; } } }
private void button1_Click(object sender, EventArgs e) { StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient(); TransactionMgnt.TransactionMgntClient client1 = new TransactionMgnt.TransactionMgntClient(); var fr = client.SetFCylinders(selectedFType, int.Parse(textBox1.Text)); var er = client.SetECylinders(selectedEType, int.Parse(textBox1.Text)); var msg1 = client1.AddCylenderTx(comboBox1.Text, int.Parse(textBox1.Text)); if (fr.Equals("OKF") && er.Equals("OKE") && msg1.Equals("OK")) { MessageBox.Show("Stock is Updated"); } cylinders = client.GetCylinders().ToList(); dataGridView1.DataSource = cylinders; textBox1.Text = ""; }
private void button1_Click(object sender, EventArgs e) { StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient(); TransactionMgnt.TransactionMgntClient client1 = new TransactionMgnt.TransactionMgntClient(); int total = int.Parse(textBox1.Text) + soldQty; var msg = client.SetStoves(comboBox1.Text, total); var msg1 = client1.AddStoveTx(comboBox1.Text, int.Parse(textBox1.Text)); if (msg.Equals("OK") && msg1.Equals("OK")) { MessageBox.Show("Your new stock for product '" + comboBox1.Text + "' is " + total); } textBox1.Text = ""; stoves = client.GetStoves().ToList(); comboBox1.DataSource = stoves; dataGridView1.DataSource = stoves; }
private void button5_Click(object sender, EventArgs e) { dataGridView3.Rows.Clear(); string cname = textBox1.Text.Trim(); double totalAmt = 0; string product = ""; int qty = 0; if (cname.Length > 0) { int imageWidth, tbQty = 0; if (Int32.TryParse(textBox2.Text, out imageWidth)) { tbQty = imageWidth; } TransactionMgnt.TransactionMgntClient txClient = new TransactionMgnt.TransactionMgntClient(); List <TransactionMgnt.GSTRates> gstrates = txClient.GetGSTRates().ToList(); if (tbQty > 0) { StockMgntRef.StockMgntClient stockMgntClient = new StockMgntRef.StockMgntClient(); var reg = stockMgntClient.GetRegulators(); int regStock = reg.Quentity; if (regStock >= tbQty) { double cgst = gstrates.Where(x => x.Comodity.Equals("Regulator")).FirstOrDefault().CGST; double sgst = gstrates.Where(x => x.Comodity.Equals("Regulator")).FirstOrDefault().SGST; DataGridViewRow nrow = (DataGridViewRow)dataGridView3.Rows[0].Clone(); nrow.Cells[0].Value = "Regulator(s)"; nrow.Cells[1].Value = tbQty; nrow.Cells[2].Value = reg.Price; nrow.Cells[3].Value = (100 + cgst + sgst) * (reg.Price * tbQty) / 100; totalAmt += double.Parse(nrow.Cells[3].Value.ToString()); dataGridView3.Rows.Add(nrow); } else { MessageBox.Show("Not Enough Stock of Regulators!!!"); } } foreach (DataGridViewRow row1 in dataGridView1.Rows) { if (row1.Cells[0].Value != null) { product = row1.Cells[0].Value.ToString(); if (int.Parse(row1.Cells[1].Value.ToString()) > 0) { var selectedStove = stoves.Where(x => x.Product.Equals(product)).FirstOrDefault(); if (selectedStove.Quentity >= qty) { qty = int.Parse(row1.Cells[1].Value.ToString()); double cgst = gstrates.Where(x => x.Comodity.Equals("Stove")).FirstOrDefault().CGST; double sgst = gstrates.Where(x => x.Comodity.Equals("Stove")).FirstOrDefault().SGST; DataGridViewRow nrow = (DataGridViewRow)dataGridView3.Rows[0].Clone(); nrow.Cells[0].Value = product; nrow.Cells[1].Value = qty; nrow.Cells[2].Value = selectedStove.Price; nrow.Cells[3].Value = (100 + cgst + sgst) * (selectedStove.Price * qty) / 100; totalAmt += double.Parse(nrow.Cells[3].Value.ToString()); dataGridView3.Rows.Add(nrow); } else { MessageBox.Show("Not Enough Stock of Stove '" + product + "' !!!"); } } } } label7.Text = totalAmt.ToString(); } }
private void button3_Click(object sender, EventArgs e) { string cname = textBox1.Text.Trim(); int cmnum = 0; string product = ""; int qty = 0; if (cname.Length > 0) { int imageWidth, tbQty = 0; if (Int32.TryParse(textBox2.Text, out imageWidth)) { tbQty = imageWidth; } if (tbQty > 0) { StockMgntRef.StockMgntClient stockMgntClient = new StockMgntRef.StockMgntClient(); int regStock = stockMgntClient.GetRegulators().Quentity; if (regStock >= tbQty) { TransactionMgnt.TransactionMgntClient client = new TransactionMgnt.TransactionMgntClient(); cmnum = client.RegulatorTx(cname, tbQty); //PrintBill(); } else { MessageBox.Show("Not Enough Stock of Regulators!!!"); } } foreach (DataGridViewRow row1 in dataGridView1.Rows) { if (row1.Cells[0].Value != null) { product = row1.Cells[0].Value.ToString(); if (int.Parse(row1.Cells[1].Value.ToString()) > 0) { int stoveStock = stoves.Where(x => x.Product.Equals(product)).FirstOrDefault().Quentity; if (stoveStock >= qty) { qty = int.Parse(row1.Cells[1].Value.ToString()); TransactionMgnt.TransactionMgntClient client1 = new TransactionMgnt.TransactionMgntClient(); cmnum = client1.StoveTx(cname, product, qty, cmnum); } else { MessageBox.Show("Not Enough Stock of Stove '" + product + "' !!!"); } } } } if (cmnum > 0) { textBox1.Text = ""; textBox2.Text = ""; dataGridView1.Rows.Clear(); MessageBox.Show("Transaction is done Successfully !!! \nCashmemo Number is " + cmnum); } TransactionMgnt.TransactionMgntClient txClient = new TransactionMgnt.TransactionMgntClient(); List <TransactionMgnt.GSTRates> gstrates = txClient.GetGSTRates().ToList(); int f = 0; foreach (DataGridViewRow r in dataGridView1.Rows) { if (r.Cells[1].Value != null) { if (int.Parse(r.Cells[1].Value.ToString()) != 0) { f = 1; break; } else { f = 0; } } } if (tbQty > 0) { f = 1; } if (f == 1) { //MessageBox.Show("In Print"); PrintReceipt(cname, cmnum, stoves, dataGridView3, gstrates); } else { MessageBox.Show("Can't Generate Invoice for zero Quentity !!!"); } } }