private void loginButton_Click(object sender, EventArgs e) { if (status != "Admin") { lf = new LoginForm(); if (lf.ShowDialog() == DialogResult.Yes) { this.setStatus("Admin", lf.login); } else { return; } } if (status == "Admin") { ap = new AdminPanel(this.currentLogin); this.Hide(); DialogResult dr = ap.ShowDialog(); if (dr == DialogResult.Cancel) { this.Close(); } else if (dr == DialogResult.Abort) { this.setStatus("Guest"); } cinemaCheckBox.Checked = timeCheckBox.Checked = dateCheckBox.Checked = genreCheckBox.Checked = false; this.Show(); } }
public Form1() { InitializeComponent(); DbProviderFactory DPF = DbProviderFactories.GetFactory(ConfigurationManager.AppSettings["database"]); this.cn = DPF.CreateConnection(); this.cn.ConnectionString = ConfigurationManager.AppSettings["connection_string"]; cmd = this.cn.CreateCommand(); this.A = DPF.CreateDataAdapter(); Connection.getInstance(cn, A); this.A.SelectCommand = cmd; ap = new AdminPanel(); if (!ap.isConnected) { this.Close(); } tableLayoutPanel3.BackColor = Color.LightGray; tableLayoutPanel5.BackColor = Color.LightGray; tableLayoutPanel6.BackColor = Color.White; this.StartPosition = FormStartPosition.CenterScreen; //this.setStatus("Guest"); this.setStatus("Admin"); this.BackColor = Color.GhostWhite; tableLayoutPanel4.BackColor = Color.White; hoursTextBox.MaxLength = 2; hoursTextBox.TextAlign = HorizontalAlignment.Center; minutesTextBox.MaxLength = 2; minutesTextBox.TextAlign = HorizontalAlignment.Center; resultListView.View = View.Details; resultListView.GridLines = true; resultListView.FullRowSelect = true; resultListView.Columns.Add("Номер сеанса", 55, HorizontalAlignment.Left); resultListView.Columns.Add("Фильм", 150, HorizontalAlignment.Left); resultListView.Columns.Add("Жанр", 130, HorizontalAlignment.Left); resultListView.Columns.Add("Длит.", 50, HorizontalAlignment.Left); resultListView.Columns.Add("Кинотеатр", 120, HorizontalAlignment.Left); resultListView.Columns.Add("Дата", 100, HorizontalAlignment.Left); resultListView.Columns.Add("Время", 100, HorizontalAlignment.Left); searchTextBox.MaxLength = 80; tableLayoutPanel10.BackgroundImage = Resource1.banner; tableLayoutPanel10.Click += TableLayoutPanel10_Click; dateTimePicker1.MinDate = DateTime.Now; }