⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 st_pagebase.cs

📁 本程序是一个宾馆管理系统
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
/// <summary>
/// ST_PageBase 的摘要说明
/// </summary>
public class ST_PageBase:System.Web.UI.Page
{
	public ST_PageBase()
	{
		//
		// TODO: 在此处添加构造函数逻辑
		//
	}
    private static string UrlSuffix
    {
        get
        {
            return HttpContext.Current.Request.Url.Host + HttpContext.Current.Request.ApplicationPath;///获得主机名或IP
        }
       
    }
    public static String UrlBase

    {
        get
        {
           // return @"http://" + HttpContext.Current.Request.Url.Host + ":2345" + HttpContext.Current.Request.ApplicationPath;
           
           return @"http://" + UrlSuffix;//返回文件位置
        }
    }
    public static bool CheckUser(string name, string pwd)
    {
        bool authenticated = false;       
        SqlConnection ST_myCon = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
        SqlCommand ST_mycommand = new SqlCommand();
        ST_mycommand.Connection = ST_myCon;
        try
        {
            ST_mycommand.CommandText = "ST_ValidateUser";
            ST_mycommand.CommandType = CommandType.StoredProcedure;
            SqlParameter Name = new SqlParameter("@name", SqlDbType.VarChar, 20);
            Name.Value = name;
            ST_mycommand.Parameters.Add(Name);

            SqlParameter PassWord = new SqlParameter("@pwd", SqlDbType.VarChar, 15);
            PassWord.Value = pwd;
            ST_mycommand.Parameters.Add(PassWord);

            SqlParameter IsValid = new SqlParameter("@isValid", SqlDbType.Int);
            IsValid.Direction = ParameterDirection.Output;
            ST_mycommand.Parameters.Add(IsValid);


            ST_myCon.Open();
            ST_mycommand.ExecuteNonQuery();
            if (((int)IsValid.Value) == 1)
            {
                authenticated = true;
            }

        }
        catch (Exception exc)
        {
            throw (exc);
        }
        finally
        {
            ST_myCon.Close();
        }
        return authenticated;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -