public GordenItem(Guid id) { ID = id; DataRow row = get(ID); Name = DBUtil.parseData <string>(row, COL_DB_NAME); CategoryEnumID = Tools.parseEnum <GordenItemCategories>(DBUtil.parseData <int>(row, COL_DB_CATEGORYENUMID)); VendorID = DBUtil.parseData <Guid>(row, COL_DB_VENDORID); ProductWidthID = DBUtil.parseData <Guid?>(row, COL_DB_PRODUCTWIDTHID); RetailLengthUnitID = DBUtil.parseData <Guid>(row, COL_DB_RETAILLENGTHUNITID); BulkLengthUnitID = DBUtil.parseData <Guid>(row, COL_DB_BULKLENGTHUNITID); BuyRetailPricePerUnit = DBUtil.parseData <decimal>(row, COL_DB_BUYRETAILPRICEPERUNIT); BuyBulkPricePerUnit = DBUtil.parseData <decimal>(row, COL_DB_BUYBULKPRICEPERUNIT); SellRetailPricePerUnit = DBUtil.parseData <decimal>(row, COL_DB_SELLRETAILPRICEPERUNIT); SellBulkPricePerUnit = DBUtil.parseData <decimal>(row, COL_DB_SELLBULKPRICEPERUNIT); Active = DBUtil.parseData <bool>(row, COL_DB_ACTIVE); Notes = DBUtil.parseData <string>(row, COL_DB_NOTES); CategoryName = DBUtil.parseData <string>(row, COL_CATEGORYNAME); VendorName = DBUtil.parseData <string>(row, COL_VENDORNAME); RetailLengthUnitName = DBUtil.parseData <string>(row, COL_RETAILLENGTHUNITNAME); BulkLengthUnitName = DBUtil.parseData <string>(row, COL_BULKLENGTHUNITNAME); ProductWidthName = DBUtil.parseData <string>(row, COL_PRODUCTWIDTHNAME); ProductWidthInMeter = DBUtil.parseData <decimal>(row, COL_PRODUCTWIDTHINMETER); Notes = DBUtil.parseData <string>(row, COL_DB_NOTES); }
public InventoryItem(Guid ID) { DataTable data = getRow(ID); if (data.Rows.Count > 0) { DataRow row = data.Rows[0]; id = (Guid)row[COL_DB_ID]; code = row[COL_DB_INVENTORY_CODE].ToString(); inventory_id = (Guid)row[COL_DB_INVENTORY_ID]; item_length = Convert.ToDecimal(row[COL_DB_LENGTH]); barcode = row[COL_DB_BARCODE].ToString(); ColorID = DBUtil.parseData <Guid?>(row, COL_DB_COLORID); SaleOrderItems_Id = DBUtil.parseData <Guid?>(row, COL_DB_SaleOrderItems_Id); notes = row[COL_DB_NOTES].ToString(); ColorName = DBUtil.parseData <string>(row, COL_INVENTORYITEMCOLORNAME); InventoryColorName = DBUtil.parseData <string>(row, COL_INVENTORYCOLORNAME); LengthUnitName = DBUtil.parseData <string>(row, COL_LENGTHUNITNAME); ProductStoreName = DBUtil.parseData <string>(row, COL_ProductStoreName); SaleOrderItemDescription = DBUtil.parseData <string>(row, COL_SaleOrderItemDescription); SaleOrderItemCustomerName = DBUtil.parseData <string>(row, COL_SaleOrderItemCustomerName); isSold = Util.wrapNullable <bool>(row, COL_IS_SOLD); SaleOrders_Customers_Id = Util.wrapNullable <Guid?>(row, COL_SaleOrders_Customers_Id); Grades_Id = Util.wrapNullable <Guid>(row, COL_DB_Grades_Id); Grades_Name = Util.wrapNullable <string>(row, COL_Grades_Name); ProductWidths_Name = Util.wrapNullable <string>(row, COL_ProductWidths_Name); OpnameMarker = Util.wrapNullable <bool>(row, COL_OpnameMarker); } }
public Sale(DataTable dt) { if (dt != null && dt.Rows.Count > 0) { datatable = dt; DataRow row = Util.getFirstRow(datatable); id = DBUtil.parseData <Guid>(row, COL_ID); time_stamp = Convert.ToDateTime(row["time_stamp"]); customer_id = Util.wrapNullable <Guid?>(row, COL_CUSTOMER_ID); Vendors_Id = Util.wrapNullable <Guid?>(row, COL_DB_Vendors_Id); voided = (Boolean)row["voided"]; user_id = (Guid)row["user_id"]; notes = row["notes"].ToString(); customer_info = row["customer_info"].ToString(); barcode = Util.wrapNullable <string>(row["hexbarcode"]); TransportID = DBUtil.parseData <Guid?>(row, COL_DB_TRANSPORTID); ShippingCost = DBUtil.parseData <decimal>(row, COL_DB_SHIPPINGCOST); TaxNo = DBUtil.parseData <string>(row, COL_DB_TAXNO); SaleCommission_Users_Id = DBUtil.parseData <Guid?>(row, COL_DB_SaleCommission_Users_Id); FakturPajaks_Id = DBUtil.parseData <Guid?>(row, COL_DB_FakturPajaks_Id); Kontrabons_Id = DBUtil.parseData <Guid?>(row, COL_DB_Kontrabons_Id); ShippingExpense = DBUtil.parseData <int>(row, COL_DB_ShippingExpense); ReturnedToSupplier = (Vendors_Id != null); TransportName = DBUtil.parseData <string>(row, COL_TRANSPORTNAME); FakturPajaks_No = DBUtil.parseData <string>(row, COL_FakturPajaks_No); Kontrabons_No = DBUtil.parseData <string>(row, COL_Kontrabons_No); Customers_Name = Util.wrapNullable <string>(row, COL_CUSTOMERNAME); Vendors_Name = Util.wrapNullable <string>(row, COL_Vendors_Name); sale_items = SaleItem.getItems(id); } }
/*******************************************************************************************************/ #region CONSTRUCTORS public POItem(Guid id) { ID = id; DataTable dt = getRow(ID); POID = (Guid)dt.Rows[0][COL_DB_POID]; LineNo = Convert.ToInt16(dt.Rows[0][COL_DB_LINENO]); ProductDescription = dt.Rows[0][COL_DB_PRODUCTDESCRIPTION].ToString(); Qty = Convert.ToInt16(dt.Rows[0][COL_DB_QTY]); UnitName = dt.Rows[0][COL_DB_UNITNAME].ToString(); Notes = dt.Rows[0][COL_DB_NOTES].ToString(); PricePerUnit = Convert.ToDecimal(dt.Rows[0][COL_DB_PRICEPERUNIT]); if (dt.Rows[0][COL_DB_REFERENCEDINVENTORYID] != DBNull.Value) { ReferencedInventoryID = (Guid)dt.Rows[0][COL_DB_REFERENCEDINVENTORYID]; } Timestamp = DBUtil.parseData <DateTime>(dt.Rows[0], COL_TIMESTAMP); ExpectedDeliveryDate = DBUtil.parseData <DateTime?>(dt.Rows[0], COL_DB_ExpectedDeliveryDate); ExpectedDeliveryDayCount = DBUtil.parseData <int?>(dt.Rows[0], COL_DB_ExpectedDeliveryDayCount); Status = Tools.parseEnum <POItemStatus>(DBUtil.parseData <Int16>(dt.Rows[0], COL_DB_STATUSENUMID)); PONo = DBUtil.parseData <string>(dt.Rows[0], COL_PONO); PendingQty = DBUtil.parseData <decimal>(dt.Rows[0], COL_PENDINGQTY); PendingQtyValue = DBUtil.parseData <decimal>(dt.Rows[0], COL_PENDINGQTYVALUE); PriorityNo = DBUtil.parseData <int>(dt.Rows[0], COL_DB_PriorityNo); PriorityQty = DBUtil.parseData <int>(dt.Rows[0], COL_DB_PriorityQty); }
public PettyCashRecordsCategory(Guid id) { DataRow row = get(id); ID = id; Name = DBUtil.parseData <string>(row, COL_DB_Name); Notes = DBUtil.parseData <string>(row, COL_DB_Notes); Active = DBUtil.parseData <bool>(row, COL_DB_Active); }
public FabricColor(Guid?id) { if (id != null) { ID = (Guid)id; DataTable dt = getRow(ID); Name = dt.Rows[0][COL_DB_NAME].ToString(); Active = (Boolean)dt.Rows[0][COL_DB_ACTIVE]; Allow2ndColor = DBUtil.parseData <bool>(dt.Rows[0], COL_DB_ALLOW2NDCOLOR); } }
public GordenOrderItem(Guid id) { DataRow row = get(id); ID = id; GordenOrderID = DBUtil.parseData <Guid>(row, COL_DB_GORDENORDERID); LineNo = DBUtil.parseData <int>(row, COL_DB_LINENO); Description = DBUtil.parseData <string>(row, COL_DB_DESCRIPTION); SellAmountPerUnit = DBUtil.parseData <decimal>(row, COL_DB_SELLAMOUNTPERUNIT); Qty = DBUtil.parseData <int>(row, COL_DB_QTY); Notes = DBUtil.parseData <string>(row, COL_DB_NOTES); }
public static Guid getIDByBarcode(string barcodeWithoutPrefix) { using (SqlCommand cmd = new SqlCommand("inventoryitem_get_id_by_barcode", DBConnection.ActiveSqlConnection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@barcode", SqlDbType.VarChar).Value = barcodeWithoutPrefix; Guid value = DBUtil.parseData <Guid>(cmd.ExecuteScalar()); return(value); } }
public GordenOrderItemMaterial(Guid id) { DataRow row = get(id); ID = id; GordenOrderItemID = DBUtil.parseData <Guid>(row, COL_DB_GORDENORDERITEMID); GordenItemID = DBUtil.parseData <Guid>(row, COL_DB_GORDENITEMID); Description = DBUtil.parseData <string>(row, COL_DB_DESCRIPTION); BuyAmountPerUnit = DBUtil.parseData <decimal>(row, COL_DB_BUYAMOUNTPERUNIT); Qty = DBUtil.parseData <int>(row, COL_DB_QTY); Notes = DBUtil.parseData <string>(row, COL_DB_NOTES); }
public CustomerTerm(Guid id) { Id = id; DataRow row = getRow(Id).Rows[0]; Customers_Id = DBUtil.parseData <Guid>(row, COL_DB_CUSTOMERS_ID); DebtLimit = DBUtil.parseData <decimal>(row, COL_DB_DEBTLIMIT); TermDays = DBUtil.parseData <int>(row, COL_DB_TERMDAYS); Notes = DBUtil.parseData <string>(row, COL_DB_NOTES); Active = DBUtil.parseData <bool>(row, COL_DB_ACTIVE); Customers_Name = DBUtil.parseData <string>(row, COL_CUSTOMERS_NAME); }
public PettyCashRecord(Guid id) { DataRow row = get(id); Id = id; No = DBUtil.parseData <string>(row, COL_DB_No); Timestamp = DBUtil.parseData <DateTime>(row, COL_DB_Timestamp); PettyCashRecordsCategories_Id = DBUtil.parseData <Guid>(row, COL_DB_PettyCashRecordsCategories_Id); Amount = DBUtil.parseData <decimal>(row, COL_DB_Amount); Notes = DBUtil.parseData <string>(row, COL_DB_Notes); PettyCashRecordsCategories_Name = DBUtil.parseData <string>(row, COL_PettyCashRecordsCategories_Name); }
public ToDo(Guid id) { ID = id; DataRow row = getRow(ID).Rows[0]; Timestamp = DBUtil.parseData <DateTime>(row, COL_DB_TIMESTAMP); Description = DBUtil.parseData <string>(row, COL_DB_DESCRIPTION); Status = Tools.parseEnum <ToDoStatus>(DBUtil.parseData <Int16>(row, COL_DB_STATUSENUMID)); CustomerID = DBUtil.parseData <Guid?>(row, COL_DB_CUSTOMERID); VendorID = DBUtil.parseData <Guid?>(row, COL_DB_VENDORID); CustomerName = DBUtil.parseData <string>(row, COL_CUSTOMERNAME); VendorName = DBUtil.parseData <string>(row, COL_VENDORNAME); }
/*******************************************************************************************************/ #region CONSTRUCTORS public SaleOrder(Guid id) { Id = id; DataRow row = get(Id).Rows[0]; Timestamp = DBUtil.parseData <DateTime>(row, COL_DB_Timestamp); Customers_Id = DBUtil.parseData <Guid>(row, COL_DB_Customers_Id); CustomerInfo = DBUtil.parseData <string>(row, COL_DB_CustomerInfo); TargetDate = DBUtil.parseData <DateTime>(row, COL_DB_TargetDate); CustomerPONo = DBUtil.parseData <string>(row, COL_DB_CustomerPONo); Notes = DBUtil.parseData <string>(row, COL_DB_Notes); Amount = DBUtil.parseData <decimal>(row, COL_Amount); Customers_Name = DBUtil.parseData <string>(row, COL_Customers_Name); }
/*******************************************************************************************************/ #region CONSTRUCTORS public PO(Guid id) { ID = id; DataRow row = get(ID).Rows[0]; Timestamp = DBUtil.parseData <DateTime>(row, COL_DB_TIMESTAMP); TargetDate = DBUtil.parseData <DateTime>(row, COL_DB_TARGETDATE); UserID = DBUtil.parseData <Guid>(row, COL_DB_USERID); Notes = DBUtil.parseData <string>(row, COL_DB_NOTES); VendorID = DBUtil.parseData <Guid>(row, COL_DB_VENDORID); VendorInfo = DBUtil.parseData <string>(row, COL_DB_VENDORINFO); PONo = DBUtil.parseData <string>(row, COL_DB_PONO); Items = POItem.getItems(ID); Amount = Convert.ToDecimal(Items.Compute(String.Format("SUM({0})", POItem.COL_SUBTOTAL), "")); }
/*******************************************************************************************************/ #region DATABASE METHODS public static void addItems(DataTable datatable) { try { foreach (DataRow row in datatable.Rows) { add(DBUtil.parseData <Guid>(row, COL_DB_GORDENORDERID), DBUtil.parseData <int>(row, COL_DB_LINENO), DBUtil.parseData <string>(row, COL_DB_DESCRIPTION), DBUtil.parseData <decimal>(row, COL_DB_SELLAMOUNTPERUNIT), DBUtil.parseData <int>(row, COL_DB_QTY), DBUtil.parseData <string>(row, COL_DB_NOTES)); } } catch { } }
/*******************************************************************************************************/ #region CONSTRUCTORS public VendorInvoice(Guid id) { DataRow row = get(id).Rows[0]; ID = id; Timestamp = DBUtil.parseData <DateTime>(row, COL_DB_Timestamp); InvoiceNo = DBUtil.parseData <string>(row, COL_DB_InvoiceNo); Amount = DBUtil.parseData <decimal>(row, COL_DB_Amount); Notes = DBUtil.parseData <string>(row, COL_DB_Notes); TOP = DBUtil.parseData <int>(row, COL_DB_TOP); FakturPajaks_Id = Util.wrapNullable <Guid?>(row, COL_DB_FakturPajaks_Id); Vendors_Id = Util.wrapNullable <Guid?>(row, COL_DB_Vendors_Id); CalculatedAmount = DBUtil.parseData <decimal>(row, COL_CalculatedAmount); VendorName = DBUtil.parseData <string>(row, COL_VendorName); FakturPajaks_No = Util.wrapNullable <string>(row, COL_FakturPajaks_No); }
public GordenOrder(Guid id) { DataRow row = get(id); ID = id; No = DBUtil.parseData <int>(row, COL_DB_NO); Timestamp = DBUtil.parseData <DateTime>(row, COL_DB_TIMESTAMP); CustomerID = DBUtil.parseData <Guid>(row, COL_DB_CUSTOMERID); CustomerInfo = DBUtil.parseData <string>(row, COL_DB_CUSTOMERINFO); DiscountAmount = DBUtil.parseData <decimal>(row, COL_DB_DISCOUNTAMOUNT); OtherCharges = DBUtil.parseData <decimal>(row, COL_DB_OTHERCHARGES); Notes = DBUtil.parseData <string>(row, COL_DB_NOTES); NoHex = DBUtil.parseData <string>(row, COL_NOHEX); CustomerName = DBUtil.parseData <string>(row, COL_CUSTOMERNAME); OrderAmount = DBUtil.parseData <decimal>(row, COL_ORDERAMOUNT); }
public Sample(Guid id) { ID = id; DataRow row = getRow(ID).Rows[0]; SampleNo = DBUtil.parseData <int>(row, COL_DB_SAMPLENO); StorageName = DBUtil.parseData <string>(row, COL_DB_STORAGENAME); VendorName = DBUtil.parseData <string>(row, COL_DB_VENDORNAME); VendorInfo = DBUtil.parseData <string>(row, COL_DB_VENDORINFO); Description = DBUtil.parseData <string>(row, COL_DB_DESCRIPTION); PriceDate = DBUtil.parseData <DateTime?>(row, COL_DB_PRICEDATE); PricePerUnit = DBUtil.parseData <decimal?>(row, COL_DB_PRICEPERUNIT); DiscontinueDate = DBUtil.parseData <DateTime?>(row, COL_DB_DISCONTINUEDATE); Notes = DBUtil.parseData <string>(row, COL_DB_NOTES); SellPricePerUnit = DBUtil.parseData <decimal?>(row, COL_DB_SELLPRICEPERUNIT); LengthUnitID = DBUtil.parseData <Guid?>(row, COL_DB_LENGTHUNITID); LengthUnitName = DBUtil.parseData <string>(row, COL_LENGTHUNITNAME); }
/*******************************************************************************************************/ #region CONSTRUCTOR METHODS public FakturPajak(Guid?id) { if (id != null) { Id = (Guid)id; DataRow row = get(Id); No = Util.wrapNullable <string>(row, COL_DB_No); Timestamp = Util.wrapNullable <DateTime>(row, COL_DB_Timestamp); Customers_Id = Util.wrapNullable <Guid?>(row, COL_DB_Customers_Id); Vendors_Id = Util.wrapNullable <Guid?>(row, COL_DB_Vendors_Id); DPP = Util.wrapNullable <decimal>(row, COL_DB_DPP); PPN = Util.wrapNullable <decimal>(row, COL_DB_PPN); Notes = Util.wrapNullable <string>(row, COL_DB_Notes); Kontrabons_Id = DBUtil.parseData <Guid?>(row, COL_DB_Kontrabons_Id); Customers_Name = Util.wrapNullable <string>(row, COL_Customers_Name); Vendors_Name = Util.wrapNullable <string>(row, COL_Vendors_Name); Kontrabons_No = DBUtil.parseData <string>(row, COL_Kontrabons_No); } }
public CustomerSaleAdjustment(Guid id) { ID = id; DataRow row = getRow(ID).Rows[0]; CustomerID = DBUtil.parseData <Guid>(row, COL_DB_CUSTOMERID); ProductStoreNameID = DBUtil.parseData <Guid>(row, COL_DB_PRODUCSTORENAMEID); ProductWidthID = DBUtil.parseData <Guid>(row, COL_DB_PRODUCTWIDTHID); GradeID = DBUtil.parseData <Guid>(row, COL_DB_GRADEID); LengthUnitID = DBUtil.parseData <Guid>(row, COL_DB_LENGTHUNITID); ColorID = DBUtil.parseData <Guid?>(row, COL_DB_COLORID); AdjustmentPerUnit = DBUtil.parseData <decimal>(row, COL_DB_ADJUSTMENTPERUNIT); Checked = DBUtil.parseData <bool>(row, COL_DB_Checked); Notes = DBUtil.parseData <string>(row, COL_DB_NOTES); CustomerName = DBUtil.parseData <string>(row, COL_CUSTOMERNAME); ProductStoreName = DBUtil.parseData <string>(row, COL_PRODUCTSTORENAME); GradeName = DBUtil.parseData <string>(row, COL_GRADE_NAME); LengthUnitName = DBUtil.parseData <string>(row, COL_LENGTH_UNIT_NAME); ProductWidthName = DBUtil.parseData <string>(row, COL_PRODUCT_WIDTH_NAME); ColorName = DBUtil.parseData <string>(row, COL_COLOR_NAME); }
public Customer(Guid?id) { if (id != null) { ID = (Guid)id; DataRow row = get(ID); Name = row[COL_DB_NAME].ToString(); Address = row[COL_DB_ADDRESS].ToString(); CityID = (Guid)row[COL_DB_CITYID]; DefaultTransportID = DBUtil.parseData <Guid?>(row, COL_DB_DEFAULTTRANSPORTID); Phone1 = row[COL_DB_PHONE1].ToString(); Phone2 = row[COL_DB_PHONE2].ToString(); Active = (Boolean)row[COL_DB_ACTIVE]; Notes = row[COL_DB_NOTES].ToString(); SalesUserID = DBUtil.parseData <Guid>(row, COL_DB_SALESUSERID); UsesFakturPajak = Util.wrapNullable <bool>(row, COL_DB_usesFakturPajak); CityName = row[COL_CITYNAME].ToString(); StateName = row[COL_STATENAME].ToString(); DefaultTransportName = DBUtil.parseData <string>(row, COL_DEFAULTTRANSPORTNAME); SalesUserName = DBUtil.parseData <string>(row, COL_SALESUSERNAME); } }
public static DataTable get(Guid?id, DateTime?timestamp_Start, DateTime?timestamp_End, Guid?pettyCashRecordsCategories_Id, string notes, bool chkOnlyNotChecked) { DataTable datatable = new DataTable(); try { using (SqlCommand cmd = new SqlCommand("PettyCashRecords_get", DBConnection.ActiveSqlConnection)) using (SqlDataAdapter adapter = new SqlDataAdapter()) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@" + COL_DB_Id, SqlDbType.UniqueIdentifier).Value = Util.wrapNullable(id); cmd.Parameters.Add("@" + COL_FILTER_Timestamp_Start, SqlDbType.DateTime).Value = Util.wrapNullable(timestamp_Start); cmd.Parameters.Add("@" + COL_FILTER_Timestamp_End, SqlDbType.DateTime).Value = Util.wrapNullable(timestamp_End); cmd.Parameters.Add("@" + COL_DB_PettyCashRecordsCategories_Id, SqlDbType.UniqueIdentifier).Value = Util.wrapNullable(pettyCashRecordsCategories_Id); cmd.Parameters.Add("@" + COL_DB_Notes, SqlDbType.VarChar).Value = Util.wrapNullable(notes); cmd.Parameters.Add("@" + FILTER_OnlyNotChecked, SqlDbType.Bit).Value = chkOnlyNotChecked; SqlParameter return_value = cmd.Parameters.Add("@return_value", SqlDbType.Decimal); return_value.Direction = ParameterDirection.Output; adapter.SelectCommand = cmd; adapter.Fill(datatable); //calculate balance only if records are not filtered by fields other than start/end time if (pettyCashRecordsCategories_Id == null) { decimal startingBalance = Convert.ToDecimal(return_value.Value); for (int i = datatable.Rows.Count - 1; i >= 0; i--) { startingBalance += DBUtil.parseData <decimal>(datatable.Rows[i], COL_DB_Amount); datatable.Rows[i][COL_Balance] = startingBalance; } } } } catch (Exception ex) { Tools.showError(ex.Message); } return(datatable); }
/*******************************************************************************************************/ #region CONSTRUCTORS public SaleOrderItem(Guid id) { Id = id; DataTable dt = get(null, Id, null, false); SaleOrders_Id = (Guid)dt.Rows[0][COL_DB_SaleOrders_Id]; if (dt.Rows[0][COL_DB_Ref_Inventory_Id] != DBNull.Value) { Ref_Inventory_Id = (Guid)dt.Rows[0][COL_DB_Ref_Inventory_Id]; } PricePerUnit = Convert.ToDecimal(dt.Rows[0][COL_DB_PricePerUnit]); ProductDescription = dt.Rows[0][COL_DB_ProductDescription].ToString(); Qty = Convert.ToInt16(dt.Rows[0][COL_DB_Qty]); UnitName = dt.Rows[0][COL_DB_UnitName].ToString(); LineNo = Convert.ToInt16(dt.Rows[0][COL_DB_LineNo]); PriorityNo = DBUtil.parseData <int>(dt.Rows[0], COL_DB_PriorityNo); ExpectedDeliveryDate = DBUtil.parseData <DateTime?>(dt.Rows[0], COL_DB_ExpectedDeliveryDate); Notes = dt.Rows[0][COL_DB_Notes].ToString(); Subtotal = DBUtil.parseData <decimal>(dt.Rows[0], COL_Subtotal); Status = Util.parseEnum <SaleOrderItemStatus>(DBUtil.parseData <object>(dt.Rows[0], COL_DB_Status_enum_id)); Customers_Id = DBUtil.parseData <Guid>(dt.Rows[0], COL_Customers_Id); CustomerName = DBUtil.parseData <string>(dt.Rows[0], COL_CustomerName); }
public InventoryStockLevel(Guid id) { ID = id; DataRow row = getRow(ID).Rows[0]; ProductID = DBUtil.parseData <Guid>(row, COL_DB_PRODUCTID); ProductWidthID = DBUtil.parseData <Guid>(row, COL_DB_PRODUCTWIDTHID); GradeID = DBUtil.parseData <Guid>(row, COL_DB_GRADEID); LengthUnitID = DBUtil.parseData <Guid>(row, COL_DB_LENGTHUNITID); ColorID = DBUtil.parseData <Guid>(row, COL_DB_COLORID); OrderLotQty = DBUtil.parseData <int>(row, COL_DB_ORDERLOTQTY); Qty = DBUtil.parseData <int>(row, COL_DB_QTY); PONotes = DBUtil.parseData <string>(row, COL_DB_PONOTES); Notes = DBUtil.parseData <string>(row, COL_DB_NOTES); ProductStoreNameID = DBUtil.parseData <Guid>(row, COL_PRODUCTSTORENAMEID); ProductStoreName = DBUtil.parseData <string>(row, COL_PRODUCTSTORENAME); VendorName = DBUtil.parseData <string>(row, COL_VENDORNAME); VendorID = DBUtil.parseData <Guid>(row, COL_VENDORID); GradeName = DBUtil.parseData <string>(row, COL_GRADE_NAME); LengthUnitName = DBUtil.parseData <string>(row, COL_LENGTH_UNIT_NAME); ProductWidthName = DBUtil.parseData <string>(row, COL_PRODUCT_WIDTH_NAME); ColorName = DBUtil.parseData <string>(row, COL_COLOR_NAME); }
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); }