Ejemplo 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();
        }
Ejemplo n.º 2
0
        public void ChangeCustomer(int customerID)
        {
            if (Toolbar.IsNullOrNoneAction() || customerID <= 0)
            {
                return;
            }

            SaleOrderEntities     entity                 = (SaleOrderEntities)CurrentModuleEntity;
            ARSaleOrdersInfo      mainObject             = (ARSaleOrdersInfo)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.ARSaleOrderCustomerName            = objCustomersInfo.ARCustomerName;
            mainObject.ARSaleOrderCustomerPhone           = string.IsNullOrEmpty(objCustomersInfo.ARCustomerContactPhone1) ? (string.IsNullOrEmpty(objCustomersInfo.ARCustomerContactPhone2) ? string.Empty : objCustomersInfo.ARCustomerContactPhone2) : objCustomersInfo.ARCustomerContactPhone1;
            mainObject.FK_GECurrencyID                    = objCustomersInfo.FK_GECurrencyID;
            mainObject.FK_GEPaymentTermID                 = objCustomersInfo.FK_GEPaymentTermID;
            mainObject.ARSaleOrderPaymentMethodType       = string.IsNullOrEmpty(objCustomersInfo.ARCustomerPaymentMethod) ? string.Empty : objCustomersInfo.ARCustomerPaymentMethod;
            mainObject.ARSaleOrderCustomerTaxCode         = objCustomersInfo.ARCustomerTaxNumber;
            mainObject.ARSaleOrderCustomerAddress         = objCustomersInfo.ARCustomerContactAddress;
            mainObject.ARSaleOrderCustomerDeliveryName    = objCustomersInfo.ARCustomerName;
            mainObject.ARSaleOrderCustomerDeliveryPhone   = mainObject.ARSaleOrderCustomerPhone;
            mainObject.ARSaleOrderCustomerDeliveryAddress = mainObject.ARSaleOrderCustomerAddress;
            mainObject.ARSaleOrderCustomerDeliveryAddress = mainObject.ARSaleOrderCustomerAddress;
            entity.UpdateMainObjectBindingSource();
        }