示例#1
0
文件: Sales.cs 项目: wenfeifei/PSS
 /// <summary>
 /// 手动更新销售单总价
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolStripButton8_Click(object sender, EventArgs e)
 {
     BLLSalesOrders.SalesManagerServiceClient salesClient = WCFServiceBLL.GetSalesService();
     if (listViewOrders.SelectedItems.Count > 0)
     {
         decimal          refreshTotalPrice  = 0.0M;
         SalesOrdersModel selectedSalesOrder = listViewOrders.SelectedItems[0].Tag as Model.SalesOrdersModel;
         List <Model.SalesCommodityModel> listSalesCommoditys = salesClient.GetSalesCommoditiesByID(selectedSalesOrder.ID).ToList();
         foreach (SalesCommodityModel orderItem in listSalesCommoditys)
         {
             refreshTotalPrice += orderItem.TotalPrice;
         }
         selectedSalesOrder.Contract = refreshTotalPrice.ToString();
         if (salesClient.UpdateSalesOrder(selectedSalesOrder))
         {
             labelContract.Text = selectedSalesOrder.Contract;
         }
         else
         {
             MessageBox.Show("更新订单总价失败!");
         }
     }
     else
     {
         MessageBox.Show("请选择一条订单");
     }
 }
示例#2
0
 private void buttonOK_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(textBoxOrderNumber.Text))
     {
         MessageBox.Show("订单编号不能为空");
         return;
     }
     Model.SalesOrdersModel salesOrder = new Model.SalesOrdersModel();
     salesOrder.OrderNumber  = textBoxOrderNumber.Text;
     salesOrder.CustomerId   = string.IsNullOrWhiteSpace(labelCustomerId.Text) ? 0 : int.Parse(labelCustomerId.Text);
     salesOrder.CustomerName = textBoxCustomer.Text;
     salesOrder.Address      = textBoxAddress.Text;
     salesOrder.Tel          = textBoxTel.Text;
     salesOrder.Contract     = textBoxContract.Text;
     salesOrder.OrderDate    = DateTime.Now;
     BLLSalesOrders.SalesManagerServiceClient salesClient = WCFServiceBLL.GetSalesService();
     if (isUpdate)
     {
         salesOrder.ID = orderID;
         if (!salesClient.UpdateSalesOrder(salesOrder))
         {
             MessageBox.Show("订单更新失败");
             this.DialogResult = DialogResult.None;
         }
     }
     else
     {
         var order = salesClient.AddSalesOrder(salesOrder);
         if (order == null)
         {
             MessageBox.Show("新增订单失败");
             this.DialogResult = DialogResult.None;
         }
         AddSalesID = order.ID;
     }
 }