public bool Login(string userID, string pwd) { try { bool OK = false; UserStrategyBuilder sb = new UserStrategyBuilder(); sb.AddStrategy(new Strategy(UserStrategyName.UserID, userID)); string sql = sb.BuildMainQueryString(); Rms.ORMap.QueryAgent qa = new QueryAgent(); EntityData entity = qa.FillEntityData("SystemUser", sql); qa.Dispose(); string workNO = ""; if (!entity.HasRecord()) { } else { string RealPwd = entity.GetString("Password"); if (RealPwd != pwd) { OK = false; } else { int status = entity.GetInt("Status"); // 0-正常,1 禁用 if (status == 0) { string userCode = entity.GetString("UserCode"); RmsPM.Web.User user = new RmsPM.Web.User(userCode); // user.ResetUser("P1010"); Session["User"] = user; workNO = user.WorkNO; OK = true; /***************************************************************/ } } } entity.Dispose(); if (OK) { //记录最后操作时间 Session["LastOperTime"] = DateTime.Now; } return(OK); } catch (Exception ex) { RmsPM.Web.ApplicationLog.WriteLog(this.ToString(), ex, "用户登录失败"); return(false); } }
protected void Page_Load(object sender, EventArgs e) { SqlDataSource1.ConnectionString = SqlHelper.DBConnString; SqlDataSource1.SelectParameters["BiddingCode"].DefaultValue = this.BiddingCode; SqlDataSource1.DataBind(); if (!this.IsPostBack) { if ((Session["User"] == null) && (ConfigurationSettings.AppSettings["IsDebug"] == "1") && (ConfigurationSettings.AppSettings["DebugUser"] != "")) { Session["User"] = new RmsPM.Web.User(ConfigurationSettings.AppSettings["DebugUser"]); } if (Session["User"] != null) { this.user = (User)Session["User"]; this.btnAdd.Visible = this.user.HasRight("210201"); this.btnApprove.Visible = this.user.HasRight("210202"); this.btnCancelApprove.Visible = this.user.HasRight("210203"); this.btnRemove.Visible = this.user.HasRight("210204"); } } }