private void SetValue() { try { String query = "SELECT * FROM Personal_Info WHERE StaffID = " + Convert.ToInt32(StaffIDtextBox.Text); SqlDataReader reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { ContacttextBox.Text = reader["Contact"].ToString(); DOB.Text = reader["Date of Birth"].ToString(); District.Text = reader["District"].ToString(); Thana.Text = reader["Thana"].ToString(); PostCodetextBox.Text = reader["Post Code"].ToString(); VillagetextBox.Text = reader["Village"].ToString(); PresentAddresstextBox.Text = reader["Present Address"].ToString(); PermanentadresstextBox.Text = reader["Permanent Address"].ToString(); MarriedCombox.Text = reader["Marital Status"].ToString(); FathersNametextBox.Text = reader["Father's Name"].ToString(); MothersNametextBox.Text = reader["Mother's Name"].ToString(); ParentsAddresstextBox.Text = reader["Parent's Address"].ToString(); } } } catch (Exception ex) { } finally { stfID = Convert.ToInt32(StaffIDtextBox.Text); DbAccess.connnection.Close(); } }
private void SetValue() { try { String query = "SELECT * FROM Employee_Info WHERE EmpID = " + Convert.ToInt32(EmpIdtextBox.Text); SqlDataReader reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { userNametextBox.Text = reader["UserName"].ToString(); passwordtextBox.Text = reader["Password"].ToString(); confirmpasswordtextBox.Text = passwordtextBox.Text; } } } catch (Exception ex) { } finally { EmployeeID = Convert.ToInt32(EmpIdtextBox.Text); DbAccess.connnection.Close(); } }
private void SearchBTtN_Click(object sender, EventArgs e) { dataGridAnnounce.Rows.Clear(); int SL = 1; string s1 = ""; string s2 = ""; string s3 = ""; string s4 = ""; string s5 = ""; string s6 = ""; string s7 = ""; if (SearchStaf.Text == "") { MessageBox.Show("Please Enter Search ID!!!"); return; } String query = "SELECT * FROM Announcement_Info WHERE StaffID = " + Convert.ToInt32(SearchStaf.Text); SqlDataReader reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { s1 = SL.ToString(); s2 = reader["StaffID"].ToString(); s3 = reader["AnnounceType"].ToString(); s4 = reader["Date"].ToString(); s5 = reader["Subject"].ToString(); s6 = reader["Description"].ToString(); s7 = reader["Id"].ToString(); dataGridAnnounce.Rows.Add(s1, s2, s3, s4, s5, s6, s7); SL++; } } DbAccess.connnection.Close(); }
private void srcBtn_Click(object sender, EventArgs e) { OfficialDataGridView.Rows.Clear(); int SL = 1; string s1 = ""; string s2 = ""; string s3 = ""; string s4 = ""; string s5 = ""; string s6 = ""; string s7 = ""; string s8 = ""; string s9 = ""; string s10 = ""; String DeptValue = ((KeyValuePair <int, string>)deparCombo.SelectedItem).Value; int DeptKey = ((KeyValuePair <int, string>)deparCombo.SelectedItem).Key; String query = "SELECT * FROM Official_Info WHERE Department = '" + DeptValue + "'"; if (sdtext.Text != "") { query = query + " AND StaffID = " + Convert.ToInt32(sdtext.Text); } SqlDataReader reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { s1 = SL.ToString(); s2 = reader["StaffID"].ToString(); s3 = reader["StaffName"].ToString(); s4 = reader["Department"].ToString(); s5 = reader["Designation"].ToString(); s6 = reader["AgeExp"].ToString(); s7 = reader["BloodGroup"].ToString(); s8 = reader["JoiningDate"].ToString(); s9 = reader["Nationality"].ToString(); s10 = reader["Status"].ToString(); OfficialDataGridView.Rows.Add(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10); SL++; } } DbAccess.connnection.Close(); }
private void SetValue() { try { String query = "SELECT * FROM Educational_Info WHERE StaffID = " + Convert.ToInt32(stIText.Text); SqlDataReader reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { stIText.Text = reader["StaffID"].ToString(); studyCombo.Text = reader["SudyLevel"].ToString(); NameofInstitutetext.Text = reader["NameOfIns"].ToString(); BoardCombo.Text = reader["Board"].ToString(); Yeartext.Text = reader["PassingYear"].ToString(); CGPAtext.Text = reader["CGPA"].ToString(); } } } catch (Exception ex) { } finally { stfID = Convert.ToInt32(stIText.Text); DbAccess.connnection.Close(); } }
private void SetValue() { try { String query = "SELECT * FROM LeaveApply_Info WHERE StaffID = " + Convert.ToInt32(StaffID.Text); SqlDataReader reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { StaffID.Text = reader["StaffID"].ToString(); LeaveaTypeCombo.Text = reader["Type"].ToString(); DateFrom.Text = reader["Datefrom"].ToString(); DateTo.Text = reader["DateTo"].ToString(); TotalLeave.Text = reader["Total"].ToString(); } } } catch (Exception ex) { } finally { stfID = Convert.ToInt32(StaffID.Text); DbAccess.connnection.Close(); } }
private void SearchBTTn_Click(object sender, EventArgs e) { leaveApplicationGridView.Rows.Clear(); int SL = 1; string s1 = ""; string s2 = ""; string s3 = ""; string s4 = ""; string s5 = ""; string s6 = ""; string s7 = ""; if (stfIDtext.Text == "") { MessageBox.Show("Please Enter Search ID!!!"); return; } String query = "SELECT * FROM LeaveApply_Info WHERE StaffID = " + Convert.ToInt32(stfIDtext.Text); SqlDataReader reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { s1 = SL.ToString(); s2 = reader["StaffID"].ToString(); s3 = reader["Type"].ToString(); s4 = reader["Datefrom"].ToString(); s5 = reader["DateTo"].ToString(); s6 = reader["Total"].ToString(); s7 = reader["Id"].ToString(); leaveApplicationGridView.Rows.Add(s1, s2, s3, s4, s5, s6, s7); SL++; } } DbAccess.connnection.Close(); }
private void SetValue() { try { String query = "SELECT * FROM Salary_Info WHERE StaffID = " + Convert.ToInt32(StaaFText.Text); SqlDataReader reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { StaaFText.Text = reader["StaffID"].ToString(); BasicSalaryText.Text = reader["BasicSalary"].ToString(); TransportText.Text = reader["Transport"].ToString(); MedicalText.Text = reader["Medical"].ToString(); MobileBill.Text = reader["MobileBill"].ToString(); FoodbillText.Text = reader["Food"].ToString(); totalAllow.Text = reader["Total"].ToString(); } } } catch (Exception ex) { } finally { stfID = Convert.ToInt32(StaaFText.Text); DbAccess.connnection.Close(); } }
private void SetValue() { try { String query = "SELECT * FROM Experience_Info WHERE StaffID = " + Convert.ToInt32(stIDTEXT.Text); SqlDataReader reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { stIDTEXT.Text = reader["StaffID"].ToString(); CompanyNameText.Text = reader["CompanyName"].ToString(); Workedas.Text = reader["WorkedAs"].ToString(); expdurnumbering.Text = reader["ExpDur"].ToString(); joiiningText.Text = reader["JoiningDate"].ToString(); ResignedDate.Text = reader["ResignedDate"].ToString(); } } } catch (Exception ex) { } finally { stfID = Convert.ToInt32(stIDTEXT.Text); DbAccess.connnection.Close(); } }
private void SearchButtontrain_Click(object sender, EventArgs e) { TrainingGridView.Rows.Clear(); int SL = 1; string s1 = ""; string s2 = ""; string s3 = ""; string s4 = ""; string s5 = ""; string s6 = ""; string s7 = ""; string s8 = ""; string s9 = ""; if (Searchtrain.Text == "") { MessageBox.Show("Please Enter Search ID!!!"); return; } String query = "SELECT * FROM Training_Info WHERE StaffID = " + Convert.ToInt32(Searchtrain.Text); SqlDataReader reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { s1 = SL.ToString(); s2 = reader["StaffID"].ToString(); s3 = reader["Companyname"].ToString(); s4 = reader["TrainingName"].ToString(); s5 = reader["TrainingInstitute"].ToString(); s6 = reader["Duration"].ToString(); s7 = reader["TrainingType"].ToString(); s8 = reader["TrainingDate"].ToString(); s9 = reader["Id"].ToString(); TrainingGridView.Rows.Add(s1, s2, s3, s4, s5, s6, s7, s8, s9); SL++; } } DbAccess.connnection.Close(); }
private void SetValue() { try { String query = "SELECT * FROM Leave_Info WHERE StaffID = " + Convert.ToInt32(SttafIdText.Text); SqlDataReader reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { SttafIdText.Text = reader["StaffID"].ToString(); CasualLeave.Text = reader["CasualLeave"].ToString(); Sickleave.Text = reader["SickLeave"].ToString(); MaternityLeave.Text = reader["MaternityLeave"].ToString(); EarnedLeave.Text = reader["EarnedLeave"].ToString(); } } } catch (Exception ex) { } finally { stfID = Convert.ToInt32(SttafIdText.Text); DbAccess.connnection.Close(); } }
private void Reportsearch_Click(object sender, EventArgs e) { string query = "SELECT StaffName, Department, Designation, JoiningDate, Contact, [Present Address], BasicSalary, Total, Status FROM MasterReportView"; int DepartmentKey = ((KeyValuePair <int, string>)DeportCombo.SelectedItem).Key; String DepartmentValue = ((KeyValuePair <int, string>)DeportCombo.SelectedItem).Value; string quer = ""; int StatusKey = ((KeyValuePair <int, string>)StatusCombo.SelectedItem).Key; String StatusValue = ((KeyValuePair <int, string>)StatusCombo.SelectedItem).Value; if (ReportID.Text.Trim() == "" && DepartmentKey < 0 && StatusKey < 0) { MessageBox.Show("Please Select Atleast One Criteria!!!"); return; } if (ReportID.Text.Trim() != "") { query = query + " WHERE StaffID = " + Convert.ToInt32(ReportID.Text) + ""; } if (DepartmentKey > 0) { query = query.Contains("WHERE") == true ? query + " AND Department = '" + DepartmentValue + "'" : query + " WHERE Department = '" + DepartmentValue + "'"; } if (StatusKey > 0) { query = query.Contains("WHERE") == true ? query + " AND Status = '" + StatusValue + "'" : query + " WHERE Status = '" + StatusValue + "'"; } ReportDataGrid.Rows.Clear(); int SL = 1; string s1 = ""; string s2 = ""; string s3 = ""; string s4 = ""; string s5 = ""; string s6 = ""; string s7 = ""; string s8 = ""; string s9 = ""; string s10 = ""; string s11 = ""; SqlDataReader reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { s1 = SL.ToString(); s2 = ReportID.Text.ToString(); s3 = reader["StaffName"].ToString(); s4 = reader["Department"].ToString(); s5 = reader["Designation"].ToString(); s6 = reader["JoiningDate"].ToString(); s7 = reader["Contact"].ToString(); s8 = reader["Present Address"].ToString(); s9 = reader["BasicSalary"].ToString(); s10 = reader["Total"].ToString(); s11 = reader["Status"].ToString(); ReportDataGrid.Rows.Add(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11); SL++; } } DbAccess.connnection.Close(); }
private void LeavereportBTN_Click(object sender, EventArgs e) { string query = ""; int YearKey = ((KeyValuePair <int, string>)YearCombo.SelectedItem).Key; String YearValue = ((KeyValuePair <int, string>)YearCombo.SelectedItem).Value; string quer = ""; int LeaveKey = ((KeyValuePair <int, string>)Leavetycombo.SelectedItem).Key; String LeaveValue = ((KeyValuePair <int, string>)Leavetycombo.SelectedItem).Value; if (LeaStaffID.Text.Trim() == "") { MessageBox.Show("Please Enter Staff ID"); LeaStaffID.Focus(); return; } if (YearKey < 0) { MessageBox.Show("Please Enter Year"); YearCombo.Focus(); return; } if (LeaveKey < 0) { MessageBox.Show("Please Enter Leave Type"); Leavetycombo.Focus(); return; } LeaveReportGridView.Rows.Clear(); string colName = LeaveValue.Replace(" ", string.Empty); int SL = 1; string s1 = ""; string s2 = ""; string s3 = ""; string s4 = ""; string s5 = ""; string s6 = ""; string s7 = ""; string s8 = ""; string s9 = ""; query = "SELECT StaffName, " + colName + ", Department, Status, SUM(Total) AS TotalLeave FROM LeaveReportView WHERE StaffID = " + Convert.ToInt32(LeaStaffID.Text) + "AND Type = '" + LeaveValue + "' AND year(DateFrom) = '" + YearValue + "' group by StaffName, Department, Status, " + colName; SqlDataReader reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { s1 = SL.ToString(); s2 = LeaStaffID.Text.ToString(); s3 = reader["StaffName"].ToString(); s4 = reader["Department"].ToString(); s5 = YearValue; s6 = reader[colName].ToString(); s7 = reader["TotalLeave"].ToString(); s8 = (Convert.ToInt32(s6) - Convert.ToInt32(s7)).ToString(); s9 = reader["Status"].ToString(); LeaveReportGridView.Rows.Add(s1, s2, s3, s4, s5, s6, s7, s8, s9); SL++; } } DbAccess.connnection.Close(); }
private void SearchBtn_Click(object sender, EventArgs e) { if (SearchStaffID.Text.Trim() == "") { MessageBox.Show("Please Enter Staff ID"); SearchStaffID.Focus(); return; } if (Datefrom.Text.Trim() == "") { MessageBox.Show("Please Enter Date From ID"); Datefrom.Focus(); return; } if (dateto.Text.Trim() == "") { MessageBox.Show("Please Enter Date To ID"); dateto.Focus(); return; } AttenDanceGRID.Rows.Clear(); int SL = 1; string s1 = ""; string s2 = ""; string s3 = ""; string s4 = ""; string s5 = ""; string s6 = ""; string s7 = ""; string s8 = ""; string s9 = ""; string s10 = ""; string s11 = ""; string query = "SELECT * FROM AttendanceReportView WHERE StaffID = " + Convert.ToInt32(SearchStaffID.Text) + " AND Date BETWEEN '" + Datefrom.Value.ToString("yyyy/MM/dd") + "' AND '" + dateto.Value.ToString("yyyy/MM/dd") + "'"; SqlDataReader reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { s1 = SL.ToString(); s2 = SearchStaffID.Text.ToString(); s3 = reader["StaffName"].ToString(); s4 = reader["Department"].ToString(); s5 = reader["Date"].ToString(); s6 = reader["InTime"].ToString(); s7 = reader["OutTime"].ToString(); s8 = reader["Status"].ToString(); AttenDanceGRID.Rows.Add(s1, s2, s3, s4, s5, s6, s7, s8); SL++; } } DbAccess.connnection.Close(); }
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); }