public IList<Core.Business.SubsidyForEmployee> GetAllSubsidyForEmployee() { IList<Core.Business.SubsidyForEmployee> subsidyForEmployeelist = new List<Core.Business.SubsidyForEmployee>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllSubsidyForEmployee); if(reader != null) { while(reader.Read()) { Core.Business.SubsidyForEmployee subsidyForEmployee = new Core.Business.SubsidyForEmployee(); if (!reader.IsDBNull(0)) subsidyForEmployee.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) subsidyForEmployee.SubsidyCode = reader.GetString(1); if (!reader.IsDBNull(2)) subsidyForEmployee.SubsidyName = reader.GetString(2); if (!reader.IsDBNull(3)) subsidyForEmployee.SubsidyDescription = reader.GetString(3); if (!reader.IsDBNull(4)) subsidyForEmployee.BeginDate = reader.GetDateTime(4); subsidyForEmployee.MarkOld(); subsidyForEmployeelist.Add(subsidyForEmployee); } reader.Close(); } return subsidyForEmployeelist; }
public IList<SubsidyForEmployee> IsExists(int id, string name) { IList<Core.Business.SubsidyForEmployee> subsidyForEmployeelist = new List<Core.Business.SubsidyForEmployee>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader; if(id>0) { sql.AddParameter("@Id",SqlDbType.Int,id); sql.AddParameter("@SubsidyName", SqlDbType.NVarChar, name); reader = sql.ExecuteSqlReader(SqlUpdateIsExists); } else { sql.AddParameter("@SubsidyName", SqlDbType.NVarChar, name); reader = sql.ExecuteSqlReader(SqlAddIsExists); } if (reader != null) { while (reader.Read()) { Core.Business.SubsidyForEmployee subsidyForEmployee = new Core.Business.SubsidyForEmployee(); if (!reader.IsDBNull(0)) subsidyForEmployee.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) subsidyForEmployee.SubsidyCode = reader.GetString(1); if (!reader.IsDBNull(2)) subsidyForEmployee.SubsidyName = reader.GetString(2); if (!reader.IsDBNull(3)) subsidyForEmployee.SubsidyDescription = reader.GetString(3); if (!reader.IsDBNull(4)) subsidyForEmployee.BeginDate = reader.GetDateTime(4); subsidyForEmployee.MarkOld(); subsidyForEmployeelist.Add(subsidyForEmployee); } reader.Close(); } return subsidyForEmployeelist; }