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; } } }