public static CustomList <EmployeeSalaryTemp> GetAllEmployeeSalaryByEmpKey(Int64 empKey, string usercode) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList <EmployeeSalaryTemp> EmployeeSalaryTempCollection = new CustomList <EmployeeSalaryTemp>(); IDataReader reader = null; String sql = "EXEC spGetSalaryInfo " + empKey + " , '" + usercode + "'"; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { EmployeeSalaryTemp newEmployeeSalaryTemp = new EmployeeSalaryTemp(); newEmployeeSalaryTemp.EmpKey = reader.GetInt64("EmpKey"); newEmployeeSalaryTemp.SalaryRuleCode = reader.GetString("SalaryRuleCode"); newEmployeeSalaryTemp.SalaryHeadKey = reader.GetInt32("SalaryHeadKey"); newEmployeeSalaryTemp.Amount = reader.GetDecimal("Amount"); EmployeeSalaryTempCollection.Add(newEmployeeSalaryTemp); } return(EmployeeSalaryTempCollection); } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) { reader.Close(); } } }
public static CustomList <EmployeeSalaryTemp> GetAllEmployeeSalaryTemp() { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList <EmployeeSalaryTemp> EmployeeSalaryTempCollection = new CustomList <EmployeeSalaryTemp>(); IDataReader reader = null; const String sql = "select *from EmployeeSalaryTemp"; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { EmployeeSalaryTemp newEmployeeSalaryTemp = new EmployeeSalaryTemp(); newEmployeeSalaryTemp.SetData(reader); EmployeeSalaryTempCollection.Add(newEmployeeSalaryTemp); } EmployeeSalaryTempCollection.InsertSpName = "spInsertEmployeeSalaryTemp"; EmployeeSalaryTempCollection.UpdateSpName = "spUpdateEmployeeSalaryTemp"; EmployeeSalaryTempCollection.DeleteSpName = "spDeleteEmployeeSalaryTemp"; return(EmployeeSalaryTempCollection); } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) { reader.Close(); } } }