private void btn_delete_Click(object sender, EventArgs e) { try { DialogResult dr = MessageBox.Show(this, "Do you really want to remove ? ", "warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); int ino = Convert.ToInt32(txt_iuno.Text); if (dr == DialogResult.Yes) { Class_sales bkk = new Class_sales(); int flag = bkk.delete(ino); if (flag > 0) { MessageBox.Show(this, "Row deleted", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); loadmetro2(); } else { MessageBox.Show(this, "Data not deleted", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception) { MessageBox.Show(this, "Datbse error ", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void cmb_fnme_SelectedIndexChanged(object sender, EventArgs e) { try { conDB.con.Open(); string aa = cmb_fnme.SelectedItem.ToString(); string query = "SELECT cus_ID from tbl_customer where cfname='" + aa + "' "; SqlCommand cmd = new SqlCommand(query, conDB.con); SqlDataReader dr = cmd.ExecuteReader(); int cid = 0; while (dr.Read()) { cid = Convert.ToInt32(dr.GetValue(0)); //txt_cid.Text = dr.GetValue(0).ToString(); } txt_cid.Text = cid.ToString(); cmd.Dispose(); dr.Dispose(); conDB.con.Close(); Class_sales ss = new Class_sales(); ld(); } catch (SqlException) { MessageBox.Show(this, "Database Error ", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception) { MessageBox.Show(this, "Error ", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void ld() { // chk(); DateTime dtnow = DateTime.Today; ; int cid = Convert.ToInt32(txt_cid.Text); Class_sales cs = new Class_sales(); cs.add(dtnow, cid); try { conDB.con.Open(); string qury = "SELECT OrderID from tbl_Orders where cid='" + cid + "' "; SqlCommand cmd = new SqlCommand(qury, conDB.con); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { txt_oid.Text = dr.GetValue(0).ToString(); } cmd.Dispose(); dr.Dispose(); cmd.Dispose(); conDB.con.Close(); Class_sales ss = new Class_sales(); int a = Convert.ToInt32(txt_oid.Text.ToString()); } catch (SqlException) { MessageBox.Show(this, "Databasse Error", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception) { MessageBox.Show(this, "Error ", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btn_update_Click(object sender, EventArgs e) { try{ DialogResult dr = MessageBox.Show(this, "Do you really want to update?", "warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr == DialogResult.Yes) { int id = Convert.ToInt32(txt_iuno.Text); int qty = 0; qty = Convert.ToInt32(txt_uqty.Text); Class_sales ss = new Class_sales(); int flag = ss.update(qty, txt_udno.Text, id); if (flag > 0) { MessageBox.Show(this, "Successfull", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); clear(); loadmetro2(); } else { MessageBox.Show(this, "Data not updated ", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (SqlException) { MessageBox.Show("Datbase error ", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception) { MessageBox.Show(this, "Error ", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btn_srch_Click(object sender, EventArgs e) { try { if (cmb_fnme.Text.Length > 0) { errorProvider1.Clear(); if (txt_dsno.Text.Length > 0) { if (txt_qty.Text.Length > 0) { errorProvider2.Clear(); int flag = 0; DateTime dtnow = DateTime.Today; int qty = 0; int ino = Convert.ToInt16(txt_ino.Text); int oid = Convert.ToInt32(txt_oid.Text); qty = Convert.ToInt32(txt_qty.Text); Class_sales cs = new Class_sales(); flag = cs.add(ino, oid, qty, txt_dsno.Text); if (flag > 0) { // MessageBox.Show(this, "Row added", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); PopupNotifier popup = new Tulpep.NotificationWindow.PopupNotifier(); popup.Image = Properties.Resources.Information_Bubble_48; popup.ContentText = "Success"; // popup.BodyColor.ToString(); popup.Popup(); } else { MessageBox.Show(this, "Data not added ", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } clear(); } else { errorProvider3.SetError(txt_qty, "Quantity Required"); } } else { errorProvider2.SetError(txt_dsno, "Please enter design no"); } } else { errorProvider1.SetError(cmb_fnme, "Please select customer"); } loadmetro2(); // load(); } catch (SqlException) { MessageBox.Show(this, "Database Error ", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception) { MessageBox.Show(this, "Error ", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } }