public static void update(Guid Id, DateTime Timestamp, string InvoiceNo, decimal Amount, int TOP, string Notes) { VendorInvoice objOld = new VendorInvoice(Id); //generate log description string log = ""; log = ActivityLog.appendChange(log, objOld.InvoiceNo, InvoiceNo, "Invoice No: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.Timestamp, Timestamp, "Timestamp: '{0:dd/MM/yy}' to '{1:dd/MM/yy}'"); log = Util.appendChange(log, objOld.Amount, Amount, "Amount: '{0:N2}' to '{1:N2}'"); log = ActivityLog.appendChange(log, objOld.TOP, TOP, "TOP: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.Notes, Notes, "Notes: '{0}' to '{1}'"); SqlQueryResult result = DBConnection.query( false, DBConnection.ActiveSqlConnection, QueryTypes.ExecuteNonQuery, "VendorInvoices_update", new SqlQueryParameter(COL_DB_Id, SqlDbType.UniqueIdentifier, Id), new SqlQueryParameter(COL_DB_Timestamp, SqlDbType.DateTime, Timestamp), new SqlQueryParameter(COL_DB_InvoiceNo, SqlDbType.VarChar, InvoiceNo), new SqlQueryParameter(COL_DB_TOP, SqlDbType.Int, TOP), new SqlQueryParameter(COL_DB_Amount, SqlDbType.Decimal, Amount), new SqlQueryParameter(COL_DB_Notes, SqlDbType.NVarChar, Util.wrapNullable(Notes)) ); if (result.IsSuccessful) { ActivityLog.submit(Id, String.Format("Updated: {0}", log)); } }
public static void update_FakturPajaks_Id(Guid Id, Guid?FakturPajaks_Id) { VendorInvoice objOld = new VendorInvoice(Id); //generate log description string log = ""; log = ActivityLog.appendChange(log, objOld.FakturPajaks_No, new FakturPajak(FakturPajaks_Id).No, "Faktur Pajak: '{0}' to '{1}'"); if (string.IsNullOrEmpty(log)) { Util.displayMessageBoxError("No changes to record"); } else { SqlQueryResult result = DBConnection.query( false, DBConnection.ActiveSqlConnection, QueryTypes.ExecuteNonQuery, "VendorInvoices_update_FakturPajaks_Id", new SqlQueryParameter(COL_DB_Id, SqlDbType.UniqueIdentifier, Id), new SqlQueryParameter(COL_DB_FakturPajaks_Id, SqlDbType.UniqueIdentifier, FakturPajaks_Id) ); if (result.IsSuccessful) { ActivityLog.submit(Id, String.Format("Updated: {0}", log)); } } }
public static void update(Guid id, Guid pettyCashRecordsCategories_Id, decimal amount, string notes) { PettyCashRecord objOld = new PettyCashRecord(id); string log = ""; log = ActivityLog.appendChange(log, objOld.PettyCashRecordsCategories_Name, new PettyCashRecordsCategory(pettyCashRecordsCategories_Id).Name, "Category: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.Amount, amount, "Amount: '{0:N2}' to '{1:N2}'"); log = ActivityLog.appendChange(log, objOld.Notes, notes, "Notes: '{0}' to '{1}'"); if (!string.IsNullOrEmpty(log)) { SqlQueryResult result = DBConnection.query( false, DBConnection.ActiveSqlConnection, QueryTypes.ExecuteNonQuery, "PettyCashRecords_update", new SqlQueryParameter(COL_DB_Id, SqlDbType.UniqueIdentifier, id), new SqlQueryParameter(COL_DB_PettyCashRecordsCategories_Id, SqlDbType.UniqueIdentifier, pettyCashRecordsCategories_Id), new SqlQueryParameter(COL_DB_Amount, SqlDbType.Decimal, amount), new SqlQueryParameter(COL_DB_Notes, SqlDbType.VarChar, Util.wrapNullable(notes)) ); if (result.IsSuccessful) { if (GlobalData.UserAccount.role != Roles.Super) { ActivityLog.submit(id, "UPDATE: " + log, (int)Roles.Super); } else { ActivityLog.submit(id, "UPDATE: " + log); } } } }
public static void update(Guid id, string description, decimal sellAmountPerUnit, int qty, string notes) { try { string log = ""; GordenOrderItem objOld = new GordenOrderItem(id); log = ActivityLog.appendChange(log, objOld.Description, description, "Description: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.SellAmountPerUnit, sellAmountPerUnit, "Sell Amount Per Unit: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.Qty, qty, "Qty: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.Notes, notes, "Notes: '{0}' to '{1}'"); using (SqlCommand cmd = new SqlCommand("gordenorderitem_update", DBConnection.ActiveSqlConnection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@" + COL_DB_ID, SqlDbType.UniqueIdentifier).Value = id; cmd.Parameters.Add("@" + COL_DB_DESCRIPTION, SqlDbType.VarChar).Value = description; cmd.Parameters.Add("@" + COL_DB_SELLAMOUNTPERUNIT, SqlDbType.Decimal).Value = sellAmountPerUnit; cmd.Parameters.Add("@" + COL_DB_QTY, SqlDbType.Int).Value = qty; cmd.Parameters.Add("@" + COL_DB_NOTES, SqlDbType.VarChar).Value = Util.wrapNullable(notes); cmd.ExecuteNonQuery(); ActivityLog.submit(id, String.Format("Item updated: {0}", log)); } } catch (Exception ex) { Tools.showError(ex.Message); } }
public static void update(Guid id, string name, string notes) { PettyCashRecordsCategory objOld = new PettyCashRecordsCategory(id); string log = ""; log = ActivityLog.appendChange(log, objOld.Name, name, "Name: '{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, "PettyCashRecordsCategories_update", new SqlQueryParameter(COL_DB_Id, SqlDbType.UniqueIdentifier, id), new SqlQueryParameter(COL_DB_Name, SqlDbType.VarChar, Util.wrapNullable(name)), new SqlQueryParameter(COL_DB_Notes, SqlDbType.VarChar, Util.wrapNullable(notes)) ); if (result.IsSuccessful) { ActivityLog.submit(id, "UPDATE: " + log); } } }
public static void update(Guid userAccountID, Guid id, int priorityNo, int priorityQty, DateTime?expectedDeliveryDate) { POItem objOld = new POItem(id); //generate log description string log = ""; log = ActivityLog.appendChange(log, objOld.ExpectedDeliveryDate, expectedDeliveryDate, "Expected Delivery: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.PriorityNo, priorityNo, "Priority No: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.PriorityQty, priorityQty, "Priority Qty: '{0}' to '{1}'"); if (!string.IsNullOrEmpty(log)) { SqlQueryResult result = DBConnection.query( false, DBConnection.ActiveSqlConnection, QueryTypes.ExecuteNonQuery, "poitem_update", new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id), new SqlQueryParameter(COL_DB_PriorityNo, SqlDbType.SmallInt, Util.wrapNullable(priorityNo)), new SqlQueryParameter(COL_DB_PriorityQty, SqlDbType.Int, Util.wrapNullable(priorityQty)), new SqlQueryParameter(COL_DB_ExpectedDeliveryDate, SqlDbType.Date, Util.wrapNullable(expectedDeliveryDate)) ); if (result.IsSuccessful) { ActivityLog.submit(id, log); } } }
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 static void update(Guid id, string name, GordenItemCategories category, Guid vendorID, Guid retailLengthUnitID, Guid bulkLengthUnitID, Guid?productWidthID, decimal?buyRetailPricePerUnit, decimal?buyBulkPricePerUnit, decimal?sellRetailPricePerUnit, decimal?sellBulkPricePerUnit, string notes) { try { GordenItem objOld = new GordenItem(id); //generate log description string log = ""; log = ActivityLog.appendChange(log, objOld.Name, name, "Name: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.CategoryName, category, "Category: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.VendorID, new Vendor(vendorID).Name, "Vendor: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.ProductWidthID, new ProductWidth(productWidthID).Name, "Width: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.RetailLengthUnitID, new LengthUnit(retailLengthUnitID).Name, "Retail Unit: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.BulkLengthUnitID, new LengthUnit(bulkLengthUnitID).Name, "Bulk Unit: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.BuyRetailPricePerUnit, buyRetailPricePerUnit, "Buy Retail Price/Unit: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.BuyBulkPricePerUnit, buyBulkPricePerUnit, "Buy Bulk Price/Unit: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.SellRetailPricePerUnit, sellRetailPricePerUnit, "Sell Retail Price/Unit: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.SellBulkPricePerUnit, sellBulkPricePerUnit, "Sell Bulk Price/Unit: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.Notes, notes, "Notes: '{0}' to '{1}'"); if (string.IsNullOrEmpty(log)) { Tools.showError("No changes to record"); } else { using (SqlCommand cmd = new SqlCommand("gordenitem_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.Parameters.Add("@" + COL_DB_CATEGORYENUMID, SqlDbType.TinyInt).Value = category; cmd.Parameters.Add("@" + COL_DB_VENDORID, SqlDbType.UniqueIdentifier).Value = vendorID; cmd.Parameters.Add("@" + COL_DB_PRODUCTWIDTHID, SqlDbType.UniqueIdentifier).Value = Util.wrapNullable(productWidthID); cmd.Parameters.Add("@" + COL_DB_RETAILLENGTHUNITID, SqlDbType.UniqueIdentifier).Value = retailLengthUnitID; cmd.Parameters.Add("@" + COL_DB_BULKLENGTHUNITID, SqlDbType.UniqueIdentifier).Value = bulkLengthUnitID; cmd.Parameters.Add("@" + COL_DB_BUYRETAILPRICEPERUNIT, SqlDbType.Decimal).Value = Util.wrapNullable(buyRetailPricePerUnit); cmd.Parameters.Add("@" + COL_DB_BUYBULKPRICEPERUNIT, SqlDbType.Decimal).Value = Util.wrapNullable(buyBulkPricePerUnit); cmd.Parameters.Add("@" + COL_DB_SELLRETAILPRICEPERUNIT, SqlDbType.Decimal).Value = Util.wrapNullable(sellRetailPricePerUnit); cmd.Parameters.Add("@" + COL_DB_SELLBULKPRICEPERUNIT, SqlDbType.Decimal).Value = Util.wrapNullable(sellBulkPricePerUnit); cmd.Parameters.Add("@" + COL_DB_NOTES, SqlDbType.VarChar).Value = Util.wrapNullable(notes); cmd.ExecuteNonQuery(); ActivityLog.submit(id, "UPDATE: " + log); } Tools.hasMessage("Item updated"); } } catch (Exception ex) { Tools.showError(ex.Message); } }
public static void update_ShippingExpense(Guid Id, Guid PettyCashRecordsCategories_Id, int Amount, string Notes) { Sale objOld = new Sale(Id); string log = ""; log = ActivityLog.appendChange(log, objOld.ShippingExpense, Amount, "Shipping Expense: '{0}' to '{1}'"); if (!string.IsNullOrEmpty(log)) { int PettyCashRecords_Amount = -1 * Amount; string PettyCashRecords_Notes = string.Format("Expense for Invoice {0}", objOld.barcode); //if there is previous amount value, adjust amount so petty cash is still correct. if (objOld.ShippingExpense > 0) { PettyCashRecords_Amount += objOld.ShippingExpense; PettyCashRecords_Notes += string.Format(" (Update {0:N0} to {1:N0})", objOld.ShippingExpense, Amount); } //transport information if (objOld.TransportName != null) { PettyCashRecords_Notes += string.Format(", Angkutan {0}", objOld.TransportName); } if (!string.IsNullOrWhiteSpace(Notes)) { PettyCashRecords_Notes += ", " + Notes; } Guid?PettyCashRecords_Id = PettyCashRecord.add(PettyCashRecordsCategories_Id, PettyCashRecords_Amount, PettyCashRecords_Notes); if (PettyCashRecords_Id != null) { log += string.Format(", Petty Cash {0} Amount: {1:N0}", new PettyCashRecord((Guid)PettyCashRecords_Id).No, PettyCashRecords_Amount); SqlQueryResult result = DBConnection.query( false, DBConnection.ActiveSqlConnection, QueryTypes.ExecuteNonQuery, "Sales_update_ShippingExpense", new SqlQueryParameter(COL_ID, SqlDbType.UniqueIdentifier, Id), new SqlQueryParameter(COL_DB_ShippingExpense, SqlDbType.Int, Amount) ); if (result.IsSuccessful) { ActivityLog.submit(Id, String.Format("Updated: {0}", log)); } } } }
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_Kontrabons_Id(Guid Id, Guid?Kontrabons_Id) { FakturPajak objOld = new FakturPajak(Id); string log = ""; log = ActivityLog.appendChange(log, objOld.Kontrabons_No, new Kontrabon(Kontrabons_Id).No, "Kontrabon: '{0}' to '{1}'"); if (!string.IsNullOrEmpty(log)) { SqlQueryResult result = DBConnection.query( false, DBConnection.ActiveSqlConnection, QueryTypes.ExecuteNonQuery, "FakturPajaks_update_Kontrabons_Id", new SqlQueryParameter(COL_DB_Id, SqlDbType.UniqueIdentifier, Id), new SqlQueryParameter(COL_DB_Kontrabons_Id, SqlDbType.UniqueIdentifier, Util.wrapNullable(Kontrabons_Id)) ); if (result.IsSuccessful) { ActivityLog.submit(Id, String.Format("Updated: {0}", log)); //update faktur pajak log if (Kontrabons_Id == null) { ActivityLog.submit((Guid)objOld.Kontrabons_Id, String.Format("Removed FP: {0}", objOld.No)); } else { ActivityLog.submit((Guid)Kontrabons_Id, String.Format("Added FP: {0}", objOld.No)); } //remove sale invoices DataTable saleInvoices = Sale.get_by_FakturPajaks_Id(Id); foreach (DataRow row in saleInvoices.Rows) { Sale.update_Kontrabons_Id(Util.wrapNullable <Guid>(row, Sale.COL_ID), Kontrabons_Id); } //remove sale returns DataTable saleReturns = SaleReturn.get_by_FakturPajaks_Id(Id); foreach (DataRow row in saleReturns.Rows) { SaleReturn.update_Kontrabons_Id(Util.wrapNullable <Guid>(row, SaleReturn.COL_ID), Kontrabons_Id); } } } }
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_Kontrabons_Id(Guid Id, Guid?Kontrabons_Id) { SaleReturn objOld = new SaleReturn(Id); string log = ""; log = ActivityLog.appendChange(log, objOld.Kontrabons_No, new Kontrabon(Kontrabons_Id).No, "Kontrabon: '{0}' to '{1}'"); if (!string.IsNullOrEmpty(log)) { SqlQueryResult result = DBConnection.query( false, DBConnection.ActiveSqlConnection, QueryTypes.ExecuteNonQuery, "salereturn_update_Kontrabons_Id", new SqlQueryParameter(COL_ID, SqlDbType.UniqueIdentifier, Id), new SqlQueryParameter(COL_DB_Kontrabons_Id, SqlDbType.UniqueIdentifier, Util.wrapNullable(Kontrabons_Id)) ); if (result.IsSuccessful) { ActivityLog.submit(Id, String.Format("Updated: {0}", log)); //update faktur pajak log if (Kontrabons_Id == null) { ActivityLog.submit((Guid)objOld.Kontrabons_Id, String.Format("Removed: {0}", objOld.barcode)); } else { ActivityLog.submit((Guid)Kontrabons_Id, String.Format("Added: {0}", objOld.barcode)); } //remove faktur pajak and all items related to it Guid?FakturPajaks_Id = new SaleReturn(Id).FakturPajaks_Id; if (FakturPajaks_Id != null) { FakturPajak.update_Kontrabons_Id((Guid)FakturPajaks_Id, Kontrabons_Id); } } } }
public static void update(Guid id, string notes) { try { string log = ""; GordenOrderItem objOld = new GordenOrderItem(id); log = ActivityLog.appendChange(log, objOld.Notes, notes, "Notes: '{0}' to '{1}'"); using (SqlCommand cmd = new SqlCommand("gordenorderitemmaterial_update", DBConnection.ActiveSqlConnection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@" + COL_DB_ID, SqlDbType.UniqueIdentifier).Value = id; cmd.Parameters.Add("@" + COL_DB_NOTES, SqlDbType.VarChar).Value = Util.wrapNullable(notes); cmd.ExecuteNonQuery(); ActivityLog.submit(id, String.Format("Item updated: {0}", log)); } } catch (Exception ex) { Tools.showError(ex.Message); } }
public static void update_FakturPajaks_Id(Guid Id, Guid?FakturPajaks_Id) { SaleReturn objOld = new SaleReturn(Id); string log = ""; log = ActivityLog.appendChange(log, objOld.FakturPajaks_No, new FakturPajak(FakturPajaks_Id).No, "Faktur Pajak: '{0}' to '{1}'"); if (string.IsNullOrEmpty(log)) { Util.displayMessageBoxError("No changes to record"); } else { SqlQueryResult result = DBConnection.query( false, DBConnection.ActiveSqlConnection, QueryTypes.ExecuteNonQuery, "salereturn_update_FakturPajaks_Id", new SqlQueryParameter(COL_ID, SqlDbType.UniqueIdentifier, Id), new SqlQueryParameter(COL_DB_FakturPajaks_Id, SqlDbType.UniqueIdentifier, Util.wrapNullable(FakturPajaks_Id)) ); if (result.IsSuccessful) { ActivityLog.submit(Id, String.Format("Updated: {0}", log)); //update faktur pajak log if (FakturPajaks_Id == null) { ActivityLog.submit((Guid)objOld.FakturPajaks_Id, String.Format("Removed Sale Return: {0}", objOld.barcode)); } else { ActivityLog.submit((Guid)FakturPajaks_Id, String.Format("Added Sale Return: {0}", objOld.barcode)); } } } }
public static bool update(Guid saleID, Guid?Customers_Id, Guid?Vendors_Id, DataTable saleItems, Guid?transportID, decimal shippingCost, string notes) { Sale objOld = new Sale(saleID); DataTable objOldItems = Tools.setDataTablePrimaryKey(SaleItem.getItems(saleID), SaleItem.COL_ID); string customerInfo = objOld.customer_info; //generate log description string log = ""; //update customer/vendor info Customer newCustomer = new Customer(Customers_Id); if (objOld.customer_id != newCustomer.ID) { log = Util.appendChange(log, objOld.Customers_Name, newCustomer.Name, "Customer: '{0}' to '{1}'"); log = Util.appendChange(log, objOld.customer_info, newCustomer.Info, "Info: '{0}' to '{1}'"); } Vendor newVendor = new Vendor(Vendors_Id); if (objOld.Vendors_Id != Vendors_Id) { log = Util.appendChange(log, objOld.Vendors_Name, newVendor.Name, "Vendor: '{0}' to '{1}'"); log = Util.appendChange(log, objOld.customer_info, newVendor.Info, "Info: '{0}' to '{1}'"); } if (Customers_Id != null) { customerInfo = newCustomer.Info; } else { customerInfo = newVendor.Info; } log = ActivityLog.appendChange(log, objOld.TransportName, new Transport(transportID).Name, "Angkutan: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.ShippingCost.ToString("N2"), shippingCost.ToString("N2"), "Shipping: '{0}' to '{1}'"); log = ActivityLog.appendChange(log, objOld.notes, notes, "Notes: '{0}' to '{1}'"); DataRow row; Guid id; decimal oldAdjustment, newAdjustment; for (int i = saleItems.Rows.Count - 1; i >= 0; i--) { row = saleItems.Rows[i]; id = DBUtil.parseData <Guid>(row, SaleItem.COL_ID); newAdjustment = DBUtil.parseData <decimal>(row, SaleItem.COL_ADJUSTMENT); oldAdjustment = DBUtil.parseData <decimal>(objOldItems.Rows.Find(id), SaleItem.COL_ADJUSTMENT); if (oldAdjustment != newAdjustment) { log = ActivityLog.appendChange(log, oldAdjustment, newAdjustment, "Inventory Item " + DBUtil.parseData <string>(row, SaleItem.COL_BARCODE) + " adjustment: {0:N2} to {1:N2}"); row[SaleItem.COL_ADJUSTMENT] = newAdjustment; } else { //remove if has no change saleItems.Rows.RemoveAt(i); } } if (!string.IsNullOrEmpty(log)) { //format notes if (string.IsNullOrWhiteSpace(notes)) { notes = null; } else { notes = string.Format("{0:MM/dd/yy}-{1}: {2}", DateTime.Now, GlobalData.UserAccount.name, notes); } SqlQueryResult result = DBConnection.query( false, DBConnection.ActiveSqlConnection, QueryTypes.ExecuteNonQuery, "sale_update", new SqlQueryParameter(COL_ID, SqlDbType.UniqueIdentifier, saleID), new SqlQueryParameter(COL_CUSTOMER_ID, SqlDbType.UniqueIdentifier, Util.wrapNullable(Customers_Id)), new SqlQueryParameter(COL_DB_Vendors_Id, SqlDbType.UniqueIdentifier, Util.wrapNullable(Vendors_Id)), new SqlQueryParameter(COL_DB_CUSTOMERINFO, SqlDbType.VarChar, Util.wrapNullable(customerInfo)), new SqlQueryParameter(COL_DB_TRANSPORTID, SqlDbType.UniqueIdentifier, Util.wrapNullable(transportID)), new SqlQueryParameter(COL_DB_SHIPPINGCOST, SqlDbType.Decimal, shippingCost), new SqlQueryParameter(COL_DB_Notes, SqlDbType.VarChar, Util.wrapNullable(notes)) ); if (!result.IsSuccessful) { return(false); } else { ActivityLog.submit(saleID, "Update: " + log); if (saleItems.Rows.Count > 0) { SaleItem.updateItems(getListOfSaleItemsForUpdate(saleID, saleItems)); } } } return(true); }
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); } } }