public override bool SaveFormula(int templateID, string formula) { BystronicDataDataContext bd = new BystronicDataDataContext(); Template oldTemplate = bd.Templates.FirstOrDefault(e => e.TemplateID == templateID); oldTemplate.Formula = formula; bd.SubmitChanges(); return(true); }
public override bool UpdateOrder(Order order) { //update order in the database with the order.ID with given order BystronicDataDataContext bd = new BystronicDataDataContext(); bd.UpdateOrder( //order.orderID I need order id order.ID, DateTime.Now, order.OrderDate, order.Salesman, order.Salesman2, order.RSM, order.PayRSMCommission, order.CustomerID, order.PONumber, (decimal)order.TotalListPrice, (decimal)order.SalePrice, (decimal)order.DiscountAmount, (decimal)order.DiscountPercent, (decimal)order.DealerCommission, (decimal)order.RegionalManagerCommission, (decimal)order.ProductManagerCommission, order.Comment, order.Status, order.ApprovedBy, order.ApprovedDate, order.ReleasedBy, order.ReleasedDate, order.PaidBy, order.PayDate, order.PayrollDate, order.TrackingNumber, order.TemplateID, order.SalesOrder, order.EstimatedShipDate, order.FinalPaymentDate); //should we update or delete and reinsert? bd.DeleteOrderItemsByOrderID(order.ID); foreach (OrderItem item in order.OrderItems) { bd.AddOrderItem(order.ID, DateTime.Now, item.ProductID, (decimal)item.Value, (decimal)item.ToolingValue); } bd.SubmitChanges(); return(true); }
public override bool AddOrder(Order order) { //add new order: ignore order.ID BystronicDataDataContext bd = new BystronicDataDataContext(); order.ID = bd.AddOrder(DateTime.Now, order.OrderDate, order.Salesman, order.Salesman2, order.RSM, order.PayRSMCommission, order.CustomerID, order.PONumber, (decimal)order.TotalListPrice, (decimal)order.SalePrice, (decimal)order.DiscountAmount, (decimal)order.DiscountPercent, (decimal)order.DealerCommission, (decimal)order.RegionalManagerCommission, (decimal)order.ProductManagerCommission, order.Comment, order.Status, order.ApprovedBy, order.ApprovedDate, order.ReleasedBy, order.ReleasedDate, order.PaidBy, order.PayDate, order.PayrollDate, order.TrackingNumber, order.TemplateID, order.SalesOrder, order.EstimatedShipDate, order.FinalPaymentDate); foreach (OrderItem item in order.OrderItems) { bd.AddOrderItem(order.ID, DateTime.Now, item.ProductID, (decimal)item.Value, (decimal)item.ToolingValue); } bd.SubmitChanges(); return(true); }