Beispiel #1
0
        public void userlogin(HttpContext context)
        {
            //String GetpayStateNanme = context.Request["callbackparam"];

            context.Session["loginName"]      = null;
            context.Session["UserID"]         = null;
            context.Session["U_Img"]          = null;
            context.Session["EnterpriseCode"] = null;
            context.Session["role_type"]      = null;
            context.Session["U_Name"]         = null;
            context.Session["UserID"]         = null;
            string userId = HttpContext.Current.User.Identity.Name;

            //userId = "G441224200410212914";
            if (userId != null && userId != "")
            {
                U_UserInfoEntity model  = new U_UserInfoEntity();
                long             result = 0;
                CrisisInterfere.RoleService.RoleEntity Roles = MgrServices.RoleService.IsRole(3, "sysadmin");
                int DID = MgrServices.Department.GetDepartmentByName("sysadmin");
                if (Roles != null)
                {
                    U_UserInfoEntity entity = new U_UserInfoEntity();
                    var IsUser = MgrServices.UserAddService.IsExistsUser(userId);
                    if (IsUser)
                    {
                        entity = MgrServices.UserAddService.GetEntity(userId);
                        context.Session["loginName"] = userId;
                        context.Session["UserID"]    = entity._u_id;
                        //context.Session["U_Img"] = entity._u_img;
                        if (entity._u_img != null && entity._u_img != "")
                        {
                            context.Session["U_Img"] = entity._u_img;
                        }
                        else
                        {
                            context.Session["U_Img"] = "";
                        }

                        context.Session["EnterpriseCode"] = entity._enterpriseCode;
                        context.Session["role_type"]      = entity._role_types;
                        context.Session["U_Name"]         = entity._u_name;
                        context.Session["UserID"]         = entity._u_id;
                        context.Response.Write(0);
                    }
                    else
                    {
                        U_UserInfoEntity Umodel = new U_UserInfoEntity();
                        model._department_id       = DID.ToString();
                        model._enterpriseCode      = "5841638608834";
                        model._u_loginname         = userId;
                        model._u_password          = MD5Helper.Upper32("123456");
                        model._u_name              = userId;
                        model._u_sex               = "女";
                        model._student_id          = "";
                        model._u_birthday          = DateTime.Now.ToString();
                        model._u_email             = "";
                        model._u_tel               = "";
                        model._u_parentstel        = "";
                        model._u_parentsemail      = "";
                        model._r_id                = Roles.Role_ID.ToString();
                        model._u_age               = "0";
                        model._u_remark            = "";
                        model._u_addfield          = "";
                        model._departmentauthority = "";
                        model._u_auditstate        = "1";
                        model._u_mark_delete       = "0";
                        result = MgrServices.UserAddService.U_UserInfoAdd(model);
                        if (result > 0)
                        {
                            entity = MgrServices.UserAddService.GetEntity(userId);
                            context.Session["loginName"] = userId;
                            context.Session["UserID"]    = entity._u_id;
                            //context.Session["U_Img"] = entity._u_img;
                            if (entity._u_img != null && entity._u_img != "")
                            {
                                context.Session["U_Img"] = entity._u_img;
                            }
                            else
                            {
                                context.Session["U_Img"] = "";
                            }

                            context.Session["EnterpriseCode"] = entity._enterpriseCode;
                            context.Session["role_type"]      = entity._role_types;
                            context.Session["U_Name"]         = entity._u_name;
                            context.Session["UserID"]         = entity._u_id;
                            SetSessionFunctionByRoleID(Convert.ToInt32(entity._r_id), context);//将对应的权限放到Session里面
                            GetRoleFuntion(context);
                            context.Response.Write(0);
                        }
                        else
                        {
                            context.Response.Write(1);
                        }
                    }
                }
                else
                {
                    context.Response.Write(1);
                }
            }
            else
            {
                context.Response.Write(1);
            }
        }
 public bool Update(CrisisInterfere.RoleService.RoleEntity re)
 {
     return(base.Channel.Update(re));
 }