Beispiel #1
0
        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("已設定過該客戶的布種單價,請使用更新單價功能!!");
            }
        }
Beispiel #2
0
        private void ButtonUpdateDefaultPriceClickExecute()
        {
            if (AccountTextileList.Count() == 0)
            {
                MessageBox.Show("未選取要新增的布種!", "錯誤!", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            bool success = AccountSystemModule.InsertDefaultPrice(AccountTextileList);

            if (success)
            {
                MessageBox.Show("新增成功!");
            }
            else
            {
                MessageBox.Show("新增失敗!", "錯誤!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            AccountTextileList.Clear();
        }