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); } } }
public static void update(Guid id, string name) { State objOld = new State(id); //generate log description string logDescription = ""; if (objOld.Name != name) { logDescription = Tools.append(logDescription, String.Format("Name: '{0}' to '{1}'", objOld.Name, name), ","); } if (!string.IsNullOrEmpty(logDescription)) { SqlQueryResult result = DBConnection.query( false, DBConnection.ActiveSqlConnection, QueryTypes.ExecuteNonQuery, "state_update", new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id), new SqlQueryParameter(COL_DB_NAME, SqlDbType.VarChar, name) ); if (result.IsSuccessful) { ActivityLog.submitUpdate(id, logDescription); } } }
public static void update(Guid id, string name) { try { Grade objOld = new Grade(id); //generate log description string logDescription = ""; if (objOld.Name != name) { logDescription = Tools.append(logDescription, String.Format("Name: '{0}' to '{1}'", objOld.Name, name), ","); } if (!string.IsNullOrEmpty(logDescription)) { using (SqlCommand cmd = new SqlCommand("grade_update", DBConnection.ActiveSqlConnection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@" + COL_DB_ID, SqlDbType.UniqueIdentifier).Value = id; cmd.Parameters.Add("@" + COL_DB_NAME, SqlDbType.VarChar).Value = name; cmd.ExecuteNonQuery(); ActivityLog.submitUpdate(id, logDescription); } Tools.hasMessage("Item updated"); } } catch (Exception ex) { Tools.showError(ex.Message); } }
public static void update(Guid id, string name, string address, Guid cityID, Guid?defaultTransportID, string phone1, string phone2, string notes, Guid?salesUserID) { Customer objOld = new Customer(id); //generate log description string logDescription = ""; if (objOld.Name != name) { logDescription = Tools.append(logDescription, String.Format("Name: '{0}' to '{1}'", objOld.Name, name), ","); } if (objOld.Address != address) { logDescription = Tools.append(logDescription, String.Format("Address: '{0}' to '{1}'", objOld.Address, address), ","); } if (objOld.CityID != cityID) { logDescription = Tools.append(logDescription, String.Format("City: '{0}' to '{1}'", objOld.CityName, new City(cityID).Name), ","); } logDescription = ActivityLog.appendChange(logDescription, objOld.DefaultTransportName, new Transport(defaultTransportID).Name, "Angkutan: '{0}' to '{1}'"); if (objOld.Phone1 != phone1) { logDescription = Tools.append(logDescription, String.Format("Phone 1: '{0}' to '{1}'", objOld.Phone1, phone1), ","); } if (objOld.Phone2 != phone2) { logDescription = Tools.append(logDescription, String.Format("Phone 2: '{0}' to '{1}'", objOld.Phone2, phone2), ","); } if (objOld.Notes != notes) { logDescription = Tools.append(logDescription, String.Format("Notes: '{0}' to '{1}'", objOld.Notes, notes), ","); } logDescription = ActivityLog.appendChange(logDescription, objOld.SalesUserName, new UserAccount(salesUserID).name, "Sales: '{0}' to '{1}'"); if (!string.IsNullOrEmpty(logDescription)) { SqlQueryResult result = DBConnection.query( false, DBConnection.ActiveSqlConnection, QueryTypes.ExecuteNonQuery, "customer_update", new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id), new SqlQueryParameter(COL_DB_NAME, SqlDbType.VarChar, name), new SqlQueryParameter(COL_DB_ADDRESS, SqlDbType.VarChar, address), new SqlQueryParameter(COL_DB_CITYID, SqlDbType.UniqueIdentifier, cityID), new SqlQueryParameter(COL_DB_DEFAULTTRANSPORTID, SqlDbType.UniqueIdentifier, Util.wrapNullable(defaultTransportID)), new SqlQueryParameter(COL_DB_PHONE1, SqlDbType.VarChar, phone1), new SqlQueryParameter(COL_DB_PHONE2, SqlDbType.VarChar, phone2), new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, notes), new SqlQueryParameter(COL_DB_SALESUSERID, SqlDbType.UniqueIdentifier, Util.wrapNullable(salesUserID)) ); if (result.IsSuccessful) { ActivityLog.submitUpdate(id, logDescription); } } }
public void update() { UserAccount objOld = new UserAccount(id); //generate log description string logDescription = ""; if (objOld.name != name) { logDescription = Tools.append(logDescription, String.Format("Name: '{0}' to '{1}'", objOld.name, name), ","); } if (!string.IsNullOrEmpty(_hashed_password) && objOld._hashed_password != _hashed_password) { logDescription = Tools.append(logDescription, "Password update", ","); } if (objOld.role != role) { logDescription = Tools.append(logDescription, String.Format("Role: '{0}' to '{1}'", objOld.role, role), ","); } if (objOld.percentCommission != percentCommission) { logDescription = Util.appendChange(logDescription, objOld.percentCommission, percentCommission, "% Comission: {0:N2} to {1:N2}"); } if (objOld.GlobalPercentComission != GlobalPercentComission) { logDescription = Util.appendChange(logDescription, objOld.GlobalPercentComission, GlobalPercentComission, "Global % Comission: {0} to {1}"); } 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, "users_update", new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id), new SqlQueryParameter(COL_DB_NAME, SqlDbType.VarChar, name), new SqlQueryParameter(COL_DB_HashedPassword, SqlDbType.VarChar, Util.wrapNullable(_hashed_password)), new SqlQueryParameter(COL_ROLE, SqlDbType.TinyInt, (int)role), new SqlQueryParameter(COL_DB_PercentCommission, SqlDbType.Decimal, percentCommission), new SqlQueryParameter(COL_DB_GlobalPercentComission, SqlDbType.Decimal, GlobalPercentComission), new SqlQueryParameter(COL_DB_Notes, SqlDbType.VarChar, Util.wrapNullable(notes)) ); if (result.IsSuccessful) { ActivityLog.submitUpdate(id, logDescription); } } }
public bool update() { Inventory objOld = new Inventory(id); //generate log description string logDescription = ""; logDescription = ActivityLog.appendChange(logDescription, objOld.code, code, "Code: '{0}' to '{1}'"); logDescription = ActivityLog.appendChange(logDescription, objOld.buy_price, buy_price, "Buy Price: '{0}' to '{1}'"); logDescription = ActivityLog.appendChange(logDescription, objOld.sell_price, sell_price, "Tag Price: '{0}' to '{1}'"); logDescription = ActivityLog.appendChange(logDescription, objOld.grade_name, grade_name, "Grade: '{0}' to '{1}'"); logDescription = ActivityLog.appendChange(logDescription, objOld.product_store_name, product_store_name, "Product Store Name: '{0}' to '{1}'"); logDescription = ActivityLog.appendChange(logDescription, objOld.product_name_vendor, product_name_vendor, "Product Vendor Name: '{0}' to '{1}'"); logDescription = ActivityLog.appendChange(logDescription, objOld.product_width_name, product_width_name, "Width: '{0}' to '{1}'"); logDescription = ActivityLog.appendChange(logDescription, objOld.length_unit_name, length_unit_name, "Length Unit: '{0}' to '{1}'"); logDescription = ActivityLog.appendChange(logDescription, objOld.color_name, color_name, "Color: '{0}' to '{1}'"); logDescription = ActivityLog.appendChange(logDescription, objOld.notes, notes, "Notes: '{0}' to '{1}'"); logDescription = ActivityLog.appendChange(logDescription, objOld.PONo, PONo, "PO Item: '{0}' to '{1}'"); logDescription = ActivityLog.appendChange(logDescription, objOld.PackingListNo, PackingListNo, "Packing List No: '{0}' to '{1}'"); logDescription = ActivityLog.appendChange(logDescription, objOld.VendorInvoiceNo, VendorInvoiceNo, "Vendor Invoice No: '{0}' to '{1}'"); if (!string.IsNullOrEmpty(logDescription)) { SqlQueryResult result = DBConnection.query( false, DBConnection.ActiveSqlConnection, QueryTypes.ExecuteNonQuery, "inventory_update", new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id), new SqlQueryParameter(COL_DB_CODE, SqlDbType.VarChar, code), new SqlQueryParameter(COL_DB_BUYPRICE, SqlDbType.Decimal, buy_price), new SqlQueryParameter(COL_DB_GRADEID, SqlDbType.UniqueIdentifier, grade_id), new SqlQueryParameter(COL_DB_PRODUCTID, SqlDbType.UniqueIdentifier, product_id), new SqlQueryParameter(COL_DB_PRODUCTWIDTHID, SqlDbType.UniqueIdentifier, product_width_id), new SqlQueryParameter(COL_DB_LENGTHUNITID, SqlDbType.UniqueIdentifier, length_unit_id), new SqlQueryParameter(COL_DB_COLORID, SqlDbType.UniqueIdentifier, color_id), new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, Util.wrapNullable(notes)), new SqlQueryParameter(COL_DB_POITEMID, SqlDbType.UniqueIdentifier, Util.wrapNullable(POItemID)), new SqlQueryParameter(COL_DB_PACKINGLISTNO, SqlDbType.VarChar, PackingListNo), new SqlQueryParameter(COL_DB_VENDORINVOICEID, SqlDbType.UniqueIdentifier, Util.wrapNullable(VendorInvoiceID)) ); if (result.IsSuccessful) { ActivityLog.submitUpdate(id, logDescription); return(true); } } return(false); }
public static void update(Guid id, string name, string address, string phone1, string phone2, string notes) { Vendor objOld = new Vendor(id); //generate log description string logDescription = ""; if (objOld.Name != name) { logDescription = Tools.append(logDescription, String.Format("Name: '{0}' to '{1}'", objOld.Name, name), ","); } if (objOld.Address != address) { logDescription = Tools.append(logDescription, String.Format("Address: '{0}' to '{1}'", objOld.Address, address), ","); } if (objOld.Phone1 != phone1) { logDescription = Tools.append(logDescription, String.Format("Phone 1: '{0}' to '{1}'", objOld.Phone1, phone1), ","); } if (objOld.Phone2 != phone2) { logDescription = Tools.append(logDescription, String.Format("Phone 2: '{0}' to '{1}'", objOld.Phone2, phone2), ","); } 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, "vendor_update", new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id), new SqlQueryParameter(COL_DB_NAME, SqlDbType.VarChar, name), new SqlQueryParameter(COL_DB_ADDRESS, SqlDbType.VarChar, address), new SqlQueryParameter(COL_DB_PHONE1, SqlDbType.VarChar, phone1), new SqlQueryParameter(COL_DB_PHONE2, SqlDbType.VarChar, phone2), new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, Util.wrapNullable(notes)) ); if (result.IsSuccessful) { ActivityLog.submitUpdate(id, logDescription); } } }
public static void update(Guid id, Guid storeNameID, string nameVendor, Guid vendorID, decimal percentageOfPercentCommission, decimal?maxCommissionAmount, string notes) { Product objOld = new Product(id); //generate log description string logDescription = ""; if (objOld.NameVendor != nameVendor) { logDescription = Tools.append(logDescription, String.Format("Name - Vendor: '{0}' to '{1}'", objOld.NameVendor, nameVendor), ","); } if (objOld.StoreNameID != storeNameID) { logDescription = Tools.append(logDescription, String.Format("Name - Store: '{0}' to '{1}'", objOld.StoreName, new ProductStoreName(storeNameID).Name), ","); } if (objOld.VendorID != vendorID) { logDescription = Tools.append(logDescription, String.Format("Vendor ID: '{0}' to '{1}'", objOld.VendorName, new Vendor(vendorID).Name), ","); } logDescription = LIBUtil.Util.appendChange(logDescription, objOld.PercentageOfPercentCommission, percentageOfPercentCommission, "Percentage of Percent Comission: {0:N2} to {1:N2}"); logDescription = LIBUtil.Util.appendChange(logDescription, objOld.MaxCommissionAmount, maxCommissionAmount, "Max Comission: {0:N0} to {1:N0}"); 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, "product_update", new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id), new SqlQueryParameter(COL_DB_STORENAMEID, SqlDbType.UniqueIdentifier, storeNameID), new SqlQueryParameter(COL_DB_NAMEVENDOR, SqlDbType.VarChar, nameVendor), new SqlQueryParameter(COL_DB_VENDORID, SqlDbType.UniqueIdentifier, vendorID), new SqlQueryParameter(COL_DB_PercentageOfPercentCommission, SqlDbType.Decimal, percentageOfPercentCommission), new SqlQueryParameter(COL_DB_MaxCommissionAmount, SqlDbType.Decimal, Util.wrapNullable(maxCommissionAmount)), new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, Util.wrapNullable(notes)) ); if (result.IsSuccessful) { ActivityLog.submitUpdate(id, logDescription); } } }
public bool update() { InventoryItem objOld = new InventoryItem(id); //generate log description string logDescription = ""; if (objOld.inventory_id != inventory_id) { logDescription = Tools.append(logDescription, String.Format("Inventory ID: '{0}' to '{1}'", objOld.inventory_id, inventory_id), ","); } if (objOld.item_length != item_length) { logDescription = Tools.append(logDescription, String.Format("Length: '{0}' to '{1}'", objOld.item_length, item_length), ","); } logDescription = Util.appendChange(logDescription, objOld.ColorName, new FabricColor(ColorID).Name, "Color: '{0}' to '{1}'"); 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, "inventoryitem_update", new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id), new SqlQueryParameter(COL_DB_INVENTORY_ID, SqlDbType.UniqueIdentifier, inventory_id), new SqlQueryParameter(COL_DB_LENGTH, SqlDbType.Decimal, item_length), new SqlQueryParameter(COL_DB_BARCODE, SqlDbType.VarChar, barcode.ToUpper()), new SqlQueryParameter(COL_DB_COLORID, SqlDbType.UniqueIdentifier, Util.wrapNullable(ColorID)), new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, Util.wrapNullable(notes)) ); if (result.IsSuccessful) { ActivityLog.submitUpdate(id, logDescription); return(true); } } return(false); }
public static void update(Guid ID, Guid?ProductStoreNameID, Guid?GradeID, Guid?ProductWidthID, Guid?LengthUnitID, decimal TagPrice, string Notes, Guid?InventoryID, Guid?ColorID, decimal?BuyPrice) { ProductPrice objOld = new ProductPrice(ID); //generate log description string log = ""; log = ActivityLog.appendChange <ProductStoreName>(log, objOld.ProductStoreNameID, ProductStoreNameID, "Product Store Name: '{0}' to '{1}'"); log = ActivityLog.appendChange <Grade>(log, objOld.GradeID, GradeID, "Grade: '{0}' to '{1}'"); log = ActivityLog.appendChange <ProductWidth>(log, objOld.ProductWidthID, ProductWidthID, "Product Width ID: '{0}' to '{1}'"); log = ActivityLog.appendChange <LengthUnit>(log, objOld.LengthUnitID, LengthUnitID, "Length Unit ID: '{0}' to '{1}'"); log = ActivityLog.appendChange <Inventory>(log, objOld.InventoryID, InventoryID, "Inventory Code: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.TagPrice, TagPrice, "Sell Price: '{0:N2}' to '{1:N2}'"); log = ActivityLog.appendChange(log, objOld.BuyPrice, BuyPrice, "Buy Price: {0:N2} to {1:N2}"); log = ActivityLog.appendChange <FabricColor>(log, objOld.ColorID, ColorID, "Color: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.Notes, Notes, "Notes: '{0}' to '{1}'"); if (!string.IsNullOrEmpty(log)) { SqlQueryResult result = DBConnection.query( false, DBConnection.ActiveSqlConnection, QueryTypes.ExecuteNonQuery, "productprice_update", new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, ID), new SqlQueryParameter(COL_DB_PRODUCTSTORENAMEID, SqlDbType.UniqueIdentifier, Util.wrapNullable(ProductStoreNameID)), new SqlQueryParameter(COL_DB_GRADEID, SqlDbType.UniqueIdentifier, Util.wrapNullable(GradeID)), new SqlQueryParameter(COL_DB_PRODUCTWIDTHID, SqlDbType.UniqueIdentifier, Util.wrapNullable(ProductWidthID)), new SqlQueryParameter(COL_DB_LENGTHUNITID, SqlDbType.UniqueIdentifier, Util.wrapNullable(LengthUnitID)), new SqlQueryParameter(COL_DB_INVENTORYID, SqlDbType.UniqueIdentifier, Util.wrapNullable(InventoryID)), new SqlQueryParameter(COL_DB_COLORID, SqlDbType.UniqueIdentifier, Util.wrapNullable(ColorID)), new SqlQueryParameter(COL_DB_SELLPRICE, SqlDbType.Decimal, TagPrice), new SqlQueryParameter(COL_DB_BuyPrice, SqlDbType.Decimal, Util.wrapNullable(BuyPrice)), new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, Util.wrapNullable(Notes)) ); if (result.IsSuccessful) { ActivityLog.submitUpdate(ID, log); } } }
public static void update(Guid id, string description, Guid?customerID, Guid?vendorID) { ToDo objOld = new ToDo(id); //generate log description string logDescription = ""; if (objOld.Description != description) { logDescription = Tools.append(logDescription, String.Format("Description: '{0}' to '{1}'", objOld.Description, description), ","); } if (objOld.CustomerID != customerID) { logDescription = Tools.append(logDescription, String.Format("Customer Name: '{0}' to '{1}'", objOld.CustomerName, new Customer(customerID).Name), ","); } if (objOld.VendorID != vendorID) { logDescription = Tools.append(logDescription, String.Format("Customer Name: '{0}' to '{1}'", objOld.VendorName, new Vendor(vendorID).Name), ","); } if (!string.IsNullOrEmpty(logDescription)) { SqlQueryResult result = DBConnection.query( false, DBConnection.ActiveSqlConnection, QueryTypes.ExecuteNonQuery, "todo_update", new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id), new SqlQueryParameter(COL_DB_DESCRIPTION, SqlDbType.VarChar, description), new SqlQueryParameter(COL_DB_CUSTOMERID, SqlDbType.UniqueIdentifier, Util.wrapNullable(customerID)), new SqlQueryParameter(COL_DB_VENDORID, SqlDbType.UniqueIdentifier, Util.wrapNullable(vendorID)) ); if (result.IsSuccessful) { ActivityLog.submitUpdate(id, logDescription); } } }
public static void update(Guid Id, decimal debtLimit, int termDays, string notes) { CustomerTerm objOld = new CustomerTerm(Id); //generate log description string logDescription = ""; if (objOld.DebtLimit != debtLimit) { logDescription = Tools.append(logDescription, String.Format("Limit: '{0}' to '{1}'", objOld.DebtLimit, debtLimit), ","); } if (objOld.TermDays != termDays) { logDescription = Tools.append(logDescription, String.Format("Term days: '{0}' to '{1}'", objOld.TermDays, termDays), ","); } 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, "CustomerTerms_update", new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, Id), new SqlQueryParameter(COL_DB_DEBTLIMIT, SqlDbType.Decimal, debtLimit), new SqlQueryParameter(COL_DB_TERMDAYS, SqlDbType.Int, termDays), new SqlQueryParameter(COL_DB_NOTES, SqlDbType.NVarChar, Util.wrapNullable(notes)) ); if (result.IsSuccessful) { ActivityLog.submitUpdate(Id, logDescription); } } }
public static void update(Guid id, Guid gradeID, Guid productID, Guid productWidthID, Guid lengthUnitID, Guid colorID, int qty, int orderLotQty, string poNotes, string notes) { InventoryStockLevel objOld = new InventoryStockLevel(id); //generate log description string logDescription = ""; Product product = new Product(productID); if (objOld.ProductStoreNameID != product.StoreNameID) { logDescription = Tools.append(logDescription, String.Format("Product Store Name: '{0}' to '{1}'", objOld.ProductStoreName, product.StoreName), ","); } 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.VendorName != product.VendorName) { logDescription = Tools.append(logDescription, String.Format("Vendor: '{0}' to '{1}'", objOld.VendorName, product.VendorName), ","); } if (objOld.OrderLotQty != orderLotQty) { logDescription = Tools.append(logDescription, String.Format("Lot qty: '{0}' to '{1}'", objOld.OrderLotQty, orderLotQty), ","); } if (objOld.Qty != qty) { logDescription = Tools.append(logDescription, String.Format("Qty: '{0}' to '{1}'", objOld.Qty, qty), ","); } if (objOld.PONotes != poNotes) { logDescription = Tools.append(logDescription, String.Format("PO Notes: '{0}' to '{1}'", objOld.PONotes, poNotes), ","); } 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, "inventorystocklevel_update", new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id), new SqlQueryParameter(COL_DB_GRADEID, SqlDbType.UniqueIdentifier, gradeID), new SqlQueryParameter(COL_DB_PRODUCTID, SqlDbType.UniqueIdentifier, productID), new SqlQueryParameter(COL_DB_PRODUCTWIDTHID, SqlDbType.UniqueIdentifier, productWidthID), new SqlQueryParameter(COL_DB_LENGTHUNITID, SqlDbType.UniqueIdentifier, lengthUnitID), new SqlQueryParameter(COL_DB_COLORID, SqlDbType.UniqueIdentifier, colorID), new SqlQueryParameter(COL_DB_ORDERLOTQTY, SqlDbType.Int, orderLotQty), new SqlQueryParameter(COL_DB_QTY, SqlDbType.Int, qty), new SqlQueryParameter(COL_DB_PONOTES, SqlDbType.VarChar, Util.wrapNullable(poNotes)), new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, Util.wrapNullable(notes)) ); if (result.IsSuccessful) { ActivityLog.submitUpdate(id, logDescription); } } }
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); } } }