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; } }
public CustomerView(VisitaJayaPerkasa.Entities.Customer customer) { InitializeComponent(); 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; lblCustomerName.Text = customer.CustomerName; lblOffice.Text = customer.Office; lblAddres.Text = customer.Address; lblEmail.Text = customer.Email; lblPhone.Text = customer.Phone; lblFax.Text = customer.Fax; lblContactPerson.Text = customer.ContactPerson; }