public static string roledel(string schid, string roleid)
        {
            if (!Com.Public.isVa(schid, ""))
            {
                return("无跨界权限;");
            }
            string ret = "success";

            if (Com.Session.userid == null)
            {
                ret = "expire";
            }
            else
            {
                try
                {
                    SchSystem.BLL.SchUserRoleSoure surBll = new SchSystem.BLL.SchUserRoleSoure();
                    bool surBool = surBll.ExistsRoleData(schid, roleid);
                    if (surBool)
                    {
                        ret = "success01";
                    }
                    else
                    {
                        SchSystem.BLL.SchRoleSoure   bll   = new SchSystem.BLL.SchRoleSoure();
                        SchSystem.Model.SchRoleSoure model = new SchSystem.Model.SchRoleSoure();
                        model.RoleId      = int.Parse(roleid);
                        model.Stat        = 2;
                        model.LastRecTime = DateTime.Now;
                        model.LastRecUser = Com.Session.userid;
                        if (bll.UpdateStat(model))
                        {
                            ret = "success";
                        }
                        else
                        {
                            ret = "操作失败";
                        }
                    }
                }
                catch (Exception ex)
                {
                    ret = ex.Message;
                }
            }
            return(ret);
        }
        public static string usersave(string schid, string userid, string userroles)
        {
            string ret = "";

            if (Com.Session.userid == null)
            {
                ret = "expire";
            }
            else
            {
                try
                {
                    if (string.IsNullOrEmpty(schid) || schid == "0")
                    {
                        ret += "非法的学校!";
                    }
                    if (!Com.Public.isVa(schid, ""))
                    {
                        ret += "无跨界权限;";
                    }

                    if (ret == "")
                    {
                        //添加或更新关联部门
                        //SchSystem.BLL.SchUserDept userdeptbll = new SchSystem.BLL.SchUserDept();
                        //if (userdpts == null) userdpts = "0";
                        //userdeptbll.DoUserDept(userid, Com.Session.userid, schid, userdpts);
                        //添加或更新关联角色
                        SchSystem.BLL.SchUserRoleSoure userrolebll = new SchSystem.BLL.SchUserRoleSoure();
                        if (userroles == null)
                        {
                            userroles = "0";
                        }
                        userrolebll.DoUserRole(userid, Com.Session.userid, schid, userroles);
                        ret = "success";
                    }
                }
                catch (Exception ex)
                {
                    ret = ex.Message;
                }
            }
            return(ret);
        }
        public static string usersave(string dotype, string schid, string systype, string userid, string usercode, string usertname, string usertel, string userpst, string usertitle, string usermobile, string username, string userpw, string usersex, string userstat, string usersub, string userdpts, string userroles)
        {
            //解密 RSA
            RSACryptoService rsa = new RSACryptoService(Model.PublicProperty.PrivateKey, Model.PublicProperty.PublicKey);

            if (userpw != "")
            {
                userpw = Com.Public.SqlEncStr(rsa.Decrypt(userpw));
            }
            string ret = "";

            if (Com.SoureSession.Soureuserid == null)
            {
                ret = "expire";
            }
            else
            {
                try
                {
                    if (string.IsNullOrEmpty(schid) || schid == "0")
                    {
                        ret += "非法的学校!";
                    }
                    SchSystem.BLL.SchUserInfo   userbll   = new SchSystem.BLL.SchUserInfo();
                    SchSystem.Model.SchUserInfo usermodel = new SchSystem.Model.SchUserInfo();
                    if (!Com.Public.isVa(schid, ""))
                    {
                        ret += "无跨界权限;";
                    }
                    //判断编号及账号是否有重复,生成密码加密
                    if (dotype == "e")
                    {
                        if (username != "")
                        {
                            if (userbll.ExistsUserName(int.Parse(userid), username))
                            {
                                ret += "账号重复!";
                            }
                            else if (!userbll.ExistsUserName(0, username))
                            {
                                userbll.UpdateUserName(username, int.Parse(userid));
                            }
                        }
                    }
                    if (dotype == "a")
                    {
                        //if (userbll.ExistsUserCode(0, usercode, int.Parse(schid)))
                        //{
                        //    ret += "用户编号重复!";
                        //}
                        if (username != "")
                        {
                            /*if (userbll.ExistsUserName(0, username, int.Parse(schid)))
                             * {
                             *  ret += "账号重复!";
                             * }*/
                            StringBuilder sbExists = new StringBuilder();
                            string        utname   = "";
                            if (userbll.ExistsUserName(0, username))
                            {
                                SchSystem.BLL.SchUserDeptV bllusdpt = new SchSystem.BLL.SchUserDeptV();
                                DataTable dt = bllusdpt.GetList("DepartName,UserTname", "UserName='******'").Tables[0];
                                DataRow[] dr = dt.Select();
                                foreach (DataRow item in dr)
                                {
                                    sbExists.Append(item["DepartName"].ToString() + "、");
                                    utname = item["UserTname"].ToString();
                                }
                                //ret += "账号重复!";
                                ret += sbExists.ToString().Substring(0, sbExists.ToString().Length - 1);
                                ret += "," + utname;
                            }
                        }
                    }
                    if (ret == "")
                    {
                        usermodel.LastRecTime = DateTime.Now;
                        usermodel.LastRecUser = Com.SoureSession.Soureuserid;
                        //usermodel.Mobile = usermobile;
                        //usermodel.Postion = userpst;
                        //usermodel.Sex = int.Parse(usersex);
                        if (!string.IsNullOrEmpty(userstat))
                        {
                            usermodel.AccStat = int.Parse(userstat);
                        }
                        else
                        {
                            usermodel.AccStat = 2;
                        }
                        //usermodel.SubCode = usersub;
                        //usermodel.SysType = int.Parse(systype);
                        //usermodel.Telno = usertel;
                        //usermodel.Title = usertitle;
                        //usermodel.UserNo = usercode;
                        //usermodel.UserTname = usertname;
                        if (dotype == "e")
                        {
                            if (!string.IsNullOrEmpty(userpw) && !string.IsNullOrEmpty(username))
                            {
                                userpw = Com.Public.StrToMD5(userpw);
                                if (userpw == Com.Public.StrToMD5("123456"))//如果重置密码时保存
                                {
                                    userbll.UpdatePw(int.Parse(userid), userpw);
                                }
                            }
                            usermodel.UserId = int.Parse(userid);
                            //userbll.UpdateUser(usermodel);
                        }
                        if (dotype == "a")
                        {
                            //必须有账号和密码
                            if (!string.IsNullOrEmpty(userpw) && !string.IsNullOrEmpty(username))
                            {
                                usermodel.PassWord = Com.Public.StrToMD5("123456"); //SchManagerInfoSystem.Common.DESEncrypt.Encrypt(userpw) ;添加时均为123456密码
                            }
                            usermodel.RecTime  = DateTime.Now;
                            usermodel.RecUser  = Com.SoureSession.Soureuserid;
                            usermodel.SchId    = int.Parse(schid);
                            usermodel.UserName = username;
                            //userid = userbll.Add(usermodel).ToString();
                        }
                        //添加或更新关联部门
                        //SchSystem.BLL.SchUserDept userdeptbll = new SchSystem.BLL.SchUserDept();
                        //if (userdpts == null) userdpts = "0";
                        //userdeptbll.DoUserDept(userid, Com.Session.userid, schid, userdpts);
                        //添加或更新关联角色
                        SchSystem.BLL.SchUserRoleSoure userrolebll = new SchSystem.BLL.SchUserRoleSoure();
                        if (userroles == null)
                        {
                            userroles = "0";
                        }
                        userrolebll.DoUserRole(userid, Com.SoureSession.Soureuserid, schid, userroles);
                        ret = "success";
                    }
                }
                catch (Exception ex)
                {
                    ret = ex.Message;
                }
            }
            return(ret);
        }