public static void delete(Guid id) { CustomerSaleAdjustment obj = new CustomerSaleAdjustment(id); //generate log description string logDescription = ""; logDescription = Tools.append(logDescription, String.Format("Customer Name: '{0}'", obj.CustomerName), ","); logDescription = Tools.append(logDescription, String.Format("Product Store Name: '{0}'", obj.ProductStoreName), ","); logDescription = Tools.append(logDescription, String.Format("Grade: '{0}'", obj.GradeName), ","); logDescription = Tools.append(logDescription, String.Format("Product Width: '{0}'", obj.ProductWidthName), ","); logDescription = Tools.append(logDescription, String.Format("Unit: '{0}'", obj.LengthUnitName), ","); logDescription = Tools.append(logDescription, String.Format("Adjustment: '{0}'", obj.AdjustmentPerUnit), ","); logDescription = Tools.append(logDescription, String.Format("Notes: '{0}'", obj.Notes), ","); SqlQueryResult result = DBConnection.query( false, DBConnection.ActiveSqlConnection, QueryTypes.ExecuteNonQuery, "customersaleadjustment_delete", new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id) ); if (result.IsSuccessful) { ActivityLog.submit(id, String.Format("Item deleted: {0}", logDescription)); } }
public static void update(Guid id, Guid customerID, Guid gradeID, Guid productStoreNameID, Guid productWidthID, Guid lengthUnitID, Guid?colorID, decimal adjustmentPerUnit, string notes) { CustomerSaleAdjustment objOld = new CustomerSaleAdjustment(id); //generate log description string logDescription = ""; if (objOld.CustomerID != customerID) { Customer customer = new Customer(customerID); logDescription = Tools.append(logDescription, String.Format("Customer Name: '{0}' to '{1}'", objOld.CustomerName, customer.Name), ","); } if (objOld.ProductStoreNameID != productStoreNameID) { logDescription = Tools.append(logDescription, String.Format("Product Store Name: '{0}' to '{1}'", objOld.ProductStoreName, new ProductStoreName(productStoreNameID).Name), ","); } if (objOld.GradeID != gradeID) { logDescription = Tools.append(logDescription, String.Format("Grade: '{0}' to '{1}'", objOld.GradeID, new Grade(gradeID).Name), ","); } if (objOld.ProductWidthID != productWidthID) { logDescription = Tools.append(logDescription, String.Format("Product Width: '{0}' to '{1}'", objOld.ProductWidthName, new ProductWidth(productWidthID).Name), ","); } if (objOld.LengthUnitID != lengthUnitID) { logDescription = Tools.append(logDescription, String.Format("Length Unit: '{0}' to '{1}'", objOld.LengthUnitID, new LengthUnit(lengthUnitID).Name), ","); } if (objOld.AdjustmentPerUnit != adjustmentPerUnit) { logDescription = Tools.append(logDescription, String.Format("Adjustment: '{0}' to '{1}'", objOld.AdjustmentPerUnit, adjustmentPerUnit), ","); } if (objOld.Notes != notes) { logDescription = Tools.append(logDescription, String.Format("Notes: '{0}' to '{1}'", objOld.Notes, notes), ","); } if (!string.IsNullOrEmpty(logDescription)) { SqlQueryResult result = DBConnection.query( false, DBConnection.ActiveSqlConnection, QueryTypes.ExecuteNonQuery, "customersaleadjustment_update", new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id), new SqlQueryParameter(COL_DB_CUSTOMERID, SqlDbType.UniqueIdentifier, customerID), new SqlQueryParameter(COL_DB_GRADEID, SqlDbType.UniqueIdentifier, gradeID), new SqlQueryParameter(COL_DB_PRODUCSTORENAMEID, SqlDbType.UniqueIdentifier, productStoreNameID), new SqlQueryParameter(COL_DB_PRODUCTWIDTHID, SqlDbType.UniqueIdentifier, productWidthID), new SqlQueryParameter(COL_DB_LENGTHUNITID, SqlDbType.UniqueIdentifier, lengthUnitID), new SqlQueryParameter(COL_DB_COLORID, SqlDbType.UniqueIdentifier, Util.wrapNullable(colorID)), new SqlQueryParameter(COL_DB_ADJUSTMENTPERUNIT, SqlDbType.Decimal, adjustmentPerUnit), new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, Util.wrapNullable(notes)) ); if (result.IsSuccessful) { ActivityLog.submitUpdate(id, logDescription); } } }