public void ChangeCustomer(int customerID) { if (Toolbar.IsNullOrNoneAction() || customerID <= 0) { return; } CustomerPaymentEntities entity = (CustomerPaymentEntities)CurrentModuleEntity; ARCustomerPaymentsInfo mainObject = (ARCustomerPaymentsInfo)CurrentModuleEntity.MainObject; ARCustomersController objCustomersController = new ARCustomersController(); ARCustomersInfo objCustomersInfo = objCustomersController.GetObjectByID(customerID) as ARCustomersInfo; if (objCustomersInfo == null) { return; } if (objCustomersInfo.ARCustomerActiveCheck == false) { MessageBox.Show("Khách hàng này đã bỏ hoạt động!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } mainObject.FK_ARCustomerID = customerID; mainObject.ARCustomerPaymentSenderName = objCustomersInfo.ARCustomerName; mainObject.ARCustomerPaymentPaymentMethodType = string.IsNullOrEmpty(objCustomersInfo.ARCustomerPaymentMethod) ? string.Empty : objCustomersInfo.ARCustomerPaymentMethod; entity.UpdateMainObjectBindingSource(); }
public override void ActionNew() { base.ActionNew(); CustomerPaymentEntities entity = (CustomerPaymentEntities)CurrentModuleEntity; ARCustomerPaymentsInfo mainObject = (ARCustomerPaymentsInfo)entity.MainObject; ARCustomerPaymentTimePaymentsController objCustomerPaymentTimePaymentsController = new ARCustomerPaymentTimePaymentsController(); List <ARCustomerPaymentTimePaymentsInfo> listCustomerPaymentTimePaymentsInfo = objCustomerPaymentTimePaymentsController.GetDocumentForCustomerPayment(); guiChooseCustomerPaymentTimePayments guiFind = new guiChooseCustomerPaymentTimePayments(listCustomerPaymentTimePaymentsInfo); guiFind.Module = this; DialogResult rs = guiFind.ShowDialog(); if (rs != DialogResult.OK) { ActionCancel(); return; } listCustomerPaymentTimePaymentsInfo = guiFind.SelectedObjects as List <ARCustomerPaymentTimePaymentsInfo>; ARCustomerPaymentTimePaymentsInfo objCustomerPaymentTimePaymentsInfo = listCustomerPaymentTimePaymentsInfo.FirstOrDefault(); mainObject.FK_ARCustomerID = objCustomerPaymentTimePaymentsInfo.FK_ARCustomerID; mainObject.FK_GECurrencyID = objCustomerPaymentTimePaymentsInfo.FK_GECurrencyID; mainObject.ARCustomerPaymentPaymentMethodType = objCustomerPaymentTimePaymentsInfo.ARCustomerPaymentPaymentMethodType; mainObject.ARCustomerPaymentSenderName = objCustomerPaymentTimePaymentsInfo.ARCustomerPaymentSenderName; entity.CustomerPaymentTimePaymentsList.Invalidate(listCustomerPaymentTimePaymentsInfo); UpdateTotalAmount(); entity.UpdateMainObjectBindingSource(); }
public void ChangeCurrency(int currencyID) { CustomerPaymentEntities entity = (CustomerPaymentEntities)CurrentModuleEntity; ARCustomerPaymentsInfo mainObject = (ARCustomerPaymentsInfo)entity.MainObject; mainObject.FK_GECurrencyID = currencyID; GECurrenciesInfo objCurrenciesInfo = VinaApp.CurrencyList.Where(o => o.GECurrencyID == currencyID).FirstOrDefault(); mainObject.ARCustomerPaymentExchangeRate = objCurrenciesInfo == null ? 1 : objCurrenciesInfo.GECurrencyTransferRate; entity.UpdateMainObjectBindingSource(); ChangeExchangeRate(); }