Ejemplo n.º 1
0
        private void SaveCustomer()
        {
            Customer cus = new Customer();
            Customer sel = cboCustomerNo.SelectedItem as Customer;

            if (sel != null)
            {
                cus.ID = sel.ID;
            }

            cus.CustomerNo  = cboCustomerNo.Text.Trim();
            cus.Sales       = cboSales.Text.Trim();
            cus.Company     = txtSellTo.Text.Trim();
            cus.Address     = txtAddr.Text;
            cus.ShipTo      = txtShipTo.Text;
            cus.ShippingWay = cboShipway.Text;
            cus.Term        = nudTerm.Value.ToString();
            cus.Freight     = txtFreight.Text.Trim();

            CustomerHelper ch = new CustomerHelper();

            if (ch.FindCustomer(cus.CustomerNo))
            {
                ch.UpdateCustomer(cus);
            }

            else
            {
                ch.InsertCustomer(cus);
            }
        }
Ejemplo n.º 2
0
        private bool SaveCustomer()
        {
            customer.Sales       = txtSales.Text.Trim();
            customer.CustomerNo  = txtCustomerNo.Text.Trim();
            customer.Company     = txtCompany.Text;
            customer.Address     = txtAddress.Text;
            customer.Tel         = txtTel.Text;
            customer.Fax         = txtFax.Text;
            customer.Email       = txtEmail.Text;
            customer.ShipTo      = txtShipTo.Text;
            customer.ShippingWay = cboShipway.Text;
            customer.Freight     = txtFreight.Text.Trim();
            CustomerHelper ch = new CustomerHelper();

            if (true == IsExistCustomerID(customer.ID))
            {
                ch.UpdateCustomer(customer);
                bNew = false;
            }
            else
            {
                ch.InsertCustomer(customer);
                bNew = true;
            }
            return(true);
        }