public List <leaveob> getOfficeMax(string officeid) { leaveob lvapp; List <leaveob> LVlist = new List <leaveob>(); try { SqlConnection conn = new SqlConnection(Login.connString); string query = "select LeaveID, OfficeID, MaxDays from LeaveOfficeMapping where OfficeID='" + officeid + "'"; SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { lvapp = new leaveob(); lvapp.maxdays = reader.GetInt32(2); lvapp.officeid = reader.GetString(1); lvapp.LeaveID = reader.GetString(0); LVlist.Add(lvapp); } conn.Close(); } catch (Exception ex) { } return(LVlist); }
public List <leaveob> getLeaveOBDetails(string empID, int year) { leaveob lob; List <leaveob> lobList = new List <leaveob>(); try { SqlConnection conn = new SqlConnection(Login.connString); string query = "select a.RowID,a.LeaveID,b.Description,a.Year,a.LeaveCount,a.CreateUser,a.CreateTime" + " from LeaveOB a , LeaveType b where a.LeaveID = b.LeaveID and a.EmployeeID = '" + empID + "' and a.Year = " + year; SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { lob = new leaveob(); lob.RowID = reader.GetInt32(0); lob.LeaveID = reader.GetString(1); lob.LeaveDescription = reader.GetString(2); lob.year = reader.GetInt32(3); lob.LeaveCount = reader.GetInt32(4); lob.CreateUser = reader.GetString(5); lob.CreateTime = reader.GetDateTime(6); lobList.Add(lob); } conn.Close(); } catch (Exception) { MessageBox.Show("Error querying LEAVE OB Data"); } return(lobList); }
/// public static List <leaveob> getLeaveLimit() { leaveob lvapp; List <leaveob> LVlist = new List <leaveob>(); try { SqlConnection conn = new SqlConnection(Login.connString); string query = "select a.EmployeeID,a.LeaveCount,a.LeaveID from ViewLeaveCount a"; SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { lvapp = new leaveob(); lvapp.EmployeeID = reader.GetString(0); lvapp.maxdays = reader.GetInt32(1); lvapp.LeaveID = reader.GetString(2); LVlist.Add(lvapp); } conn.Close(); } catch (Exception ex) { } return(LVlist); }