public static void update(Guid id, string name) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var stat = (from s in context.Statuses where s.StatusId == id select s).FirstOrDefault(); stat.StatusValue = name; context.SaveChanges(); } }
public static void update(Guid id, string subcategory) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var sc = (from subcat in context.SubCategories where subcat.SubCategoryId == id select subcat).FirstOrDefault(); sc.SubCategoryValue = subcategory; context.SaveChanges(); } }
public static void delete(Guid id) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var warehouse = (from w in context.Warehouses where w.WarehouseId == id select w).FirstOrDefault(); context.Warehouses.Remove(warehouse); context.SaveChanges(); } }
public static void delete(Guid id) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var stat = (from status in context.Statuses where status.StatusId == id select status).FirstOrDefault(); context.Statuses.Remove(stat); context.SaveChanges(); } }
public static void delete(Guid id) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var product = (from p in context.Products where p.ProductId == id select p).FirstOrDefault(); context.Products.Remove(product); context.SaveChanges(); } }
public static void delete(Guid id) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var sc = (from subcat in context.SubCategories where subcat.SubCategoryId == id select subcat).FirstOrDefault(); context.SubCategories.Remove(sc); context.SaveChanges(); } }
public static void delete(Guid id) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var cat = (from c in context.Categories where c.CategoryId == id select c).FirstOrDefault(); context.Categories.Remove(cat); context.SaveChanges(); } }
public static void delete(Guid id) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var sup = (from s in context.Suppliers where s.SupplierId == id select s).FirstOrDefault(); context.Suppliers.Remove(sup); context.SaveChanges(); } }
public static void update(Guid categoryId, string category) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var categ = (from c in context.Categories where c.CategoryId == categoryId select c).FirstOrDefault(); categ.CategoryValue = category; context.SaveChanges(); } }
public static void updateQuantityBySku(Double quantity, String sku) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var product = (from p in context.Products where p.ProductSku == sku select p).FirstOrDefault(); product.ProductQuantity = quantity; context.SaveChanges(); } }
public static void updateOrderQuantity(Guid transactionId, Guid productId, double quantity) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var orders = (from order in context.Orders where order.Order_Transaction == transactionId && order.Order_ProductId == productId select order).FirstOrDefault(); orders.Order_Quantity = quantity; context.SaveChanges(); } }
public static void update(Guid id, string name, string address, double contact) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { Store store = (from s in context.Stores where s.StoreId == id select s).FirstOrDefault(); store.StoreName = name; store.StoreAddress = address; store.StoreContactNumber = contact; context.SaveChanges(); } }
public static void update(Guid id, string name, string address, double contact) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var sup = (from s in context.Suppliers where s.SupplierId == id select s).FirstOrDefault(); sup.SupplierName = name; sup.SupplierAddress = address; sup.SupplierContactNumber = contact; context.SaveChanges(); } }
public static void insert(Guid id, string name) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var stat = new Status() { StatusId = id, StatusValue = name }; context.Statuses.Add(stat); context.SaveChanges(); } }
public static void update(Guid id, string name, string address, double contact, string sublocation) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var warehouse = (from w in context.Warehouses where w.WarehouseId == id select w).FirstOrDefault(); warehouse.WarehouseName = name; warehouse.WarehouseAddress = address; warehouse.WarehouseContactNumber = contact; warehouse.WarehouseSubLocation = sublocation; context.SaveChanges(); } }
public static void insert(Guid id, string subcategory) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var sc = new SubCategory() { SubCategoryId = id, SubCategoryValue = subcategory }; context.SubCategories.Add(sc); context.SaveChanges(); } }
public static void create(string category) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var categ = new Category() { CategoryId = Guid.NewGuid(), CategoryValue = category.ToLower() }; context.Categories.Add(categ); context.SaveChanges(); } }
public static void insert(Guid id, string name, string address, double contact) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var sup = new Supplier() { SupplierAddress = address, SupplierContactNumber = contact, SupplierId = id, SupplierName = name }; context.Suppliers.Add(sup); context.SaveChanges(); } }
public static void updateTransaction(Guid transactionId, double newamountreturned, double subtotal, string remarks, string status) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var transaction = (from tran in context.Transactions where tran.TransactionId == transactionId select tran).FirstOrDefault(); transaction.TransactionNewAmountReturned = newamountreturned; transaction.TransactionSubTotal = subtotal; transaction.Transaction_Remarks = remarks; transaction.Transaction_Status = status; transaction.TransactionDateModified = DateTime.Now.ToString("d"); transaction.TransactionTimeModified = DateTime.Now.ToUniversalTime().ToString(); context.SaveChanges(); } }
public static void create(Guid id, string name, string address, double contact, string sublocation) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var warehouse = new Warehouse() { WarehouseAddress = address, WarehouseContactNumber = contact, WarehouseId = id, WarehouseName = name, WarehouseSubLocation = sublocation }; context.Warehouses.Add(warehouse); context.SaveChanges(); } }
public static void insert(Guid id, string name, string address, double contact) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { Store store = new Store() { StoreId = id, StoreName = name, StoreAddress = address, StoreContactNumber = contact }; context.Stores.Add(store); context.SaveChanges(); } }
public static void insertOrder(Guid orderId, Guid transactionId, Guid customer, Guid productId, double orderQuantity) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var order = new Order() { OrderId = orderId, Order_DateTime = DateTime.Now, Order_ProductId = productId, Order_Transaction = transactionId, Order_UserId = customer, Order_Quantity = orderQuantity }; context.Orders.Add(order); context.SaveChanges(); } }
public static void update(Guid productId, string productName, string description, string barcode, string barcodeImage, Guid categoryId, string dateAdded, double discount, string productImage, double quantity, double reoderLimit, double replenish, string sku, Guid StatusId, Guid storeId, Guid subCategoryId, Guid supplierId, double unitCost, Guid uomId, double vat, Guid warehouseId, List <ProductAttribute> attrib ) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var product = (from prod in context.Products where prod.ProductId == productId select prod).FirstOrDefault(); product.ProductName = productName; product.ProductDescription = description; product.ProductBarcode = barcode; product.ProductBarcodeImage = barcodeImage; product.ProductCategory = categoryId; product.ProductDateAdded = dateAdded; product.ProductDiscount = discount; product.ProductImage = productImage; product.ProductQuantity = quantity; product.ProductReorderLimit = reoderLimit; product.ProductReplenishLimit = replenish; product.ProductSku = sku; product.ProductStatus = StatusId; product.ProductStore = storeId; product.ProductSubCategory = subCategoryId; product.ProductSupplier = supplierId; product.ProductUnitCost = unitCost; product.ProductUnitOfMeasurement = uomId; product.ProductVat = vat; product.ProductWarehouse = warehouseId; for (int i = 0; i < attrib.Count; i++) { Guid id = attrib[i].AttributeId; var attr = (from attrb in context.Attributes where attrb.AttributeId == id select attrb).FirstOrDefault(); attr.AttributeName = attrib[i].AttributeName; attr.AttributeValue = attrib[i].AttributeValue; } context.SaveChanges(); } }
public static void insert(string productName, string description, Guid category, Guid subcategory, double unitCost, double quantity, string barcode, string barcodeImage, string sku, double vat, string productImage, Guid status, Guid store, string dateAdded, double replenish, double reorder, double discount, Guid supplier, Guid warehouse, List <ProductAttribute> productAttributes, Guid unitOfMeasurement ) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var product = new Product() { ProductId = Guid.NewGuid(), ProductName = productName, ProductDescription = description, ProductBarcode = barcode, ProductBarcodeImage = barcodeImage, ProductSku = sku, ProductImage = productImage, ProductVat = vat, ProductUnitCost = unitCost, ProductQuantity = quantity, ProductReplenishLimit = replenish, ProductReorderLimit = reorder, ProductDiscount = discount, ProductDateAdded = dateAdded, ProductUnitOfMeasurement = unitOfMeasurement, ProductCategory = category, ProductSubCategory = subcategory, ProductStatus = status, ProductStore = store, ProductSupplier = supplier, ProductWarehouse = warehouse, ProductAttributes = productAttributes }; context.Products.Add(product); context.SaveChanges(); } }
public static void insertTransaction(Guid transactionId, Guid cashierId, double amountReceived, double amountReturned, double subTotal, Guid ownerId) { using (SMLIB.Context.Context context = new SMLIB.Context.Context()) { var transaction = new Transaction() { TransactionId = transactionId, TransactionAmountReceived = amountReceived, TransactionAmountReturned = amountReturned, TransactionDate = DateTime.Now.ToString("d"), TransactionSubTotal = subTotal, Transaction_OwnerId = ownerId, Transaction_Remarks = "Successful", Transaction_Status = "Successful", Transaction_CashierId = cashierId, Transaction_Time = (DateTime.Now.TimeOfDay.ToString()), TransactionDateModified = "00:00", TransactionNewAmountReturned = 0.00, TransactionTimeModified = "00:00" }; context.Transactions.Add(transaction); context.SaveChanges(); } }