using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using Ease.CoreV35.Model; using Ease.CoreV35.Utility; using Payroll.BO; using System.Windows.Forms; using Microsoft.Reporting.WinForms; namespace Payroll.Report { public partial class fTrainingReport : Form { private enum EnumTrainingReports { Training_Summary=0, Training_Wise_Report, Training_Conducted_by_Department, Department_wise_Tarining_Attendee, Training_NEED_Analysis_Status, Employee_Wise_Training_Status, Employee_Wise_Training_Details, Training_Name_wise_details, Department_Wise_Training_Expens, Training_costing_Information, Entity_Wise_Training_Summary, Attendance_Record, Proposed_TNA } private EnumTrainingReports _selectedReport; string embeddedResource; List dataSource=null; string caption; public fTrainingReport() { InitializeComponent(); LoadtrainingTypeCbo(); LoadtrainingNatureCbo(); LoadinstituteCbo(); lsbReports.SelectedIndex = 0; //lblFromDate.Visible = true; //lblToDate.Visible = true; //dtpFromDate.Visible = true; //dtpToDate.Visible = true; //lblTraining.Visible = false; } public void ShowDlg(DateTime fromDate, DateTime toDate) { embeddedResource = "Payroll.Report.RDLC.rptUpcomingTraining.rdlc"; caption = "Upcoming Training"; this.RefreshReport(fromDate, toDate); fReportViewer fViewer = new fReportViewer(); fViewer.PreviewtrainingReport(dataSource, embeddedResource, caption); //fViewer.ShowDialog(); //else // MessageBox.Show("No data available.", "Leave", MessageBoxButtons.OK, MessageBoxIcon.Information); } private void LoadtrainingTypeCbo() { cboTrainingType.Items.Clear(); ObjectsTemplate trainingTypes = TrainingType.Get(); trainingTypes.Insert(0,new TrainingType(){ Name=""}); //TrainingType dummy = new TrainingType(); //dummy.Name = ""; //cboTrainingType.Items.Add(dummy); //foreach (TrainingType trainingType in trainingTypes) //{ // cboTrainingType.Items.Add(trainingType); //} cboTrainingType.DataSource = trainingTypes; cboTrainingType.DisplayMember = "Name"; cboTrainingType.ValueMember = "ID"; cboTrainingType.SelectedIndex = 0; } private void LoadtrainingCbo(ID TrainingTypeID) { cboTraining.Items.Clear(); ObjectsTemplate trainings = new ObjectsTemplate(); if (TrainingTypeID.IsUnassigned) { trainings = Training.Get(); } else { trainings = Training.GetByTrainingType(TrainingTypeID.Integer); } Training dummy = new Training(); dummy.Name = ""; cboTraining.Items.Add(dummy); foreach (Training training in trainings) { cboTraining.Items.Add(training); } cboTraining.DisplayMember = "Name"; cboTraining.ValueMember = "ID"; cboTraining.SelectedIndex = 0; } private void LoadtrainingNatureCbo() { cboTrainingNature.Items.Clear(); ObjectsTemplate natures = new ObjectsTemplate(); natures = NatureOfTraining.Get(); NatureOfTraining dummy = new NatureOfTraining(); dummy.Name = ""; cboTrainingNature.Items.Add(dummy); foreach (NatureOfTraining training in natures) { cboTrainingNature.Items.Add(training); } cboTrainingNature.DisplayMember = "Name"; cboTrainingNature.ValueMember = "ID"; cboTrainingNature.SelectedIndex = 0; } private void LoadinstituteCbo() { cboInstitute.Items.Clear(); ObjectsTemplate institutions = new ObjectsTemplate(); institutions = Institution.Get(); institutions.Insert(0, new Institution() { Name = "" }); cboInstitute.DataSource = institutions; cboInstitute.DisplayMember = "Name"; cboInstitute.ValueMember = "ID"; cboInstitute.SelectedIndex = 0; } private void LoadTrainingScheduleCbo(ID iD) { //int id = iD.Integer; cboSchedule.Items.Clear(); ObjectsTemplate trainings = new ObjectsTemplate(); if (iD.IsUnassigned) { //trainings = TrainingSchedule.Get(); return; } else { //DateTime dFDate = Convert.ToDateTime("1 Jan "+DateTime.Today.Year.ToString()); //DateTime dLDate = Convert.ToDateTime("31 Dec "+DateTime.Today.Year.ToString()); DateTime dFDate = dtpFromDate.Value; DateTime dLDate = dtpToDate.Value; trainings = TrainingSchedule.Get(dFDate ,dLDate , iD.Integer); } //TrainingSchedule dummy = new TrainingSchedule(); //dummy.Name = ""; //cboSchedule.Items.Add(dummy); if (trainings.Count > 0) { foreach (TrainingSchedule training in trainings) { cboSchedule.Items.Add(training); cboSchedule.DisplayMember = "Name"; cboSchedule.ValueMember = "ID"; } cboSchedule.SelectedIndex = 0; } } private void RefreshReport(DateTime fromDate, DateTime toDate) { List oTrainingSchedule = new List(); oTrainingSchedule = TrainingSchedule.Get(fromDate, toDate); DataTable oBody = new Payroll.Report.PayrollDataSet.PayrollDataSet.UpcomingTrainingDataTable(); DataRow dr = null; dataSource = new List(); if (oTrainingSchedule.Count > 0) { foreach (TrainingSchedule ts in oTrainingSchedule) { dr = oBody.NewRow(); dr["TrainingType"] = ts.Training.TrainingType; dr["Name"] = ts.Training.Name; dr["StartDate"] = ts.StartDate.ToString("dd MMM yyyy"); dr["EndDate"] = ts.EndDate.ToString("dd MMM yyyy"); dr["MaxParticepant"] = ts.MaxParticipants; dr["Enrolled"] = ts.EnrolledParticipants; dr["Nature"] = NatureOfTraining.Get(ts.TrainingNatureID).Name; dr["Institute"] = Institution.Get(ts.InstituteID).Name; oBody.Rows.Add(dr); //oBody.Rows.Add(ts.Training.TrainingType, ts.Training.Name, ts.StartDate.ToString("dd MMM yyyy"), ts.EndDate.ToString("dd MMM yyyy"), ts.MaxParticipants, ts.EnrolledParticipants, NatureOfTraining.Get(ts.TrainingNatureID).Name, Institution.Get(ts.InstituteID).Name); } dataSource.Add(new ReportDataSource("PayrollDataSet_UpcomingTraining", oBody)); } } private string CreateSearchCriteria() { String searchCriteria = string.Empty; if (dtpFromDate.Enabled && dtpToDate.Enabled) { searchCriteria += "Date Range: " + dtpFromDate.Value.ToString("dd MMM yyyy") + " to " + dtpToDate.Value.ToString("dd MMM yyyy") ; } if (dtpFromDate.Enabled && dtpToDate.Enabled==false) { searchCriteria += "Year: " + dtpFromDate.Value.ToString("yyyy") ; } if (ctlMultipleEmployee.SearchCriteria!=string.Empty) { searchCriteria += (searchCriteria == string.Empty ? "" : "; " + System.Environment.NewLine) + ctlMultipleEmployee.SearchCriteria ; } //if (ctlMultipleEmployee.Enabled && ctlMultipleEmployee.SelectedEmployees!=null && ctlMultipleEmployee.SelectedEmployees.Count>0) //{ // searchCriteria += (searchCriteria==string.Empty?"":",") + // "Employee No(s):" + // ctlMultipleEmployee.SelectedEmployees // .Aggregate(new StringBuilder(), // (sb, o) => sb.Append("" + o.EmployeeNo + ","), // sb => sb.ToString()).Trim(','); //} if (cboTrainingNature.Enabled && cboTrainingNature.Text.Trim() != string.Empty) { searchCriteria += (searchCriteria == string.Empty ? "" : "; " + System.Environment.NewLine) + "Training Nature: " + cboTrainingNature.Text.Trim() ; } if (cboTrainingType.Enabled && cboTrainingType.Text.Trim() != string.Empty) { searchCriteria += (searchCriteria == string.Empty ? "" : "; " + System.Environment.NewLine) + "Training Type: " + cboTrainingType.Text.Trim() ; } if (cboTraining.Enabled && cboTraining.Text.Trim() != string.Empty) { searchCriteria += (searchCriteria == string.Empty ? "" : "; " + System.Environment.NewLine) + "Training: " + cboTraining.Text.Trim(); } if (cboSchedule.Enabled && cboSchedule.Text.Trim() != string.Empty) { searchCriteria += (searchCriteria == string.Empty ? "" : "; " + System.Environment.NewLine) + "Training Schedule: " + cboSchedule.Text.Trim() ; } if (ctlDepartment.Enabled && ctlDepartment.SelectedIDs != null && ctlDepartment.SelectedIDs.Length > 0) { Department oD = Department.Get(ID.FromInteger(ctlDepartment.SelectedIDs[0])); if (oD.Tier == 1) { } else if (oD.Tier == 2) { searchCriteria += (searchCriteria == string.Empty ? "" : ",") + "Division: " + oD.Name ; } else if (oD.Tier == 3) { searchCriteria += (searchCriteria == string.Empty ? "" : ",") + "Department: " + oD.Name ; } else if (oD.Tier == 4) { searchCriteria += (searchCriteria == string.Empty ? "" : ",") + "Unit: " + oD.Name ; } else { } } if (cboInstitute.Enabled && cboInstitute.Text.Trim() != string.Empty) { searchCriteria += (searchCriteria == string.Empty ? "" : "; " + System.Environment.NewLine) + "Organizer: " + cboInstitute.Text.Trim() ; } return searchCriteria; } private void btnPreview_Click(object sender, EventArgs e) { rptTraining trainingReports = new rptTraining(); trainingReports.SearchCriteria = CreateSearchCriteria(); switch (_selectedReport) { case EnumTrainingReports.Training_Summary: trainingReports.ShowTrainingSummaryReport(ctlMultipleEmployee.SelectedEmployees, dtpFromDate.Value, dtpToDate.Value, cboTrainingNature.SelectedIndex == 0 ? 0 : ((NatureOfTraining)cboTrainingNature.SelectedItem).ID.Integer, cboTrainingType.SelectedIndex == 0 ? 0 : ((TrainingType)cboTrainingType.SelectedItem).ID.Integer, cboTraining.SelectedIndex == 0 ? 0 : ((Training)cboTraining.SelectedItem).ID.Integer, ctlDepartment.SelectedIDs != null?ctlDepartment.SelectedIDs.ToList().First():0, cboInstitute.SelectedIndex == 0 ? 0 : ((Institution)cboInstitute.SelectedItem).ID.Integer); if (!GlobalFunctions.bDataFound) MessageBox.Show("No data found"); break; case EnumTrainingReports.Training_Wise_Report: trainingReports.ShowTrainingWiseReport(ctlMultipleEmployee.SelectedEmployees, ((Training)cboTraining.SelectedItem), dtpFromDate.Value, dtpToDate.Value, cboTrainingNature.SelectedIndex == 0 ? 0 : ((NatureOfTraining)cboTrainingNature.SelectedItem).ID.Integer, cboTrainingType.SelectedIndex == 0 ? 0 : ((TrainingType)cboTrainingType.SelectedItem).ID.Integer, ctlDepartment.SelectedIDs != null ? ctlDepartment.SelectedIDs.ToList().First() : 0, cboInstitute.SelectedIndex == 0 ? 0 : ((Institution)cboInstitute.SelectedItem).ID.Integer); if (!GlobalFunctions.bDataFound) MessageBox.Show("No data found"); break; case EnumTrainingReports.Training_Conducted_by_Department: //ctlDepartment.SelectedIDs.ToList().ForEach(i => sDeptIDs += i.ToString() + ","); //sDeptIDs = sDeptIDs.Trim(',', ' '); if (ctlDepartment.SelectedIDs != null) { trainingReports.ShowTrainingConductedByDepartment(ctlDepartment.SelectedIDs.ToList().First(), dtpFromDate.Value, dtpToDate.Value, cboTrainingNature.SelectedIndex == 0 ? 0 : ((NatureOfTraining)cboTrainingNature.SelectedItem).ID.Integer, cboTrainingType.SelectedIndex == 0 ? 0 : ((TrainingType)cboTrainingType.SelectedItem).ID.Integer, cboTraining.SelectedIndex == 0 ? 0 : ((Training)cboTraining.SelectedItem).ID.Integer, cboInstitute.SelectedIndex == 0 ? 0 : ((Institution)cboInstitute.SelectedItem).ID.Integer); } else { trainingReports.ShowTrainingConductedByDepartment(0, dtpFromDate.Value, dtpToDate.Value, cboTrainingNature.SelectedIndex == 0 ? 0 : ((NatureOfTraining)cboTrainingNature.SelectedItem).ID.Integer, cboTrainingType.SelectedIndex == 0 ? 0 : ((TrainingType)cboTrainingType.SelectedItem).ID.Integer, cboTraining.SelectedIndex==0?0: ((Training)cboTraining.SelectedItem).ID.Integer, cboInstitute.SelectedIndex == 0 ? 0 : ((Institution)cboInstitute.SelectedItem).ID.Integer); } if (!GlobalFunctions.bDataFound) MessageBox.Show("No data found"); break; case EnumTrainingReports.Department_wise_Tarining_Attendee: //ctlDepartment.SelectedIDs.ToList().ForEach(i => sDeptIDs += i.ToString() + ","); //sDeptIDs = sDeptIDs.Trim(',', ' '); if (ctlDepartment.SelectedIDs != null) { trainingReports.ShowDeptWiseTrainingReport(ctlDepartment.SelectedIDs.ToList().First(), dtpFromDate.Value, dtpToDate.Value, cboTrainingNature.SelectedIndex == 0 ? 0 : ((NatureOfTraining)cboTrainingNature.SelectedItem).ID.Integer, cboTrainingType.SelectedIndex == 0 ? 0 : ((TrainingType)cboTrainingType.SelectedItem).ID.Integer, cboInstitute.SelectedIndex == 0 ? 0 : ((Institution)cboInstitute.SelectedItem).ID.Integer,cboTraining.SelectedIndex==0?0:((Training)cboTraining.SelectedItem).ID.Integer); } else { trainingReports.ShowDeptWiseTrainingReport(0, dtpFromDate.Value, dtpToDate.Value, cboTrainingNature.SelectedIndex == 0 ? 0 : ((NatureOfTraining)cboTrainingNature.SelectedItem).ID.Integer, cboTrainingType.SelectedIndex == 0 ? 0 : ((TrainingType)cboTrainingType.SelectedItem).ID.Integer, cboInstitute.SelectedIndex == 0 ? 0 : ((Institution)cboInstitute.SelectedItem).ID.Integer, cboTraining.SelectedIndex == 0 ? 0 : ((Training)cboTraining.SelectedItem).ID.Integer); } if (!GlobalFunctions.bDataFound) MessageBox.Show("No data found"); break; case EnumTrainingReports.Training_NEED_Analysis_Status: trainingReports.ShowTNAStatusReport(dtpFromDate.Value.Year); if (!GlobalFunctions.bDataFound) MessageBox.Show("No data found"); break; case EnumTrainingReports.Employee_Wise_Training_Status: trainingReports.ShowEmployeeWiseTrainingReport(ctlMultipleEmployee.SelectedEmployees, cboTrainingNature.SelectedIndex == 0 ? 0 : ((NatureOfTraining)cboTrainingNature.SelectedItem).ID.Integer, cboTrainingType.SelectedIndex == 0 ? 0 : (((TrainingType)cboTrainingType.SelectedItem).ID.Integer), ctlDepartment.SelectedIDs != null ? ctlDepartment.SelectedIDs.ToList().First() : 0, cboInstitute.SelectedIndex == 0 ? 0 : ((Institution)cboInstitute.SelectedItem).ID.Integer, dtpFromDate.Value.Year); if (!GlobalFunctions.bDataFound) MessageBox.Show("No data found"); break; //case EnumTrainingReports.Training_Cost_Details: // trainingReports.ShowTrainingCostDetailsReport(ctlMultipleEmployee.SelectedEmployees); // break; case EnumTrainingReports.Employee_Wise_Training_Details: trainingReports.ShowTrainingDetailsReport(ctlMultipleEmployee.SelectedEmployees, dtpFromDate.Value, dtpToDate.Value, cboTrainingNature.SelectedIndex == 0 ? 0 : ((NatureOfTraining)cboTrainingNature.SelectedItem).ID.Integer, cboTrainingType.SelectedIndex == 0 ? 0 : ((TrainingType)cboTrainingType.SelectedItem).ID.Integer, cboInstitute.SelectedIndex == 0 ? 0 : ((Institution)cboInstitute.SelectedItem).ID.Integer); if (!GlobalFunctions.bDataFound) MessageBox.Show("No data found"); break; case EnumTrainingReports.Training_Name_wise_details: trainingReports.ShowTrainingNameWiseDetailsReport(ctlMultipleEmployee.SelectedEmployees, dtpFromDate.Value, dtpToDate.Value, cboTrainingNature.SelectedIndex == 0 ? 0 : ((NatureOfTraining)cboTrainingNature.SelectedItem).ID.Integer, cboTrainingType.SelectedIndex == 0 ? 0 : ((TrainingType)cboTrainingType.SelectedItem).ID.Integer, cboInstitute.SelectedIndex == 0 ? 0 : ((Institution)cboInstitute.SelectedItem).ID.Integer, cboTraining.SelectedIndex == 0 ? 0 : ((Training)cboTraining.SelectedItem).ID.Integer); if (!GlobalFunctions.bDataFound) MessageBox.Show("No data found"); break; case EnumTrainingReports.Department_Wise_Training_Expens: trainingReports.ShowDepartmentWiseTrainingExpense(ctlMultipleEmployee.SelectedEmployees, cboTrainingNature.SelectedIndex == 0 ? 0 : ((NatureOfTraining)cboTrainingNature.SelectedItem).ID.Integer, cboTrainingType.SelectedIndex == 0 ? 0 : (((TrainingType)cboTrainingType.SelectedItem).ID.Integer), cboInstitute.SelectedIndex == 0 ? 0 : ((Institution)cboInstitute.SelectedItem).ID.Integer, dtpFromDate.Value.Year); if (!GlobalFunctions.bDataFound) MessageBox.Show("No data found"); break; case EnumTrainingReports.Training_costing_Information: trainingReports.ShowTrainingCostingInfoReport(ctlMultipleEmployee.SelectedEmployees, dtpFromDate.Value, dtpToDate.Value, cboTrainingNature.SelectedIndex == 0 ? 0 : ((NatureOfTraining)cboTrainingNature.SelectedItem).ID.Integer, cboInstitute.SelectedIndex == 0 ? 0 : ((Institution)cboInstitute.SelectedItem).ID.Integer, cboTrainingType.SelectedIndex == 0 ? 0 : ((TrainingType)cboTrainingType.SelectedItem).ID.Integer); if (!GlobalFunctions.bDataFound) MessageBox.Show("No data found"); break; case EnumTrainingReports.Entity_Wise_Training_Summary: trainingReports.ShowEntityWiseTrainingSummery(ctlMultipleEmployee.SelectedEmployees, dtpFromDate.Value, dtpToDate.Value, cboTrainingNature.SelectedIndex == 0 ? 0 : ((NatureOfTraining)cboTrainingNature.SelectedItem).ID.Integer, cboTrainingType.SelectedIndex == 0 ? 0 : (((TrainingType)cboTrainingType.SelectedItem).ID.Integer), cboInstitute.SelectedIndex == 0 ? 0 : ((Institution)cboInstitute.SelectedItem).ID.Integer); if(!GlobalFunctions.bDataFound) MessageBox.Show("No data found"); break; case EnumTrainingReports.Attendance_Record: if (cboTraining.SelectedIndex != 0) { trainingReports.ShowTrainingAttendenceReport(ctlMultipleEmployee.SelectedEmployees, ((Training)cboTraining.SelectedItem), dtpFromDate.Value, dtpToDate.Value, cboTrainingType.SelectedIndex == 0 ? 0 : (((TrainingType)cboTrainingType.SelectedItem).ID.Integer), cboTrainingNature.SelectedIndex == 0 ? 0 : ((NatureOfTraining)cboTrainingNature.SelectedItem).ID.Integer, cboInstitute.SelectedIndex == 0 ? 0 : ((Institution)cboInstitute.SelectedItem).ID.Integer,cboSchedule.SelectedIndex!=-1?((TrainingSchedule)cboSchedule.SelectedItem).ID.Integer:0); if (!GlobalFunctions.bDataFound) MessageBox.Show("No data found"); } else MessageBox.Show("Please select a training !"); break; case EnumTrainingReports.Proposed_TNA: trainingReports.ShowProposedTNA(dtpFromDate.Value.Year); if (!GlobalFunctions.bDataFound) MessageBox.Show("No data found"); break; default: break; } } private void btnCancel_Click(object sender, EventArgs e) { this.Close(); } private void lsbReports_SelectedIndexChanged(object sender, EventArgs e) { _selectedReport = (EnumTrainingReports)lsbReports.SelectedIndex; RefreshControls(); switch ((EnumTrainingReports)lsbReports.SelectedIndex) { case EnumTrainingReports.Training_Summary: dtpFromDate.Enabled = true; dtpToDate.Enabled = true; ctlMultipleEmployee.Enabled = true; ctlDepartment.Enabled = false; cboInstitute.Enabled = true; cboTraining.Enabled = true; cboTrainingNature.Enabled = true; cboTrainingType.Enabled = true; btnPreview.Enabled = true; cboSchedule.Enabled = false; break; case EnumTrainingReports.Training_Wise_Report: dtpFromDate.Enabled = true; dtpToDate.Enabled = true; ctlMultipleEmployee.Enabled = true; ctlDepartment.Enabled = false; cboInstitute.Enabled = true; cboTraining.Enabled = true; cboTrainingNature.Enabled = true; cboTrainingType.Enabled = true; btnPreview.Enabled = true; cboSchedule.Enabled = false; break; case EnumTrainingReports.Training_Conducted_by_Department: dtpFromDate.Enabled = true; dtpToDate.Enabled = true; ctlMultipleEmployee.Enabled = false; ctlDepartment.Enabled = true; cboInstitute.Enabled = true; cboTraining.Enabled = true; cboTrainingNature.Enabled = true; cboTrainingType.Enabled = true; btnPreview.Enabled = true; cboSchedule.Enabled = false; break; case EnumTrainingReports.Department_wise_Tarining_Attendee: dtpFromDate.Enabled = true; dtpToDate.Enabled = true; ctlMultipleEmployee.Enabled = false; ctlDepartment.Enabled = true; cboInstitute.Enabled = true; cboTraining.Enabled = true; cboTrainingNature.Enabled = true; cboTrainingType.Enabled = true; btnPreview.Enabled = true; cboSchedule.Enabled = false; break; case EnumTrainingReports.Training_NEED_Analysis_Status: dtpFromDate.Enabled = true; dtpToDate.Enabled = false; ctlMultipleEmployee.Enabled = false; ctlDepartment.Enabled = false; cboInstitute.Enabled = false; cboTraining.Enabled = false; cboTrainingNature.Enabled = false; cboTrainingType.Enabled = false; btnPreview.Enabled = true; cboSchedule.Enabled = false; break; case EnumTrainingReports.Employee_Wise_Training_Status: dtpFromDate.Enabled = true; dtpToDate.Enabled = false; ctlMultipleEmployee.Enabled = true; ctlDepartment.Enabled = false; cboInstitute.Enabled = true; cboTraining.Enabled = false; cboTrainingNature.Enabled = true; cboTrainingType.Enabled = true; btnPreview.Enabled = true; cboSchedule.Enabled = false; break; //case EnumTrainingReports.Training_Cost_Details: // dtpFromDate.Enabled = false; // dtpToDate.Enabled = false; // ctlMultipleEmployee.Enabled = true; // ctlDepartment.Enabled = false; // cboInstitute.Enabled = false; // cboTraining.Enabled = false; // cboTrainingNature.Enabled = true; // cboTrainingType.Enabled = false; // btnPreview.Enabled = true; // break; case EnumTrainingReports.Employee_Wise_Training_Details: dtpFromDate.Enabled = true; dtpToDate.Enabled = true; ctlMultipleEmployee.Enabled = true; ctlDepartment.Enabled = false; cboInstitute.Enabled = true; cboTraining.Enabled = false; cboTrainingNature.Enabled = true; cboTrainingType.Enabled = true; btnPreview.Enabled = true; cboSchedule.Enabled = false; break; case EnumTrainingReports.Training_Name_wise_details: dtpFromDate.Enabled = true; dtpToDate.Enabled = true; ctlMultipleEmployee.Enabled = true; ctlDepartment.Enabled = false; cboInstitute.Enabled = true; cboTraining.Enabled = true; cboTrainingNature.Enabled = true; cboTrainingType.Enabled = true; btnPreview.Enabled = true; cboSchedule.Enabled = false; break; case EnumTrainingReports.Department_Wise_Training_Expens: dtpFromDate.Enabled = true; dtpToDate.Enabled = false; ctlMultipleEmployee.Enabled = true; ctlDepartment.Enabled = false; cboInstitute.Enabled = true; cboTraining.Enabled = false; cboTrainingNature.Enabled = true; cboTrainingType.Enabled = true; btnPreview.Enabled = true; cboSchedule.Enabled = false; break; case EnumTrainingReports.Training_costing_Information: dtpFromDate.Enabled = true; dtpToDate.Enabled = true; ctlMultipleEmployee.Enabled = true; ctlDepartment.Enabled = false; cboInstitute.Enabled = true; cboTraining.Enabled = false; cboTrainingNature.Enabled = true; cboTrainingType.Enabled = true; btnPreview.Enabled = true; cboSchedule.Enabled = false; break; case EnumTrainingReports.Entity_Wise_Training_Summary: dtpFromDate.Enabled = true; dtpToDate.Enabled = true; ctlMultipleEmployee.Enabled = true; ctlDepartment.Enabled = false; cboInstitute.Enabled = true; cboTraining.Enabled = false; cboTrainingNature.Enabled = true; cboTrainingType.Enabled = true; btnPreview.Enabled = true; cboSchedule.Enabled = false; break; case EnumTrainingReports.Attendance_Record: dtpFromDate.Enabled = true; dtpToDate.Enabled = true; ctlMultipleEmployee.Enabled = true; ctlDepartment.Enabled = false; cboInstitute.Enabled = true; cboTraining.Enabled = true; cboTrainingNature.Enabled = true; cboTrainingType.Enabled = true; btnPreview.Enabled = true; cboSchedule.Enabled = true; break; case EnumTrainingReports.Proposed_TNA: dtpFromDate.Enabled = true; dtpToDate.Enabled = false; ctlMultipleEmployee.Enabled = false; ctlDepartment.Enabled = false; cboInstitute.Enabled = false; cboTraining.Enabled = false; cboTrainingNature.Enabled = false; cboTrainingType.Enabled = false; btnPreview.Enabled = true; cboSchedule.Enabled = false; break; default: break; } } private void RefreshControls() { ctlMultipleEmployee.Clear(); ctlDepartment.Clear(); cboInstitute.SelectedIndex = 0; cboTraining.SelectedIndex = 0; cboTrainingNature.SelectedIndex = 0; cboTrainingType.SelectedIndex = 0; } private void cboTrainingType_SelectedIndexChanged(object sender, EventArgs e) { LoadtrainingCbo(((TrainingType)cboTrainingType.SelectedItem).ID); } private void cboTraining_SelectedIndexChanged(object sender, EventArgs e) { LoadTrainingScheduleCbo(((Training)cboTraining.SelectedItem).ID); } } }