private static void Main() { _repo = new CustomerRepository(); _breakout = false; do { LoadByStoreProcedure(); } while (!_breakout); }
private void btnSaveCustomer_Click(object sender, EventArgs e) { using (CustomerRepository context = new CustomerRepository()) { var result = context.Context.Customer.SingleOrDefault(b => b.Id == customer.Id); if (result != null) { result.Name = txtIme.Text; result.Age = int.Parse(txtAge.Text); result.BirthdayDate = dtpBirthday.Value; result.ContactPerson = txtContactPerson.Text; result.PhoneNumber = txtContactNumber.Text; result.Note = txtNote.Text; context.Context.SaveChanges(); } } this.Close(); }
private async Task CustomerSelect() { try { CustomerRepository CustomerDB = new CustomerRepository(); var customers = await CustomerDB.GetList(); customerBindingSource.DataSource = customers; grpAddCake.Visible = false; grpDeleteCake.Visible = false; grdCustomer.DataSource = customers; grdCustomer.Update(); grdCustomer.Refresh(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void GetCustomerByGuid(Guid id) { using (var context = new CustomerRepository()) { var user = context.Context.Customer.Find(id); customer = user; } }
private bool CheckIfCustomerIdExist(Guid guid) { using (var context = new CustomerRepository()) { bool idExists = context.Context.Customer.Any(contact => contact.Id.Equals(guid)); if (idExists) { return true; } else { return false; } } }
private bool CheckIfNameAndBirthdayExist(string name, DateTime birthday) { using (var context = new CustomerRepository()) { bool birthdayExists = context.Context.Customer.Any(contact => contact.Name.Equals(cboName.DisplayMember) && contact.BirthdayDate.Equals(dtpBirthdayDate.Value.Date)); if (birthdayExists) { return true; } else { return false; } } }