Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            conn.con.Open();
            SqlCommand auth1 = new SqlCommand($"SELECT * FROM dbo.executor " +
                                              $"where [Login_executor] = '{textBox1.Text}' AND Password = '******'",
                                              conn.con);
            SqlCommand auth2 = new SqlCommand($"SELECT * FROM dbo.manager where " +
                                              $"[login_manager] = '{textBox1.Text}' AND password = '******'",
                                              conn.con);
            SqlDataReader read1 = auth1.ExecuteReader();

            if (read1.HasRows)
            {
                read1.Read();
                s.Add(read1[1].ToString());
                MessageBox.Show("Вы успешно авторизовались");
                read1.Close();
                conn coh = new conn();
                coh.dann();
                Form2 fm = new Form2();
                fm.Show();
                this.Hide();
            }
            else
            {
                read1.Close();
                SqlDataReader read2 = auth2.ExecuteReader();
                {
                    if (read2.HasRows)
                    {
                        read2.Read();
                        Form2.id = int.Parse(read2["id"].ToString());
                        MessageBox.Show("Вы успешно авторизовались");
                        read2.Close();
                        conn coh = new conn();
                        coh.dann();
                        Form2 fm = new Form2();
                        fm.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Попробуйте снова");
                        textBox1.Text = "";
                        textBox2.Text = "";
                    }
                }
            }
            conn.con.Close();
        }
Beispiel #2
0
        private void load()
        {
            conn SANECHINE = new conn();

            SANECHINE.dann();
            comboBox1.Items.Clear();
            comboBox2.Items.Clear();
            comboBox1.Items.Add("Создать");
            foreach (string s in Form1.s)
            {
                foreach (DataRow dr in conn.data.Tables[3].Rows)
                {
                    if (dr[1].ToString() == s)
                    {
                        comboBox1.Items.Add("Задача №" + dr[0].ToString());
                        SADAME.Add(int.Parse(dr[0].ToString()));
                    }
                }
            }
            foreach (string isp in Form1.s)
            {
                foreach (DataRow dr in conn.data.Tables[3].Rows)
                {
                    if (dr[1].ToString() == isp)
                    {
                        if (!comboBox2.Items.Contains(dr[8].ToString()))
                        {
                            comboBox2.Items.Add(dr[8].ToString());
                        }
                    }
                }
            }


            comboBox2.SelectedIndex = 0;
            comboBox1.SelectedIndex = 0;
        }