Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
        {
            SqlDb.Dcms_User user = new SqlDb.Dcms_User();
            UpdateModelByForm(user, Request.Form);
            IQuery query = session.GetQuery(user).Where(SqlDb.Dcms_User._USER_NAME_.EqulesExp(Request.Form["User_Name"]));
            List <SqlDb.Dcms_User> userList = query.GetList <SqlDb.Dcms_User>();
            if (userList.Count == 1)
            {
                //if (userList[0].User_Email != "")
//                {
//                    SendeMail(userList[0].User_PassWord);
//                    Jscript.AlertAndBack("邮件已发送,请及时查收.");
//                }
                if (userList[0].User_Name == user.User_Name && userList[0].User_Email == user.User_Email)
                {
                    Jscript.AlertAndBack("您的密码是: " + userList[0].User_PassWord + " 请妥善保管!");
                }
                else
                {
                    Jscript.AlertAndBack("身份验证错误!");
                }
            }
            else
            {
                Jscript.AlertAndBack("用户名不存在.");
            }
        }
    }
Пример #2
0
 /// <summary>
 /// 编辑一条数据
 /// </summary>
 /// <returns>"true"/"false"</returns>
 private string doUpdate()
 {
     try
     {
         //int productsid = IRequest.GetQueryInt("productsid", 0);
         int userid = IRequest.GetFormInt("User_Id", 0);
         if (userid > 0)
         {
             using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
             {
                 SqlDb.Dcms_User user = new SqlDb.Dcms_User();
                 user.User_Id = userid;
                 IQuery query = session.GetQuery(user).Where(SqlDb.Dcms_User._USER_ID_.EqulesExp());
                 IList <SqlDb.Dcms_User> userlist = query.GetList <SqlDb.Dcms_User>();
                 if (userlist.Count > 0)
                 {
                     user = userlist[0];
                     UpdateModelByForm(user, Request.Form);
                     session.Update(user);
                 }
             }
         }
         return("true");
     }
     catch
     {
         return("false");
     }
 }
Пример #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     string successMessage = IRequest.GetFormString("successMessage");
     string successUrl = IRequest.GetFormString("successUrl");
     string errorMessage = IRequest.GetFormString("errorMessage");
     int UId = Utils.StrToInt(SessionHelper.Get("UserId"), 0);
     if (UId <= 0)
     {
         Jscript.AlertAndBack("登录超时");
         Response.End();
     }
     try
     {
         using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
         {
             SqlDb.Dcms_User user = new SqlDb.Dcms_User();
             int UserId = Utils.StrToInt(SessionHelper.Get("UserId"), 0);
             user.User_Id = UserId;
             IQuery query = session.GetQuery(user).Where(SqlDb.Dcms_User._USER_ID_.EqulesExp());
             List<SqlDb.Dcms_User> userList = query.GetList<SqlDb.Dcms_User>();
             if (userList.Count == 1)
             {
                 user = userList[0];
                 UpdateModelByForm(user, Request.Form);
                 user.User_PassWord=IRequest.GetFormString("Password2");
                 session.Update(user);
                 Jscript.AlertAndRedirect(successMessage, successUrl);
             }
           }
     }
         catch
         {
             Jscript.AlertAndBack(errorMessage);
         }
 }
Пример #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
     {
         SqlDb.Dcms_User user = new SqlDb.Dcms_User();
         UpdateModelByForm(user, Request.Form);
         IQuery query = session.GetQuery(user).Where(SqlDb.Dcms_User._USER_NAME_.EqulesExp(Request.Form["User_Name"]));
         List<SqlDb.Dcms_User> userList = query.GetList<SqlDb.Dcms_User>();
         if (userList.Count == 1)
         {
             //if (userList[0].User_Email != "")
     //                {
     //                    SendeMail(userList[0].User_PassWord);
     //                    Jscript.AlertAndBack("邮件已发送,请及时查收.");
     //                }
             if(userList[0].User_Name==user.User_Name&&userList[0].User_Email==user.User_Email)
             {
              Jscript.AlertAndBack("您的密码是: "+userList[0].User_PassWord+" 请妥善保管!");
             }
             else
             {
              Jscript.AlertAndBack("身份验证错误!");
             }
         }
         else
         {
             Jscript.AlertAndBack("用户名不存在.");
         }
     }
 }
Пример #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string successMessage   = IRequest.GetFormString("successMessage");
        string successUrl       = IRequest.GetFormString("successUrl");
        string errorMessage     = IRequest.GetFormString("errorMessage");
        string errorCodeMessage = IRequest.GetFormString("errorCodeMessage");
        bool   hasValidCode     = false;
        string ValidCode        = string.Empty;

        for (int i = 0; i < Request.Form.Keys.Count; i++)
        {
            if (Request.Form.Keys[i].ToLower() == "validcode")
            {
                hasValidCode = true;
                ValidCode    = IRequest.GetFormString("ValidCode");
                break;
            }
        }

        if ((hasValidCode) && (ValidCode != Convert.ToString(SessionHelper.Get("ValidCode"))))
        {
            Jscript.AlertAndBack(errorCodeMessage);
            Response.End();
        }
        if ((IRequest.GetFormString("User_Name").Trim().Length <= 1) || (IRequest.GetFormString("Password1").Trim().Length < 6) || (IRequest.GetFormString("Password1") != IRequest.GetFormString("Password2")))
        {
            Jscript.AlertAndBack(errorMessage);
        }
        else
        {
            try
            {
                using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
                {
                    SqlDb.Dcms_User user = new SqlDb.Dcms_User();
                    UpdateModelByForm(user, Request.Form);
                    user.User_RegTime   = DateTime.Now;
                    user.User_InVisible = 1;
                    user.User_PassWord  = IRequest.GetFormString("Password1").Trim();
                    user.User_Gender    = IRequest.GetFormString("User_Gender").Trim();
                    user.User_RegIp     = Utility.GetIPAddress();
                    user.User_LastIp    = Utility.GetIPAddress();
                    user.User_LastTime  = DateTime.Now;
                    user.User_BirthDay  = DateTime.Now;
                    session.Create(user);
                    SessionHelper.Add("UserId", session.ExecuteScalar("select max(user_id) from dcms_user"));
                    Utils.WriteCookie("UserId", session.ExecuteScalar("select max(user_id) from dcms_user"));
                    SessionHelper.Add("UserName", IRequest.GetFormString("User_Name").Trim());
                    Utils.WriteCookie("UserNmae", IRequest.GetFormString("User_Name").Trim());
                }
                Jscript.AlertAndRedirect(successMessage, successUrl);
            }
            catch
            {
                Jscript.AlertAndBack(errorMessage);
            }
        }
    }
Пример #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string successMessage = IRequest.GetFormString("successMessage");
        string successUrl = IRequest.GetFormString("successUrl");
        string errorMessage = IRequest.GetFormString("errorMessage");
        string errorCodeMessage = IRequest.GetFormString("errorCodeMessage");
        bool hasValidCode = false;
        string ValidCode = string.Empty;
        for (int i = 0; i < Request.Form.Keys.Count; i++)
        {
            if (Request.Form.Keys[i].ToLower() == "validcode")
            {
                hasValidCode = true;
                ValidCode = IRequest.GetFormString("ValidCode");
                break;
            }
        }

        if ((hasValidCode) && (ValidCode != Convert.ToString(SessionHelper.Get("ValidCode"))))
        {
            Jscript.AlertAndBack(errorCodeMessage);
            Response.End();
        }
        if ((IRequest.GetFormString("User_Name").Trim().Length <= 1) || (IRequest.GetFormString("Password1").Trim().Length <6) || (IRequest.GetFormString("Password1")!=IRequest.GetFormString("Password2")))
        {
            Jscript.AlertAndBack(errorMessage);
        }
        else
        {
            try
            {
                using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
                {
                    SqlDb.Dcms_User user = new SqlDb.Dcms_User();
                    UpdateModelByForm(user, Request.Form);
                    user.User_RegTime = DateTime.Now;
                    user.User_InVisible = 1;
                    user.User_PassWord = IRequest.GetFormString("Password1").Trim();
                    user.User_Gender = IRequest.GetFormString("User_Gender").Trim();
                    user.User_RegIp = Utility.GetIPAddress();
                    user.User_LastIp = Utility.GetIPAddress();
                    user.User_LastTime = DateTime.Now;
                    user.User_BirthDay = DateTime.Now;
                    session.Create(user);
                    SessionHelper.Add("UserId",session.ExecuteScalar("select max(user_id) from dcms_user"));
                    Utils.WriteCookie("UserId", session.ExecuteScalar("select max(user_id) from dcms_user"));
                    SessionHelper.Add("UserName", IRequest.GetFormString("User_Name").Trim());
                    Utils.WriteCookie("UserNmae", IRequest.GetFormString("User_Name").Trim());
                }
                Jscript.AlertAndRedirect(successMessage, successUrl);
            }
            catch
            {
                Jscript.AlertAndBack(errorMessage);
            }
        }
    }
Пример #7
0
        /// <summary>
        /// 按页取数据
        /// </summary>
        /// <returns>json</returns>
        private string doSelect()
        {
            StringBuilder sb = new StringBuilder();
            //取Grid提交来的数据开始
            //int uploadId = IRequest.GetQueryInt("id", 0);
            int    rp      = IRequest.GetFormInt("rp", 10);
            int    page    = IRequest.GetFormInt("page", 1);
            string keyword = Utils.chkSQL(IRequest.GetFormString("query"));
            string qtype   = IRequest.GetFormString("qtype");
            int    cateid  = IRequest.GetQueryInt("cateid", 0);

            //string path = getUploadPathByUploadId(uploadId).Replace("\\", "/");
            //取Grid提交来的数据结束
            using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
            {
                SqlDb.Dcms_User user = new SqlDb.Dcms_User();
                //创建查询
                IQuery query = session.GetQuery(user);

                if (keyword.Length > 0)
                {
                    query.Where(SqlDb.Dcms_User._USER_NAME_.Like('%', keyword, '%'));
                }
                query.OrderBy(SqlDb.Dcms_User._USER_ID_, Direction.DESC);
                //取总记录
                int totalCount = query.Count();
                List <SqlDb.Dcms_User> userList = query.GetList <SqlDb.Dcms_User>(page, rp);
                //Json格式
                sb.Append("{\n");
                sb.Append("\"page\":" + page.ToString() + ",\n");
                sb.Append("\"total\":" + totalCount.ToString() + ",\n");
                sb.Append("\"rows\": [\n");
                for (int i = 0; i < userList.Count; i++)
                {
                    sb.Append("{");
                    sb.Append(string.Format("\"id\":\"{0}\",\"cell\":[\"{1}\",\"{2}\",\"{3}\",\"{4}\"]", userList[i].User_Id.ToString(), userList[i].User_Id.ToString(), FormatJsonData(userList[i].User_Name.ToString()), FormatJsonData(userList[i].User_Email), userList[i].User_RegTime.ToString("yyyy-MM-dd")));
                    if ((i + 1) == userList.Count)
                    {
                        sb.Append("}\n");
                    }
                    else
                    {
                        sb.Append("},\n");
                    }
                }
                sb.Append("]\n");
                sb.Append("}");
            }
            return(sb.ToString());
        }
Пример #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string successMessage = IRequest.GetFormString("successMessage");
        string successUrl     = IRequest.GetFormString("successUrl");
        string errorMessage   = IRequest.GetFormString("errorMessage");
        int    UId            = Utils.StrToInt(SessionHelper.Get("UserId"), 0);

        if (UId <= 0)
        {
            Jscript.AlertAndBack("登录超时");
            return;
        }
        try
        {
            using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
            {
                SqlDb.Dcms_User user = new SqlDb.Dcms_User();
                user.User_Id = UId;
                string UserPwd  = IRequest.GetFormString("Password1").Trim();
                string UserPwd1 = IRequest.GetFormString("Password2").Trim();
                if (!UserPwd.Equals(UserPwd1))
                {
                    Jscript.AlertAndBack("二次输入的密码不相同.");
                    return;
                }

                IQuery query = session.GetQuery(user).Where(SqlDb.Dcms_User._USER_ID_.EqulesExp());
                List <SqlDb.Dcms_User> userList = query.GetList <SqlDb.Dcms_User>();
                if (userList.Count == 1)
                {
                    user = userList[0];
                    user.User_PassWord = UserPwd;
                    session.Update(user);
                    Jscript.AlertAndRedirect(successMessage, successUrl);
                }
                else
                {
                    Jscript.AlertAndBack("修改失败.");
                }
            }
        }
        catch
        {
            Jscript.AlertAndBack(errorMessage);
        }
    }
Пример #9
0
 /// <summary>
 /// 插入一条数据
 /// </summary>
 /// <returns>"true"/"false"</returns>
 private string doInsert()
 {
     try
     {
         using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
         {
             SqlDb.Dcms_User user = new SqlDb.Dcms_User();
             user.User_RegTime = DateTime.Now;
             UpdateModelByForm(user, Request.Form);
             session.Create(user);
         }
         return("true");
     }
     catch
     {
         return("false");
     }
 }
Пример #10
0
 /// <summary>
 /// 编辑一条数据
 /// </summary>
 /// <returns>"true"/"false"</returns>
 private string doUpdate()
 {
     try
     {
         //int productsid = IRequest.GetQueryInt("productsid", 0);
         int userid = IRequest.GetFormInt("User_Id", 0);
         if (userid > 0)
         {
             using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
             {
                 SqlDb.Dcms_User user = new SqlDb.Dcms_User();
                 user.User_Id = userid;
                 IQuery query = session.GetQuery(user).Where(SqlDb.Dcms_User._USER_ID_.EqulesExp());
                 IList<SqlDb.Dcms_User> userlist = query.GetList<SqlDb.Dcms_User>();
                 if (userlist.Count > 0)
                 {
                     user = userlist[0];
                     UpdateModelByForm(user, Request.Form);
                     session.Update(user);
                 }
             }
         }
         return "true";
     }
     catch
     {
         return "false";
     }
 }
Пример #11
0
        /// <summary>
        /// 按页取数据
        /// </summary>
        /// <returns>json</returns>
        private string doSelect()
        {
            StringBuilder sb = new StringBuilder();
            //取Grid提交来的数据开始
            //int uploadId = IRequest.GetQueryInt("id", 0);
            int rp = IRequest.GetFormInt("rp", 10);
            int page = IRequest.GetFormInt("page", 1);
            string keyword = Utils.chkSQL(IRequest.GetFormString("query"));
            string qtype = IRequest.GetFormString("qtype");
            int cateid = IRequest.GetQueryInt("cateid", 0);
            //string path = getUploadPathByUploadId(uploadId).Replace("\\", "/");
            //取Grid提交来的数据结束
            using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
            {
                SqlDb.Dcms_User user = new SqlDb.Dcms_User();
                //创建查询
                IQuery query = session.GetQuery(user);

                if (keyword.Length > 0)
                {
                    query.Where(SqlDb.Dcms_User._USER_NAME_.Like('%', keyword, '%'));
                }
                query.OrderBy(SqlDb.Dcms_User._USER_ID_, Direction.DESC);
                //取总记录
                int totalCount = query.Count();
                List<SqlDb.Dcms_User> userList = query.GetList<SqlDb.Dcms_User>(page, rp);
                //Json格式
                sb.Append("{\n");
                sb.Append("\"page\":" + page.ToString() + ",\n");
                sb.Append("\"total\":" + totalCount.ToString() + ",\n");
                sb.Append("\"rows\": [\n");
                for (int i = 0; i < userList.Count; i++)
                {
                    sb.Append("{");
                    sb.Append(string.Format("\"id\":\"{0}\",\"cell\":[\"{1}\",\"{2}\",\"{3}\",\"{4}\"]", userList[i].User_Id.ToString(), userList[i].User_Id.ToString(), FormatJsonData(userList[i].User_Name.ToString()), FormatJsonData(userList[i].User_Email), userList[i].User_RegTime.ToString("yyyy-MM-dd")));
                    if ((i + 1) == userList.Count)
                    {
                        sb.Append("}\n");
                    }
                    else
                    {
                        sb.Append("},\n");
                    }
                }
                sb.Append("]\n");
                sb.Append("}");
            }
            return sb.ToString();
        }
Пример #12
0
 /// <summary>
 /// 插入一条数据
 /// </summary>
 /// <returns>"true"/"false"</returns>
 private string doInsert()
 {
     try
     {
         using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
         {
             SqlDb.Dcms_User user = new SqlDb.Dcms_User();
             user.User_RegTime = DateTime.Now;
             UpdateModelByForm(user, Request.Form);
             session.Create(user);
         }
         return "true";
     }
     catch
     {
         return "false";
     }
 }
Пример #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            iframeid = IRequest.GetQueryString("iframeid");
            int CateId = IRequest.GetQueryInt("cateid", 0);
            int Id = IRequest.GetQueryInt("id", -1);
            string cateName = IRequest.GetQueryString("catename");
            StringBuilder sb = new StringBuilder();
            sb.Append("<select name=\"User_LevelKey\" id=\"User_LevelKey\" style=\"width:200px\">\n");
            using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
            {
                SqlDb.Dcms_UserLevel userlevel = new SqlDb.Dcms_UserLevel();
                IQuery query = session.GetQuery(userlevel);
                List<SqlDb.Dcms_UserLevel> userlevelList = query.GetList<SqlDb.Dcms_UserLevel>();
                for (int i = 0; i < userlevelList.Count; i++)
                {
                    sb.Append(string.Format("<option value=\"{0}\">{1}</option>\n", Convert.ToString(userlevelList[i].UserLevel_Key), Convert.ToString(userlevelList[i].UserLevel_Title)));
                }

            }
            sb.Append("</select>");
            lit_UserLevel.Text = sb.ToString();
            if (Id > 0)
            {
                using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
                {
                    SqlDb.Dcms_User user = new SqlDb.Dcms_User();
                    user.User_Id = Id;
                    IQuery query = session.GetQuery(user).Where(SqlDb.Dcms_User._USER_ID_.EqulesExp());
                    List<SqlDb.Dcms_User> userList = query.GetList<SqlDb.Dcms_User>();
                    if (userList.Count > 0)
                    {
                        cateName = userList[0].User_Name;
                    }
                }
            }
            if (Id == 0)
            {
                this.Page.Title = "新建" + cateName;
                this.lit_Title.Text = "新建" + cateName;
                User_Id.Value = "0";
            }
            else if (Id > 0)
            {

                this.Page.Title = "编辑" + cateName;
                this.lit_Title.Text = "编辑" + cateName;
                lit_id.Text = Id.ToString();
                User_Id.Value = Id.ToString();
            }
            else
            {
                int thisId = 0;
                using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
                {
                    SqlDb.Dcms_User user = new SqlDb.Dcms_User();
                    user.User_Id = Id;
                    IQuery query = session.GetQuery(user).Where(SqlDb.Dcms_User._USER_ID_.EqulesExp());
                    List<SqlDb.Dcms_User> userList = query.GetList<SqlDb.Dcms_User>();
                    if (userList.Count > 0)
                    {
                        thisId = userList[0].User_Id;
                    }
                }
                this.Page.Title = "编辑" + cateName;
                this.lit_Title.Text = "编辑" + cateName;
                lit_id.Text = thisId.ToString();
                User_Id.Value = thisId.ToString();
            }
        }
Пример #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string successMessage = IRequest.GetFormString("successMessage");
        string successUrl = IRequest.GetFormString("successUrl");
        string errorMessage = IRequest.GetFormString("errorMessage");
        string errorCodeMessage = IRequest.GetFormString("errorCodeMessage");
        bool hasValidCode = false;
        string ValidCode = string.Empty;
        for (int i = 0; i < Request.Form.Keys.Count; i++)
        {
            if (Request.Form.Keys[i].ToLower() == "validcode")
            {
                hasValidCode = true;
                ValidCode = IRequest.GetFormString("ValidCode");
                break;
            }
        }

        if ((hasValidCode) && (ValidCode != Convert.ToString(SessionHelper.Get("ValidCode"))))
        {
            Jscript.AlertAndBack("验证码出错");
            Response.End();
        }
        try
         {
                using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
                {
                    SqlDb.Dcms_User user = new SqlDb.Dcms_User();
                    UpdateModelByForm(user, Request.Form);
                    if (string.IsNullOrEmpty(user.User_Name) || string.IsNullOrEmpty(user.User_PassWord))
                    {
                        Jscript.AlertAndBack("用户名或密码不能为空.");
                        return;
                    }
                    else
                    {
                        IQuery query = session.GetQuery(user).Where(SqlDb.Dcms_User._USER_NAME_.EqulesExp().AND(SqlDb.Dcms_User._USER_PASSWORD_.EqulesExp()));
                        List<SqlDb.Dcms_User> userList = query.GetList<SqlDb.Dcms_User>();
                        if (userList.Count == 1)
                        {
                           // string str=(userList[0].User_InVisible==0)?"fd":"f";
                            if (userList[0].User_InVisible.Equals("0"))
                            {
                                Jscript.AlertAndBack("你还没有审核通过.");
                                return;
                            }
                            else
                            {
                                SessionHelper.Add("UserLevelKey", userList[0].User_LevelKey);
                                SessionHelper.Add("UserName", userList[0].User_Name);
                                SessionHelper.Add("UserId", userList[0].User_Id.ToString());
                                Utils.WriteCookie("UserId", userList[0].User_Id.ToString());
                                string urlRef = Utils.GetCookie("urlRef");
                                if ((urlRef.Length > 0))
                                {
                                    Response.Redirect(urlRef);
                                }
                                else
                                {
                                    Jscript.AlertAndRedirect(successMessage, successUrl);
                                }
                                return;
                            }
                        }
                        else
                        {
                            Jscript.AlertAndBack("用户名或密码错误.");
                            return;
                        }
                    }
                }
         }
        catch(Exception ex)
        {
            Jscript.AlertAndBack(ex.Message);
        }
    }
Пример #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string successMessage   = IRequest.GetFormString("successMessage");
        string successUrl       = IRequest.GetFormString("successUrl");
        string errorMessage     = IRequest.GetFormString("errorMessage");
        string errorCodeMessage = IRequest.GetFormString("errorCodeMessage");
        bool   hasValidCode     = false;
        string ValidCode        = string.Empty;

        for (int i = 0; i < Request.Form.Keys.Count; i++)
        {
            if (Request.Form.Keys[i].ToLower() == "validcode")
            {
                hasValidCode = true;
                ValidCode    = IRequest.GetFormString("ValidCode");
                break;
            }
        }

        if ((hasValidCode) && (ValidCode != Convert.ToString(SessionHelper.Get("ValidCode"))))
        {
            Jscript.AlertAndBack("验证码出错");
            Response.End();
        }
        try
        {
            using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
            {
                SqlDb.Dcms_User user = new SqlDb.Dcms_User();
                UpdateModelByForm(user, Request.Form);
                if (string.IsNullOrEmpty(user.User_Name) || string.IsNullOrEmpty(user.User_PassWord))
                {
                    Jscript.AlertAndBack("用户名或密码不能为空.");
                    return;
                }
                else
                {
                    IQuery query = session.GetQuery(user).Where(SqlDb.Dcms_User._USER_NAME_.EqulesExp().AND(SqlDb.Dcms_User._USER_PASSWORD_.EqulesExp()));
                    List <SqlDb.Dcms_User> userList = query.GetList <SqlDb.Dcms_User>();
                    if (userList.Count == 1)
                    {
                        // string str=(userList[0].User_InVisible==0)?"fd":"f";
                        if (userList[0].User_InVisible.Equals("0"))
                        {
                            Jscript.AlertAndBack("你还没有审核通过.");
                            return;
                        }
                        else
                        {
                            SessionHelper.Add("UserLevelKey", userList[0].User_LevelKey);
                            SessionHelper.Add("UserName", userList[0].User_Name);
                            SessionHelper.Add("UserId", userList[0].User_Id.ToString());
                            Utils.WriteCookie("UserId", userList[0].User_Id.ToString());
                            string urlRef = Utils.GetCookie("urlRef");
                            if ((urlRef.Length > 0))
                            {
                                Response.Redirect(urlRef);
                            }
                            else
                            {
                                Jscript.AlertAndRedirect(successMessage, successUrl);
                            }
                            return;
                        }
                    }
                    else
                    {
                        Jscript.AlertAndBack("用户名或密码错误.");
                        return;
                    }
                }
            }
        }
        catch (Exception ex)
        {
            Jscript.AlertAndBack(ex.Message);
        }
    }
Пример #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            iframeid = IRequest.GetQueryString("iframeid");
            int           CateId   = IRequest.GetQueryInt("cateid", 0);
            int           Id       = IRequest.GetQueryInt("id", -1);
            string        cateName = IRequest.GetQueryString("catename");
            StringBuilder sb       = new StringBuilder();

            sb.Append("<select name=\"User_LevelKey\" id=\"User_LevelKey\" style=\"width:200px\">\n");
            using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
            {
                SqlDb.Dcms_UserLevel userlevel = new SqlDb.Dcms_UserLevel();
                IQuery query = session.GetQuery(userlevel);
                List <SqlDb.Dcms_UserLevel> userlevelList = query.GetList <SqlDb.Dcms_UserLevel>();
                for (int i = 0; i < userlevelList.Count; i++)
                {
                    sb.Append(string.Format("<option value=\"{0}\">{1}</option>\n", Convert.ToString(userlevelList[i].UserLevel_Key), Convert.ToString(userlevelList[i].UserLevel_Title)));
                }
            }
            sb.Append("</select>");
            lit_UserLevel.Text = sb.ToString();
            if (Id > 0)
            {
                using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
                {
                    SqlDb.Dcms_User user = new SqlDb.Dcms_User();
                    user.User_Id = Id;
                    IQuery query = session.GetQuery(user).Where(SqlDb.Dcms_User._USER_ID_.EqulesExp());
                    List <SqlDb.Dcms_User> userList = query.GetList <SqlDb.Dcms_User>();
                    if (userList.Count > 0)
                    {
                        cateName = userList[0].User_Name;
                    }
                }
            }
            if (Id == 0)
            {
                this.Page.Title     = "新建" + cateName;
                this.lit_Title.Text = "新建" + cateName;
                User_Id.Value       = "0";
            }
            else if (Id > 0)
            {
                this.Page.Title     = "编辑" + cateName;
                this.lit_Title.Text = "编辑" + cateName;
                lit_id.Text         = Id.ToString();
                User_Id.Value       = Id.ToString();
            }
            else
            {
                int thisId = 0;
                using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
                {
                    SqlDb.Dcms_User user = new SqlDb.Dcms_User();
                    user.User_Id = Id;
                    IQuery query = session.GetQuery(user).Where(SqlDb.Dcms_User._USER_ID_.EqulesExp());
                    List <SqlDb.Dcms_User> userList = query.GetList <SqlDb.Dcms_User>();
                    if (userList.Count > 0)
                    {
                        thisId = userList[0].User_Id;
                    }
                }
                this.Page.Title     = "编辑" + cateName;
                this.lit_Title.Text = "编辑" + cateName;
                lit_id.Text         = thisId.ToString();
                User_Id.Value       = thisId.ToString();
            }
        }