📄 login.aspx.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;
public partial class LoginPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if ( !Page.IsPostBack )
{
if (null == Session["IsLogin"])
return;
if (true == (bool)Session["IsLogin"])
Response.Redirect("Price_MainFrame.htm");
}
}
protected void Login_Authenticate(object sender, AuthenticateEventArgs e)
{
string strUsr = Login.UserName;
string strPwd = Login.Password;
DBConnector dbConn = new DBConnector();
DataSet dsUsrInfo = dbConn.Query("SELECT * FROM userInfo WHERE 用户名 LIKE '" + strUsr +"'");
string strPwdResult = dsUsrInfo.Tables[0].Rows[0]["密码"].ToString();
if (null == strPwdResult)
{
MessageBox.Show(this, "此用户不存在");
return;
}
if (strPwd == strPwdResult)
{
Session["UserID"] = strUsr;
Session["IsLogin"] = true;
int iAdmin = Convert.ToInt32( dsUsrInfo.Tables[0].Rows[0]["管理员"].ToString() );
Session["IsAdmin"] = (1 == iAdmin) ? true : false;
Session["RoleID"] = Convert.ToInt32(dsUsrInfo.Tables[0].Rows[0]["角色编号"].ToString());
// 系统参数设置
string strSQL_SysConfg = "SELECT * FROM [Option]";
DataSet dsSysConfg = dbConn.Query( strSQL_SysConfg );
// 是否提供零件名称列(0:不提供 1:提供)
Session["ProvideName"] = dsSysConfg.Tables[0].Rows[0]["ProvideName"].ToString();
// 使用的文件格式(1:用户定义格式 2:标准文件格式)
Session["FileFormat"] = dsSysConfg.Tables[0].Rows[0]["FileFormat"].ToString();
// 可查看的最大价格套数(1~6)
Session["PriceCount"] = dsSysConfg.Tables[0].Rows[0]["ViewPriceCount"].ToString();
// 重复零件导入规则(1:取最大值;2:取最小值;3:取平均值;4:用户指定)
Session["DuplicateComp"] = dsSysConfg.Tables[0].Rows[0]["DupComponet"].ToString();
// 超越价格范围导入规则(1:导入;2:不导入)
Session["OverLimit"] = dsSysConfg.Tables[0].Rows[0]["OverLimitPrice"].ToString();
// 未匹配零件处理规则(1:不处理;2:原厂价格;3:按幅度调节;4:用户指定)
Session["UmMatchedComp"] = dsSysConfg.Tables[0].Rows[0]["UmMatchedPrice"].ToString();
// 用户指定未匹配价格时是否必须完成
Session["NeedCompelte"] = dsSysConfg.Tables[0].Rows[0]["NeedComplete"].ToString();
// 是否发布未导入的车系价格(1:发布未导入的车系价格;2:不发布未导入的车系价格)
Session["PublishPrice"] = dsSysConfg.Tables[0].Rows[0]["PubPrice"].ToString();
Response.Redirect("Price_MainFrame.htm");
}
else
MessageBox.Show(this, "密码错误");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -