private void clientesToolStripMenuItem_Click(object sender, EventArgs e) { frmCustomers frmCustomers = new frmCustomers(); frmCustomers.Show(); Hide(); }
private void btnSave_Click(object sender, System.EventArgs e) { if (IsValid()) { Customer customer = rentACarEntities.Customers.Where(c => c.Id == Customer.Id).FirstOrDefault(); customer.Name = txtName.Text; customer.DocumentNumber = txtDocumentNumber.Text; customer.CreditCarNumber = txtCreditCarNumber.Text; customer.CreditLimit = txtCreditLimit.Value; customer.PersonTypeId = (int)cbPersonType.SelectedValue; rentACarEntities.Entry(customer).State = System.Data.Entity.EntityState.Modified; rentACarEntities.SaveChanges(); MessageBox.Show("El cliente fue editado correctamente.", "InformaciĆ³n", MessageBoxButtons.OK, MessageBoxIcon.Information); frmCustomers frmCustomers = new frmCustomers(); frmCustomers.Show(); Hide(); } }
private void btnSave_Click(object sender, EventArgs e) { if (IsValid()) { rentACarEntities.Customers.Add(new Customer() { Name = txtName.Text, DocumentNumber = txtDocumentNumber.Text, CreditCarNumber = txtCreditCarNumber.Text, CreditLimit = txtCreditLimit.Value, PersonTypeId = (int)cbPersonType.SelectedValue, Created = DateTime.Now, Status = true }); rentACarEntities.SaveChanges(); MessageBox.Show("El cliente fue agreagdo correctamente.", "InformaciĆ³n", MessageBoxButtons.OK, MessageBoxIcon.Information); frmCustomers frmCustomers = new frmCustomers(); frmCustomers.Show(); Close(); } }