private void InsertCustomerPriceClickExecute() { if (NewCustomerPrice <= 0) { MessageBox.Show("設定的客戶單價不正確!!"); return; } bool newDefaultPriceSuccess = false; if (SelectedCustomerCheckBillSheet.DefaultPrice == 0) { List <AccountTextile> accountTextile = new List <AccountTextile>() { new AccountTextile { FactoryID = SelectedCustomerCheckBillSheet.F_01, ItemID = SelectedCustomerCheckBillSheet.I_01, ItemName = SelectedCustomerCheckBillSheet.I_03, DefaultPrice = Convert.ToInt32(SelectedCustomerCheckBillSheet.Price) } }; newDefaultPriceSuccess = AccountSystemModule.InsertDefaultPrice(accountTextile); } IEnumerable <AccountTextile> accountTextiles = AccountSystemModule.GetAccountTextile(); CustomerTextilePrice customerTextilePrice = new CustomerTextilePrice { AccountTextileID = accountTextiles.Where(w => w.FactoryID == SelectedCustomerCheckBillSheet.F_01 && w.ItemID == SelectedCustomerCheckBillSheet.I_01).FirstOrDefault().AccountTextileID, AccountCustomerID = SelectedTrashCustomer.CARD_NO, Price = NewCustomerPrice }; if (!AccountSystemModule.GetCustomerTextilePrice(SelectedCustomerCheckBillSheet.C_01).Any(a => a.AccountTextileID == SelectedCustomerCheckBillSheet.AccountTextileID)) { bool success = AccountSystemModule.InsertCustomerTextilePrice(customerTextilePrice); if (success) { bool updateTrashSystemsuccess = UpdateTrashSystemPrice(SelectedCustomerCheckBillSheet, NewCustomerPrice); if (updateTrashSystemsuccess) { DisplayUpdate(newDefaultPriceSuccess, NewCustomerPrice); MessageBox.Show("新增客戶單價成功!"); } else { MessageBox.Show("帳務系統新增失敗!!", "錯誤!", MessageBoxButton.OK, MessageBoxImage.Error); } } else { MessageBox.Show("新增失敗!!", "錯誤!", MessageBoxButton.OK, MessageBoxImage.Error); } } else { MessageBox.Show("已設定過該客戶的布種單價,請使用更新單價功能!!"); } }
private void ComboBoxCustomerSelectionChangedExecute() { if (priviousTrashCustomer == SelectedTrashCustomer && priviousCheckBillDate.ToString("yyyy/MM") == CheckBillDate.ToString("yyyy/MM")) { return; } if (SelectedTrashCustomer == null) { return; } ; priviousTrashCustomer = SelectedTrashCustomer; priviousCheckBillDate = CheckBillDate; List <TrashCustomerShipped> invoSubList = new List <TrashCustomerShipped>(TrashModule.GetInvoSub(CheckBillDate) .Where(w => w.C_01 == SelectedTrashCustomer.CARD_NO)); IEnumerable <AccountTextile> accountTextiles = AccountSystemModule.GetAccountTextile(); IEnumerable <CustomerTextilePrice> customerTextilePrices = AccountSystemModule.GetCustomerTextilePrice(SelectedTrashCustomer.CARD_NO); IEnumerable <CustomerCheckBillSheet> customerCheckBillSheets = AccountSystemModule.GetCheckBillSheet(accountTextiles, customerTextilePrices, invoSubList).OrderBy(o => o.IN_DATE).ThenBy(t => t.Time); CustomerCheckBillSheets = new ObservableCollection <CustomerCheckBillSheet>(customerCheckBillSheets); OnPropertyChanged("CustomerCheckBillSheets"); }