当前位置: 首页>>代码示例>>C#>>正文


C# Driver.Show方法代码示例

本文整理汇总了C#中Driver.Show方法的典型用法代码示例。如果您正苦于以下问题:C# Driver.Show方法的具体用法?C# Driver.Show怎么用?C# Driver.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Driver的用法示例。


在下文中一共展示了Driver.Show方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Login_Click

        private void Login_Click(object sender, RoutedEventArgs e)
        {

            NewConnection.connection();
            int online = 3, zer=0;
            scmd.Connection = Cn.con;
            
            scmd.CommandText = "Update Login set Online='" + zer + "'where Online='" + online + "'"; // update last online person to 0
            scmd.ExecuteNonQuery();
            
            scmd.CommandText = "Update Login set Online='" + online + "'where Username='" + UserNameTxt.Text + "'"; // update person that logged on to 3
            scmd.ExecuteNonQuery();

            SqlDataAdapter dataA = new SqlDataAdapter("Select Count(*) From Login where Username= '" + UserNameTxt.Text + "' and Password ='" + PasswordTxt.Text + "'", Cn.con);

            DataTable dt = new DataTable();
            dataA.Fill(dt);

            if (dt.Rows[0][0].ToString() == "1")
            {      
                string adRank = "Select Rank,Id From Login where Username='" + UserNameTxt.Text + "'"; // take UserRank in one line with username from DB 
                SqlCommand cmd = new SqlCommand(adRank, Cn.con);
                SqlDataReader rd = cmd.ExecuteReader();
                if (rd.HasRows)
                {
                    rd.Read();
                    var userRank = rd.GetInt32(0);
    
                    switch (userRank)           // opens a UI for ranks
                    {
                        case 1:
                            
                            AdminUI showAdminUI = new AdminUI();
                            showAdminUI.Show();

                            break;

                        case 2:
                            
                            Storekeeper showStorekeeper = new Storekeeper();
                            showStorekeeper.Show();

                            break;

                        case 3:
                            
                            Shop showShop = new Shop();                           
                            showShop.Show();
                            
                            break;

                        case 4:

                            Driver showDriver = new Driver();
                            showDriver.Show();

                            break;
                    }
                }
            }
            else
            {
                MessageBox.Show("Please check your User Name and Password");
            }
        }
开发者ID:recovery098,项目名称:Depot,代码行数:65,代码来源:MainWindow.xaml.cs


注:本文中的Driver.Show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。