コード例 #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "")
     {
         mDIP = (MDIParent1)this.MdiParent;
         if (mDIP.activeForm != null)
         {
             startMain = mDIP.activeForm.RichTextBox1.SelectionStart;
             if (ReplaceAll(mDIP.activeForm.RichTextBox1))
             {
                 MessageBox.Show(string.Format("Заменено {0} элементов", cntReplaced));
                 cntReplaced = 0;
             }
             else
             {
                 MessageBox.Show("Не найдено");
             }
         }
     }
 }
コード例 #2
0
ファイル: Lgin.cs プロジェクト: sajidmct21/LMS
        private void btnLogin_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection();

            con.ConnectionString = @"Data Source=SAJID-PC\SQLEXPRESS;Initial Catalog=Library_Management;Integrated Security=True;Pooling=False";
            con.Open();
            SqlCommand     cmd = new SqlCommand("select * from library_person where userName='******'and password='******'", con);
            SqlDataAdapter da  = new SqlDataAdapter(cmd);
            DataTable      dt  = new DataTable();

            da.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                MDIParent1 md = new MDIParent1();
                this.Hide();
                md.Show();
            }
            else
            {
                MessageBox.Show("Invalid Login please check username and password");
            }
            con.Close();
        }
コード例 #3
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (comboBox1.Text != "" && comboBox2.Text != "" && comboBox2.Text != "Hов слов или список")
     {
         MDIParent1 mDIP = (MDIParent1)this.MdiParent;
         Dictionary <string, Color> dict = mDIP.Samples[comboBox1.Text];
         if (dict.ContainsKey(comboBox2.Text))
         {
             if (label1.BackColor == Color.Black)
             {
                 if (MessageBox.Show("Установить цвет по-умолчанию", "default color", MessageBoxButtons.YesNo) == DialogResult.Yes)
                 {
                     dict.Remove(comboBox2.Text);
                 }
             }
             else
             {
                 dict[comboBox2.Text] = label1.BackColor;
             }
         }
         else
         {
             if (label1.BackColor != Color.Black)
             {
                 dict.Add(comboBox2.Text, label1.BackColor);
             }
             else
             {
                 MessageBox.Show("Выберите цвет");
             }
         }
     }
     else
     {
         MessageBox.Show("Не достаточно данных");
     }
 }
コード例 #4
0
        private void 帮助ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form m1 = new MDIParent1();

            m1.Show();
        }
コード例 #5
0
ファイル: Abrir1.cs プロジェクト: edsonaraujo1/JoinusRentaCar
 public Abrir1(MDIParent1 formulario)
 {
     this.formulario = formulario;
     this.formulario.HabilitarMenu(true);
     this.Close();
 }
コード例 #6
0
        private void Form2_Activated(object sender, EventArgs e)
        {
            MDIParent1 mDI = (MDIParent1)this.MdiParent;

            mDI.activeForm = this;
        }
コード例 #7
0
        private void performLogin()
        {
            if ((usernameTb.TextLength == 0) || (passwordTb.TextLength == 0))
            {
                MessageBox.Show("Please Fill All Blanks");
                return;
            }

            if (checkUserExists())
            {
                String password = passwordTb.Text;
                byte[] salt = shg.generateSalt(saltByteSize);
                byte[] hash = shg.generateHash(password, salt, hashingIterations, hashByteSize);

                String finalHash = Convert.ToBase64String(salt) + ":" + Convert.ToBase64String(hash);
                var dbPassword = getDBPassword();

                if (checkPasswordsMatch(password, dbPassword))
                {
                    MessageBox.Show("Access Granted");
                    String username = usernameTb.Text;
                    String query = "SELECT * FROM useraccounts WHERE Username='******'";
                    String[] userDetails = crud.getRecordRowDetails(stringconn, query, 4);
                    bool hasPermission = bool.Parse(userDetails[3]);
                    if (hasPermission)
                    {
                        MDIParent1 mdiparent = new MDIParent1();
                        mdiparent.Show();
                        this.Hide();
                    }
                }
                else
                {
                    MessageBox.Show("Access Denied");
                }
            }
            else
            {
                MessageBox.Show("User does not exist");
            }
        }
コード例 #8
0
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            MDIParent1 mDIP = (MDIParent1)this.MdiParent;

            label1.BackColor = mDIP.Samples[comboBox1.Text][comboBox2.Text];
        }