Exemple #1
0
 public void ShiftsSetAdd(ShiftsSet shifts)
 {
     using (BakeryEntities db = new BakeryEntities())
     {
         db.ShiftsSet.Add(shifts);
         db.SaveChanges();
     }
 }
Exemple #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex == 0)
     {
         BackerySet BackerySet = new BackerySet
         {
             adres = textBox1.Text
         };
         BackerySet.BackerySetAdd(BackerySet);
         BackerySetDataGridFill();
     }
     else if (comboBox1.SelectedIndex == 1)
     {
         StaffSet StaffSet = new StaffSet
         {
             Surname    = textBox1.Text,
             name       = textBox2.Text,
             patronymic = textBox3.Text
         };
         StaffSet.StaffSetAdd(StaffSet);
         StaffSetDataGridFill();
     }
     else if (comboBox1.SelectedIndex == 2)
     {
         ShiftsSet ShiftsSet = new ShiftsSet
         {
             Plan       = textBox1.Text,
             Backery_Id = Convert.ToInt32(textBox3.Text),
             Staff_Id   = Convert.ToInt32(textBox2.Text)
         };
         ShiftsSet.ShiftsSetAdd(ShiftsSet);
         ShiftsSetDataGridFill();
     }
     else if (comboBox1.SelectedIndex == 3)
     {
         DeliveriesSet DeliveriesSet = new DeliveriesSet
         {
             adres         = textBox1.Text,
             Backery_Id    = Convert.ToInt32(textBox2.Text),
             numberOfCakes = Convert.ToInt16(textBox3.Text)
         };
         DeliveriesSet.DeliveriesSetAdd(DeliveriesSet);
         DeliveriesSetDataGridFill();
     }
 }
Exemple #3
0
        private void Grid_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
        {
            BakeryEntities db = new BakeryEntities();

            if (e.ColumnIndex == 0)
            {
                if (comboBox1.SelectedIndex == 0)
                {
                    BackerySet BackerySet = db.BackerySet.Find(Grid[0, e.RowIndex].Value);
                    db.BackerySet.Remove(BackerySet);
                    db.SaveChanges();
                    BackerySetDataGridFill();
                }
                else if (comboBox1.SelectedIndex == 1)
                {
                    StaffSet StaffSet = db.StaffSet.Find(Grid[0, e.RowIndex].Value);
                    db.StaffSet.Remove(StaffSet);
                    db.SaveChanges();
                    StaffSetDataGridFill();
                }
                else if (comboBox1.SelectedIndex == 2)
                {
                    ShiftsSet ShiftsSet = db.ShiftsSet.Find(Grid[0, e.RowIndex].Value);
                    db.ShiftsSet.Remove(ShiftsSet);
                    db.SaveChanges();
                    ShiftsSetDataGridFill();
                }
                else if (comboBox1.SelectedIndex == 3)
                {
                    DeliveriesSet DeliveriesSet = db.DeliveriesSet.Find(Grid[0, e.RowIndex].Value);
                    db.DeliveriesSet.Remove(DeliveriesSet);
                    db.SaveChanges();
                    DeliveriesSetDataGridFill();
                }
            }
        }
Exemple #4
0
        private void Grid_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            BakeryEntities db = new BakeryEntities();

            if (checkBox1.Checked)
            {
                if (comboBox1.SelectedIndex == 0)
                {
                    if (e.ColumnIndex == 1)
                    {
                        BackerySet backerySet = db.BackerySet.Find(Grid[0, e.RowIndex].Value);
                        backerySet.adres = Grid[e.ColumnIndex, e.RowIndex].Value.ToString();
                        db.SaveChanges();
                        BackerySetDataGridFill();
                    }
                }
                else if (comboBox1.SelectedIndex == 1)
                {
                    if (e.ColumnIndex == 1)
                    {
                        StaffSet staffSet = db.StaffSet.Find(Grid[0, e.RowIndex].Value);
                        staffSet.Surname = Grid[e.ColumnIndex, e.RowIndex].Value.ToString();
                        db.SaveChanges();
                        StaffSetDataGridFill();
                    }
                    else if (e.ColumnIndex == 2)
                    {
                        StaffSet staffSet = db.StaffSet.Find(Grid[0, e.RowIndex].Value);
                        staffSet.name = Grid[e.ColumnIndex, e.RowIndex].Value.ToString();
                        db.SaveChanges();
                        StaffSetDataGridFill();
                    }
                    else if (e.ColumnIndex == 3)
                    {
                        StaffSet staffSet = db.StaffSet.Find(Grid[0, e.RowIndex].Value);
                        staffSet.patronymic = Grid[e.ColumnIndex, e.RowIndex].Value.ToString();
                        db.SaveChanges();
                        StaffSetDataGridFill();
                    }
                }
                else if (comboBox1.SelectedIndex == 3)
                {
                    if (e.ColumnIndex == 1)
                    {
                        DeliveriesSet deliveriesSet = db.DeliveriesSet.Find(Grid[0, e.RowIndex].Value);
                        deliveriesSet.adres = Grid[e.ColumnIndex, e.RowIndex].Value.ToString();
                        db.SaveChanges();
                        DeliveriesSetDataGridFill();
                    }
                    else if (e.ColumnIndex == 3)
                    {
                        DeliveriesSet deliveriesSet = db.DeliveriesSet.Find(Grid[0, e.RowIndex].Value);
                        deliveriesSet.Backery_Id = Convert.ToInt32(Grid[e.ColumnIndex, e.RowIndex].Value.ToString());
                        db.SaveChanges();
                        DeliveriesSetDataGridFill();
                    }
                    else if (e.ColumnIndex == 2)
                    {
                        DeliveriesSet deliveriesSet = db.DeliveriesSet.Find(Grid[0, e.RowIndex].Value);
                        deliveriesSet.numberOfCakes = Convert.ToInt16(Grid[e.ColumnIndex, e.RowIndex].Value.ToString());
                        db.SaveChanges();
                        DeliveriesSetDataGridFill();
                    }
                }
                else if (comboBox1.SelectedIndex == 2)
                {
                    if (e.ColumnIndex == 1)
                    {
                        ShiftsSet shifts = db.ShiftsSet.Find(Grid[0, e.RowIndex].Value);
                        shifts.Plan = Grid[e.ColumnIndex, e.RowIndex].Value.ToString();
                        db.SaveChanges();
                        ShiftsSetDataGridFill();
                    }
                    else if (e.ColumnIndex == 2)
                    {
                        ShiftsSet shifts = db.ShiftsSet.Find(Grid[0, e.RowIndex].Value);
                        shifts.Backery_Id = Convert.ToInt32(Grid[e.ColumnIndex, e.RowIndex].Value.ToString());
                        db.SaveChanges();
                        ShiftsSetDataGridFill();
                    }
                    else if (e.ColumnIndex == 3)
                    {
                        ShiftsSet shifts = db.ShiftsSet.Find(Grid[0, e.RowIndex].Value);
                        shifts.Staff_Id = Convert.ToInt32(Grid[e.ColumnIndex, e.RowIndex].Value.ToString());
                        db.SaveChanges();
                        ShiftsSetDataGridFill();
                    }
                }
            }
        }