Exemplo n.º 1
0
        public FormGenre(Genres genreIn, Users sess)
        {
            this.sess  = sess;
            this.genre = genreIn;

            InitializeComponent();
            if (DBFunction.Session(sess))
            {
                if (genre == null)
                {
                    bAdd.Click  += bAdd_Click_Add;
                    bDel.Visible = false;
                    this.Text    = "Добавление жанра";
                }
                else
                {
                    tbName.Text        = genre.Name;
                    tbDescription.Text = genre.Description;
                    str         = genre.Name;
                    bAdd.Click += bAdd_Click_Edit;
                    this.Text   = "Редактирование жанра";
                    bAdd.Text   = "Изменить";
                }
            }
            else
            {
                MessageBox.Show("Ай-ай");
                FormAutorization formAuth = new FormAutorization();
                formAuth.Show();
                formAuth.Closed += (s, Args) => this.Close();
                this.Hide();
            }
        }
Exemplo n.º 2
0
 public FormAuthor(Authors authorIn, Users sess)
 {
     this.sess   = sess;
     this.author = authorIn;
     InitializeComponent();
     if (DBFunction.Session(sess))
     {
         if (authorIn == null)
         {
             bAdd.Click  += bClick_Add;
             bDel.Visible = false;
             this.Text    = "Добавление автора";
         }
         else
         {
             tbName.Text    = author.Name;
             dateBorn.Value = author.Born;
             dateDied.Value = author.Died;
             str            = author.Name;
             bAdd.Click    += bClick_Edit;
             this.Text      = "Редактирование автора";
             bAdd.Text      = "Изменить";
         }
     }
     else
     {
         MessageBox.Show("Ай-ай");
         FormAutorization formAuth = new FormAutorization();
         formAuth.Show();
         formAuth.Closed += (s, Args) => this.Close();
         this.Hide();
     }
 }
Exemplo n.º 3
0
        //
        //ВЫХОД
        //
        private void bExit_Click(object sender, EventArgs e)
        {
            MessageBoxButtons msb     = MessageBoxButtons.YesNo;
            String            message = "Вы действительно хотите выйти?";
            String            caption = "Выход";

            if (MessageBox.Show(message, caption, msb) == DialogResult.Yes)
            {
                FormAutorization formAuth = new FormAutorization();
                formAuth.Show();
                formAuth.Closed += (s, Args) => this.Close();
                this.Hide();
            }
        }
Exemplo n.º 4
0
 public FormGenreList(Users sess)
 {
     this.sess = sess;
     TabCon    = new TableContext();
     InitializeComponent();
     if (DBFunction.Session(sess))
     {
         TabCon.Genres.Load();
         dGVGenreList.DataSource = TabCon.Genres.Local.ToBindingList();
         bDel.Visible            = false;
     }
     else
     {
         MessageBox.Show("Ай-ай");
         FormAutorization formAuth = new FormAutorization();
         formAuth.Show();
         formAuth.Closed += (s, Args) => this.Close();
         this.Hide();
     }
 }
Exemplo n.º 5
0
        public FormMain(Users sess)
        {
            this.sess = sess;
            InitializeComponent();

            if (DBFunction.Session(sess))
            {
                db = new TableContext();

                fillchbox();
                bPicSbros_Click(null, null);

                dtPicker.Format       = DateTimePickerFormat.Custom;
                dtPicker.CustomFormat = "yyyy";
                dtPicker.ShowUpDown   = true;

                switch (sess.Position.Position)
                {
                case "Администратор":
                    db.Pictures.Include("Status").Load();
                    dGVPicturesList.DataSource = db.Pictures.Local.ToBindingList();
                    dGVPicturesList.Columns[4].DefaultCellStyle.Format = "yyyy";
                    db.Expositions.Load();
                    dGVExpositionList.DataSource = db.Expositions.Local.ToBindingList();
                    CbExposition_Refresh();
                    cbExposition_SelectionChangeCommitted(null, null);
                    db.Users.Include("Position").Load();
                    db.Users.Load();
                    dGVUserList.DataSource = db.Users.Local.ToBindingList();
                    break;

                case "Реставратор":
                    db.Pictures.Include("Status").Load();
                    dGVPicturesList.DataSource = db.Pictures.Local.ToBindingList();
                    dGVPicturesList.Columns[4].DefaultCellStyle.Format = "yyyy";

                    tabControl3.TabPages.Remove(tabPageExpToPic);
                    tabControl3.TabPages.Remove(tabPageExp);
                    tabControl3.TabPages.Remove(tabPageUser);
                    bGenre.Visible = false;
                    break;

                case "Помошник администратора":
                    db.Pictures.Include("Status").Load();
                    dGVPicturesList.DataSource = db.Pictures.Local.ToBindingList();
                    dGVPicturesList.Columns[4].DefaultCellStyle.Format = "yyyy";
                    db.Expositions.Load();
                    dGVExpositionList.DataSource = db.Expositions.Local.ToBindingList();
                    CbExposition_Refresh();
                    cbExposition_SelectionChangeCommitted(null, null);
                    break;

                case "Директор":
                    db.Pictures.Include("Status").Load();
                    dGVPicturesList.DataSource = db.Pictures.Local.ToBindingList();
                    dGVPicturesList.Columns[4].DefaultCellStyle.Format = "yyyy";
                    tabControl3.TabPages.Remove(tabPageExpToPic);
                    tabControl3.TabPages.Remove(tabPageExp);
                    tabControl3.TabPages.Remove(tabPageUser);
                    bGenre.Visible = false;
                    break;

                default:
                    Console.WriteLine("Ой-ой");
                    break;
                }
            }
            else
            {
                MessageBox.Show("Ай-ай");
                FormAutorization formAuth = new FormAutorization();
                formAuth.Show();
                formAuth.Closed += (s, Args) => this.Close();
                this.Hide();
            }
        }