/// <summary> /// Populate business object from data reader /// </summary> /// <param name="businessObject">business object</param> /// <param name="dataReader">data reader</param> internal void PopulateBusinessObjectFromReader3(clsAssets businessObject, IDataReader dataReader) { businessObject.ASSET_ID = dataReader.GetInt32(dataReader.GetOrdinal(clsAssets.clsAssetsFields.ASSET_ID.ToString())); businessObject.EMP_ID = dataReader.GetInt32(dataReader.GetOrdinal(clsAssets.clsAssetsFields.EMP_ID.ToString())); businessObject.ASSET_DESC = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.ASSET_DESC.ToString())); businessObject.MANUFACTURER = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.MANUFACTURER.ToString())); businessObject.MODEL_NO = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.MODEL_NO.ToString())); businessObject.SERIAL_NO = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.SERIAL_NO.ToString())); businessObject.ASSET_TAG = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.ASSET_TAG.ToString())); businessObject.DATE_ASSIGNED = dataReader.GetDateTime(dataReader.GetOrdinal(clsAssets.clsAssetsFields.DATE_ASSIGNED.ToString())); businessObject.STATUS = dataReader.GetInt32(dataReader.GetOrdinal(clsAssets.clsAssetsFields.STATUS.ToString())); businessObject.FULL_NAME = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.FULL_NAME.ToString())); businessObject.APPROVAL = dataReader.GetInt32(dataReader.GetOrdinal(clsAssets.clsAssetsFields.APPROVAL.ToString())); if (!dataReader.IsDBNull(dataReader.GetOrdinal(clsAssets.clsAssetsFields.COMMENTS.ToString()))) { businessObject.COMMENTS = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.COMMENTS.ToString())); } else { businessObject.COMMENTS = String.Empty; } if (!dataReader.IsDBNull(dataReader.GetOrdinal(clsAssets.clsAssetsFields.DEPARTMENT.ToString()))) { businessObject.DEPARTMENT = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.DEPARTMENT.ToString())); } else { businessObject.DEPARTMENT = String.Empty; } }
public bool UpdateAssetsInventoryCancel(clsAssets businessObject) { SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandText = "dbo.[sp_UpdateAssetsInventoryCancel]"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.Add(new SqlParameter("@ASSET_ID", SqlDbType.Int, 10, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.ASSET_ID)); sqlCommand.Parameters.Add(new SqlParameter("@EMP_ID", SqlDbType.Int, 10, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.EMP_ID)); sqlCommand.Parameters.Add(new SqlParameter("@DATE_ASSIGNED", SqlDbType.DateTime, 10, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.DATE_ASSIGNED)); sqlCommand.Parameters.Add(new SqlParameter("@STATUS", SqlDbType.Int, 10, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.STATUS)); sqlCommand.Parameters.Add(new SqlParameter("@COMMENTS", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.COMMENTS)); MainConnection.Open(); sqlCommand.ExecuteNonQuery(); return(true); } catch (Exception ex) { throw new Exception("clsAssets::sp_UpdateAssetsInventoryCancel::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
internal void PopulateBusinessObjectFromReader4(clsAssets businessObject, IDataReader dataReader) { businessObject.ASSET_ID = dataReader.GetInt32(dataReader.GetOrdinal(clsAssets.clsAssetsFields.ASSET_ID.ToString())); businessObject.FULL_NAME = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.FULL_NAME.ToString())); businessObject.TABLE_NAME = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.TABLE_NAME.ToString())); businessObject.STATUS_DESCR = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.STATUS_DESCR.ToString())); businessObject.DATE_ASSIGNED = dataReader.GetDateTime(dataReader.GetOrdinal(clsAssets.clsAssetsFields.DATE_ASSIGNED.ToString())); }
internal List <clsAssets> PopulateObjectsFromReader6(IDataReader dataReader) { List <clsAssets> list = new List <clsAssets>(); while (dataReader.Read()) { clsAssets businessObject = new clsAssets(); PopulateBusinessObjectFromReader6(businessObject, dataReader); list.Add(businessObject); } return(list); }
internal void PopulateBusinessObjectFromReader4(clsAssets businessObject, IDataReader dataReader) { businessObject.ASSET_ID = dataReader.GetInt32(dataReader.GetOrdinal(clsAssets.clsAssetsFields.ASSET_ID.ToString())); businessObject.FULL_NAME = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.FULL_NAME.ToString())); businessObject.ASSET_DESC = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.ASSET_DESC.ToString())); businessObject.MANUFACTURER = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.MANUFACTURER.ToString())); businessObject.MODEL_NO = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.MODEL_NO.ToString())); businessObject.SERIAL_NO = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.SERIAL_NO.ToString())); businessObject.ASSET_TAG = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.ASSET_TAG.ToString())); businessObject.STATUS_DESCR = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.STATUS_DESCR.ToString())); businessObject.DATE_ASSIGNED = dataReader.GetDateTime(dataReader.GetOrdinal(clsAssets.clsAssetsFields.DATE_ASSIGNED.ToString())); }
/// <summary> /// Populate business object from data reader /// </summary> /// <param name="businessObject">business object</param> /// <param name="dataReader">data reader</param> internal void PopulateBusinessObjectFromReader(clsAssets businessObject, IDataReader dataReader) { businessObject.ASSET_ID = dataReader.GetInt32(dataReader.GetOrdinal(clsAssets.clsAssetsFields.ASSET_ID.ToString())); businessObject.EMP_ID = dataReader.GetInt32(dataReader.GetOrdinal(clsAssets.clsAssetsFields.EMP_ID.ToString())); businessObject.ASSET_DESC = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.ASSET_DESC.ToString())); businessObject.MANUFACTURER = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.MANUFACTURER.ToString())); businessObject.MODEL_NO = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.MODEL_NO.ToString())); businessObject.SERIAL_NO = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.SERIAL_NO.ToString())); businessObject.ASSET_TAG = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.ASSET_TAG.ToString())); businessObject.DATE_PURCHASED = dataReader.GetDateTime(dataReader.GetOrdinal(clsAssets.clsAssetsFields.DATE_PURCHASED.ToString())); businessObject.STATUS = dataReader.GetInt32(dataReader.GetOrdinal(clsAssets.clsAssetsFields.STATUS.ToString())); businessObject.FULL_NAME = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.FULL_NAME.ToString())); if (!dataReader.IsDBNull(dataReader.GetOrdinal(clsAssets.clsAssetsFields.OTHER_INFO.ToString()))) { businessObject.OTHER_INFO = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.OTHER_INFO.ToString())); } else { businessObject.OTHER_INFO = String.Empty; } }
/// <summary> /// insert new row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true of successfully insert</returns> public bool InsertAssets(clsAssets businessObject) { SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandText = "dbo.[sp_InsertAssets]"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.Add(new SqlParameter("@EMP_ID", SqlDbType.Int, 10, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.EMP_ID)); sqlCommand.Parameters.Add(new SqlParameter("@ASSET_DESC", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.ASSET_DESC)); sqlCommand.Parameters.Add(new SqlParameter("@MANUFACTURER", SqlDbType.VarChar, 20, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.MANUFACTURER)); sqlCommand.Parameters.Add(new SqlParameter("@MODEL_NO", SqlDbType.VarChar, 20, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.MODEL_NO)); sqlCommand.Parameters.Add(new SqlParameter("@SERIAL_NO", SqlDbType.VarChar, 20, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.SERIAL_NO)); sqlCommand.Parameters.Add(new SqlParameter("@ASSET_TAG", SqlDbType.VarChar, 20, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.ASSET_TAG)); sqlCommand.Parameters.Add(new SqlParameter("@DATE_PURHCASED", SqlDbType.DateTime, 100, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.DATE_PURCHASED)); sqlCommand.Parameters.Add(new SqlParameter("@STATUS", SqlDbType.Int, 10, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.STATUS)); sqlCommand.Parameters.Add(new SqlParameter("@OTHER_INFO", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.OTHER_INFO)); sqlCommand.Parameters.Add(new SqlParameter("@ASSIGNEDTO", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.ASSIGNED_TO)); MainConnection.Open(); sqlCommand.ExecuteNonQuery(); return(true); } catch (Exception ex) { throw new Exception("clsAssets:sp_InsertAssests:Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
internal void PopulateBusinessObjectFromReader6(clsAssets businessObject, IDataReader dataReader) { businessObject.ASSET_ID = dataReader.GetInt32(dataReader.GetOrdinal(clsAssets.clsAssetsFields.ASSET_ID.ToString())); businessObject.ASSET_DESC = dataReader.GetString(dataReader.GetOrdinal(clsAssets.clsAssetsFields.ASSET_DESC.ToString())); }