private void btn_ane_insert_Click(object sender, EventArgs e) { if (txteno.Text == "") { txteno.BackColor = Color.Red; } else { try { pno = Convert.ToInt32(mtxt_pno.Text); con.connection(); con.qurry("insert into employee values('" + txteno.Text + "','" + txtename.Text + "','" + txteadd.Text + "','" + pno + "','" + dtp_dob.Text + "');"); con.nonqurry(); MessageBox.Show("insert"); con.conclose(); txteno.BackColor = Color.White; txteadd.Clear(); txtename.Clear(); txteno.Clear(); mtxt_pno.Clear(); } catch (Exception EX) { MessageBox.Show(EX.Message); } } }
private void btn_ok_Click(object sender, EventArgs e) { try { con.connection(); con.qurry("select * from item where ino='" + txtino.Text + "';"); String price = ""; String cost = ""; String name = ""; int q1 = Convert.ToInt32(txtqty.Text); con.ad(); price = con.dt.Rows[0][2].ToString(); cost = con.dt.Rows[0][3].ToString(); name = con.dt.Rows[0][1].ToString(); double p = double.Parse(price); double c = double.Parse(cost); double totcost = (c * q1); double subtotal = (p * q1); decimal tcc = (decimal)totcost; decimal stt = (decimal)subtotal; gtot = gtot + stt; txtiname.Text = name; txt_gross_amo.Text = gtot.ToString(); txtsubtot.Text = subtotal.ToString(); con.qurry("update item set no_of_item=(no_of_item-'" + txtqty.Text + "') where ino='" + txtino.Text + "';"); con.nonqurry(); con.qurry("update sales_s set item_name='" + txtiname.Text + "', item_price=(item_price+ '" + stt + "') ,item_cost=(item_cost+ '" + tcc + "'),no_of_s=(no_of_s+ '" + q1 + "') where item_no='" + txtino.Text + "';"); con.nonqurry(); lst_bill.Items.Add(string.Format("{0} ", txtiname.Text)); lst_bill.Items.Add(string.Format(" X {0} RS.{1} ", txtqty.Text, txtsubtot.Text)); } catch (Exception EX) { MessageBox.Show(EX.Message); } }
private void button1_Click(object sender, EventArgs e) { con.connection(); con.qurry("delete from employee where eno='" + textBox1.Text + "';"); con.nonqurry(); MessageBox.Show("Delete!"); }
private void button1_Click(object sender, EventArgs e) { try { con.connection(); con.qurry("select * from log where UserName='******';"); con.ad(); String pw = ""; pw = con.dt.Rows[0][1].ToString(); //con.dt.Clear(); if (pw.Equals(txtoldpass2.Text)) { con.qurry("update log set password='******' where UserName='******';"); con.nonqurry(); MessageBox.Show("Password Change!"); } else { MessageBox.Show("Check Ysername or Password"); } } catch (Exception EX) { MessageBox.Show(EX.Message); } }
private void button3_Click(object sender, EventArgs e) { try { con.connection(); con.qurry("insert into item values('" + txtino.Text + "','" + txtiname.Text + "','" + txtiprice.Text + "','" + txticost.Text + "','" + txtqty.Text + "');"); con.nonqurry(); con.qurry("insert into sales_s values('" + txtino.Text + "','" + txtiname.Text + "',0,0,0);"); con.nonqurry(); MessageBox.Show("insert"); con.conclose(); } catch (Exception EX) { MessageBox.Show(EX.Message); } }
/* private void textBox3_Click(object sender, EventArgs e) * { * lblprivrlege.Show(); * }*/ /* private void textBox3_MouseLeave(object sender, EventArgs e) * { * lblprivrlege.Hide(); * }*/ private void button1_Click(object sender, EventArgs e) { try { con.connection(); con.qurry("insert into log values('" + txtusername.Text + "','" + txtpass.Text + "','" + txtprivilege.Text + "');"); con.nonqurry(); MessageBox.Show("user created!"); con.conclose(); } catch (Exception EX) { MessageBox.Show(EX.Message); } }
private void button4_Click(object sender, EventArgs e) { try { DialogResult dialogResult = MessageBox.Show("Are you sure you want to Reset Data?", "Some Title", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { Microsoft.Office.Interop.Excel._Application app = new Microsoft.Office.Interop.Excel.Application(); Microsoft.Office.Interop.Excel._Workbook workbook = app.Workbooks.Add(Type.Missing); Microsoft.Office.Interop.Excel._Worksheet worksheet = null; app.Visible = true; worksheet = workbook.Sheets["Sheet1"]; worksheet = workbook.ActiveSheet; for (int i = 1; i < dataGridView1.Columns.Count + 1; i++) { worksheet.Cells[1, i] = dataGridView1.Columns[i - 1].HeaderText; } for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) { for (int j = 0; j < dataGridView1.Columns.Count; j++) { if (dataGridView1.Rows[i].Cells[j].Value != null) { worksheet.Cells[i + 2, j + 1] = dataGridView1.Rows[i].Cells[j].Value.ToString(); } else { worksheet.Cells[i + 2, j + 1] = ""; } } } con.connection(); con.qurry("update sales_s set item_price=0,item_cost=0,no_of_s=0;"); con.nonqurry(); } else if (dialogResult == DialogResult.No) { MessageBox.Show("aaaaaaaaaaa"); } } catch (Exception EX) { MessageBox.Show(EX.Message); } }
private void button1_Click(object sender, EventArgs e) { try { con.connection(); con.qurry("delete from item where ino='" + txtino2.Text + "';"); con.nonqurry(); con.conclose(); MessageBox.Show("Deleted!"); } catch (Exception EX) { MessageBox.Show(EX.Message); } finally { txtino2.Clear(); txtino2.Focus(); } }