private void button3_Click(object sender, EventArgs e) { try { if (Validation()) { if (IfEmployeeExists(textBox5.Text, textBox2.Text)) { MessageBox.Show("Employee already Exists"); } else { DialogResult dr = MessageBox.Show("Are you sure want to Save Record", "Polkotuwa Stores", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { Connection3 con3 = new Connection3(); con3.dataSend3("insert into [dbo].[Employee_Register] (Name,Mobile,Email,Dob,BankDetails,Address) values('" + textBox5.Text.ToString() + "', '" + textBox2.Text.ToString() + "', '" + textBox6.Text.ToString() + "', '" + dateTimePicker1.Value.ToString("dd-MM-yyyy") + "', '" + textBox4.Text.ToString() + "', '" + textBox7.Text.ToString() + "', '" + "')"); MessageBox.Show("Record Saved Successfully....!!!", "Polkotuwa Stores", MessageBoxButtons.OK, MessageBoxIcon.Information); disp_data(); } ClearData(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button4_Click(object sender, EventArgs e) { try { DialogResult dr = MessageBox.Show("Are you sure want to Update", "Polkotuwa Stores", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { con3.dataSend3("UPDATE [dbo].[Employee_Register] SET Email ='" + textBox6.Text + "', BankDetails ='" + textBox4.Text + "', Address ='" + textBox7.Text + "'where EmpId='" + textBox1.Text + "'"); MessageBox.Show("Record Updated Successfully....!!!", "Polkotuwa Stores", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearData(); } disp_data(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button1_Click(object sender, EventArgs e) { try { con3.dataSend3("insert into [dbo].[EmpAttendence] (EmpId,Name,Year,Month,TotalDays,WorkingDays,PresentDays,AbsentDays) values ('" + textBox5.Text + "','" + textBox6.Text + "','" + comboBox1.Text + "','" + comboBox2.Text + "','" + textBox1.Text.ToString() + "','" + textBox2.Text.ToString() + "','" + textBox3.Text.ToString() + "','" + textBox4.Text.ToString() + "')"); MessageBox.Show("Saved Successfully....!!!", "Polkotuwa Stores", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button1_Click_1(object sender, EventArgs e) { try { con3.dataSend3(@"insert into [dbo].[Budget] (Year,Month,CostForInventory,WaterBill,LightBill,EmployeeTotalSalary,Other,TotalIncome,NetIncomeForMonth,NetIncomeForYear) values ('" + comboBox1.Text + "','" + comboBox2.Text + "','" + textBox1.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox2.Text + "','" + textBox7.Text + "','" + textBox8.Text + "')"); MessageBox.Show("Saved Successfully....!!!", "Polkotuwa Stores", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearData(); LoadData(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }