public IList<Core.Business.MACHINESET> GetAllMACHINESET() { IList<Core.Business.MACHINESET> mACHINESETlist = new List<Core.Business.MACHINESET>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectMACHINESETsAll"); if(reader != null) { while(reader.Read()) { Core.Business.MACHINESET mACHINESET = new Core.Business.MACHINESET(); if (!reader.IsDBNull(0)) mACHINESET.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) mACHINESET.UnitID = reader.GetGuid(1); if (!reader.IsDBNull(2)) mACHINESET.LabID = reader.GetGuid(2); if (!reader.IsDBNull(3)) mACHINESET.UnitCode = reader.GetString(3); if (!reader.IsDBNull(4)) mACHINESET.LabCode = reader.GetString(4); if (!reader.IsDBNull(5)) mACHINESET.SetCode = reader.GetString(5); if (!reader.IsDBNull(6)) mACHINESET.SETNAME = reader.GetString(6); if (!reader.IsDBNull(7)) mACHINESET.LINKMAN = reader.GetString(7); if (!reader.IsDBNull(8)) mACHINESET.GroupInstance = reader.GetString(8); if (!reader.IsDBNull(9)) mACHINESET.PHONE = reader.GetString(9); if (!reader.IsDBNull(10)) mACHINESET.FAX = reader.GetString(10); if (!reader.IsDBNull(11)) mACHINESET.EMAIL = reader.GetString(11); if (!reader.IsDBNull(12)) mACHINESET.SETMAN = reader.GetString(12); if (!reader.IsDBNull(13)) mACHINESET.AUDITINGSTATE = reader.GetInt32(13); if (!reader.IsDBNull(14)) mACHINESET.ASSESSOR = reader.GetString(14); if (!reader.IsDBNull(15)) mACHINESET.AUDITINGDATE = reader.GetDateTime(15); if (!reader.IsDBNull(16)) mACHINESET.REMARK = reader.GetString(16); if (!reader.IsDBNull(17)) mACHINESET.WRITEDATE = reader.GetDateTime(17); if (!reader.IsDBNull(18)) mACHINESET.UPDATEDATE = reader.GetDateTime(18); mACHINESET.MarkOld(); mACHINESETlist.Add(mACHINESET); } reader.Close(); } return mACHINESETlist; }
public IList<MACHINESET> SelectMachinesetsDynamic(string whereCondition, string orderByExpression) { if (string.IsNullOrEmpty(whereCondition)) { return this.GetAllMACHINESET(); } IList<Core.Business.MACHINESET> mACHINESETlist = new List<Core.Business.MACHINESET>(); SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@WhereCondition", SqlDbType.NVarChar, whereCondition); sql.AddParameter("@OrderByExpression", SqlDbType.NVarChar, orderByExpression); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectMACHINESETsDynamic"); if (reader != null) { while (reader.Read()) { Core.Business.MACHINESET mACHINESET = new Core.Business.MACHINESET(); if (!reader.IsDBNull(0)) mACHINESET.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) mACHINESET.UnitID = reader.GetGuid(1); if (!reader.IsDBNull(2)) mACHINESET.LabID = reader.GetGuid(2); if (!reader.IsDBNull(3)) mACHINESET.UnitCode = reader.GetString(3); if (!reader.IsDBNull(4)) mACHINESET.LabCode = reader.GetString(4); if (!reader.IsDBNull(5)) mACHINESET.SetCode = reader.GetString(5); if (!reader.IsDBNull(6)) mACHINESET.SETNAME = reader.GetString(6); if (!reader.IsDBNull(7)) mACHINESET.LINKMAN = reader.GetString(7); if (!reader.IsDBNull(8)) mACHINESET.GroupInstance = reader.GetString(8); if (!reader.IsDBNull(9)) mACHINESET.PHONE = reader.GetString(9); if (!reader.IsDBNull(10)) mACHINESET.FAX = reader.GetString(10); if (!reader.IsDBNull(11)) mACHINESET.EMAIL = reader.GetString(11); if (!reader.IsDBNull(12)) mACHINESET.SETMAN = reader.GetString(12); if (!reader.IsDBNull(13)) mACHINESET.AUDITINGSTATE = reader.GetInt32(13); if (!reader.IsDBNull(14)) mACHINESET.ASSESSOR = reader.GetString(14); if (!reader.IsDBNull(15)) mACHINESET.AUDITINGDATE = reader.GetDateTime(15); if (!reader.IsDBNull(16)) mACHINESET.REMARK = reader.GetString(16); if (!reader.IsDBNull(17)) mACHINESET.WRITEDATE = reader.GetDateTime(17); if (!reader.IsDBNull(18)) mACHINESET.UPDATEDATE = reader.GetDateTime(18); mACHINESET.MarkOld(); mACHINESETlist.Add(mACHINESET); } reader.Close(); } return mACHINESETlist; }
public Core.Business.MACHINESET Select(Guid id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectMACHINESET"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.MACHINESET mACHINESET = new Core.Business.MACHINESET(); if (!reader.IsDBNull(0)) mACHINESET.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) mACHINESET.UnitID = reader.GetGuid(1); if (!reader.IsDBNull(2)) mACHINESET.LabID = reader.GetGuid(2); if (!reader.IsDBNull(3)) mACHINESET.UnitCode = reader.GetString(3); if (!reader.IsDBNull(4)) mACHINESET.LabCode = reader.GetString(4); if (!reader.IsDBNull(5)) mACHINESET.SetCode = reader.GetString(5); if (!reader.IsDBNull(6)) mACHINESET.SETNAME = reader.GetString(6); if (!reader.IsDBNull(7)) mACHINESET.LINKMAN = reader.GetString(7); if (!reader.IsDBNull(8)) mACHINESET.GroupInstance = reader.GetString(8); if (!reader.IsDBNull(9)) mACHINESET.PHONE = reader.GetString(9); if (!reader.IsDBNull(10)) mACHINESET.FAX = reader.GetString(10); if (!reader.IsDBNull(11)) mACHINESET.EMAIL = reader.GetString(11); if (!reader.IsDBNull(12)) mACHINESET.SETMAN = reader.GetString(12); if (!reader.IsDBNull(13)) mACHINESET.AUDITINGSTATE = reader.GetInt32(13); if (!reader.IsDBNull(14)) mACHINESET.ASSESSOR = reader.GetString(14); if (!reader.IsDBNull(15)) mACHINESET.AUDITINGDATE = reader.GetDateTime(15); if (!reader.IsDBNull(16)) mACHINESET.REMARK = reader.GetString(16); if (!reader.IsDBNull(17)) mACHINESET.WRITEDATE = reader.GetDateTime(17); if (!reader.IsDBNull(18)) mACHINESET.UPDATEDATE = reader.GetDateTime(18); reader.Close(); return mACHINESET; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }