public static void update(Guid id, string storageName, string vendorName, string vendorInfo, string description, DateTime?priceDate, decimal?pricePerUnit, DateTime?discontinueDate, string notes, Guid?lengthUnitID, decimal?sellPricePerUnit) { Sample objOld = new Sample(id); //generate log description string logDescription = ""; if (objOld.StorageName != storageName) { logDescription = Tools.append(logDescription, String.Format("Storage Name: '{0}' to '{1}'", objOld.StorageName, storageName), ","); } if (objOld.VendorName != vendorName) { logDescription = Tools.append(logDescription, String.Format("Vendor Name: '{0}' to '{1}'", objOld.VendorName, vendorName), ","); } if (objOld.VendorInfo != vendorInfo) { logDescription = Tools.append(logDescription, String.Format("Vendor Info: '{0}' to '{1}'", objOld.VendorInfo, vendorInfo), ","); } if (objOld.Description != description) { logDescription = Tools.append(logDescription, String.Format("Description: '{0}' to '{1}'", objOld.Description, description), ","); } if (objOld.PriceDate != priceDate) { logDescription = Tools.append(logDescription, String.Format("Price Date: '{0:MM/dd/yy}' to '{1:MM/dd/yy}'", objOld.PriceDate, priceDate), ","); } if (objOld.PricePerUnit != pricePerUnit) { logDescription = Tools.append(logDescription, String.Format("Price Per Unit: '{0:N2}' to '{1:N2}'", objOld.PricePerUnit, pricePerUnit), ","); } if (objOld.DiscontinueDate != discontinueDate) { logDescription = Tools.append(logDescription, String.Format("Discontinue Date: '{0:MM/dd/yy}' to '{1:MM/dd/yy}'", objOld.DiscontinueDate, discontinueDate), ","); } if (objOld.Notes != notes) { logDescription = Tools.append(logDescription, String.Format("Notes: '{0}' to '{1}'", objOld.Notes, notes), ","); } logDescription = ActivityLog.appendChange(logDescription, objOld.SellPricePerUnit, sellPricePerUnit, "Sell Price: '{0}' to '{1}'"); logDescription = ActivityLog.appendChange(logDescription, objOld.LengthUnitName, new LengthUnit(lengthUnitID).Name, "Unit: '{0}' to '{1}'"); if (!string.IsNullOrEmpty(logDescription)) { SqlQueryResult result = DBConnection.query( false, DBConnection.ActiveSqlConnection, QueryTypes.ExecuteNonQuery, "sample_update", new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id), new SqlQueryParameter(COL_DB_STORAGENAME, SqlDbType.VarChar, storageName), new SqlQueryParameter(COL_DB_VENDORNAME, SqlDbType.VarChar, vendorName), new SqlQueryParameter(COL_DB_VENDORINFO, SqlDbType.VarChar, vendorInfo), new SqlQueryParameter(COL_DB_DESCRIPTION, SqlDbType.VarChar, description), new SqlQueryParameter(COL_DB_PRICEDATE, SqlDbType.DateTime, Util.wrapNullable(priceDate)), new SqlQueryParameter(COL_DB_PRICEPERUNIT, SqlDbType.Decimal, Util.wrapNullable(pricePerUnit)), new SqlQueryParameter(COL_DB_DISCONTINUEDATE, SqlDbType.DateTime, Util.wrapNullable(discontinueDate)), new SqlQueryParameter(COL_DB_LENGTHUNITID, SqlDbType.UniqueIdentifier, Util.wrapNullable(lengthUnitID)), new SqlQueryParameter(COL_DB_SELLPRICEPERUNIT, SqlDbType.Decimal, Util.wrapNullable(sellPricePerUnit)), new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, Util.wrapNullable(notes)) ); if (result.IsSuccessful) { ActivityLog.submitUpdate(id, logDescription); } } }