/// <summary> /// insert new row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true of successfully insert</returns> public bool InsertAuditDaily(clsWorkplaceAudit businessObject) { SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandText = "dbo.[sp_InsertAuditDaily]"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.Add(new SqlParameter("@AUDIT_QUESTIONS_ID", SqlDbType.Int, 15, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.AUDIT_QUESTIONS_ID)); sqlCommand.Parameters.Add(new SqlParameter("@EMP_ID", SqlDbType.Int, 15, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.EMP_ID)); sqlCommand.Parameters.Add(new SqlParameter("@FY_WEEK", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.FY_WEEK)); sqlCommand.Parameters.Add(new SqlParameter("@DT_CHECKED", SqlDbType.DateTime, 12, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.DT_CHECKED)); MainConnection.Open(); sqlCommand.ExecuteNonQuery(); return(true); } catch (Exception ex) { throw new Exception("clsAuditSched:sp_InsertAuditSched:Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
/// <summary> /// Populate business object from data reader /// </summary> /// <param name="businessObject">business object</param> /// <param name="dataReader">data reader</param> internal void PopulateBusinessObjectFromReader2(clsWorkplaceAudit businessObject, IDataReader dataReader) { businessObject.AUDIT_QUESTIONS_ID = dataReader.GetInt32(dataReader.GetOrdinal(clsWorkplaceAudit.clsWorkplaceAuditFields.AUDIT_QUESTIONS_ID.ToString())); businessObject.EMP_ID = dataReader.GetInt32(dataReader.GetOrdinal(clsWorkplaceAudit.clsWorkplaceAuditFields.EMP_ID.ToString())); businessObject.AUDIT_QUESTIONS = dataReader.GetString(dataReader.GetOrdinal(clsWorkplaceAudit.clsWorkplaceAuditFields.AUDIT_QUESTIONS.ToString())); businessObject.OWNER = dataReader.GetString(dataReader.GetOrdinal(clsWorkplaceAudit.clsWorkplaceAuditFields.OWNER.ToString())); businessObject.AUDIT_QUESTIONS_GROUP = dataReader.GetString(dataReader.GetOrdinal(clsWorkplaceAudit.clsWorkplaceAuditFields.AUDIT_QUESTIONS_GROUP.ToString())); }
/// <summary> /// Populate business object from data reader /// </summary> /// <param name="businessObject">business object</param> /// <param name="dataReader">data reader</param> internal void PopulateBusinessObjectFromReader(clsWorkplaceAudit businessObject, IDataReader dataReader) { businessObject.AUDIT_DAILY_ID = dataReader.GetInt32(dataReader.GetOrdinal(clsWorkplaceAudit.clsWorkplaceAuditFields.AUDIT_DAILY_ID.ToString())); businessObject.AUDIT_QUESTIONS_ID = dataReader.GetInt32(dataReader.GetOrdinal(clsWorkplaceAudit.clsWorkplaceAuditFields.AUDIT_QUESTIONS_ID.ToString())); businessObject.EMP_ID = dataReader.GetInt32(dataReader.GetOrdinal(clsWorkplaceAudit.clsWorkplaceAuditFields.EMP_ID.ToString())); businessObject.FY_WEEK = dataReader.GetInt32(dataReader.GetOrdinal(clsWorkplaceAudit.clsWorkplaceAuditFields.FY_WEEK.ToString())); businessObject.STATUS = dataReader.GetInt32(dataReader.GetOrdinal(clsWorkplaceAudit.clsWorkplaceAuditFields.STATUS.ToString())); businessObject.DT_CHECKED = dataReader.GetDateTime(dataReader.GetOrdinal(clsWorkplaceAudit.clsWorkplaceAuditFields.DT_CHECKED.ToString())); }
/// <summary> /// Populate business objects from the data reader /// </summary> /// <param name="dataReader">data reader</param> /// <returns>list of clsContacts</returns> internal List <clsWorkplaceAudit> PopulateObjectsFromReader2(IDataReader dataReader) { List <clsWorkplaceAudit> list = new List <clsWorkplaceAudit>(); while (dataReader.Read()) { clsWorkplaceAudit businessObject = new clsWorkplaceAudit(); PopulateBusinessObjectFromReader2(businessObject, dataReader); list.Add(businessObject); } return(list); }