private void SavePersonal_Click(object sender, EventArgs e) { string query = ""; int DistrictKey = ((KeyValuePair <int, string>)District.SelectedItem).Key; string que = ""; int ThanaKey = ((KeyValuePair <int, string>)Thana.SelectedItem).Key; string qu = ""; int MarriedKey = ((KeyValuePair <int, string>)MarriedCombox.SelectedItem).Key; String DistrictValue = ((KeyValuePair <int, string>)District.SelectedItem).Value; String ThanaValue = ((KeyValuePair <int, string>)Thana.SelectedItem).Value; String MarriedValue = ((KeyValuePair <int, string>)MarriedCombox.SelectedItem).Value; if (StaffIDtextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Staff ID"); StaffIDtextBox.Focus(); return; } if (ContacttextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Contact Number"); ContacttextBox.Focus(); return; } if (DOB.Text == "") { MessageBox.Show("Please Enter Date of Birth"); DOB.Focus(); return; } if (DistrictKey < 1) { MessageBox.Show("Please Enter District"); District.Focus(); return; } if (ThanaKey < 1) { MessageBox.Show("Please Enter Thana"); District.Focus(); return; } if (PostCodetextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Post Code"); PostCodetextBox.Focus(); return; } if (VillagetextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Village Name"); VillagetextBox.Focus(); return; } if (PresentAddresstextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Present Address"); PresentAddresstextBox.Focus(); return; } if (PermanentadresstextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Permanent Address"); PermanentadresstextBox.Focus(); return; } if (MarriedKey < 1) { MessageBox.Show("Please Enter Marital Status"); District.Focus(); return; } if (FathersNametextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Father's name"); FathersNametextBox.Focus(); return; } if (MothersNametextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Mother's Name"); MothersNametextBox.Focus(); return; } if (ParentsAddresstextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Present Address"); ParentsAddresstextBox.Focus(); return; } query = "SELECT COUNT(*) AS Count FROM Personal_Info WHERE StaffID = " + StaffIDtextBox.Text + ""; if (stfID == 0) { if (DbAccess.NumberOfRecords(query) > 0) { MessageBox.Show("This Username already exists! Please try another ID!"); StaffIDtextBox.Focus(); return; } } else { if (DbAccess.NumberOfRecords(query) > 1) { MessageBox.Show("Update Not Successfully Done!"); StaffIDtextBox.Focus(); return; } } try { if (stfID == 0) { query = "INSERT INTO Personal_Info(StaffID,Contact,[Date of Birth],District,Thana,[Post Code],Village,[Present Address],[Permanent Address],[Marital Status],[Father's Name],[Mother's Name],[Parent's Address]) VALUES(" + Convert.ToInt32(StaffIDtextBox.Text) + ", '" + ContacttextBox.Text + "', '" + DOB.Value.ToString("yyyy/MM/dd") + "', '" + DistrictValue + "', '" + ThanaValue + "', '" + PostCodetextBox.Text + "', '" + VillagetextBox.Text + "', '" + PresentAddresstextBox.Text + "', '" + PermanentadresstextBox.Text + "', '" + MarriedValue + "', '" + FathersNametextBox.Text + "', '" + MothersNametextBox.Text + "', '" + ParentsAddresstextBox.Text + "')"; } else { query = "UPDATE Personal_Info SET Contact = '" + ContacttextBox.Text + "', [Date of Birth] = '" + DOB.Text + "', District= '" + District.Text + "', Thana = '" + Thana.Text + "', [Post Code] = '" + PostCodetextBox.Text + "', Village = '" + VillagetextBox.Text + "',[Present Address] = '" + PresentAddresstextBox.Text + "', [Permanent Address] = '" + PermanentadresstextBox.Text + "', [Marital Status] = '" + MarriedValue + "',[Father's Name] = '" + FathersNametextBox.Text + "', [Mother's Name]= '" + MothersNametextBox.Text + "',[Parent's Address] = '" + ParentsAddresstextBox.Text + "' WHERE StaffID = " + stfID; } if (DbAccess.ExecuteToDB(query)) { if (stfID == 0) { MessageBox.Show("Saved Successfully!!!"); } else { MessageBox.Show("Update Successfully!!!"); } } else { MessageBox.Show("Failed To Save!!!"); } } catch (Exception ex) { MessageBox.Show("Connection Error!!!"); } finally { Reset(); } }
private void saveButton_Click(object sender, EventArgs e) { string query = ""; if (EmpIdtextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Employee ID"); EmpIdtextBox.Focus(); return; } if (userNametextBox.Text.Trim() == "") { MessageBox.Show("Please Enter UserName"); userNametextBox.Focus(); return; } if (passwordtextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Password"); passwordtextBox.Focus(); return; } if (confirmpasswordtextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Confirm Passowrd"); confirmpasswordtextBox.Focus(); return; } if (passwordtextBox.Text != confirmpasswordtextBox.Text) { MessageBox.Show("Password does not match with Confirm Passowrd"); passwordtextBox.Focus(); confirmpasswordtextBox.Focus(); return; } query = "SELECT COUNT(*) FROM Employee_Info WHERE UserName = '******'"; if (EmployeeID == 0) { if (DbAccess.NumberOfRecords(query) > 0) { MessageBox.Show("This username already exists! Please try another username!"); userNametextBox.Focus(); return; } } else { if (DbAccess.NumberOfRecords(query) > 1) { MessageBox.Show("This username already exists! Please try another username!"); userNametextBox.Focus(); return; } } try { if (EmployeeID == 0) { query = "INSERT INTO Employee_Info(EmpID,UserName,Password) VALUES(" + EmpIdtextBox.Text + ", '" + userNametextBox.Text + "', '" + passwordtextBox.Text + "')"; } else { query = "UPDATE Employee_Info SET Password = '******' WHERE EmpID = " + EmployeeID; } if (DbAccess.ExecuteToDB(query)) { if (EmployeeID == 0) { MessageBox.Show("Saved Successfully!!!"); } else { MessageBox.Show("Updated Successfully!!!"); } } else { MessageBox.Show("Failed To Save!!!"); } } catch (Exception ex) { MessageBox.Show("Connection Error!!!"); } finally { Reset(); } }
private void OFSaveButton_Click(object sender, EventArgs e) { string query = ""; int DepartmentKey = ((KeyValuePair <int, string>)DeptcomboBox.SelectedItem).Key; String DepartmentValue = ((KeyValuePair <int, string>)DeptcomboBox.SelectedItem).Value; String DesignationValue = ((KeyValuePair <int, string>)DesigcomboBox.SelectedItem).Value; String BloodValue = ((KeyValuePair <int, string>)BloodcomboBox.SelectedItem).Value; String StatusValue = ((KeyValuePair <int, string>)Statuscombo.SelectedItem).Value; string que = ""; int DesignationKey = ((KeyValuePair <int, string>)DesigcomboBox.SelectedItem).Key; string qu = ""; int BloodKey = ((KeyValuePair <int, string>)BloodcomboBox.SelectedItem).Key; string q = ""; int StatusKey = ((KeyValuePair <int, string>)Statuscombo.SelectedItem).Key; if (StaftextBox.Text == "") { query = "SELECT Count(*) AS Count FROM Official_Info"; int rowsCount = DbAccess.NumberOfRecords(query) + 1; stfID = Convert.ToInt32(DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + rowsCount.ToString()); } if (StaffNatext.Text.Trim() == "") { MessageBox.Show("Please Enter Staff Name"); StaffNatext.Focus(); return; } if (DepartmentKey < 1) { MessageBox.Show("Please Enter Department"); DeptcomboBox.Focus(); return; } if (DesignationKey < 1) { MessageBox.Show("Please Enter designation"); DesigcomboBox.Focus(); return; } if (EXPText.Text.Trim() == "") { MessageBox.Show("Please Enter Experience"); EXPText.Focus(); return; } if (BloodKey < 1) { MessageBox.Show("Please Enter BloodGroup"); BloodcomboBox.Focus(); return; } if (joindateTimePicker.Text.Trim() == "") { MessageBox.Show("Please Enter Time"); joindateTimePicker.Focus(); return; } if (NationaText.Text.Trim() == "") { MessageBox.Show("Please Enter Nationality"); NationaText.Focus(); return; } if (StatusKey < 1) { MessageBox.Show("Please Enter Status"); Statuscombo.Focus(); return; } try { if (StaftextBox.Text == "") { query = "INSERT INTO Official_Info(StaffID,StaffName,Department,Designation,AgeExp,BloodGroup,JoiningDate,Nationality,Status ) VALUES(" + stfID + ", '" + StaffNatext.Text + "', '" + DepartmentValue + "', '" + DesignationValue + "', " + Convert.ToInt32(EXPText.Text) + ", '" + BloodValue + "' , '" + joindateTimePicker.Value.ToString("yyyy/MM/dd") + "', '" + NationaText.Text + "', '" + StatusValue + "' )"; } else { query = "UPDATE Official_Info SET StaffName = '" + StaffNatext.Text + "' ,Department = '" + DepartmentValue + "', Designation = '" + DesignationValue + "', AgeExp= '" + Convert.ToInt32(EXPText.Text) + "',BloodGroup = '" + BloodValue + "', JoiningDate = '" + joindateTimePicker.Value.ToString("yyyy/MM/dd") + "',Nationality = '" + NationaText.Text + "',Status = '" + StatusValue + "' WHERE StaffID = " + Convert.ToInt32(StaftextBox.Text); } if (DbAccess.ExecuteToDB(query)) { if (stfID != 0) { MessageBox.Show("Saved Successfully!!!"); } else { MessageBox.Show("Updated Successfully!!!"); } } else { MessageBox.Show("Failed To Save!!!"); } } catch (Exception ex) { MessageBox.Show("Connection Error!!!"); } finally { Reset(); } }
private void SAveAdd_Click(object sender, EventArgs e) { string query = ""; int AnnonceKey = ((KeyValuePair <int, string>)AnnonceCombo.SelectedItem).Key; String AnnounceValue = ((KeyValuePair <int, string>)AnnonceCombo.SelectedItem).Value; if (AddStafID.Text.Trim() == "") { MessageBox.Show("Please Enter Staff ID"); AddStafID.Focus(); return; } if (AnnonceKey < 1) { MessageBox.Show("Please Enter Announce Type"); AnnonceCombo.Focus(); return; } if (AddDate.Text == "") { MessageBox.Show("Please Enter Announce Date"); AddDate.Focus(); return; } if (Addsubject.Text.Trim() == "") { MessageBox.Show("Please Enter Subject"); Addsubject.Focus(); return; } if (AddDescription.Text.Trim() == "") { MessageBox.Show("Please Add Description "); AddDescription.Focus(); return; } try { if (hidebox.Text == "") { query = "INSERT INTO Announcement_Info(StaffID,AnnounceType,Date,Subject,Description) VALUES(" + Convert.ToInt32(AddStafID.Text) + ", '" + AnnounceValue + "', '" + AddDate.Value.ToString("yyyy/MM/dd") + "', '" + Addsubject.Text + "', '" + AddDescription.Text + "' )"; } else { query = "UPDATE Announcement_Info SET AnnounceType = '" + AnnounceValue + "', Date = '" + AddDate.Text + "', Subject= '" + Addsubject.Text + "',Description = '" + Addsubject.Text + "' WHERE Id = " + Convert.ToInt32(hidebox.Text); } if (DbAccess.ExecuteToDB(query)) { if (hidebox.Text == "") { MessageBox.Show("Saved Successfully!!!"); } else { MessageBox.Show("Updated Successfully!!!"); } } else { MessageBox.Show("Failed To Save!!!"); } } catch (Exception ex) { MessageBox.Show("Connection Error!!!"); } finally { Reset(); } }
public Boolean IsValid(int TypeKey, string TypeValue, int totalLeave) { string query = "SELECT * FROM Leave_Info WHERE StaffID = " + Convert.ToInt32(StaffID.Text); int SickLeave = 0; int CasualLeave = 0; int MaternityLeave = 0; int EarnedLeave = 0; SqlDataReader reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { SickLeave = Convert.ToInt32(reader["SickLeave"]); CasualLeave = Convert.ToInt32(reader["CasualLeave"]); MaternityLeave = Convert.ToInt32(reader["MaternityLeave"]); EarnedLeave = Convert.ToInt32(reader["EarnedLeave"]); } } DbAccess.connnection.Close(); if (TypeKey == 1) { if (DbAccess.recordExist("SELECT* FROM LeaveApply_Info WHERE StaffID = " + Convert.ToInt32(StaffID.Text) + " AND year(DateFrom) = '" + (int)DateTime.Now.Year + "' AND Type = '" + TypeValue + "'")) { query = "SELECT SUM(Total) AS UsedLeave FROM LeaveApply_Info WHERE StaffID = " + Convert.ToInt32(StaffID.Text) + " AND year(DateFrom) = '" + (int)DateTime.Now.Year + "' AND Type = '" + TypeValue + "'"; reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { if (totalLeave > (SickLeave - Convert.ToInt32(reader["UsedLeave"]))) { DbAccess.connnection.Close(); return(false); } } } } else { query = "SELECT SickLeave FROM Leave_Info WHERE StaffID = " + Convert.ToInt32(StaffID.Text); reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { if (totalLeave > Convert.ToInt32(reader["SickLeave"])) { DbAccess.connnection.Close(); return(false); } } } } } if (TypeKey == 2) { if (DbAccess.recordExist("SELECT* FROM LeaveApply_Info WHERE StaffID = " + Convert.ToInt32(StaffID.Text) + " AND year(DateFrom) = '" + (int)DateTime.Now.Year + "' AND Type = '" + TypeValue + "'")) { query = "SELECT SUM(Total) AS UsedLeave FROM LeaveApply_Info WHERE StaffID = " + Convert.ToInt32(StaffID.Text) + " AND year(DateFrom) = '" + (int)DateTime.Now.Year + "' AND Type = '" + TypeValue + "'"; reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { if (totalLeave > (CasualLeave - Convert.ToInt32(reader["UsedLeave"]))) { DbAccess.connnection.Close(); return(false); } } } } else { query = "SELECT CasualLeave FROM Leave_Info WHERE StaffID = " + Convert.ToInt32(StaffID.Text); reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { if (totalLeave > Convert.ToInt32(reader["CasualLeave"])) { DbAccess.connnection.Close(); return(false); } } } } } if (TypeKey == 3) { if (DbAccess.recordExist("SELECT* FROM LeaveApply_Info WHERE StaffID = " + Convert.ToInt32(StaffID.Text) + " AND year(DateFrom) = '" + (int)DateTime.Now.Year + "' AND Type = '" + TypeValue + "'")) { query = "SELECT SUM(Total) AS UsedLeave FROM LeaveApply_Info WHERE StaffID = " + Convert.ToInt32(StaffID.Text) + " AND year(DateFrom) = '" + (int)DateTime.Now.Year + "' AND Type = '" + TypeValue + "'"; reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { if (totalLeave > (MaternityLeave - Convert.ToInt32(reader["UsedLeave"]))) { DbAccess.connnection.Close(); return(false); } } } } else { query = "SELECT MaternityLeave FROM Leave_Info WHERE StaffID = " + Convert.ToInt32(StaffID.Text); reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { if (totalLeave > Convert.ToInt32(reader["MaternityLeave"])) { DbAccess.connnection.Close(); return(false); } } } } } if (TypeKey == 4) { if (DbAccess.recordExist("SELECT* FROM LeaveApply_Info WHERE StaffID = " + Convert.ToInt32(StaffID.Text) + " AND year(DateFrom) = '" + (int)DateTime.Now.Year + "' AND Type = '" + TypeValue + "'")) { query = "SELECT SUM(Total) AS UsedLeave FROM LeaveApply_Info WHERE StaffID = " + Convert.ToInt32(StaffID.Text) + " AND year(DateFrom) = '" + (int)DateTime.Now.Year + "' AND Type = '" + TypeValue + "'"; reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { if (totalLeave > (EarnedLeave - Convert.ToInt32(reader["UsedLeave"]))) { DbAccess.connnection.Close(); return(false); } } } } else { query = "SELECT EarnedLeave FROM Leave_Info WHERE StaffID = " + Convert.ToInt32(StaffID.Text); reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { if (totalLeave > Convert.ToInt32(reader["EarnedLeave"])) { DbAccess.connnection.Close(); return(false); } } } } } DbAccess.connnection.Close(); return(true); }
private void eduSaveButton_Click(object sender, EventArgs e) { string query = ""; int studyKey = ((KeyValuePair <int, string>)studyCombo.SelectedItem).Key; String studyValue = ((KeyValuePair <int, string>)studyCombo.SelectedItem).Value; string quer = ""; int BoardKey = ((KeyValuePair <int, string>)BoardCombo.SelectedItem).Key; String BoardValue = ((KeyValuePair <int, string>)BoardCombo.SelectedItem).Value; if (stIText.Text.Trim() == "") { MessageBox.Show("Please Enter Staff ID"); stIText.Focus(); return; } if (studyKey < 1) { MessageBox.Show("Please Enter Studylevel"); studyCombo.Focus(); return; } if (NameofInstitutetext.Text == "") { MessageBox.Show("Please Enter Name Of Institute"); NameofInstitutetext.Focus(); return; } if (BoardKey < 1) { MessageBox.Show("Please Enter Your Board"); BoardCombo.Focus(); return; } if (Yeartext.Text.Trim() == "") { MessageBox.Show("Please Enter Your passing year"); Yeartext.Focus(); return; } if (CGPAtext.Text.Trim() == "") { MessageBox.Show("Please Enter Your CGPA"); CGPAtext.Focus(); return; } query = "SELECT COUNT(*) AS Count FROM Educational_Info WHERE StaffID = " + stIText.Text + ""; if (stfID == 0) { if (DbAccess.NumberOfRecords(query) > 0) { MessageBox.Show("This username already exists! Please try another ID!"); stIText.Focus(); return; } } else { if (DbAccess.NumberOfRecords(query) > 1) { MessageBox.Show("This username already exists! Please try another ID!"); stIText.Focus(); return; } } try { if (stfID == 0) { query = "INSERT INTO Educational_Info(StaffID,SudyLevel,NameOfIns,Board,PassingYear,CGPA) VALUES(" + Convert.ToInt32(stIText.Text) + ", '" + studyValue + "', '" + NameofInstitutetext.Text + "', '" + BoardValue + "', '" + Yeartext.Text + "', '" + CGPAtext.Text + "' )"; } else { query = "UPDATE Educational_Info SET SudyLevel = '" + studyValue + "', NameOfIns = '" + NameofInstitutetext.Text + "', Board= '" + BoardValue + "',PassingYear = '" + Yeartext.Text + "', CGPA = '" + CGPAtext.Text + "' WHERE StaffID = " + stfID; } if (DbAccess.ExecuteToDB(query)) { if (stfID == 0) { MessageBox.Show("Saved Successfully!!!"); } else { MessageBox.Show("Update Successfully!!!"); } } else { MessageBox.Show("Failed To Save!!!"); } } catch (Exception ex) { MessageBox.Show("Connection Error!!!"); } finally { Reset(); } }
private void SaveLeave_Click(object sender, EventArgs e) { string query = ""; int TypeKey = ((KeyValuePair <int, string>)LeaveaTypeCombo.SelectedItem).Key; String TypeValue = ((KeyValuePair <int, string>)LeaveaTypeCombo.SelectedItem).Value; if (StaffID.Text.Trim() == "") { MessageBox.Show("Please Enter Staff ID"); StaffID.Focus(); return; } if (TypeKey < 1) { MessageBox.Show("Please Enter Leave Type"); LeaveaTypeCombo.Focus(); return; } if (DateFrom.Text == "") { MessageBox.Show("Please Enter Date From"); DateFrom.Focus(); return; } if (DateTo.Text.Trim() == "") { MessageBox.Show("Please Enter Date To"); DateTo.Focus(); return; } if (TotalLeave.Text.Trim() == "") { TotalLeave.Focus(); return; } else { if (!IsValid(TypeKey, TypeValue, Convert.ToInt32(TotalLeave.Text))) { MessageBox.Show("You can not apply for more than ur assigned leave!!!"); return; } } try { if (hiddenText.Text == "") { query = "INSERT INTO LeaveApply_Info(StaffID,Type,Datefrom,DateTo,Total) VALUES(" + Convert.ToInt32(StaffID.Text) + ", '" + TypeValue + "', '" + DateFrom.Value.ToString("yyyy/MM/dd") + "', '" + DateTo.Value.ToString("yyyy/MM/dd") + "', '" + TotalLeave.Text + "' )"; } else { query = "UPDATE LeaveApply_Info SET Type = '" + TypeValue + "', Datefrom= '" + DateFrom.Value.ToString("yyyy/MM/dd") + "',DateTo = '" + DateTo.Value.ToString("yyyy/MM/dd") + "', Total = '" + TotalLeave.Text + "' WHERE Id = " + Convert.ToInt32(hiddenText.Text); } if (DbAccess.ExecuteToDB(query)) { if (hiddenText.Text == "") { MessageBox.Show("Saved Successfully!!!"); } else { MessageBox.Show("Updated Successfully!!!"); } } else { MessageBox.Show("Failed To Save!!!"); } } catch (Exception ex) { MessageBox.Show("Connection Error!!!"); } finally { Reset(); } }
private void ReSavebtn_Click(object sender, EventArgs e) { string query = ""; if (StaaFText.Text.Trim() == "") { MessageBox.Show("Please Enter Employee ID"); StaaFText.Focus(); return; } if (BasicSalaryText.Text.Trim() == "") { MessageBox.Show("Please Enter Password"); BasicSalaryText.Focus(); return; } if (TransportText.Text.Trim() == "") { MessageBox.Show("Please Enter Transport Parcentage"); TransportText.Focus(); return; } if (MedicalText.Text.Trim() == "") { MessageBox.Show("Please Enter Medicalbill Percentage"); MedicalText.Focus(); return; } if (MobileBill.Text.Trim() == "") { MessageBox.Show("Please Enter MobileBill Percentage"); MobileBill.Focus(); return; } if (FoodbillText.Text.Trim() == "") { MessageBox.Show("Please Enter FoodBil Percentage"); FoodbillText.Focus(); return; } if (totalAllow.Text.Trim() == "") { totalAllow.Focus(); return; } query = "SELECT COUNT(*) AS Count FROM Salary_Info WHERE StaffID = " + StaaFText.Text + ""; if (stfID == 0) { if (DbAccess.NumberOfRecords(query) > 0) { MessageBox.Show("This username already exists! Please try another ID!"); StaaFText.Focus(); return; } } else { if (DbAccess.NumberOfRecords(query) > 1) { MessageBox.Show("This username already exists! Please try another ID!"); StaaFText.Focus(); return; } } try { if (stfID == 0) { query = "INSERT INTO Salary_Info(StaffID,BasicSalary,Transport,Medical,MobileBill,Food,Total) VALUES(" + Convert.ToInt32(StaaFText.Text) + ", '" + BasicSalaryText.Text + "', '" + TransportText.Text + "', '" + MedicalText.Text + "', '" + MobileBill.Text + "', '" + FoodbillText.Text + "', '" + totalAllow.Text + "' )"; } else { query = "UPDATE Salary_Info SET BasicSalary = '" + BasicSalaryText.Text + "', Transport = '" + TransportText.Text + "', Medical= '" + MedicalText.Text + "',MobileBill = '" + MobileBill.Text + "', Food = '" + FoodbillText.Text + "', Total = '" + totalAllow.Text + "' WHERE StaffID = " + stfID; } if (DbAccess.ExecuteToDB(query)) { if (stfID == 0) { MessageBox.Show("Saved Successfully!!!"); } else { MessageBox.Show("Update Successfully!!!"); } } else { MessageBox.Show("Failed To Save!!!"); } } catch (Exception ex) { MessageBox.Show("Connection Error!!!"); } finally { Reset(); } }
private void expSaveBtn_Click(object sender, EventArgs e) { string query = ""; if (stIDTEXT.Text.Trim() == "") { MessageBox.Show("Please Enter Employee ID"); stIDTEXT.Focus(); return; } if (CompanyNameText.Text.Trim() == "") { MessageBox.Show("Please Enter Company Name"); CompanyNameText.Focus(); return; } if (Workedas.Text.Trim() == "") { MessageBox.Show("Please Enter Designation!"); Workedas.Focus(); return; } if (expdurnumbering.Text.Trim() == "") { MessageBox.Show("Please Enter Experience Year!"); expdurnumbering.Focus(); return; } if (joiiningText.Text.Trim() == "") { MessageBox.Show("Please Enter Your Joining Date"); joiiningText.Focus(); return; } if (ResignedDate.Text.Trim() == "") { MessageBox.Show("Please Enter Resigned Date"); ResignedDate.Focus(); return; } query = "SELECT COUNT(*) AS Count FROM Experience_Info WHERE StaffID = " + stIDTEXT.Text + ""; if (stfID == 0) { if (DbAccess.NumberOfRecords(query) > 0) { MessageBox.Show("This username already exists! Please try another ID!"); stIDTEXT.Focus(); return; } } else { if (DbAccess.NumberOfRecords(query) > 1) { MessageBox.Show("This username already exists! Please try another ID!"); stIDTEXT.Focus(); return; } } try { if (stfID == 0) { query = "INSERT INTO Experience_Info(StaffID,CompanyName,WorkedAs,ExpDur,JoiningDate,ResignedDate) VALUES(" + Convert.ToInt32(stIDTEXT.Text) + ", '" + CompanyNameText.Text + "', '" + Workedas.Text + "', '" + Convert.ToInt32(expdurnumbering.Text) + "', '" + joiiningText.Value.ToString("yyyy/MM/dd") + "', '" + ResignedDate.Value.ToString("yyyy/MM/dd") + "' )"; } else { query = "UPDATE Experience_Info SET CompanyName = '" + CompanyNameText.Text + "', WorkedAs = '" + Workedas.Text + "', ExpDur= '" + Convert.ToInt32(expdurnumbering.Text) + "',JoiningDate = '" + joiiningText.Value.ToString("yyyy/MM/dd") + "', ResignedDate = '" + ResignedDate.Value.ToString("yyyy/MM/dd") + "' WHERE StaffID = " + stfID; } if (DbAccess.ExecuteToDB(query)) { if (stfID == 0) { MessageBox.Show("Saved Successfully!!!"); } else { MessageBox.Show("Update Successfully!!!"); } } else { MessageBox.Show("Failed To Save!!!"); } } catch (Exception ex) { MessageBox.Show("Connection Error!!!"); } finally { Reset(); } }
private void SaveTrain_Click(object sender, EventArgs e) { string query = ""; if (comStaffID.Text.Trim() == "") { MessageBox.Show("Please Enter Staff ID"); comStaffID.Focus(); return; } if (CompanyNameText.Text == "") { MessageBox.Show("Company Name"); CompanyNameText.Focus(); return; } if (TrainingNameText.Text == "") { MessageBox.Show("Please Enter Training Name"); TrainingNameText.Focus(); return; } if (TrainingInsText.Text.Trim() == "") { MessageBox.Show("Please Enter Training Institute"); TrainingInsText.Focus(); return; } if (DurationText.Text.Trim() == "") { MessageBox.Show("Please Enter Duration Time"); DurationText.Focus(); return; } if (TrainType.Text.Trim() == "") { MessageBox.Show("Please Enter Training type"); TrainType.Focus(); return; } if (traindate.Text.Trim() == "") { MessageBox.Show("Please Enter Training Date"); traindate.Focus(); return; } try { if (Hide.Text == "") { query = "INSERT INTO Training_Info(StaffID,Companyname,TrainingName,TrainingInstitute,Duration,TrainingType,TrainingDate) VALUES(" + Convert.ToInt32(comStaffID.Text) + ", '" + CompanyNameText.Text + "', '" + TrainingNameText.Text + "', '" + TrainingInsText.Text + "', '" + DurationText.Text + "', '" + TrainType.Text + "', '" + traindate.Value.ToString("yyyy/MM/dd") + "' )"; } else { query = "UPDATE Training_Info SET Companyname = '" + CompanyNameText.Text + "',TrainingInstitute = '" + TrainingInsText.Text + "', Duration= '" + DurationText.Text + "',TrainingType = '" + TrainType.Text + "',TrainingDate = '" + traindate.Value.ToString("yyyy/MM/dd") + "' WHERE ID= " + Convert.ToInt32(Hide.Text); } if (DbAccess.ExecuteToDB(query)) { if (Hide.Text == "") { MessageBox.Show("Saved Successfully!!!"); } else { MessageBox.Show("Update Successfully!!!"); } } else { MessageBox.Show("Failed To Save!!!"); } } catch (Exception ex) { MessageBox.Show("Connection Error!!!"); } finally { Reset(); } }
private void SaveLeave_Click(object sender, EventArgs e) { string query = ""; if (SttafIdText.Text.Trim() == "") { MessageBox.Show("Please Enter Employee ID"); SttafIdText.Focus(); return; } if (CasualLeave.Text.Trim() == "") { MessageBox.Show("Please Enter The Number"); CasualLeave.Focus(); return; } if (Sickleave.Text.Trim() == "") { MessageBox.Show("Please Enter The Number"); Sickleave.Focus(); return; } if (MaternityLeave.Text.Trim() == "") { MessageBox.Show("Please Enter Password"); MaternityLeave.Focus(); return; } if (EarnedLeave.Text.Trim() == "") { MessageBox.Show("Please Enter Number"); EarnedLeave.Focus(); return; } query = "SELECT COUNT(*) AS Count FROM Leave_Info WHERE StaffID = " + SttafIdText.Text + ""; if (stfID == 0) { if (DbAccess.NumberOfRecords(query) > 0) { MessageBox.Show("This username already exists! Please try another ID!"); SttafIdText.Focus(); return; } } else { if (DbAccess.NumberOfRecords(query) > 1) { MessageBox.Show("This username already exists! Please try another ID!"); SttafIdText.Focus(); return; } } try { if (stfID == 0) { query = "INSERT INTO Leave_Info(StaffID,CasualLeave,SickLeave,MaternityLeave,EarnedLeave) VALUES(" + Convert.ToInt32(SttafIdText.Text) + ", '" + Convert.ToInt32(CasualLeave.Text) + "', '" + Convert.ToInt32(Sickleave.Text) + "', '" + Convert.ToInt32(MaternityLeave.Text) + "', '" + Convert.ToInt32(EarnedLeave.Text) + "' )"; } else { query = "UPDATE Leave_Info SET CasualLeave = '" + Convert.ToInt32(CasualLeave.Text) + "', SickLeave = '" + Convert.ToInt32(Sickleave.Text) + "',MaternityLeave= '" + Convert.ToInt32(MaternityLeave.Text) + "',EarnedLeave = '" + Convert.ToInt32(EarnedLeave.Text) + "' WHERE StaffID = " + stfID; } if (DbAccess.ExecuteToDB(query)) { if (stfID == 0) { MessageBox.Show("Saved Successfully!!!"); } else { MessageBox.Show("Update Successfully!!!"); } } else { MessageBox.Show("Failed To Save!!!"); } } catch (Exception ex) { MessageBox.Show("Connection Error!!!"); } finally { Reset(); } }