Exemple #1
0
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string Login(HttpContext context)
        {
            string WorkNum = context.Request["name"] ?? "";
            string pwd     = context.Request["pwd"] ?? "";
            var    str     = new StringBuilder();

            try
            {
                var employeeBll = new EmployerBll();
                if (employeeBll.Login(WorkNum, pwd))
                {
                    context.Session[Constant.LoginUser] =
                        employeeBll.GetEntity(new Employer()
                    {
                        WorkNum = WorkNum, Password = pwd
                    });
                    str.Append("1");
                    return(str.ToString());
                }
                else
                {
                    str.Append("0");
                    return(str.ToString());
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                str.Append("0");
                return(str.ToString());
            }
        }
Exemple #2
0
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string Login1(HttpContext context)
        {
            string id = context.Request["id"] ?? "";

            try
            {
                var employeeBll = new EmployerBll();
                context.Session[Constant.LoginUser] =
                    employeeBll.GetEntity(new Employer()
                {
                    Id = id
                });
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
            return("");
        }