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


C# DB.CleanUp方法代码示例

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


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

示例1: btnLogin_Click

        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtUsername.Text.Trim().Length <= 0)
            {
                MessageBox.Show("Please enter a valid username.");
                txtUsername.Focus();
                return;
            }
            else if (txtPassword.Text.Trim().Length <= 0)
            {
                MessageBox.Show("Please enter a valid password.");
                txtPassword.Focus();
                return;
            }
            else
            {
                int UserID = 0;
                DB db = new DB();
                try
                {
                    db.AddParam("@Username", txtUsername.Text.Trim());
                    db.AddParam("@Password", BMan_Encryption.EncryptPassword(txtPassword.Text.Trim(), ConfigurationManager.AppSettings["EncKey"]));
                    DataTable dtUser = db.SQLResults("usp_Login");
                    if (dtUser.Rows.Count > 0)
                    {
                        UserID = Convert.ToInt32(dtUser.Rows[0]["UserID"]);
                    }
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "Login.btnLogin_Click");
                }
                finally
                {
                    db.CleanUp();
                }

                if (UserID > 0)
                {
                    Menu m = new Menu(UserID);
                    m.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Login or Password invalid. Please try again.");
                    txtPassword.Text = "";
                    txtPassword.Focus();
                    return;
                }
            }
        }
开发者ID:brneff,项目名称:IndianaWhiskey,代码行数:52,代码来源:Login.cs

示例2: GetUserName

        private string GetUserName(int userID)
        {
            string strUserName = "";

            DB db = new DB();
            db.AddParam("@UserID", userID);
            DataTable dt = db.SQLResults("usp_UserNameGet");
            if (dt.Rows.Count >= 1 && dt.Rows[0]["UserName"] != null && dt.Rows[0]["UserName"] != DBNull.Value)
                strUserName = dt.Rows[0]["UserName"].ToString();
            db.CleanUp();

            return strUserName;
        }
开发者ID:brneff,项目名称:IndianaWhiskey,代码行数:13,代码来源:PageHeader.cs

示例3: btnSave_Click

 private void btnSave_Click(object sender, EventArgs e)
 {
     if (txtFirstName.Text.Trim().Length <= 0)
     {
         MessageBox.Show("Please enter a first name.");
         txtFirstName.Focus();
         return;
     }
     else if (txtLastName.Text.Trim().Length <= 0)
     {
         MessageBox.Show("Please enter a last name.");
         txtLastName.Focus();
         return;
     }
     else if (txtUsername.Text.Trim().Length <= 0)
     {
         MessageBox.Show("Please enter a username.");
         txtUsername.Focus();
         return;
     }
     else if (txtPassword.Text.Trim().Length <= 0)
     {
         MessageBox.Show("Please enter a password.");
         txtPassword.Focus();
         return;
     }
     else if (txtPasswordConfirm.Text.Trim().Length <= 0)
     {
         MessageBox.Show("Please confirm your password.");
         txtPasswordConfirm.Focus();
         return;
     }
     else if (txtPassword.Text.Trim() != txtPasswordConfirm.Text.Trim())
     {
         MessageBox.Show("Passwords do not match. Please try again.");
         txtPassword.Text = "";
         txtPasswordConfirm.Text = "";
         txtPassword.Focus();
         return;
     }
     else if (cboUserType.SelectedIndex < 0)
     {
         MessageBox.Show("Please select a user type.");
         cboUserType.Focus();
         return;
     }
     else
     {
         UserID = 0;
         DB db = new DB();
         try
         {
             db.AddParam("@FirstName", txtFirstName.Text.Trim());
             db.AddParam("@LastName", txtLastName.Text.Trim());
             db.AddParam("@Username", txtUsername.Text.Trim());
             db.AddParam("@Password", BMan_Encryption.EncryptPassword(txtPassword.Text.Trim(), ConfigurationManager.AppSettings["EncKey"]));
             db.AddParam("@UserTypeID", cboUserType.SelectedValue);
             DataTable dtUser = db.SQLResults("usp_UserAdd");
             if (dtUser.Rows.Count > 0)
             {
                 UserID = Convert.ToInt32(dtUser.Rows[0]["UserID"]);
             }
         }
         catch (Exception ex)
         {
             Common.LogError(ex, "UserMaintenance.btnSave_Click");
             UserID = 0;
         }
         finally
         {
             db.CleanUp();
         }
         if (UserID > 0)
         {
             Menu m = new Menu(UserID);
             m.Show();
             this.Hide();
         }
         else if (UserID == -1)
         {
             MessageBox.Show("Username already exists. Please enter a different one.");
             txtUsername.Focus();
             return;
         }
         else
         {
             MessageBox.Show("Error adding user. Please try again.");
             return;
         }
     }
 }
开发者ID:brneff,项目名称:IndianaWhiskey,代码行数:91,代码来源:UserMaintenance.cs

示例4: UserMaintenance_Load

 private void UserMaintenance_Load(object sender, EventArgs e)
 {
     DB db = new DB();
     DataTable dtUT = db.SQLResults("usp_UserTypeList");
     cboUserType.DataSource = dtUT;
     cboUserType.DisplayMember = "Description";
     cboUserType.ValueMember = "UserTypeID";
     db.CleanUp();
 }
开发者ID:brneff,项目名称:IndianaWhiskey,代码行数:9,代码来源:UserMaintenance.cs


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