private void buttonDelete_Click(object sender, EventArgs e) { string nama = textBoxSearch.Text; var contex = new db_daycareContextEntities(); var cust = (from a in contex.Customers where a.customer_name == nama select a).Single(); contex.Customers.Remove(cust); contex.SaveChanges(); MessageBox.Show("Data telah berhasil dihapus."); CustomerForm f = new CustomerForm(); f.Show(); this.Hide(); }
private void addCustomerButton_Click(object sender, EventArgs e) { var contex = new db_daycareContextEntities(); var cust = new Customers(); cust.customer_name = nameTextBox.Text; cust.customer_address = addressTextBox.Text; cust.customer_phone = phoneTextBox.Text; contex.Customers.Add(cust); contex.SaveChanges(); MessageBox.Show("Tambah data owner pet berhasil!!"); CustomerForm f = new CustomerForm(); f.Show(); this.Hide(); }
private void addEmployeeButton_Click(object sender, EventArgs e) { var contex = new db_daycareContextEntities(); var emp = new Employees(); emp.employee_name = nameTextBox.Text; emp.employee_address = addressTextBox.Text; emp.employee_phone = phoneTextBox.Text; contex.Employees.Add(emp); contex.SaveChanges(); MessageBox.Show("Tambah data pegawai berhasil!!"); EmployeeForm f = new EmployeeForm(); f.Show(); this.Hide(); }
private void buttonUpdate_Click(object sender, EventArgs e) { var context = new db_daycareContextEntities(); var cust = (from a in context.Customers where a.customer_name == textBoxSearch.Text select a).Single(); cust.customer_name = nameTextBox.Text; cust.customer_address = addressTextBox.Text; cust.customer_phone = phoneTextBox.Text; context.SaveChanges(); MessageBox.Show("Data telah berhasil diupdate."); CustomerForm f = new CustomerForm(); f.Show(); this.Hide(); }
private void buttonUpdate_Click(object sender, EventArgs e) { var context = new db_daycareContextEntities(); var emp = (from a in context.Employees where a.employee_name == textBoxSearch.Text select a).Single(); emp.employee_name = nameTextBox.Text; emp.employee_address = addressTextBox.Text; emp.employee_phone = phoneTextBox.Text; context.SaveChanges(); MessageBox.Show("Data telah berhasil diupdate."); EmployeeForm f = new EmployeeForm(); f.Show(); this.Hide(); }
private void buttonUpdate_Click(object sender, EventArgs e) { var context = new db_daycareContextEntities(); var pet = (from a in context.Pets where a.pet_name == textBoxSearch.Text select a).Single(); pet.pet_name = nameTextBox.Text; pet.customer_id = int.Parse(ownerComboBox.SelectedValue.ToString()); pet.pet_type_id = int.Parse(typeComboBox.SelectedValue.ToString()); context.SaveChanges(); MessageBox.Show("Data telah berhasil diupdate."); PetForm f = new PetForm(); f.Show(); this.Hide(); }
private void proccessButton_Click(object sender, EventArgs e) { db_daycareContextEntities context = new db_daycareContextEntities(); var daycare = new Daycares(); daycare.employee_id = int.Parse(comboBoxEmployee.SelectedValue.ToString()); daycare.pet_id = int.Parse(comboBoxPet.SelectedValue.ToString()); daycare.daycare_date = dateTimePickerDaycare.Value; daycare.daycare_pickup_date = dateTimePickerPickup.Value; daycare.daycare_cost = Convert.ToInt32(labelCost.Text); daycare.dayare_status = 1; context.Daycares.Add(daycare); context.SaveChanges(); SuccessForm f = new SuccessForm(); f.Show(); this.Hide(); }
private void addPetButton_Click(object sender, EventArgs e) { db_daycareContextEntities context = new db_daycareContextEntities(); var pet = new Pets(); pet.pet_name = nameTextBox.Text; //pet.customer_id = (int)ownerComboBox.SelectedIndex; //pet.pet_type_id = (int)typeComboBox.SelectedIndex; pet.customer_id = int.Parse(ownerComboBox.SelectedValue.ToString()); pet.pet_type_id = int.Parse(typeComboBox.SelectedValue.ToString()); context.Pets.Add(pet); context.SaveChanges(); MessageBox.Show("Peliharaan berhasil ditambah!"); PetForm f = new PetForm(); f.Show(); this.Hide(); }
private void buttonPickup_Click(object sender, EventArgs e) { var context = new db_daycareContextEntities(); var pickup = new Pickups(); pickup.daycare_id = int.Parse(textBoxSearch.Text); pickup.pickup_date = dateTimePickerPickupCharge.Value; pickup.pickup_charge = int.Parse(labelCost.Text); context.Pickups.Add(pickup); int daycareId = int.Parse(textBoxSearch.Text); var daycare = (from a in context.Daycares where a.daycare_id == daycareId select a).Single(); daycare.dayare_status = 0; context.SaveChanges(); SuccessForm f = new SuccessForm(); f.Show(); this.Hide(); }