Exemplo n.º 1
0
        private void updateCustomerInfo(data.Customer customer, DataActionMode mode)
        {
            // save customer info data
            int _result = new CustomerDAL().updateCustomer(customer, mode);

            // save delivery address info
            if (_custMode == DataActionMode.Add)
            {
                if (_addrs.Count > 0)
                {
                    foreach (DeliveryAddr address in _addrs)
                    {
                        int _done = new CustomerDAL().updateDeliveryAddr(address, DataActionMode.Add);
                    }
                }
            }


            if (_result > 0)
            {
                MessageBox.Show("update customer information successfully", "Message", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
        }
Exemplo n.º 2
0
        private void customerInfo(string customerCode)
        {
            // Add
            if (String.IsNullOrEmpty(customerCode))
            {
                _customer                 = new data.Customer();
                _customer.Active          = true;
                _customer.Address         = "";
                _customer.Balance         = 0.00m;
                _customer.City            = "";
                _customer.CompanyName     = "";
                _customer.ContactName     = "";
                _customer.Country         = "";
                _customer.Creditlimit     = 0.00m;
                _customer.CreditTerm      = "COD";
                _customer.Currency        = "USD";
                _customer.CustomerCode    = "";
                _customer.CustomerType    = 1;
                _customer.DeliveryAddress = 0;
                _customer.Email           = "";
                _customer.Fax             = "";
                _customer.Industry        = 5;
                _customer.Mobile          = "";
                _customer.Phone           = "";
                _customer.Province        = "";
                _customer.Status          = 1;
                _customer.TaxCode         = "";
                _customer.Website         = "";
                _customer.Zipcode         = "";

                txtContactName.Text           = _customer.ContactName;
                txtBalance.Text               = $"{_customer.Balance:N2}";
                txtAddress.Text               = _customer.Address;
                txtCity.Text                  = _customer.City;
                txtCompany.Text               = _customer.CompanyName;
                txtCountry.Text               = _customer.Country;
                txtCreditlimit.Text           = $"{_customer.Creditlimit:N2}";
                txtCustomerCode.Text          = _customer.CustomerCode;
                txtEmail.Text                 = _customer.Email;
                txtFax.Text                   = _customer.Fax;
                txtMobile.Text                = _customer.Mobile;
                txtPhone.Text                 = _customer.Phone;
                txtProvince.Text              = _customer.Province;
                txtTaxCode.Text               = _customer.TaxCode;
                txtWebsite.Text               = _customer.Website;
                txtZipCode.Text               = _customer.Zipcode;
                cbxCreditTerm.SelectedValue   = _customer.CreditTerm;
                cbxCurrency.SelectedValue     = _customer.Currency;
                cbxCustomerType.SelectedValue = _customer.CustomerType;
                cbxDeliveryAddr.SelectedValue = _customer.DeliveryAddress;
                cbxIndustry.SelectedValue     = _customer.Industry;
                cbxStatus.SelectedValue       = _customer.Status;
                chkActive.Checked             = _customer.Active;
            }
            else // edit
            {
                _customer                     = new CustomerDAL().getCustomerByCode(customerCode);
                txtContactName.Text           = _customer.ContactName;
                txtBalance.Text               = $"{_customer.Balance:N2}";
                txtAddress.Text               = _customer.Address;
                txtCity.Text                  = _customer.City;
                txtCompany.Text               = _customer.CompanyName;
                txtCountry.Text               = _customer.Country;
                txtCreditlimit.Text           = $"{_customer.Creditlimit:N2}";
                txtCustomerCode.Text          = _customer.CustomerCode;
                txtEmail.Text                 = _customer.Email;
                txtFax.Text                   = _customer.Fax;
                txtMobile.Text                = _customer.Mobile;
                txtPhone.Text                 = _customer.Phone;
                txtProvince.Text              = _customer.Province;
                txtTaxCode.Text               = _customer.TaxCode;
                txtWebsite.Text               = _customer.Website;
                txtZipCode.Text               = _customer.Zipcode;
                cbxCreditTerm.SelectedValue   = _customer.CreditTerm;
                cbxCurrency.SelectedValue     = _customer.Currency;
                cbxCustomerType.SelectedValue = _customer.CustomerType;
                cbxDeliveryAddr.SelectedValue = _customer.DeliveryAddress;
                cbxIndustry.SelectedValue     = _customer.Industry;
                cbxStatus.SelectedValue       = _customer.Status;
                chkActive.Checked             = _customer.Active;
            }

            updateUI();
        }