public List<BusinessUnits> GetBusinesUnits() { List<BusinessUnits> businessUnits = new List<BusinessUnits>(); BusinessUnits businessUnit = null; try { string sql = "SELECT DISTINCT Bussiness_Unit from EBS_Employees"; using (OdbcConnection conn = new OdbcConnection(Database.EBSConnection)) { conn.Open(); using (OdbcCommand comm = new OdbcCommand(sql, conn)) { OdbcDataReader dr = comm.ExecuteReader(); while (dr.Read()) { try { businessUnit = new BusinessUnits(); EBSEmployee EBSEmployee = new EBSEmployee(); try { businessUnit.BusinessUnit = dr.GetString(0); } catch { } businessUnits.Add(businessUnit); } catch (Exception er) { Log.LogMessage(er.ToString()); } } } } return businessUnits; } catch (Exception er) { Log.LogMessage(er.ToString()); return businessUnits; } }
public EBSEmployee GetEmployeeData(string ID) { EBSEmployee employeeData = new EBSEmployee(); try { string sql = "SELECT Employee_ID,Name_First, Name_Last,Status,Phone_Mobile,Bussiness_Unit,Location,Email_personal,flag_mobile_tel,Flag_txt_msg,Flag_email,Flag_Home_tel,Phone_home from EBS_Employees" //string sql = "SELECT Employee_ID, Name_First, Name_Last,Bussiness_Unit,Location,Department from EBS_Employees" + " where Employee_ID = '" + ID + "'"; using (OdbcConnection conn = new OdbcConnection(Database.EBSConnection)) { conn.Open(); using (OdbcCommand comm = new OdbcCommand(sql, conn)) { OdbcDataReader dr = comm.ExecuteReader(); while (dr.Read()) { try { employeeData = new EBSEmployee(); try { employeeData.Employee_ID = dr.GetString(0); } catch { } try { employeeData.Name_First = dr.GetString(1) + " " + dr.GetString(2); } catch { } try { employeeData.Status = dr.GetString(3); } catch { } try { employeeData.Phone_Mobile = dr.GetString(4); } catch { } try { employeeData.Bussiness_Unit = dr.GetString(5); } catch { } try { employeeData.Location = dr.GetString(6); } catch { } try { employeeData.Email_personal = dr.GetString(7); } catch { } try { employeeData.flag_mobile_tel = dr.GetString(8); } catch { } try { employeeData.Flag_txt_msg = dr.GetString(9); } catch { } try { employeeData.Flag_email = dr.GetString(10); } catch { } try { employeeData.Flag_Home_tel = dr.GetString(11); } catch { } try { employeeData.Phone_Home = dr.GetString(12); } catch { } //try //{ // employeeData.Bussiness_Unit = dr.GetString(3); //} //catch { } //try //{ // employeeData.Location = dr.GetString(4); //} //catch { } //try //{ // employeeData.Department = dr.GetString(5); //} //catch { } //return employeeData; //ebsDataList.Add(EBSEmployee); } catch (Exception er) { Log.LogMessage(er.ToString()); return employeeData; } } } } return employeeData; } catch (Exception er) { Log.LogMessage(er.ToString()); return employeeData; } }
public List<EBSEmployee> GetEBSDate() { List<EBSEmployee> ebsDataList = new List<EBSEmployee>(); try { //string sql = "SELECT Name_First, Name_Last,Status,Phone_Mobile,Bussiness_Unit,Location,Email_personal,flag_mobile_tel,Flag_txt_msg,Flag_email,Flag_Home_tel from EBS_Employees"; string sql = "SELECT Employee_ID, Name_First, Name_Last,Bussiness_Unit,Location,Department,Status from EBS_Employees" + " where status = 'Active'"; using (OdbcConnection conn = new OdbcConnection(Database.EBSConnection)) { conn.Open(); using (OdbcCommand comm = new OdbcCommand(sql, conn)) { OdbcDataReader dr = comm.ExecuteReader(); while (dr.Read()) { try { EBSEmployee EBSEmployee = new EBSEmployee(); try { EBSEmployee.Employee_ID = dr.GetString(0); } catch { } try { EBSEmployee.Name_First = dr.GetString(1) + " " + dr.GetString(2); } catch { } try { EBSEmployee.Bussiness_Unit = dr.GetString(3); } catch { } try { EBSEmployee.Location = dr.GetString(4); } catch { } try { EBSEmployee.Department = dr.GetString(5); } catch { } ebsDataList.Add(EBSEmployee); } catch (Exception er) { Log.LogMessage(er.ToString()); } } } } return ebsDataList; } catch (Exception er) { Log.LogMessage(er.ToString()); return ebsDataList; } }