コード例 #1
0
ファイル: AdminLoginWindow.cs プロジェクト: PrinceWaichal/IMS
        private void AdminSignIn(object sender, EventArgs e)
        {
            //Do Validatation
            if (AdminID.Text == "")
            {
                MessageBox.Show("You have not entered Username");
                AdminID.Focus();
            }

            else if (AdminPass.Text == "")
            {
                MessageBox.Show("You have not entered Password");
                AdminPass.Focus();
            }

            else
            {
                try
                {
                    //Opening Connection
                    ServerInfo.MySQLConnect.Open();

                    //Creating objects
                    MySqlCommand MySQLCommand = new MySqlCommand();

                    //Connecting the Command
                    MySQLCommand.Connection = ServerInfo.MySQLConnect;

                    //Passing MySQL Statement
                    MySQLCommand.CommandText = "Select count(*) from UserMaster Where UserName = '******' " +
                                               "and UserPassword = '******' ";
                    MySQLCommand.ExecuteNonQuery();

                    MySqlDataAdapter MySQLDataAdapt = new MySqlDataAdapter(MySQLCommand);

                    //Creating a new Data Table
                    DataTable DatTable = new DataTable();

                    MySQLDataAdapt.Fill(DatTable);

                    int i = Convert.ToInt32(DatTable.Rows.Count.ToString());

                    if (i == 0)
                    {
                        MessageBox.Show("Wrong Input");
                    }
                    else
                    {
                        this.Hide();
                        _3___DataEntry.DataEntry_Activities dataEntry_Act = new _3___DataEntry.DataEntry_Activities();
                        dataEntry_Act.Show();
                    }
                    // MessageBox.Show("Successful Connection");
                }
                catch
                {
                    MessageBox.Show("Failed to Connect");
                }
            }
        }
コード例 #2
0
ファイル: Home.cs プロジェクト: parth281/sample
        private void changeAdminPasswordToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form c in this.MdiChildren)
            {
                c.Close();
            }
            AdminPass ap = new AdminPass();

            ap.MdiParent = this;
            ap.Show();
            groupBox1.Hide();
        }