private void PopulateCombos() { try { DataTable dt = new DataTable(); DAL.Departments obj = new DAL.Departments(); obj.connectionstring = objDAL.connectionstring; dt = obj.getRecord(string.Empty); cboDepartment.DataSource = dt; cboDepartment.ValueMember = "DepartmentID"; cboDepartment.DisplayMember = "DepartmentTitle"; DAL.Designation objD = new DAL.Designation(); objD.connectionstring = objDAL.connectionstring; dt = objD.getRecord(string.Empty); DataRow dr = dt.NewRow(); dr["DesignationID"] = 0; dr["DesignationTitle"] = "All"; dt.Rows.Add(dr); cboDesignation.DataSource = dt; cboDesignation.ValueMember = "DesignationID"; cboDesignation.DisplayMember = "DesignationTitle"; cboDesignation.SelectedValue = 0; cboDesignation.SelectedText = "All"; DAL.Shifts objS = new DAL.Shifts(); objS.connectionstring = objDAL.connectionstring; dt = objS.getRecord(string.Empty); DataRow dr1 = dt.NewRow(); dr1["ShiftID"] = 0; dr1["ShiftTitle"] = "All"; dt.Rows.Add(dr1); cboShift.DataSource = dt; cboShift.ValueMember = "ShiftID"; cboShift.DisplayMember = "ShiftTitle"; cboShift.SelectedValue = 0; cboShift.SelectedText = "All"; } catch (Exception exc) { Message.ShowMessage(MyMessages.MessageType.Error, exc.Message); } }
private void PopulateCombos() { try { DataTable dt = new DataTable(); DAL.Departments obj = new DAL.Departments(); obj.connectionstring = objDAL.connectionstring; dt = obj.getRecord(string.Empty); cboDepartment.DataSource = dt; cboDepartment.ValueMember = "DepartmentID"; cboDepartment.DisplayMember = "DepartmentTitle"; DAL.Designation objD = new DAL.Designation(); objD.connectionstring = objDAL.connectionstring; dt = objD.getRecord(string.Empty); cboDesignation.DataSource = dt; cboDesignation.ValueMember = "DesignationID"; cboDesignation.DisplayMember = "DesignationTitle"; DAL.Shifts objS = new DAL.Shifts(); objS.connectionstring = objDAL.connectionstring; dt = objS.getRecord(string.Empty); cboShift.DataSource = dt; cboShift.ValueMember = "ShiftID"; cboShift.DisplayMember = "ShiftTitle"; } catch (Exception exc) { Message.ShowMessage(MyMessages.MessageType.Error, exc.Message); } }