public PartCategoryCompany(String argConnection, Int32 argPartCategoryCompanyId) { mConnection = argConnection; string pstrSql = "SELECT * FROM PartCategoryCompany WHERE PartCategoryCompanyId=" + argPartCategoryCompanyId; SqlDataReader dr = SqlHelper.ExecuteReader(Connection, CommandType.Text, pstrSql); if (dr.Read()) { mPartCategoryCompanyId = (System.Int32)dr["PartCategoryCompanyId"]; mPart = new Part(Connection, (int)dr["PartId"]); mInsuranceCompany = new InsuranceCompany(Connection, (int)dr["InsuranceCompanyId"]); mPartCategory = new PartCategory(Connection, (int)dr["PartCategoryId"]); } else { Exception ex = new Exception("Identifier does not exist."); ex.Source = "PartCategoryCompany.PartCategoryCompany()"; throw ex; } dr.Close(); }
public DepreciationSchedule(String argConnection, Int32 argDepreciationScheduleId) { mConnection = argConnection; string pstrSql = "SELECT * FROM DepreciationSchedule WHERE DepreciationScheduleId=" + argDepreciationScheduleId; SqlDataReader dr = SqlHelper.ExecuteReader(Connection, CommandType.Text, pstrSql); if (dr.Read()) { mDepreciationScheduleId = (System.Int32)dr["DepreciationScheduleId"]; mMonthAgeFrom = (System.Single)dr["MonthAgeFrom"]; mMonthAgeTill = (System.Single)dr["MonthAgeTill"]; mDepreciationRate = (System.Single)dr["DepreciationRate"]; mPartCategory = new PartCategory(Connection, (int)dr["PartCategoryId"]); } else { Exception ex = new Exception("Identifier does not exist."); ex.Source = "DepreciationSchedule.DepreciationSchedule()"; throw ex; } dr.Close(); }
public Part(String argConnection, Int32 argPartId) { mConnection = argConnection; string pstrSql = "SELECT * FROM Part WHERE PartId=" + argPartId; SqlDataReader dr = SqlHelper.ExecuteReader(Connection, CommandType.Text, pstrSql); if (dr.Read()) { mPartId = (System.Int32)dr["PartId"]; mDefault = (System.String)dr["Part"]; mPartCategory = new PartCategory(Connection, (int)dr["PartCategoryId"]); mVatRate = (System.Single)dr["VatRate"]; mCode = dr["Code"].ToString(); mIsIMT23Applicable = dr.GetBoolean(dr.GetOrdinal("IsIMT23Applicable")); } else { Exception ex = new Exception("Identifier does not exist."); ex.Source = "Part.Part()"; //throw ex; } dr.Close(); }