Beispiel #1
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            var custCode = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();

            _customer = _customerService.GetCustomerByCustCode(custCode);

            txtCustCode.Text = _customer.CUST_CODE;
            txtCustName.Text = _customer.CUST_NAME;
            txtAddress.Text  = _customer.ADDRESS;
            txtTaxCode.Text  = _customer.TAX_CODE;
            txtTel.Text      = _customer.TEL;
            txtFax.Text      = _customer.FAX;
            txtPartName.Text = _customer.NAME_PART;
            txtBuyer.Text    = _customer.BUYER;
            txtCusName.Text  = _customer.NAME_CUS;
            txtPayType.Text  = _customer.PAY_TYPE;
            txtPayTerm.Text  = _customer.PAY_TERM;
            txtCodeTax.Text  = _customer.CODE_TAX;
            txtCurrency.Text = _customer.CURRENCY;
            txtDelTerm.Text  = _customer.DEL_TERM;
            txtDelPlace.Text = _customer.DEL_PLACE;
            txtNamePart.Text = _customer.NAME_PART1;

            txtCustCode.Enabled = false;
            btnDel.Enabled      = true;
        }
Beispiel #2
0
        private void cboCustomers_SelectedIndexChanged(object sender, EventArgs e)
        {
            string custCode = cboCustomers.SelectedValue.ToString();

            if (!string.IsNullOrEmpty(custCode))
            {
                _customer = _customerService.GetCustomerByCustCode(custCode);

                txtCustCode.Text = _customer.CUST_CODE;
                txtCustName.Text = _customer.CUST_NAME;
                txtAddress.Text  = _customer.ADDRESS;
                txtCodeTax.Text  = _customer.CODE_TAX;
                txtTel.Text      = _customer.TEL;
                txtFax.Text      = _customer.FAX;
                txtPartName.Text = _customer.NAME_PART;
                txtCusName.Text  = _customer.NAME_CUS;
                txtPayType.Text  = _customer.PAY_TYPE;
                txtPayTerm.Text  = _customer.PAY_TERM;
                txtCurrency.Text = _customer.CURRENCY;
                txtTaxCode.Text  = _customer.TAX_CODE;
                txtDelTerm.Text  = _customer.DEL_TERM;
                txtDelPlace.Text = _customer.DEL_PLACE;
                txtNamePart.Text = _customer.NAME_PART1;
                txtBuyer.Text    = _customer.BUYER;


                btnExport.Enabled = true;
            }
        }
Beispiel #3
0
 private void Add(Customer customer)
 {
     using (var context=new PURCHASEEntities())
     {
         context.AddToCustomers(customer);
         context.SaveChanges();
     }
     
 }
Beispiel #4
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            var custCode = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
            _customer = _customerService.GetCustomerByCustCode(custCode);

            txtCustCode.Text = _customer.CUST_CODE;
            txtCustName.Text = _customer.CUST_NAME;
            txtAddress.Text = _customer.ADDRESS;
            txtTaxCode.Text = _customer.TAX_CODE;
            txtTel.Text = _customer.TEL;
            txtFax.Text = _customer.FAX;
            txtPartName.Text = _customer.NAME_PART;
            txtBuyer.Text = _customer.BUYER;
            txtCusName.Text = _customer.NAME_CUS;
            txtPayType.Text = _customer.PAY_TYPE;
            txtPayTerm.Text = _customer.PAY_TERM;
            txtCodeTax.Text = _customer.CODE_TAX;
            txtCurrency.Text = _customer.CURRENCY;
            txtDelTerm.Text = _customer.DEL_TERM;
            txtDelPlace.Text = _customer.DEL_PLACE;
            txtNamePart.Text = _customer.NAME_PART1;

            txtCustCode.Enabled = false;
            btnDel.Enabled = true;
        }
Beispiel #5
0
        public void InsertOrUpdate(string custCode,
            string custName,
            string address,
            string taxCode,
            string tel,
            string fax,
            string partName,
            string buyerName,
            string cusName,
            string payType,
            string payTerm,
            string currency,
            string codeTax,
            string delTerm,
            string delPlace,
            string namePart
            )
        {
            //Add(customer);
            if (CheckCustCodeExit(custCode))
            {
                var cusInsert = new Customer()
                {
                    CUST_CODE = custCode,
                    CUST_NAME = custName,
                    ADDRESS = address,
                    TAX_CODE = taxCode,
                    TEL = tel,
                    FAX = fax,
                    NAME_PART = partName,
                    BUYER = buyerName,
                    NAME_CUS = cusName,
                    PAY_TYPE = payType,
                    PAY_TERM = payTerm,
                    CURRENCY = currency,
                    CODE_TAX = codeTax,
                    DEL_TERM = delTerm,
                    DEL_PLACE = delPlace,
                    NAME_PART1 = namePart
                };

                Add(cusInsert);
            }
            else
            {
                using (var context = new PURCHASEEntities())
                {
                    Customer cusUpdate = context.Customers.FirstOrDefault(c => c.CUST_CODE == custCode);
                    if (cusUpdate != null)
                    {
                        cusUpdate.CUST_NAME = custName;
                        cusUpdate.ADDRESS = address;
                        cusUpdate.CODE_TAX = taxCode;
                        cusUpdate.TEL = tel;
                        cusUpdate.FAX = fax;
                        cusUpdate.NAME_PART = partName;
                        cusUpdate.BUYER = buyerName;
                        cusUpdate.NAME_CUS = cusName;
                        cusUpdate.PAY_TYPE = payType;
                        cusUpdate.PAY_TERM = payTerm;
                        cusUpdate.CURRENCY = currency;
                        cusUpdate.TAX_CODE = codeTax;
                        cusUpdate.DEL_TERM = delTerm;
                        cusUpdate.DEL_PLACE = delPlace;
                        cusUpdate.NAME_PART1 = namePart;

                        context.SaveChanges();
                    }

                }
            }
        }
Beispiel #6
0
        private void cboCustomers_SelectedIndexChanged(object sender, EventArgs e)
        {
            string custCode = cboCustomers.SelectedValue.ToString();
            if (!string.IsNullOrEmpty(custCode))
            {
                _customer = _customerService.GetCustomerByCustCode(custCode);

                txtCustCode.Text = _customer.CUST_CODE;
                txtCustName.Text = _customer.CUST_NAME;
                txtAddress.Text = _customer.ADDRESS;
                txtCodeTax.Text = _customer.CODE_TAX;
                txtTel.Text = _customer.TEL;
                txtFax.Text = _customer.FAX;
                txtPartName.Text = _customer.NAME_PART;
                txtCusName.Text = _customer.NAME_CUS;
                txtPayType.Text = _customer.PAY_TYPE;
                txtPayTerm.Text = _customer.PAY_TERM;
                txtCurrency.Text = _customer.CURRENCY;
                txtTaxCode.Text = _customer.TAX_CODE;
                txtDelTerm.Text = _customer.DEL_TERM;
                txtDelPlace.Text = _customer.DEL_PLACE;
                txtNamePart.Text = _customer.NAME_PART1;
                txtBuyer.Text = _customer.BUYER;


                btnExport.Enabled = true;
            }
        }