Пример #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (gridSubsidiaryCompaniesRegion.CurrentRow != null)
     {
         var Row = gridSubsidiaryCompaniesRegion.CurrentRow.DataBoundItem as Subsidiary_companies_region;
         db.Subsidiary_companies_region.Remove(Row);
         db.SaveChanges();
     }
 }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime?_date_end      = null;
                int?     id_user_access = null;

                if (!not.Checked)
                {
                    _date_end = date_end.Value;
                }
                if (userAccess.Text != "")
                {
                    id_user_access = (int)userAccess.SelectedValue;
                }
                Employees addEmp = new Employees
                {
                    first_name     = first_name.Text,
                    middle_name    = middle_name.Text,
                    last_name      = last_name.Text,
                    birthday       = birthday.Value,
                    id_user_access = id_user_access,
                    position       = position.Text,
                    expiriens      = expiriens.Text,
                    date_begin     = date_begin.Value,
                    date_end       = _date_end,
                    id_subsidiary_companies_region = (int)subsidiary_companies_region.SelectedValue,
                    date_up = DateTime.Now
                };
                db.Employees.Add(addEmp);
                db.SaveChanges();
                refreshModel();
            }

            catch
            {
                MessageBox.Show("Заполните поля");
            }
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                User_access addAccess = new User_access
                {
                    login    = login.Text,
                    password = password.Text,
                    type     = type.Text,
                    status   = status.Text,
                    id_subsidiary_companies_region = this.id_region,
                    date_up = DateTime.Now
                };
                db.User_access.Add(addAccess);
                db.SaveChanges();
                refreshModel();
            }

            catch
            {
                MessageBox.Show("Заполните поля");
            }
        }