//adds the given order to the db //through the web service private int AddToDB(Order currOrder) { return(_orderdb.AddNewOrder( currOrder.OrderDate.Date.ToString(), currOrder.DeliveryDate.Date.ToString(), currOrder.CalculateTotal(), currOrder.Paid, currOrder.Client.id )); }
//populates the order form with the given order private void PopulateOrder(Order order) { if (order != null) { _dpDeliveryDate.Value = order.DeliveryDate; _dpOrderDate.Value = order.OrderDate; _txtTotalCost.Text = order.CalculateTotal().ToString(); _currOrder = order; _cboOrderClient.SelectedItem = order.Client; _chkPaid.Checked = _currOrder.Paid; ResetOrderItemList(); } }
//prep order to string values to be sent to //order web service -> update db private void UpdateDB(Order currOrder) { string orderString = string.Format("{0}|{1}|{2}|{3}|{4}|{5}", currOrder.OrderNumber, currOrder.OrderDate, currOrder.DeliveryDate, currOrder.CalculateTotal(), currOrder.Paid, currOrder.Client.id ); _orderdb.UpdateOrder(orderString); //update orderitems //this is the 'simplest' way of updating order //items without the need to figure out which was //updated or not _orderdb.DeleteOrderItems(currOrder.OrderNumber); AddOrderItemsToDB(currOrder); }
//recalculates total. called when item added/deleted private void UpdateTotalCost() { _txtTotalCost.Text = _currOrder.CalculateTotal().ToString(); }
//updates the total for the current quick order private void UpdateTotal(Order quickOrder) { _txtQOTotal.Text = quickOrder.CalculateTotal().ToString(); }