コード例 #1
0
        private void login_button_Click(object sender, RoutedEventArgs e)
        {
            string        connectionstring = @"Data Source=SHUVRO\SQLEXPRESS;Initial Catalog=library;Integrated Security=True";
            SqlConnection sqlcon           = new SqlConnection(connectionstring);

            sqlcon.Open();
            string        commandstring = "select user_id,password from library";
            SqlCommand    sqlcmd        = new SqlCommand(commandstring, sqlcon);
            SqlDataReader read          = sqlcmd.ExecuteReader();
            int           i             = 0;

            if (txt_login_user.Text == "admin" && pass_login_password.Password == "admin")
            {
                i = 1;
                admin_panel ap = new admin_panel();
                ap.Show();
                this.Close();
            }
            while (read.Read())
            {
                if (read[0].ToString() == txt_login_user.Text && read[1].ToString() == pass_login_password.Password)
                {
                    i = 1;
                    user_panel up = new user_panel();
                    my_books   mb = new my_books();
                    string     ab;
                    ab = txt_login_user.Text;
                    up.up_loggd_user.Text = ab;
                    up.Show();
                    this.Close();
                }
            }
            if (i == 0)
            {
                MessageBox.Show("Incorrect data", "Error");
            }

            sqlcon.Close();
        }
コード例 #2
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Admin_Panel = ((Library_Management.admin_panel)(target));
                return;

            case 2:
                this.admin_menu = ((System.Windows.Controls.Menu)(target));
                return;

            case 3:

            #line 25 "..\..\..\admin\admin_panel.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.student_page);

            #line default
            #line hidden
                return;

            case 4:

            #line 27 "..\..\..\admin\admin_panel.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.search_click);

            #line default
            #line hidden
                return;

            case 5:

            #line 29 "..\..\..\admin\admin_panel.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.add_student_page);

            #line default
            #line hidden
                return;

            case 6:

            #line 31 "..\..\..\admin\admin_panel.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.student_req);

            #line default
            #line hidden
                return;

            case 7:

            #line 36 "..\..\..\admin\admin_panel.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.view_books);

            #line default
            #line hidden
                return;

            case 8:

            #line 38 "..\..\..\admin\admin_panel.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.add_book);

            #line default
            #line hidden
                return;

            case 9:

            #line 40 "..\..\..\admin\admin_panel.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.lendBook);

            #line default
            #line hidden
                return;

            case 10:

            #line 44 "..\..\..\admin\admin_panel.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.help);

            #line default
            #line hidden
                return;

            case 11:

            #line 46 "..\..\..\admin\admin_panel.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.abt_us);

            #line default
            #line hidden
                return;

            case 12:

            #line 48 "..\..\..\admin\admin_panel.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.logout_click);

            #line default
            #line hidden
                return;

            case 13:
                this.frame = ((System.Windows.Controls.Frame)(target));
                return;
            }
            this._contentLoaded = true;
        }