Esempio n. 1
0
        public void ChangeCustomer(int customerID)
        {
            if (Toolbar.IsNullOrNoneAction() || customerID <= 0)
            {
                return;
            }

            ProposalEntities      entity                 = (ProposalEntities)CurrentModuleEntity;
            ARProposalsInfo       mainObject             = (ARProposalsInfo)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.ARProposalCustomerName  = objCustomersInfo.ARCustomerName;
            mainObject.FK_GECurrencyID         = objCustomersInfo.FK_GECurrencyID;
            mainObject.ARProposalPaymentMethod = string.IsNullOrEmpty(objCustomersInfo.ARCustomerPaymentMethod) ? string.Empty : objCustomersInfo.ARCustomerPaymentMethod;
            entity.UpdateMainObjectBindingSource();
            SetDefaultProposalName();
        }
Esempio n. 2
0
        public void ChangeItemFromProposalItemsList()
        {
            if (Toolbar.IsNullOrNoneAction())
            {
                return;
            }

            ProposalEntities entity     = (ProposalEntities)CurrentModuleEntity;
            ARProposalsInfo  mainObject = (ARProposalsInfo)CurrentModuleEntity.MainObject;

            if (entity.ProposalItemList.CurrentIndex < 0)
            {
                return;
            }

            ARProposalItemsInfo objProposalItemsInfo = entity.ProposalItemList[entity.ProposalItemList.CurrentIndex];

            if (objProposalItemsInfo == null)
            {
                return;
            }

            entity.UpdateTotalAmountProposalItemList(mainObject.FK_GECurrencyID);
            UpdateTotalAmount();
            entity.ProposalItemList.GridControl.RefreshDataSource();
            entity.UpdateMainObjectBindingSource();
        }
Esempio n. 3
0
        public void ChangeCurrency(int currencyID)
        {
            ProposalEntities entity     = (ProposalEntities)CurrentModuleEntity;
            ARProposalsInfo  mainObject = (ARProposalsInfo)entity.MainObject;

            mainObject.FK_GECurrencyID = currencyID;
            entity.UpdatePriceBelongCurrency(currencyID);
            entity.UpdateMainObjectBindingSource();
        }
Esempio n. 4
0
        public void SetDefaultProposalName()
        {
            ProposalEntities entity     = (ProposalEntities)CurrentModuleEntity;
            ARProposalsInfo  mainObject = (ARProposalsInfo)CurrentModuleEntity.MainObject;

            if (!String.IsNullOrWhiteSpace(mainObject.ARProposalName))
            {
                return;
            }

            if (mainObject.FK_ARCustomerID == 0)
            {
                return;
            }

            mainObject.ARProposalName = string.Format("Bán hàng cho {0}", mainObject.ARProposalCustomerName);

            entity.UpdateMainObjectBindingSource();
        }