コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }