Exemplo n.º 1
0
        private void My_first_event_handler(object sender, ExecutedRoutedEventArgs e)
        {
            if (purchaseList.Count > 0)
            {
                if (MessageBox.Show("Are you sure do you want to save purchase info?", "Confirm", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    PurchaseDetaiInfo purchaseDetailInfo = new PurchaseDetaiInfo();
                    //if (invoiceDate.SelectedDate != null)
                    //{
                    //    DateTime billDate = invoiceDate.SelectedDate ?? DateTime.Now;
                    //    if(billDate!=null)
                    //    {
                    //        purchaseDetailInfo.InvoiceDate = Convert.ToInt32(billDate.ToString("yyyyMMdd"));
                    //    }
                    //}
                    purchaseDetailInfo.InvoiceNum       = txtInvoiceNum.Text;
                    purchaseDetailInfo.PurchaseitemList = purchaseList.ToArray();
                    decimal totalAmount = 0;
                    decimal.TryParse(txtTotalAmount.Text, out totalAmount);
                    purchaseDetailInfo.TotalAmount = totalAmount;

                    VendorInfo vendorInfo = (VendorInfo)autoVendorName.SelectedItem;
                    if (vendorInfo != null)
                    {
                        purchaseDetailInfo.VendorID = vendorInfo.VendorID;
                    }

                    BLL.PurchaseBLL.InsertPurchaseInfo(purchaseDetailInfo);
                    purchaseList = new List <BS_PurchaseService.PurchaseInfo>();
                    datagridProduct.ItemsSource = null;
                    //this.autoProductName.Focus();
                }
            }
        }
        public static bool InsertPurchaseInfo(PurchaseDetaiInfo purhcaseDetailInfo)
        {
            PurchaseServiceClient service = new PurchaseServiceClient();

            return(service.InsertPurchaseInfo(purhcaseDetailInfo));
        }