public CustomerEdit(VisitaJayaPerkasa.Entities.Customer customer) { InitializeComponent(); this.customer = customer; if (customer == null) { wantToCreateVessel = true; listCustomerDetail = new List<Entities.CustomerDetail>(); } else { wantToCreateVessel = false; etCustomerName.Text = customer.CustomerName; etOffice.Text = customer.Office; etAddress.Text = customer.Address; etEmail.Text = customer.Email; etPhone.Text = customer.Phone; etFax.Text = customer.Fax; etContactPerson.Text = customer.ContactPerson; chkStatusPPN.Checked = Convert.ToBoolean(customer.StatusPPN); SqlCustomerRepository sqlCustomerRepository = new SqlCustomerRepository(); listCustomerDetail = sqlCustomerRepository.ListCustomerDetail(customer.ID); if (!Constant.VisitaJayaPerkasaApplication.anyConnection) MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); else if (listCustomerDetail != null) CustomerDetailGridView.DataSource = listCustomerDetail; else listCustomerDetail = new List<VisitaJayaPerkasa.Entities.CustomerDetail>(); sqlCustomerRepository = null; } }
private void btnSearch_Click(object sender, EventArgs e) { new SearchCustomer().ShowDialog(); if (Constant.VisitaJayaPerkasaApplication.objGetOtherView != null) { searchResultCustomer = (VisitaJayaPerkasa.Entities.Customer)Constant.VisitaJayaPerkasaApplication.objGetOtherView; txtCustomer.Text = searchResultCustomer.CustomerName; } Constant.VisitaJayaPerkasaApplication.objGetOtherView = null; }