Exemplo n.º 1
0
        public static string getnj(string typecode, string pcode, string schid, string classid)
        {
            if (schid == "undefined")
            {
                schid = Com.SoureSession.Soureschid;
            }
            schid    = Com.Public.SqlEncStr(schid);
            typecode = Com.Public.SqlEncStr(typecode);
            string ClassId = "";

            SchSystem.BLL.SchGradeUsers sguBLL = new SchSystem.BLL.SchGradeUsers();
            SchSystem.BLL.SchClassUser  scuBLL = new SchSystem.BLL.SchClassUser();
            SchWebMaster.Web.Student.StudentList.namepack np = new SchWebMaster.Web.Student.StudentList.namepack();

            if (typecode == "1")//1为获取年级领导
            {
                string GradeCode = Com.Public.SqlEncStr(pcode);
                string sql1      = "";
                string sql2      = "";
                if (Com.SoureSession.Souresystype != "2")//判断是否是超管
                {
                    sql1 = "select GradeId from dbo.SchGradeInfo where GradeId='" + GradeCode + "' and SchId='" + Com.SoureSession.Soureschid + "'";
                    sql2 = "select *  FROM SchClassGradeV  where IsFinish<>2 and SchId='" + Com.SoureSession.Soureschid + "' and IsFinish=0 and GradeCode='" + GradeCode + "' and ClassId='" + classid + "' order by GradeCode,ClassName	";
                }
                else
                {
                    sql1 = "select GradeId from dbo.SchGradeInfo where GradeId='" + GradeCode + "'  and SchId='" + schid + "'";
                    sql2 = "select *  FROM SchClassGradeV  where IsFinish<>2 and SchId='" + schid + "' and IsFinish=0 and GradeCode='" + GradeCode + "' and ClassId='" + classid + "' order by GradeCode,ClassName	";
                }
                DataTable dt1     = DbHelperSQL.Query(sql1).Tables[0];
                string    GradeId = "";
                if (dt1.Rows.Count > 0)
                {
                    GradeId = dt1.Rows[0]["GradeId"].ToString();
                }
                DataTable dt2 = DbHelperSQL.Query(sql2).Tables[0];
                if (dt2.Rows.Count > 0)
                {
                    njld = np.gradeboss = sguBLL.GetNames("GradeId='" + GradeId + "'");
                }
                if (dt2.Rows.Count != 0)
                {
                    ClassId = dt2.Rows[0]["ClassId"].ToString();
                    bzr     = np.classms = scuBLL.GetNames("ClassId='" + ClassId + "' and IsMs=1");
                    bjjs    = np.classtec = scuBLL.GetNames("ClassId=" + ClassId + " and IsMs=0");
                }
            }
            else//侧为获取班主任和任课老师
            {
                np.classms  = scuBLL.GetNames("ClassId='" + pcode + "' and IsMs=1 and SchId='" + schid + "'");
                np.classtec = scuBLL.GetNames("ClassId=" + pcode + " and IsMs=0  and SchId='" + schid + "'");
            }

            return(Newtonsoft.Json.JsonConvert.SerializeObject(np));
        }
        public static string page(string PageIndex, string PageSize, string ClassId, string SchId, string Stuname, string GradeId)
        {
            Com.Public.PageModelResp pages = new Com.Public.PageModelResp();
            pages.PageIndex = int.Parse(PageIndex);
            pages.PageSize  = int.Parse(PageSize);
            SchSystem.BLL.SchClassUser  bllclassuser = new SchSystem.BLL.SchClassUser();
            SchSystem.BLL.SchGradeUsers bllgradeuser = new SchSystem.BLL.SchGradeUsers();
            string strWhere = "StuStat=1 and SchId=" + Com.Public.SqlEncStr(SchId);

            if (!string.IsNullOrEmpty(Stuname))
            {
                strWhere += " and stuname LIKE '%" + Com.Public.SqlEncStr(Stuname) + "%'";
            }
            if (GradeId != "-1" && GradeId != "")//获取当前用户的所有年级
            {
                strWhere += " and GradeId=" + Com.Public.SqlEncStr(GradeId);
            }
            if (ClassId != "-1" && ClassId != "")//获取当前用户的所有班级
            {
                strWhere += " and ClassId=" + Com.Public.SqlEncStr(ClassId);
            }
            int    RowCount = 0; int PageCount = 0;//left('00000000',8-len(StuId))+convert(varchar(10),StuId)
            string cols = "  GradeId,ClassId,GradeName,ClassName,StuId,TestNo,StuName,CardNo,Sex,StuNo,TelNo,StudyType,LoginName,'' GenNameO,'' GenLoginNameO ,'' GenTelO,'' GenNameT,'' GenLoginNameT ,'' GenTelT,'0' isdel,'0' isedit,'0' islook";

            SchSystem.BLL.SchStuInfoV bllstuv = new SchSystem.BLL.SchStuInfoV();
            DataTable dtstuv = bllstuv.GetListCols(cols, strWhere, "StuName", "ASC", pages.PageIndex, pages.PageSize, ref RowCount, ref PageCount).Tables[0];

            pages.PageCount = PageCount;
            pages.RowCount  = RowCount;
            if (dtstuv != null && dtstuv.Rows.Count > 0)
            {
                SchSystem.BLL.SchStuGenUV bllstugenv = new SchSystem.BLL.SchStuGenUV();
                for (int i = 0; i < dtstuv.Rows.Count; i++)//将家长添加上,并且把权限加上
                {
                    //获取家长
                    DataTable dtgenv = bllstugenv.GetList("GenName,LoginName,TelNo,Relation", "Stat=1 and StuId=" + dtstuv.Rows[i]["StuId"].ToString()).Tables[0];
                    if (dtgenv != null && dtgenv.Rows.Count > 0)
                    {
                        dtstuv.Rows[i]["GenNameO"]      = dtgenv.Rows[0]["GenName"].ToString();
                        dtstuv.Rows[i]["GenTelO"]       = dtgenv.Rows[0]["TelNo"].ToString();
                        dtstuv.Rows[i]["GenLoginNameO"] = dtgenv.Rows[0]["LoginName"].ToString();
                        if (dtgenv.Rows.Count > 1)
                        {
                            dtstuv.Rows[i]["GenNameT"]      = dtgenv.Rows[1]["GenName"].ToString();
                            dtstuv.Rows[i]["GenTelT"]       = dtgenv.Rows[1]["TelNo"].ToString();
                            dtstuv.Rows[i]["GenLoginNameT"] = dtgenv.Rows[1]["LoginName"].ToString();
                        }
                    }

                    pages.list = dtstuv;
                }
            }
            return(Newtonsoft.Json.JsonConvert.SerializeObject(pages));
        }
        public static string page(string txtname, string ustat, string cotycode, string schid, string gradeCode)
        {
            txtname   = Com.Public.SqlEncStr(txtname);
            ustat     = Com.Public.SqlEncStr(ustat);
            cotycode  = Com.Public.SqlEncStr(cotycode);
            schid     = Com.Public.SqlEncStr(schid);
            gradeCode = Com.Public.SqlEncStr(gradeCode);
            SchSystem.BLL.SchClassInfo sciBll = new SchSystem.BLL.SchClassInfo();
            if (schid == "")
            {
                schid = "0";
            }
            //IsFinish:毕业状态,0非,1是,2被删除,正常界面不显示删除,超管界面可以考虑
            string strwhere = "IsFinish = 0 and SchId = '" + Com.Public.SqlEncStr(schid) + "'";

            if (!string.IsNullOrEmpty(ustat))
            {
                strwhere += " and IsFinish=" + Com.Public.SqlEncStr(ustat);
            }
            if (!string.IsNullOrEmpty(gradeCode) || gradeCode != "")
            {
                strwhere += " and GradeCode='" + Com.Public.SqlEncStr(gradeCode) + "'";
            }
            int rowc = 0;
            int pc   = 0;
            //DataTable dt = userbll.GetListCols("*", strwhere, "SchName", "ASC", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
            DataTable ClassDt = sciBll.GetList(strwhere).Tables[0];//得到班级数据列表

            //pages.PageCount = pc;
            if (ClassDt.Rows.Count > 0)
            {
                ClassDt.Columns.Add("Ustat");
                ClassDt.Columns.Add("Ucity");
                ClassDt.Columns.Add("TeacherClass"); //班主任
                //ClassDt.Columns.Add("Teacher");//任课老师
                ClassDt.Columns.Add("TeacherSub");   //任课老师科目
                SchSystem.BLL.SchClassUser scuBLL = new SchSystem.BLL.SchClassUser();
                for (int i = 0; i < ClassDt.Rows.Count; i++)
                {
                    ClassDt.Rows[i]["Ustat"] = ClassDt.Rows[i]["IsFinish"].ToString() == "0" ? "正常" : "停用";
                    string ClassId = ClassDt.Rows[i]["ClassId"].ToString();
                    //班级教师(班主任)
                    ClassDt.Rows[i]["TeacherClass"] = scuBLL.GetNames("ClassId='" + ClassId + "' and Stat=1 and IsMs=1");
                    //任课老师
                    ClassDt.Rows[i]["TeacherSub"] = scuBLL.GetNames("ClassId='" + ClassId + "' and Stat=1 and IsMs=0");
                }
                //pages.list = ClassDt;
            }
            //Newtonsoft.Json.JsonConvert();
            //string ddd = Newtonsoft.Json.JsonConvert.SerializeObject(pages);
            //string ddd = Newtonsoft.Json.JsonConvert.SerializeObject(ClassDt);
            return(Newtonsoft.Json.JsonConvert.SerializeObject(ClassDt));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                usertname = Com.Session.uname;
                //权限组的增删改
                if (Com.Session.systype == "1")         //超级管理员和学校管理员
                {
                    if (Com.Session.appeditstat == "0") // && Com.Session.systype == "1"
                    {
                        isadd = false;
                    }
                    else
                    {
                        isadd = true;
                    }
                }
                SchSystem.BLL.SchClassUser bllclassuser = new SchSystem.BLL.SchClassUser();
                if (bllclassuser.ExistsIsMs(Com.Session.usertid, Com.Session.schid, 1) == true)//班主任
                {
                    if (Com.Session.appeditstat == "1")
                    {
                        isaddlist = true;
                    }
                }
                #region 普通人员
                if (Com.Session.systype == "0")
                {
                    schid = Com.Session.schid;
                    StringBuilder sbarea = new StringBuilder();
                    //获取年级
                    sbarea.Append("年级:<select id=\"nj\" style=\"width:100px\">");
                    string schcode = "";
                    sbarea.Append(Com.Public.GetDrpAreaStu("4", Com.Session.schid, ref schcode, true));

                    sbarea.Append("</select>&nbsp;&nbsp;&nbsp;&nbsp;");
                    sbarea.Append("<span id=\"njld\" style=\"color:	#808080	\">年级领导:</span><br/>");
                    sbarea.Append("<div class=\"space-4\"></div>");
                    //获取班级
                    sbarea.Append("班级:<select id=\"bj\" style=\"width:100px\" >");
                    string Classcode = "";
                    sbarea.Append(Com.Public.GetDrpAreaStu("5", "", ref Classcode, true));
                    sbarea.Append("</select>&nbsp;&nbsp;&nbsp;&nbsp;");
                    sbarea.Append("<span id=\"bzr\" style=\"color:	#808080	\">班主任:</span>&nbsp;&nbsp; ");
                    sbarea.Append("<span id=\"bjjs\" style=\"color:	#808080	\">任课老师:</span>");

                    areastr = sbarea.ToString();
                }
                #endregion
            }
        }
Exemplo n.º 5
0
        public static string getusers(string tp, string id)
        {
            StudentList.namepack np = new StudentList.namepack();
            if (Com.Public.IsNum(id))
            {
                if (tp == "1")//获取年级主任
                {
                    SchSystem.BLL.SchGradeUsers sguBLL = new SchSystem.BLL.SchGradeUsers();
                    np.gradeboss = sguBLL.GetNames("GradeId=" + Com.Public.SqlEncStr(id));
                }
                else
                {
                    SchSystem.BLL.SchClassUser scuBLL = new SchSystem.BLL.SchClassUser();
                    np.classms  = scuBLL.GetNames("ClassId=" + Com.Public.SqlEncStr(id) + " and IsMs=1");
                    np.classtec = scuBLL.GetNames("ClassId=" + Com.Public.SqlEncStr(id) + " and IsMs=0");
                }
            }

            return(Newtonsoft.Json.JsonConvert.SerializeObject(np));
        }
        public static int ClassDelete(string schid, string schclassid)
        {
            int ret = 0;

            SchSystem.BLL.SchClassInfo classbll = new SchSystem.BLL.SchClassInfo();
            bool resultBool = classbll.ExistsClassStuData(int.Parse(schclassid));

            SchSystem.BLL.SchClassUser classuserbll = new SchSystem.BLL.SchClassUser();
            bool resultBoolUser = classuserbll.ExistsClassUser(schid, schclassid);

            if (resultBool || resultBoolUser)//如果为true说明是班级内有数据
            {
                ret = 0;
            }
            else//否则即可删除班级记录
            {
                SchSystem.Model.SchClassInfo classmodel = new SchSystem.Model.SchClassInfo();
                classmodel.ClassId     = int.Parse(schclassid);
                classmodel.IsFinish    = 2;
                classmodel.LastRecTime = DateTime.Now;
                classmodel.LastRecUser = Com.Session.userid;
                if (classbll.UpdateStat(classmodel))
                {
                    //SchSystem.BLL.SchClassUser scuBll = new SchSystem.BLL.SchClassUser();
                    // bool ecu = scuBll.ExistsClassUser(int.Parse(schid), int.Parse(classid));
                    //bool scubool = scuBll.Delete(classid, schid);
                    //if (scubool)
                    // {
                    ret = 1;
                    //}
                }
                else
                {
                    ret = 0;
                }
            }
            return(ret);
        }
        public static string ExistsClassSubUser(string schid, string subcode)
        {
            SchSystem.BLL.SchSubLeader sslBll = new SchSystem.BLL.SchSubLeader();
            bool sslbool = sslBll.ExistsClassSubUser(schid, subcode);

            if (sslbool)
            {
                return("success01");
            }
            else
            {
                SchSystem.BLL.SchClassUser scuBll = new SchSystem.BLL.SchClassUser();
                bool scuBool = scuBll.ExistsClassSubUser(schid, subcode);
                if (scuBool)
                {
                    return("success02");
                }
                else
                {
                    return("0");
                }
            }
        }
Exemplo n.º 8
0
        public static string schsave(string Genid1, string Genid2, string Unid1, string Unid2, string Stuid, string dotype, string schid, string ClassId, string TestNo, string StuName, string Sex, string CardNo, string StudyType, string TelNo, string LoginName, string Pwd, string Addr, string Stat, string jzGenName1, string jzTelNo1, string jzLoginName1, string jzPwd1, string jzStat1, string jzGenName2, string jzTelNo2, string jzLoginName2, string jzPwd2, string jzStat2, string Relation1, string Relation2, string OldClassName, string OldGradeId, string OldGradeName, string GradeId, string OldClassId, string CurrentTestNo)
        {
            string result = ""; //事物返回结果

            SchSystem.BLL.SchClassUser bllclassuser          = new SchSystem.BLL.SchClassUser();
            Com.DataPack.DataRsp <Com.DataPack.UserInfo> rsp = Com.Public.UserFuncSoure(Com.SoureSession.jsid, Com.SoureSession.jstoken);
            if (rsp.code == "ERROR_TOKEN")
            {
                result = "expire";
            }
            else
            {
                List <string> LstError = new List <string>();
                try
                {
                    //if (!Com.Public.isVa(schid, ""))
                    //{
                    //    LstError.Add("无跨界权限!" + Environment.NewLine);
                    //}
                    SchSystem.Model.SchStuInfo model_stu = new SchSystem.Model.SchStuInfo();
                    SchSystem.BLL.SchStuInfo   bll_stu   = new SchSystem.BLL.SchStuInfo();
                    #region 收集学生信息
                    if (Com.SoureSession.Souresystype != "2")
                    {
                        model_stu.SchId = Convert.ToInt32(Com.SoureSession.Soureschid);
                    }
                    else
                    {
                        model_stu.SchId = Convert.ToInt32(schid);
                    }

                    StringBuilder sb = new StringBuilder();
                    if (GradeId != OldGradeId)
                    {
                        sb.Append(OldGradeName);
                    }
                    if (ClassId != OldClassId)
                    {
                        sb.Append(OldClassName);
                    }
                    string sbstr = sb.ToString();
                    if (sbstr != "")
                    {
                        model_stu.OldClassId = sbstr;
                    }
                    else
                    {
                        model_stu.OldClassId = "";
                    }
                    model_stu.ClassId = Convert.ToInt32(ClassId);

                    /*
                     * if (ClassId != OldClassIdstr)//如果班级ID有变化说明是在调班
                     * {
                     *  if (OldClassIdSavestr == "")//如果是第一次调班
                     *  {
                     *      model_stu.OldClassId = OldClassIdstr;
                     *  }
                     *  else//曾经调过班
                     *  {
                     *      StringBuilder sb = new StringBuilder();
                     *      sb.Append(OldClassIdSavestr + "," + OldClassIdstr);//班级ID以英文半角的逗号隔开
                     *      model_stu.OldClassId = sb.ToString() ;
                     *  }
                     *  model_stu.ClassId = Convert.ToInt32(ClassId);
                     * }
                     * else//否则,没有调班
                     * {
                     *  model_stu.ClassId = Convert.ToInt32(ClassId);
                     * }
                     */
                    model_stu.TestNo    = Com.Public.SqlEncStr(TestNo);
                    model_stu.StuName   = Com.Public.SqlEncStr(StuName);
                    model_stu.Sex       = Convert.ToInt32(Sex);
                    model_stu.Dutie     = "";
                    model_stu.StudyType = Convert.ToInt32(StudyType);
                    model_stu.TelNo     = Com.Public.SqlEncStr(TelNo);
                    model_stu.LoginName = Com.Public.SqlEncStr(LoginName);
                    if (Pwd != "")
                    {
                        model_stu.Pwd = Com.Public.StrToMD5(Com.Public.SqlEncStr(Pwd));
                    }
                    else
                    {
                        model_stu.Pwd = "";
                    }
                    model_stu.Addr        = Com.Public.SqlEncStr(Addr);
                    model_stu.Stat        = Convert.ToInt32(Stat);
                    model_stu.Birth       = Convert.ToDateTime(DateTime.Now.ToLocalTime().ToString());
                    model_stu.RecUser     = Com.SoureSession.Soureuserid;
                    model_stu.RecTime     = Convert.ToDateTime(DateTime.Now.ToLocalTime().ToString());
                    model_stu.LastRecUser = Com.SoureSession.Soureuserid;
                    model_stu.LastRecTime = Convert.ToDateTime(DateTime.Now.ToLocalTime().ToString());
                    model_stu.StuNo       = Com.Public.SqlEncStr(TestNo);
                    model_stu.CardNo      = "";   //(Test)卡地址在前台读取,
                    model_stu.ImgUrl      = "00"; //(Test)学生默认头像
                    if (dotype == "e")
                    {
                        model_stu.StuId = Convert.ToInt32(Stuid);
                    }
                    #endregion
                    #region 收集家长信息
                    List <SchSystem.Model.SchGenInfo> list_model_gen = new List <SchSystem.Model.SchGenInfo>();
                    SchSystem.Model.SchGenInfo        model_gen      = new SchSystem.Model.SchGenInfo();
                    //if (Convert.ToString(jzGenName1) != "" && Convert.ToString(jzTelNo1) != "")
                    //{
                    model_gen.GenName   = Com.Public.SqlEncStr(jzGenName1);
                    model_gen.TelNo     = Com.Public.SqlEncStr(jzTelNo1);
                    model_gen.LoginName = "";

                    if (Pwd != "")
                    {
                        model_gen.Pwd = Com.Public.StrToMD5(Com.Public.SqlEncStr(jzPwd1));
                    }
                    else
                    {
                        model_gen.Pwd = "";
                    }
                    model_gen.Stat        = Convert.ToInt32(jzStat1);
                    model_gen.RecUser     = Com.SoureSession.Soureuserid;
                    model_gen.RecTime     = Convert.ToDateTime(DateTime.Now.ToLocalTime().ToString());
                    model_gen.LastRecUser = Com.SoureSession.Soureuserid;
                    model_gen.LastRecTime = Convert.ToDateTime(DateTime.Now.ToLocalTime().ToString());
                    model_gen.ImgUrl      = "00";//(Test)学生默认头像
                    model_gen.Sex         = 1;
                    if (Genid1 != "")
                    {
                        if (dotype == "e")
                        {
                            model_gen.GenId = Convert.ToInt32(Genid1);
                        }
                    }
                    list_model_gen.Add(model_gen);
                    //}

                    SchSystem.Model.SchGenInfo model_gen2 = new SchSystem.Model.SchGenInfo();
                    //if (Convert.ToString(jzGenName2) != "" && Convert.ToString(jzTelNo2) != "")
                    //{
                    model_gen2.GenName   = Com.Public.SqlEncStr(jzGenName2);
                    model_gen2.TelNo     = Com.Public.SqlEncStr(jzTelNo2);
                    model_gen2.LoginName = "";
                    if (Pwd != "")
                    {
                        model_gen2.Pwd = Com.Public.StrToMD5(Convert.ToString(jzPwd2));
                    }
                    else
                    {
                        model_gen2.Pwd = "";
                    }
                    model_gen2.Stat        = Convert.ToInt32(jzStat2);
                    model_gen2.RecUser     = Com.SoureSession.Soureuserid;
                    model_gen2.RecTime     = Convert.ToDateTime(DateTime.Now.ToLocalTime().ToString());
                    model_gen2.LastRecUser = Com.SoureSession.Soureuserid;
                    model_gen2.LastRecTime = Convert.ToDateTime(DateTime.Now.ToLocalTime().ToString());
                    model_gen2.ImgUrl      = "00";//(Test)学生默认头像
                    model_gen2.Sex         = 1;
                    if (dotype == "e")
                    {
                        if (Genid2 == "")//编辑时,如果家长ID为空,则添加
                        {
                            model_gen2.GenId = 0;
                        }
                        else
                        {
                            model_gen2.GenId = Convert.ToInt32(Genid2);
                        }
                    }
                    list_model_gen.Add(model_gen2);
                    //}

                    #endregion
                    #region 收集学生家长关系信息
                    List <SchSystem.Model.SchStuGenUn> list_model_stu_gen = new List <SchSystem.Model.SchStuGenUn>();
                    SchSystem.Model.SchStuGenUn        model_stu_gen      = new SchSystem.Model.SchStuGenUn();
                    model_stu_gen.Relation = Com.Public.SqlEncStr(Relation1);
                    model_stu_gen.GenName  = Com.Public.SqlEncStr(jzGenName1);
                    if (dotype == "e")
                    {
                        if (Unid1 != "")
                        {
                            model_stu_gen.UnId = Convert.ToInt32(Unid1);
                        }
                        else
                        {
                            model_stu_gen.UnId = 0;
                        }
                        model_stu_gen.StuId = model_stu.StuId;
                        model_stu_gen.GenId = model_gen.GenId;
                    }
                    list_model_stu_gen.Add(model_stu_gen);


                    SchSystem.Model.SchStuGenUn model_stu_gen2 = new SchSystem.Model.SchStuGenUn();
                    if (Convert.ToString(Relation2) != "")
                    {
                        model_stu_gen2.Relation = Com.Public.SqlEncStr(Relation2);
                        model_stu_gen2.GenName  = Com.Public.SqlEncStr(jzGenName2);
                        if (dotype == "e")
                        {
                            if (model_gen2.GenId != 0)
                            {
                                model_stu_gen2.UnId  = Convert.ToInt32(Unid2);
                                model_stu_gen2.StuId = model_stu.StuId;
                                model_stu_gen2.GenId = model_gen2.GenId;
                            }
                            else
                            {
                                model_stu_gen2.UnId = 0;
                            }
                        }
                        list_model_stu_gen.Add(model_stu_gen2);
                    }


                    #endregion
                    if (dotype == "a")//操作类型为添加
                    {
                        if (bll_stu.ExistsStuCode(0, model_stu.TestNo.ToString(), Convert.ToInt32(model_stu.SchId)))
                        {
                            /*
                             * LstError.Add("学(考)号重复 !" + Environment.NewLine);//学(考)号重复
                             * result = "KHCF";*/
                            StringBuilder            sbExists = new StringBuilder();
                            string                   utname   = "";
                            SchSystem.BLL.SchStuInfo ssiBll   = new SchSystem.BLL.SchStuInfo();
                            if (schid == "0")
                            {
                                schid = model_stu.SchId.ToString();
                            }
                            DataTable dt = ssiBll.ExistsStuNo(TestNo, int.Parse(schid)).Tables[0];
                            if (dt.Rows.Count > 0)
                            {
                                DataRow[] dr = dt.Select();
                                foreach (DataRow item in dr)
                                {
                                    sbExists.Append(item["StuName"].ToString() + "[" + item["GradeName"].ToString());
                                    sbExists.Append("(" + item["ClassName"].ToString() + ")]");
                                }
                                //ret += "账号重复!";
                                return(result = sbExists.ToString());
                            }
                        }
                        if (LoginName != "")
                        {
                            if (bll_stu.ExistsStuUsername(0, model_stu.LoginName.ToString(), Convert.ToInt32(model_stu.SchId)))
                            {
                                LstError.Add("账号重复 !" + Environment.NewLine);//账号重复
                                result = "ZHCF";
                            }
                        }
                        if (LstError.Count == 0)
                        {
                            if (Com.SoureSession.Souresystype == "1" || Com.SoureSession.Souresystype == "2")//超管和学校超管
                            {
                                result = bll_stu.Add(model_stu, list_model_gen, list_model_stu_gen);
                            }
                            else
                            {
                                //if (ClassId == classidstr)
                                //{
                                if (bllclassuser.ExistsIsMs(Com.Public.SqlEncStr(ClassId), Com.SoureSession.Soureusertid, Com.SoureSession.Soureschid, 1) == true)//班主任
                                {
                                    result = bll_stu.Add(model_stu, list_model_gen, list_model_stu_gen);
                                }
                                else
                                {
                                    result = "BBBZR";
                                }
                                //}
                                //else if (GradeId == gradecodestr)
                                //{
                                //    if (bll_stu.ExistsGrade(Com.Public.SqlEncStr(GradeId), Com.Session.schid, Com.Session.usertid) == true)//年级主任
                                //    {
                                //        result = bll_stu.Add(model_stu, list_model_gen, list_model_stu_gen);
                                //    }
                                //    else
                                //    {
                                //        result = "BNJZR";
                                //    }
                                //}
                            }
                            //result = bll_stu.Add(model_stu, list_model_gen, list_model_stu_gen);
                        }
                    }
                    else if (dotype == "e")//操作类型为编辑
                    {
                        StringBuilder            sbExists = new StringBuilder();
                        string                   utname   = "";
                        SchSystem.BLL.SchStuInfo ssiBll   = new SchSystem.BLL.SchStuInfo();
                        if (schid == "0")
                        {
                            schid = model_stu.SchId.ToString();
                        }
                        DataTable dt = ssiBll.ExistsStuNoUpdate(TestNo, int.Parse(schid), CurrentTestNo).Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            DataRow[] dr = dt.Select();
                            foreach (DataRow item in dr)
                            {
                                sbExists.Append(item["StuName"].ToString() + "[" + item["GradeName"].ToString());
                                sbExists.Append("(" + item["ClassName"].ToString() + ")]");
                            }
                            //ret += "账号重复!";
                            return(result = sbExists.ToString());
                        }
                        //if (bll_stu.ExistsStuCode(0, model_stu.TestNo.ToString(), Convert.ToInt32(model_stu.SchId)))
                        //{
                        //    LstError.Add("学(考)号重复 !" + Environment.NewLine);//学(考)号重复
                        //    result = "KHCF";
                        //}
                        if (LstError.Count == 0)
                        {
                            result = bll_stu.Update(model_stu, list_model_gen, list_model_stu_gen);
                        }
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }

            return(result);
        }
Exemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt = new DataTable();
                dotype       = Request.Params["dotype"].ToString();
                gradecodestr = Request.Params["gradecode"].ToString();
                classidstr   = Request.Params["classid"].ToString();
                #region 编辑绑定查询
                if (dotype == "e")
                {
                    Stubh = Request.Params["Stubh"].ToString();
                    stuid = Request.Params["id"].ToString();
                    string sql = "select * from SchStuInfoV where StuId='" + stuid + "' ";//根据学生ID查询出学校,年级,班级等信息
                    dt = DbHelperSQL.Query(sql).Tables[0];
                    //18
                    //string oldclassname = dt.Rows[0][18].ToString();
                    DataRow[] dr = dt.Select();
                    if (classidstr == "")
                    {
                        classidstr = dr[0]["ClassId"].ToString();
                    }
                    string oldclassname = dr[0]["OldClassId"].ToString();
                    if (!string.IsNullOrEmpty(oldclassname) || oldclassname != "")
                    {
                        oldClassName = oldclassname;
                    }
                    else
                    {
                        oldClassName = "";
                    }

                    /*if (!string.IsNullOrEmpty(oldclassid) || oldclassid != "")
                     * {
                     *  SchSystem.BLL.SchClassInfo sciBll = new SchSystem.BLL.SchClassInfo();
                     *  oldClassName = sciBll.GetClassNames("ClassId in (" + oldclassid + ")");
                     * }
                     * else
                     * {
                     *  oldClassName = "";
                     * }*/
                    if (dt.Rows.Count > 0)
                    {
                        classinfo = Newtonsoft.Json.JsonConvert.SerializeObject(dt);
                    }
                    else
                    {
                        classinfo = "0";
                    }
                    SchSystem.BLL.SchStuInfo bll_stu = new SchSystem.BLL.SchStuInfo();
                    string  strWhere = " a.StuId=" + stuid;
                    DataSet ds       = bll_stu.GetList(strWhere);//修改绑定需要的数据
                    ds.Tables[0].Columns.Add("ClassId");
                    ds.Tables[0].Columns.Add("jzGenName2");
                    ds.Tables[0].Columns.Add("jzLoginName2");
                    ds.Tables[0].Columns.Add("jzTelNo2");
                    ds.Tables[0].Columns.Add("jzPwd2");
                    ds.Tables[0].Columns.Add("jzStat2");
                    ds.Tables[0].Columns.Add("jzRelation2");
                    ds.Tables[0].Columns.Add("jzGenId2");
                    ds.Tables[0].Columns.Add("jzUnId2");
                    if (ds.Tables[0].Rows.Count != 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            for (int j = i + 1; j < ds.Tables[0].Rows.Count; j++)
                            {
                                if (ds.Tables[0].Rows[i]["StuId"].ToString() == ds.Tables[0].Rows[j]["StuId"].ToString())
                                {
                                    ds.Tables[0].Rows[i]["jzGenName2"]   = ds.Tables[0].Rows[j]["jzGenName1"].ToString();
                                    ds.Tables[0].Rows[i]["jzLoginName2"] = ds.Tables[0].Rows[j]["jzLoginName1"].ToString();
                                    ds.Tables[0].Rows[i]["jzTelNo2"]     = ds.Tables[0].Rows[j]["jzTelNo1"].ToString();
                                    ds.Tables[0].Rows[i]["jzPwd2"]       = ds.Tables[0].Rows[j]["jzPwd1"].ToString();
                                    ds.Tables[0].Rows[i]["jzStat2"]      = ds.Tables[0].Rows[j]["jzStat1"].ToString();
                                    ds.Tables[0].Rows[i]["jzRelation2"]  = ds.Tables[0].Rows[j]["jzRelation1"].ToString();
                                    ds.Tables[0].Rows[i]["jzGenId2"]     = ds.Tables[0].Rows[j]["jzGenId1"].ToString();
                                    ds.Tables[0].Rows[i]["jzUnId2"]      = ds.Tables[0].Rows[j]["jzUnId1"].ToString();
                                    ds.Tables[0].Rows.RemoveAt(j);
                                }
                            }
                        }
                    }
                    umodelstr = dttojson.DatSetToJSON2(ds);
                }
                #endregion
                #region 缺省值:年級領導、班主任和任課教師
                SchSystem.BLL.SchGradeUsers sgiBll = new SchSystem.BLL.SchGradeUsers();
                SchSystem.BLL.SchClassUser  scuBll = new SchSystem.BLL.SchClassUser();
                DataTable dtgradeuser = sgiBll.GetList("*", "GradeId='" + gradecodestr + "'").Tables[0];
                if (dtgradeuser.Rows.Count > 0)
                {
                    StringBuilder sbgradeuser = new StringBuilder();
                    foreach (DataRow dr in dtgradeuser.Rows)
                    {
                        sbgradeuser.Append(dr["UserTname"].ToString() + ",");
                    }
                    if (sbgradeuser.ToString().Length > 0)
                    {
                        njld = sbgradeuser.ToString().Substring(0, sbgradeuser.ToString().Length - 1);//年級領導
                    }
                }
                DataTable dtclassuser = scuBll.GetList("*", "ClassId='" + classidstr + "'").Tables[0];
                if (dtclassuser.Rows.Count > 0)
                {
                    StringBuilder sbgradeuser01 = new StringBuilder();
                    StringBuilder sbgradeuser02 = new StringBuilder();
                    foreach (DataRow dr in dtclassuser.Rows)
                    {
                        if (dr["IsMs"].ToString() == "1")
                        {
                            sbgradeuser01.Append(dr["UserTname"].ToString() + ",");
                        }
                        else
                        {
                            sbgradeuser02.Append(dr["UserTname"].ToString() + ",");
                        }
                    }
                    if (sbgradeuser01.ToString().Length > 0)
                    {
                        bzr = sbgradeuser01.ToString().Substring(0, sbgradeuser01.ToString().Length - 1);//班主任
                    }
                    if (sbgradeuser02.ToString().Length > 0)
                    {
                        bjjs = sbgradeuser02.ToString().Substring(0, sbgradeuser02.ToString().Length - 1);//任課教師
                    }
                }
                #endregion
                StringBuilder sbarea = new StringBuilder();
                //普通老师登录
                if (Com.SoureSession.Souresystype == "0")
                {
                    string gradeid = "";
                    if (dotype == "e" && dt.Rows[0]["AreaNo"].ToString().Length == 6)
                    {
                        gradeid = dt.Rows[0]["GradeId"].ToString();
                    }
                    else
                    {
                        gradeid = gradecodestr;
                    }
                    sbarea.Append("<br/><label class=\"biaoti\">年级:</label><select id=\"nj\" style=\"width:100px\">");
                    sbarea.Append(Com.Public.GetGradeSelect("1", int.Parse(classidstr), ref gradeid, Com.SoureSession.Soureschid));
                    sbarea.Append("</select>");
                    string classid = "";
                    if (dotype == "e" && dt.Rows[0]["AreaNo"].ToString().Length == 6)
                    {
                        classid = dt.Rows[0]["ClassId"].ToString();
                    }
                    sbarea.Append("<span id=\"njld\" style=\"color:	#808080	\">年级领导:" + njld + "</span><br/><br/>");
                    sbarea.Append("<label class=\"biaoti\">班级:</label><select id=\"bj\" style=\"width:100px\" >");
                    sbarea.Append(Com.Public.GetGradeSelect("2", int.Parse(classidstr), ref classid, gradeid));
                    sbarea.Append("</select>");
                    sbarea.Append("<span id=\"bzr\" style=\"color:	#808080	\">班主任:"+ bzr + "</span>&nbsp;&nbsp; ");
                    sbarea.Append("<span id=\"bjjs\" style=\"color:	#808080	\">任课老师:" + bjjs + "</span><br/><br/>");

                    areastr = sbarea.ToString();
                }
                else if (Com.SoureSession.Souresystype == "1")
                {
                    //获取年级
                    sbarea.Append("<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;年级:<select id=\"nj\" style=\"width:100px\">");
                    string schcode = "";
                    if (dotype == "e" && dt.Rows[0]["AreaNo"].ToString().Length == 6)
                    {
                        schcode = dt.Rows[0]["GradeId"].ToString();
                    }
                    sbarea.Append(Com.Public.GetDrpArea("4", Com.SoureSession.Soureschid, ref schcode, false));



                    sbarea.Append("</select>&nbsp;&nbsp;&nbsp;&nbsp;");
                    sbarea.Append("<span id=\"njld\" style=\"color:	#808080	\">年级领导:" + njld + "</span><br/><br/>");
                    //获取班级
                    sbarea.Append(" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;班级:<select id=\"bj\" style=\"width:100px\" >");
                    string Classcode = "";
                    if (dotype == "e" && dt.Rows[0]["AreaNo"].ToString().Length == 6)
                    {
                        Classcode = dt.Rows[0]["ClassId"].ToString();
                    }
                    sbarea.Append(Com.Public.GetDrpArea("5", schcode, ref Classcode, false));
                    sbarea.Append("</select>&nbsp;&nbsp;&nbsp;&nbsp;");
                    sbarea.Append("<span id=\"bzr\" style=\"color:	#808080	\">班主任:"+ bzr + "</span>&nbsp;&nbsp; ");
                    sbarea.Append("<span id=\"bjjs\" style=\"color:	#808080	\">任课老师:" + bjjs + "</span><br/><br/>");
                    string s = getnj("1", schcode, schid, Classcode);
                    areastr = sbarea.ToString();
                }
                else//超管还要加学校下拉,后面需要更改
                {
                    //第一次加载,获取省市区,获取第一个省份下的所有学校
                    //StringBuilder sbarea = new StringBuilder();
                    //获取省份

                    sbarea.Append("省:<select id=\"aprov\">");
                    string sareacode = "";
                    if (dotype == "e" && dt.Rows[0]["AreaNo"].ToString().Length == 6)
                    {
                        sareacode = dt.Rows[0]["AreaNo"].ToString().Substring(0, 2) + "0000";
                    }
                    sbarea.Append(Com.Public.GetDrpArea("0", "", ref sareacode, false));
                    sbarea.Append("</select>");
                    //获取城市
                    sbarea.Append("市:<select id=\"acity\">");
                    string sareacitycode = "";
                    if (dotype == "e" && dt.Rows[0]["AreaNo"].ToString().Length == 6)
                    {
                        sareacitycode = dt.Rows[0]["AreaNo"].ToString().Substring(0, 4) + "00";
                    }
                    sbarea.Append(Com.Public.GetDrpArea("1", sareacode, ref sareacitycode, false));
                    sbarea.Append("</select>");
                    //获取区县
                    sbarea.Append("区:<select id=\"acoty\">");
                    string sareacotycode = "";
                    if (dotype == "e" && dt.Rows[0]["AreaNo"].ToString().Length == 6)
                    {
                        sareacotycode = dt.Rows[0]["AreaNo"].ToString();
                    }
                    sbarea.Append(Com.Public.GetDrpArea("2", sareacitycode, ref sareacotycode, false));
                    sbarea.Append("</select>");
                    //获取学校
                    sbarea.Append("学校:<select id=\"asch\">");
                    string sareaschid = "";
                    if (dotype == "e" && dt.Rows[0]["AreaNo"].ToString().Length == 6)
                    {
                        sareaschid = dt.Rows[0]["SchId"].ToString();
                    }
                    sbarea.Append(Com.Public.GetDrpArea("3", sareacotycode, ref sareaschid, false));
                    sbarea.Append("</select><br/> ");

                    //获取年级
                    sbarea.Append("<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;年级:<select id=\"nj\" style=\"width:100px\">");
                    string schcode = "";
                    if (dotype == "e" && dt.Rows[0]["AreaNo"].ToString().Length == 6)
                    {
                        schcode = dt.Rows[0]["GradeId"].ToString();
                    }
                    sbarea.Append(Com.Public.GetDrpArea("4", sareaschid, ref schcode, false));
                    sbarea.Append("</select>&nbsp;&nbsp;&nbsp;&nbsp;");


                    sbarea.Append("<span id=\"njld\" style=\"color:#808080	\">年级领导:"+ njld + "</span><br/><br/>");
                    //获取班级
                    sbarea.Append(" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;班级:<select id=\"bj\" style=\"width:100px\" >");
                    string Classcode = "";
                    if (dotype == "e" && dt.Rows[0]["AreaNo"].ToString().Length == 6)
                    {
                        Classcode = dt.Rows[0]["ClassId"].ToString();
                    }
                    sbarea.Append(Com.Public.GetDrpArea("5", schcode, ref Classcode, false));
                    sbarea.Append("</select>&nbsp;&nbsp;&nbsp;&nbsp;");
                    sbarea.Append("<span id=\"bzr\" style=\"color:	#808080	\">班主任:"+ bzr + "</span>&nbsp;&nbsp; ");
                    sbarea.Append("<span id=\"bjjs\"  style=\"color:#808080	\">任课老师:" + bjjs + "</span><br/><br/>");
                    string s = getnj("1", schcode, sareaschid, Classcode);

                    areastr = sbarea.ToString();
                }
            }
        }
        public static string udel(string schid, string id)
        {
            string ret = "";

            Com.DataPack.DataRsp <Com.DataPack.UserInfo> rsp = Com.Public.UserFuncSoure(Com.SoureSession.jsid, Com.SoureSession.jstoken);
            if (rsp.code == "ERROR_TOKEN")
            {
                ret = "expire";
            }
            else
            {
                try
                {
                    SchSystem.BLL.SchSubLeader sslBll = new SchSystem.BLL.SchSubLeader();
                    bool sslBool = sslBll.ExistsClassSubLeader(schid, id);
                    if (sslBool)
                    {
                        ret = "success01";
                    }
                    else
                    {
                        SchSystem.BLL.SchGradeUsers sguBll = new SchSystem.BLL.SchGradeUsers();
                        bool sguBool = sguBll.ExistsGradeUser(schid, id);
                        if (sguBool)
                        {
                            ret = "success02";
                        }
                        else
                        {
                            SchSystem.BLL.SchClassUser scuBll = new SchSystem.BLL.SchClassUser();
                            bool scuBooll = scuBll.ExistsClassUser(schid, id);
                            if (scuBooll)
                            {
                                ret = "success03";
                            }
                            else
                            {
                                SchSystem.BLL.SchUserInfo   bll   = new SchSystem.BLL.SchUserInfo();
                                SchSystem.Model.SchUserInfo model = new SchSystem.Model.SchUserInfo();
                                model.UserId      = int.Parse(id);
                                model.Stat        = 2;
                                model.LastRecTime = DateTime.Now;
                                model.LastRecUser = Com.SoureSession.Soureuserid;
                                if (bll.UpdateStat(model))
                                {
                                    ret = "success";
                                }
                                else
                                {
                                    ret = "操作失败";
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    ret = ex.Message;
                }
            }
            return(ret);
        }
Exemplo n.º 11
0
        //需要根据不同情况建立或修改的不同学校用户和不同类型的用户,本学校用户唯一,不需要全系统唯一
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (true)//如果没对应权限,及判断用户类型是否跨界,主要防止非法篡改数据出现
            //{
            //    Response.Write("无对应权限");
            //    Response.End();
            //}
            if (!IsPostBack)
            {
                //先得到操作类型
                dotype    = Com.Public.SqlEncStr(Request.Params["dotype"].ToString());
                schid     = Com.Public.SqlEncStr(Request.Params["schid"].ToString());
                gradecode = Com.Public.SqlEncStr(Request.Params["gradecode"].ToString());
                if (string.IsNullOrEmpty(schid) || string.IsNullOrEmpty(gradecode))//如果没有对应参数中任意一个
                {
                    Response.Write("参数错误!");
                    Response.End();
                }
                if (dotype == "a")
                {
                }
                else if (dotype == "e")//修改,不能修改用户的类型及学校参数
                {
                    btnname = "保存";
                    classid = Com.Public.SqlEncStr(Request.Params["classid"].ToString());
                    if (string.IsNullOrEmpty(classid))
                    {
                        Response.Write("无对应修改的记录!");
                        Response.End();
                    }
                    //获取修改的对应用户的
                    SchSystem.BLL.SchClassInfo   sgibll   = new SchSystem.BLL.SchClassInfo();
                    SchSystem.Model.SchClassInfo sgimodel = sgibll.GetModel(int.Parse(classid));
                    if (sgimodel != null && sgimodel.ClassId > 0)
                    {
                        umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(sgimodel);
                    }
                    else
                    {
                        Response.Write("无该记录!");
                        Response.End();
                    }
                }
                else//不在添加及修改之内,则返回
                {
                    Response.Write("没有可供确认的操作类型!");
                    Response.End();
                }

                /*//判断跨界操作的可能性
                 * if (!Com.Public.isVa(schid, systype))
                 * {
                 *  Response.Write("出错,用户非法跨界操作!");
                 *  Response.End();
                 * }*/
                SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo();
                schname = schbll.GetSchName(int.Parse(schid));
                #region 获取当前学校的老师
                //当前班级任课老师及班主任
                SchSystem.BLL.SchClassUser userclassbll = new SchSystem.BLL.SchClassUser();
                DataTable dtclassuser = userclassbll.GetList("UserName id,SubCode subcode,UserTname name,IsMs isms", "ClassId=" + Com.Public.SqlEncStr(classid)).Tables[0];

                //当前学校老师
                SchSystem.BLL.SchUserDeptV userbll = new SchSystem.BLL.SchUserDeptV();
                DataTable dtuser = userbll.GetList("DeptId,DepartName,UserId,UserTname", "Stat=1 and Ustat=1 and SchId=" + Com.Public.SqlEncStr(schid)).Tables[0];
                //DataRow[] dtRow = dtuser.Select();
                StringBuilder sb = new StringBuilder();
                //DataView dv = dtuser.DefaultView;
                //DataTable datadpt = dv.ToTable(true, "Pid,DeptId,DepartName");
                SchSystem.BLL.SchDepartInfo dptbll = new SchSystem.BLL.SchDepartInfo();
                DataTable dt        = dptbll.GetList(" 'd_'+convert(varchar(20),Pid) pId,'d_'+convert(varchar(20),DepartId) id,DepartName name,'0' isms,'' subcode,'false' checked,'true' nochecks", "SchId=" + schid + " and Stat=1 Order by OrderId,DepartName").Tables[0];
                DataTable dtdptuser = dt.Clone();
                dtdptuser.Columns["nochecks"].ColumnName = "nocheck";
                if (dt.Rows.Count > 0)
                {
                    //合并人员到部门表
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        dtdptuser.Rows.Add(dt.Rows[i].ItemArray);
                        //获取该部门下的人员
                        DataRow[] drss = dtuser.Select("DeptId='" + dt.Rows[i]["id"].ToString().Replace("d_", "") + "'");
                        if (drss.Length > 0)
                        {
                            foreach (DataRow item in drss)
                            {
                                DataRow dr = dtdptuser.NewRow();
                                dr["id"]   = item["UserId"].ToString();
                                dr["name"] = item["UserTname"].ToString();
                                dr["pId"]  = "d_" + item["DeptId"].ToString();
                                dtdptuser.Rows.Add(dr);
                            }
                        }
                    }
                    deptusers = Newtonsoft.Json.JsonConvert.SerializeObject(dtdptuser);
                    //DataRow[] drs = dt.Select("Pid=0");
                    //foreach (DataRow dr in drs)
                    //{
                    //    string nodeID = dr["ID"].ToString();
                    //    string nodeText = dr["Name"].ToString();


                    //    nodeText = "├" + nodeText;
                    //    string blank = "&nbsp;&nbsp;&nbsp;&nbsp;";
                    //    sb.Append("<option value=\"p_" + nodeID + "\">" + nodeText + "</option>");
                    //    DataRow[] drusers = dtuser.Select("DeptId='" + nodeID + "'");
                    //    if (drusers != null && drusers.Length > 0)
                    //    {
                    //        foreach (DataRow druser in drusers)
                    //        {
                    //            sb.Append("<option style=\"color:blue\" value=\"u_" + druser["UserId"].ToString() + "\">" + blank + "&nbsp;&nbsp;&nbsp;&nbsp;" + druser["UserTname"].ToString() + "</option>");
                    //        }
                    //    }
                    //    BindSon(sb, nodeID, dt, blank, dtuser);
                    //}
                }
                //depts = sb.ToString();
                deptss  = Newtonsoft.Json.JsonConvert.SerializeObject(dtclassuser);
                subsdrp = Com.Public.GetDrp("sub", schid, "1", false, "", "");
                #endregion

                #region 获取年级领导
                SchSystem.BLL.SchGradeUsers usergradebll = new SchSystem.BLL.SchGradeUsers();
                gradeboss = usergradebll.GetNames("GradeId='" + Com.Public.SqlEncStr(gradecode) + "'");
                gradesdrp = Com.Public.GetDrp("grade", schid, "0", false, "", "");
                #endregion
            }
        }
Exemplo n.º 12
0
        public static string classsave(string dotype, string schid, string gradecode, string classid, string classname, string tagsusers)
        {
            dotype    = Com.Public.SqlEncStr(dotype);
            schid     = Com.Public.SqlEncStr(schid);
            gradecode = Com.Public.SqlEncStr(gradecode);
            classid   = Com.Public.SqlEncStr(classid);
            classname = Com.Public.SqlEncStr(classname);
            tagsusers = Com.Public.SqlEncStr(tagsusers);
            string ret = "";

            if (Com.Session.userid == null)
            {
                ret = "expire";
            }
            else
            {
                //字符串匹配验证
                string PatternStr = @"^[0-9a-zA-Z\u4e00-\u9fa5]+$";
                bool   resultStr  = Regex.IsMatch(classname, PatternStr);
                if (resultStr != true)
                {
                    return(ret = "必填,只能输入中文、数字和字母");
                }
                try
                {
                    if (!Com.Public.isVa(schid, ""))
                    {
                        return(ret = "无跨界权限");
                    }
                    if (schid == Com.Public.getKey("adminschid"))
                    {
                        ret = "此为系统学校,不允许操作";
                    }
                    else if (string.IsNullOrEmpty(schid) || schid == "0")
                    {
                        ret += "非法的学校!";
                    }
                    //SchSystem.BLL.SchClassInfo classbll = new SchSystem.BLL.SchClassInfo();
                    //SchSystem.Model.SchClassInfo classmodel = new SchSystem.Model.SchClassInfo();
                    //classmodel.LastRecTime = DateTime.Now;
                    //classmodel.LastRecUser = Com.Session.userid;
                    //classmodel.GradeId = gradecode;
                    //classmodel.ClassName = classname;
                    //判断编号及账号是否有重复,生成密码加密
                    if (dotype == "e")
                    {
                        /*if (userbll.ExistsUserCode(int.Parse(userid), usercode, int.Parse(schid)))
                         * {
                         *  ret += "用户编号重复!";
                         * }*/
                    }
                    if (dotype == "a")
                    {
                        /*if (userbll.ExistsUserCode(0, usercode, int.Parse(schid)))
                         * {
                         *  ret += "用户编号重复!";
                         * }
                         * if (userbll.ExistsUserCode(0, username, int.Parse(schid)))
                         * {
                         *  ret += "账号重复!";
                         * }*/
                    }
                    if (ret == "")
                    {
                        //if (dotype == "e")
                        //{
                        //    classmodel.ClassId = int.Parse(classid);
                        //    classbll.Update(classmodel);
                        //}
                        //if (dotype == "a")
                        //{
                        //    //usermodel.PassWord = SchManagerInfoSystem.Common.DESEncrypt.Encrypt(userpw);
                        //    classmodel.RecTime = DateTime.Now;
                        //    classmodel.RecUser = Com.Session.userid;
                        //    classmodel.IsFinish = 0;
                        //    classmodel.SchId = int.Parse(schid);
                        //    classid = classbll.Add(classmodel).ToString();
                        //}
                        //清除关联的老师,再添加或更新关联老师
                        SchSystem.BLL.SchClassUser   classuserbll = new SchSystem.BLL.SchClassUser();
                        SchSystem.Model.SchClassUser classusermodel;
                        classuserbll.DeleteUserSub("ClassId=" + Com.Public.SqlEncStr(classid));
                        tagsusers = tagsusers.Replace("u_", "");//UID,UTNAME,SUB,ISMS
                        string[] uss = tagsusers.Split('|');
                        if (uss.Length > 0)
                        {
                            foreach (string item in uss)
                            {
                                string[] its = item.Split(',');
                                if (its.Length == 4)
                                {
                                    if (its[0] != "")
                                    {
                                        classusermodel             = new SchSystem.Model.SchClassUser();
                                        classusermodel.ClassId     = int.Parse(classid);
                                        classusermodel.LastRecTime = DateTime.Now;
                                        classusermodel.SchId       = int.Parse(schid);
                                        classusermodel.LastRecUser = Com.Session.userid;
                                        classusermodel.RecTime     = DateTime.Now;
                                        classusermodel.RecUser     = Com.Session.userid;
                                        classusermodel.UserName    = its[0];
                                        classusermodel.SubCode     = its[1];
                                        classusermodel.UserTname   = its[2];
                                        classusermodel.IsMs        = int.Parse(its[3]);
                                        classuserbll.Add(classusermodel);
                                    }
                                }
                            }
                        }
                        ret = "success";
                    }
                }
                catch (Exception ex)
                {
                    ret = ex.Message;
                }
            }
            return(ret);
        }
        public static string udel(string schid, string id)
        {
            if (!Com.Public.isVa(schid, ""))
            {
                return("无跨界权限");
            }
            string ret = "";

            if (Com.Session.userid == null)
            {
                ret = "expire";
            }
            else
            {
                try
                {
                    SchSystem.BLL.SchSubLeader sslBll = new SchSystem.BLL.SchSubLeader();
                    bool sslBool = sslBll.ExistsClassSubLeader(schid, id);
                    if (sslBool)
                    {
                        ret = "success01";
                    }
                    else
                    {
                        SchSystem.BLL.SchGradeUsers sguBll = new SchSystem.BLL.SchGradeUsers();
                        bool sguBool = sguBll.ExistsGradeUser(schid, id);
                        if (sguBool)
                        {
                            ret = "success02";
                        }
                        else
                        {
                            SchSystem.BLL.SchClassUser scuBll = new SchSystem.BLL.SchClassUser();
                            bool scuBooll = scuBll.ExistsClassUser(schid, id);
                            if (scuBooll)
                            {
                                ret = "success03";
                            }
                            else
                            {
                                SchSystem.BLL.SchUserInfo   bll   = new SchSystem.BLL.SchUserInfo();
                                SchSystem.Model.SchUserInfo model = new SchSystem.Model.SchUserInfo();
                                model.UserId      = int.Parse(id);
                                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);
        }
Exemplo n.º 14
0
        public static Com.DataPack.DataRsp <string> schsave(string Stuid, string dotype, string schid, string ClassId, string TestNo, string StuName, string Sex, string CardNo, string StudyType, string TelNo, string Addr, string jzGenName1, string jzTelNo1, string jzGenName2, string jzTelNo2, string Relation1, string Relation2, string OldClassName, string OldGradeId, string OldGradeName, string GradeId, string OldClassId, string CurrentTestNo)
        {
            Com.DataPack.DataRsp <string> rsp          = new Com.DataPack.DataRsp <string>();
            SchSystem.BLL.SchClassUser    bllclassuser = new SchSystem.BLL.SchClassUser();
            if (Com.Session.userid == null)
            {
                rsp.code = "expire";
                rsp.msg  = "页面已经过期,请重新登录";
            }
            else
            {
                try
                {
                    SchSystem.Model.SchStuInfo model_stu = new SchSystem.Model.SchStuInfo();
                    SchSystem.BLL.SchStuInfo   bll_stu   = new SchSystem.BLL.SchStuInfo();
                    if (Com.Session.systype != "2")
                    {
                        model_stu.SchId = Convert.ToInt32(Com.Session.schid);
                    }
                    else
                    {
                        model_stu.SchId = Convert.ToInt32(schid);
                    }

                    StringBuilder sb = new StringBuilder();
                    if (ClassId != OldClassId)
                    {
                        sb.Append(OldGradeName + "(" + OldClassName + ")");
                    }
                    string sbstr = sb.ToString();
                    if (sbstr != "")
                    {
                        model_stu.OldClassId = sbstr;
                    }
                    else
                    {
                        model_stu.OldClassId = "";
                    }
                    model_stu.ClassId     = Convert.ToInt32(ClassId);
                    model_stu.TestNo      = Com.Public.SqlEncStr(TestNo);
                    model_stu.StuName     = Com.Public.SqlEncStr(StuName);
                    model_stu.Sex         = Convert.ToInt32(Sex);
                    model_stu.StudyType   = Convert.ToInt32(StudyType);
                    model_stu.TelNo       = Com.Public.SqlEncStr(TelNo);
                    model_stu.Addr        = Com.Public.SqlEncStr(Addr);
                    model_stu.RecUser     = Com.Session.userid;
                    model_stu.RecTime     = Convert.ToDateTime(DateTime.Now.ToLocalTime().ToString());
                    model_stu.LastRecUser = Com.Session.userid;
                    model_stu.LastRecTime = Convert.ToDateTime(DateTime.Now.ToLocalTime().ToString());
                    model_stu.StuNo       = Com.Public.SqlEncStr(TestNo);
                    model_stu.CardNo      = "";//(Test)卡地址在前台读取,
                    string errorstr = "";
                    //获取有考号的学生列表,进行添加或者修改判断
                    int stuids = 0;
                    if (dotype == "e")//根据是否有判断
                    {
                        model_stu.StuId = Convert.ToInt32(Stuid);
                        stuids          = model_stu.StuId;
                    }
                    //判断是否有该学号的学生
                    StringBuilder            sbExists = new StringBuilder();
                    SchSystem.BLL.SchStuInfo ssiBll   = new SchSystem.BLL.SchStuInfo();
                    //看是否考号被占用
                    DataTable dt = ssiBll.GetStuNoList(TestNo, model_stu.SchId, stuids).Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        DataRow[] dr = dt.Select();
                        foreach (DataRow item in dr)
                        {
                            sbExists.Append("[" + item["GradeName"].ToString() + item["ClassName"].ToString() + "]" + item["StuName"].ToString() + ";");
                        }
                        errorstr += "考号被:" + sbExists.ToString() + "占用;";
                    }
                    if (Com.Session.systype == "0" && !bllclassuser.ExistsIsMs(Com.Public.SqlEncStr(ClassId), Com.Session.usertid, Com.Session.schid, 1) == true)//班主任
                    {
                        errorstr += "非班主任不能添加学生!";
                    }
                    if (errorstr == "")
                    {
                        if (dotype == "e")
                        {
                            //更新学生
                            bll_stu.UpdateStu(model_stu);
                        }
                        else
                        {
                            stuids = bll_stu.AddStu(model_stu);
                        }
                        if (stuids > 0)
                        {
                            //添加家长
                            //先删除关联表数据
                            SchSystem.BLL.SchStuGenUn genunBll = new SchSystem.BLL.SchStuGenUn();
                            genunBll.DeleteStuUn(stuids);
                            SchSystem.BLL.SchGenInfo genBll = new SchSystem.BLL.SchGenInfo();
                            //对第一个家长资料进行处理
                            if (Convert.ToString(jzGenName1) != "" && Convert.ToString(jzTelNo1) != "")
                            {
                                int genid = genBll.GetMbId(jzTelNo1);
                                if (genid == 0)//无号码存在,则插数据
                                {
                                    SchSystem.Model.SchGenInfo genmodel = new SchSystem.Model.SchGenInfo();
                                    genmodel.TelNo       = jzTelNo1;
                                    genmodel.RecUser     = Com.Session.userid;
                                    genmodel.RecTime     = DateTime.Now;
                                    genmodel.LastRecUser = Com.Session.userid;
                                    genmodel.LastRecTime = DateTime.Now;
                                    genid = genBll.Add(genmodel);
                                }
                                if (genid > 0)//插成功或者获取成功,则往关联表插数据
                                {
                                    SchSystem.Model.SchStuGenUn genunmodel = new SchSystem.Model.SchStuGenUn();
                                    genunmodel.StuId    = stuids;
                                    genunmodel.GenId    = genid;
                                    genunmodel.GenName  = jzGenName1;
                                    genunmodel.Relation = Relation1 == "" ? "其他" : Relation1;
                                    genunBll.Add(genunmodel);
                                }
                            }
                            //对第二个家长进行处理
                            if (Convert.ToString(jzGenName2) != "" && Convert.ToString(jzTelNo2) != "")
                            {
                                int genid = genBll.GetMbId(jzTelNo2);
                                if (genid == 0)//无号码存在,则插数据
                                {
                                    SchSystem.Model.SchGenInfo genmodel = new SchSystem.Model.SchGenInfo();
                                    genmodel.TelNo       = jzTelNo2;
                                    genmodel.RecUser     = Com.Session.userid;
                                    genmodel.RecTime     = DateTime.Now;
                                    genmodel.LastRecUser = Com.Session.userid;
                                    genmodel.LastRecTime = DateTime.Now;
                                    genid = genBll.Add(genmodel);
                                }
                                if (genid > 0)//插成功或者获取成功,则往关联表插数据
                                {
                                    SchSystem.Model.SchStuGenUn genunmodel = new SchSystem.Model.SchStuGenUn();
                                    genunmodel.StuId    = stuids;
                                    genunmodel.GenId    = genid;
                                    genunmodel.GenName  = jzGenName2;
                                    genunmodel.Relation = Relation2 == "" ? "其他" : Relation2;
                                    genunBll.Add(genunmodel);
                                }
                            }
                        }
                        rsp.code = "success";
                        rsp.msg  = "保存成功";
                    }
                    else
                    {
                        rsp.code = "error";
                        rsp.msg  = errorstr;
                    }
                }
                catch (Exception ex)
                {
                    rsp.code = "error";
                    rsp.msg  = ex.Message;
                }
            }

            return(rsp);
        }
        //需要根据不同情况建立或修改的不同学校用户和不同类型的用户,本学校用户唯一,不需要全系统唯一
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (true)//如果没对应权限,及判断用户类型是否跨界,主要防止非法篡改数据出现
            //{
            //    Response.Write("无对应权限");
            //    Response.End();
            //}
            if (!IsPostBack)
            {
                //先得到操作类型
                dotype    = Com.Public.SqlEncStr(Request.Params["dotype"].ToString());
                schid     = Com.Public.SqlEncStr(Request.Params["schid"].ToString());
                gradecode = Com.Public.SqlEncStr(Request.Params["gradecode"].ToString());
                if (string.IsNullOrEmpty(schid) || string.IsNullOrEmpty(gradecode))//如果没有对应参数中任意一个
                {
                    Response.Write("参数错误!");
                    Response.End();
                }
                if (dotype == "a")
                {
                }
                else if (dotype == "e")//修改,不能修改用户的类型及学校参数
                {
                    btnname = "修改";
                    classid = Com.Public.SqlEncStr(Request.Params["classid"].ToString());
                    if (string.IsNullOrEmpty(classid))
                    {
                        Response.Write("无对应修改的记录!");
                        Response.End();
                    }
                    //获取修改的对应用户的
                    SchSystem.BLL.SchClassInfo   sgibll   = new SchSystem.BLL.SchClassInfo();
                    SchSystem.Model.SchClassInfo sgimodel = sgibll.GetModel(int.Parse(classid));
                    if (sgimodel != null && sgimodel.ClassId > 0)
                    {
                        umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(sgimodel);
                    }
                    else
                    {
                        Response.Write("无该记录!");
                        Response.End();
                    }
                }
                else//不在添加及修改之内,则返回
                {
                    Response.Write("没有可供确认的操作类型!");
                    Response.End();
                }

                /*//判断跨界操作的可能性
                 * if (!Com.Public.isVa(schid, systype))
                 * {
                 *  Response.Write("出错,用户非法跨界操作!");
                 *  Response.End();
                 * }*/
                #region 获取部门人员列表
                SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo();
                schname = schbll.GetSchName(int.Parse(schid));
                //获取年级领导
                SchSystem.BLL.SchGradeUsers usergradebll = new SchSystem.BLL.SchGradeUsers();
                gradeboss = usergradebll.GetNames("GradeId in ( select GradeId from SchGradeInfo where GradeCode=" + Com.Public.SqlEncStr(gradecode) + " and schid=" + schid + ")");
                gradesdrp = Com.Public.GetDrp("grade", schid, "0", false, "", "");
                SchSystem.BLL.SchDepartInfo sdiBll = new SchSystem.BLL.SchDepartInfo();
                //获取部门列表
                DataTable dtdpt = sdiBll.GetList("Pid pId,convert(varchar(20),DepartId) id,DepartName name,'false' checked,'true' nochecks,'0' isms,'' subcode", "SchId=" + Com.Public.SqlEncStr(schid) + " and Stat=1 Order by OrderId").Tables[0];
                dtdpt.Columns["nochecks"].ColumnName = "nocheck";
                DataTable     dtdptuser = dtdpt.Clone();
                StringBuilder sb        = new StringBuilder();
                if (dtdpt.Rows.Count > 0)
                {
                    SchSystem.BLL.SchClassUser userclassbll = new SchSystem.BLL.SchClassUser();
                    DataTable dtclassuser = userclassbll.GetList("UserName,SubCode,IsMs", "ClassId=" + Com.Public.SqlEncStr(classid)).Tables[0];
                    //获取该学校的所有人员
                    SchSystem.BLL.SchUserDeptV userbll = new SchSystem.BLL.SchUserDeptV();
                    DataTable dtuser = userbll.GetList("DeptId ,UserName,UserTname", "Stat=1 and Ustat=1 and SchId=" + Com.Public.SqlEncStr(schid)).Tables[0];
                    //合并人员到部门表
                    for (int i = 0; i < dtdpt.Rows.Count; i++)
                    {
                        dtdptuser.Rows.Add(dtdpt.Rows[i].ItemArray);
                        //获取该部门下的人员
                        DataRow[] drs = dtuser.Select("DeptId='" + dtdpt.Rows[i]["id"].ToString() + "'");
                        if (drs.Length > 0)
                        {
                            foreach (DataRow item in drs)
                            {
                                DataRow dr = dtdptuser.NewRow();
                                dr["id"]   = "u_" + item["UserName"].ToString();
                                dr["name"] = item["UserTname"].ToString();
                                dr["pId"]  = item["DeptId"].ToString();
                                //如果是被绑定了,则勾选
                                DataRow[] drsclassuser = dtclassuser.Select("UserName='******'");
                                if (drsclassuser.Length > 0)
                                {
                                    dr["isms"]    = drsclassuser[0]["IsMs"].ToString();
                                    dr["subcode"] = drsclassuser[0]["SubCode"].ToString();
                                    dr["checked"] = "true";
                                }
                                dtdptuser.Rows.Add(dr);
                            }
                        }
                    }
                }
                SchSystem.BLL.SchUserInfo sui = new SchSystem.BLL.SchUserInfo();
                DataTable dtsui = sui.GetList("*", "Stat=1 and SchId=" + Com.Public.SqlEncStr(schid)).Tables[0];
                DataRow[] drsui = dtsui.Select();

                foreach (DataRow item in drsui)
                {
                    sb.Append("<option value=\"u_" + item["UserName"].ToString() + "\">" + item["UserTname"].ToString() + "</option>");
                }
                tec     = sb.ToString();
                depts   = Newtonsoft.Json.JsonConvert.SerializeObject(dtdptuser);
                subsdrp = Com.Public.GetDrp("sub", schid, "1", false, "", "");
                #endregion
                #region 获取部门人员列表

                /*SchSystem.BLL.SchInfo schbll = new SchSystem.BLL.SchInfo();
                 * schname = schbll.GetSchName(int.Parse(schid));
                 * //获取年级领导
                 * SchSystem.BLL.SchGradeUsers usergradebll = new SchSystem.BLL.SchGradeUsers();
                 * gradeboss = usergradebll.GetNames("GradeId in ( select GradeId from SchGradeInfo where GradeCode=" + Com.Public.SqlEncStr(gradecode) + " and schid=" + schid + ")");
                 * gradesdrp = Com.Public.GetDrp("grade", schid, "0", false, "", "");
                 * SchSystem.BLL.SchDepartInfo sdiBll = new SchSystem.BLL.SchDepartInfo();
                 * //获取部门列表
                 * DataTable dtdpt = sdiBll.GetList("Pid pId,convert(varchar(20),DepartId) id,DepartName name,'false' checked,'false' checked,'true' nochecks,'0' isms,'' subcode", "SchId=" + Com.Public.SqlEncStr(schid) + " and Stat=1 Order by OrderId").Tables[0];
                 * dtdpt.Columns["nochecks"].ColumnName = "nocheck";
                 * DataTable dtdptuser = dtdpt.Clone();
                 * StringBuilder sb = new StringBuilder();
                 * if (dtdpt.Rows.Count > 0)
                 * {
                 *  SchSystem.BLL.SchClassUser userclassbll = new SchSystem.BLL.SchClassUser();
                 *  DataTable dtclassuser = userclassbll.GetList("UserName,SubCode,IsMs", "ClassId=" + Com.Public.SqlEncStr(classid)).Tables[0];
                 *  //获取该学校的所有人员
                 *  SchSystem.BLL.SchUserDeptV userbll = new SchSystem.BLL.SchUserDeptV();
                 *  DataTable dtuser = userbll.GetList("DeptId ,UserName,UserTname", "Stat=1 and Ustat=1 and SchId=" + Com.Public.SqlEncStr(schid)).Tables[0];
                 *  //合并人员到部门表
                 *  int z = 0;
                 *  for (int i = 0; i < dtdpt.Rows.Count; i++)
                 *  {
                 *
                 *      dtdptuser.Rows.Add(dtdpt.Rows[i].ItemArray);
                 *      //获取该部门下的人员
                 *      DataRow[] drs = dtuser.Select("DeptId='" + dtdpt.Rows[i]["id"].ToString() + "'");
                 *      if (drs.Length > 0)
                 *      {
                 *          foreach (DataRow item in drs)
                 *          {
                 *              sb.Append("<option value=\"u_"+z+"_" + item["UserName"].ToString() + "\">" + item["UserTname"].ToString() + "</option>");
                 *              DataRow dr = dtdptuser.NewRow();
                 *              dr["id"] = "u_" + z + "_" + item["UserName"].ToString();
                 *              dr["name"] = item["UserTname"].ToString();
                 *              dr["pId"] = item["DeptId"].ToString();
                 *              //如果是被绑定了,则勾选
                 *              DataRow[] drsclassuser = dtclassuser.Select("UserName='******'");
                 *              if (drsclassuser.Length > 0)
                 *              {
                 *                  dr["isms"] = drsclassuser[0]["IsMs"].ToString();
                 *                  dr["subcode"] = drsclassuser[0]["SubCode"].ToString();
                 *                  dr["checked"] = "true";
                 *              }z++;
                 *              dtdptuser.Rows.Add(dr);
                 *
                 *          }
                 *      }
                 *  }
                 *
                 * }
                 * tec = sb.ToString();
                 * depts = Newtonsoft.Json.JsonConvert.SerializeObject(dtdptuser);
                 * subsdrp = Com.Public.GetDrp("sub", schid, "1", false, "", "");*/
                #endregion
            }
        }
        public static string classsave(string dotype, string schid, string gradecode, string classid, string classname, string tagsusers)
        {
            dotype    = Com.Public.SqlEncStr(dotype);
            schid     = Com.Public.SqlEncStr(schid);
            gradecode = Com.Public.SqlEncStr(gradecode);
            classid   = Com.Public.SqlEncStr(classid);
            classname = Com.Public.SqlEncStr(classname);
            tagsusers = Com.Public.SqlEncStr(tagsusers);

            /*
             * //手机号码验证
             * string PatternPhone = @"^(?:13|15\d|15[89])-?\d{5}(\d{3}|\*{3})$";
             * bool ResultPhone = Regex.IsMatch(classname, PatternPhone);
             * if (ResultPhone != true)
             * {
             *  return "手机号码(格式:15153585510)或固定电话(格式:0531-1234678)格式不正确";
             * }
             */
            //字符串匹配验证
            string PatternStr = @"^[\u4e00-\u9fa5]+$";
            bool   resultStr  = Regex.IsMatch(classname, PatternStr);

            if (resultStr != true)
            {
                return("只能输入中文名称");
            }
            string ret = "";

            try
            {
                if (!Com.Public.IsOne(Com.Session.userrolestr, 12))
                {
                    return(ret = "无操作权限");
                }
                if (!Com.Public.isVa(schid, ""))
                {
                    return(ret = "无跨界权限");
                }
                if (schid == Com.Public.getKey("adminschid"))
                {
                    ret = "此为系统学校,不允许操作";
                }
                else if (string.IsNullOrEmpty(schid) || schid == "0")
                {
                    ret += "非法的学校!";
                }
                SchSystem.BLL.SchClassInfo   classbll   = new SchSystem.BLL.SchClassInfo();
                SchSystem.Model.SchClassInfo classmodel = new SchSystem.Model.SchClassInfo();
                classmodel.LastRecTime = DateTime.Now;
                classmodel.LastRecUser = Com.Session.userid;
                classmodel.GradeCode   = gradecode;
                classmodel.ClassName   = classname;
                //判断编号及账号是否有重复,生成密码加密
                if (dotype == "e")
                {
                    /*if (userbll.ExistsUserCode(int.Parse(userid), usercode, int.Parse(schid)))
                     * {
                     *  ret += "用户编号重复!";
                     * }*/
                }
                if (dotype == "a")
                {
                    /*if (userbll.ExistsUserCode(0, usercode, int.Parse(schid)))
                     * {
                     *  ret += "用户编号重复!";
                     * }
                     * if (userbll.ExistsUserCode(0, username, int.Parse(schid)))
                     * {
                     *  ret += "账号重复!";
                     * }*/
                }
                if (ret == "")
                {
                    if (dotype == "e")
                    {
                        classmodel.ClassId = int.Parse(classid);
                        classbll.Update(classmodel);
                    }
                    if (dotype == "a")
                    {
                        //usermodel.PassWord = SchManagerInfoSystem.Common.DESEncrypt.Encrypt(userpw);
                        classmodel.RecTime  = DateTime.Now;
                        classmodel.RecUser  = Com.Session.userid;
                        classmodel.IsFinish = 0;
                        classmodel.SchId    = int.Parse(schid);
                        classid             = classbll.Add(classmodel).ToString();
                    }
                    //清除关联的老师,再添加或更新关联老师
                    SchSystem.BLL.SchClassUser   classuserbll = new SchSystem.BLL.SchClassUser();
                    SchSystem.Model.SchClassUser classusermodel;
                    classuserbll.DeleteUserSub("ClassId=" + Com.Public.SqlEncStr(classid));
                    tagsusers = tagsusers.Replace("u_", "");//UID,UTNAME,SUB,ISMS
                    string[] uss = tagsusers.Split('|');
                    if (uss.Length > 0)
                    {
                        foreach (string item in uss)
                        {
                            string[] its = item.Split(',');
                            if (its.Length == 4)
                            {
                                classusermodel             = new SchSystem.Model.SchClassUser();
                                classusermodel.ClassId     = int.Parse(classid);
                                classusermodel.IsMs        = int.Parse(its[3]);
                                classusermodel.LastRecTime = DateTime.Now;
                                classusermodel.LastRecUser = Com.Session.userid;
                                classusermodel.RecTime     = DateTime.Now;
                                classusermodel.RecUser     = Com.Session.userid;
                                classusermodel.UserName    = its[0];
                                classusermodel.UserTname   = its[1];
                                classusermodel.SubCode     = its[2];
                                classusermodel.SchId       = int.Parse(schid);
                                classuserbll.Add(classusermodel);
                            }
                        }
                    }
                    ret = "success";
                }
            }
            catch (Exception ex)
            {
                ret = ex.Message;
            }
            return(ret);
        }
Exemplo n.º 17
0
        public static string page(string txtname, string ustat, string cotycode, string schid, string gradeCode, string classid, string subcode)
        {
            string ret = "";

            if (Com.Session.userid == null)
            {
                ret = "expire";
            }
            else
            {
                SchSystem.BLL.SchClassInfo sciBll = new SchSystem.BLL.SchClassInfo();
                //Stat:0废弃,1正常,2被删除,正常界面不显示删除,超管界面可以考虑
                string strwhere = "ClassStat=0 and SchId = '" + Com.Public.SqlEncStr(schid) + "'";
                if (!string.IsNullOrEmpty(ustat))
                {
                    strwhere += " and IsFinish=" + Com.Public.SqlEncStr(ustat);
                }
                else
                {
                    strwhere += " and IsFinish=0";
                }
                if (!string.IsNullOrEmpty(gradeCode))
                {
                    strwhere += " and GradeId='" + Com.Public.SqlEncStr(gradeCode) + "'";
                }
                if (!string.IsNullOrEmpty(classid))
                {
                    strwhere += " and ClassId='" + Com.Public.SqlEncStr(classid) + "'";
                }

                if (!string.IsNullOrEmpty(subcode) && !string.IsNullOrEmpty(txtname))
                {
                    strwhere += " and ClassId in (select ClassId from SchClassUser where SubCode='" + Com.Public.SqlEncStr(subcode) + "' and schid='" + Com.Public.SqlEncStr(schid) + "' and UserTname like '%" + Com.Public.SqlEncStr(txtname) + "%')";
                }
                else if (!string.IsNullOrEmpty(txtname) || !string.IsNullOrEmpty(subcode))
                {
                    if (!string.IsNullOrEmpty(txtname))
                    {
                        strwhere += " and ClassId in (select ClassId from SchClassUser where UserTname like '%" + Com.Public.SqlEncStr(txtname) + "%' and schid='" + Com.Public.SqlEncStr(schid) + "')";
                    }
                    else
                    {
                        strwhere += " and ClassId in (select ClassId from SchClassUser where SubCode='" + Com.Public.SqlEncStr(subcode) + "' and schid='" + Com.Public.SqlEncStr(schid) + "')";
                    }
                }
                int rowc = 0;
                int pc   = 0;
                //DataTable dt = userbll.GetListCols("*", strwhere, "SchName", "ASC", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
                DataTable ClassDt = sciBll.GetListV(strwhere + " order by GradeCode,ClassName").Tables[0];//得到班级数据列表
                //pages.PageCount = pc;
                if (ClassDt.Rows.Count > 0)
                {
                    ClassDt.Columns.Add("Ustat");
                    ClassDt.Columns.Add("Ucity");
                    ClassDt.Columns.Add("TeacherClass"); //班主任
                    //ClassDt.Columns.Add("Teacher");//任课老师
                    ClassDt.Columns.Add("TeacherSub");   //任课老师科目
                    SchSystem.BLL.SchClassUser scuBLL = new SchSystem.BLL.SchClassUser();
                    string sqlstr  = "";
                    string sqlstrn = "";
                    if (!string.IsNullOrEmpty(txtname))
                    {
                        sqlstrn = " UserTname like '%" + Com.Public.SqlEncStr(txtname) + "%'";
                    }
                    string sqlstrs = "";
                    if (!string.IsNullOrEmpty(subcode))
                    {
                        sqlstrs = " SubCode='" + Com.Public.SqlEncStr(subcode) + "'";
                    }
                    if (sqlstrn != "" && sqlstrs != "")
                    {
                        sqlstr = " and ( " + sqlstrn + " or " + sqlstrs + ")";
                    }
                    else if (sqlstrn != "" || sqlstrs != "")
                    {
                        sqlstr = " and " + sqlstrn + sqlstrs;
                    }
                    for (int i = 0; i < ClassDt.Rows.Count; i++)
                    {
                        ClassDt.Rows[i]["Ustat"] = ClassDt.Rows[i]["IsFinish"].ToString() == "0" ? "正常" : "毕业";
                        string ClassId = ClassDt.Rows[i]["ClassId"].ToString();
                        string sss     = scuBLL.GetNames("ClassId='" + ClassId + "'and IsMs=1");
                        //班级教师(班主任)
                        ClassDt.Rows[i]["TeacherClass"] = scuBLL.GetNames("ClassId='" + ClassId + "' and IsMs=1 " + sqlstr);
                        //任课老师
                        ClassDt.Rows[i]["TeacherSub"] = scuBLL.GetNames("ClassId='" + ClassId + "' and IsMs=0 " + sqlstr);
                    }
                    //pages.list = ClassDt;
                }
                ret = Newtonsoft.Json.JsonConvert.SerializeObject(ClassDt);
            }
            return(ret);
        }
Exemplo n.º 18
0
        public static string page(string PageIndex, string PageSize, string ClassId, string SchId, string Stuname, string GradeId)
        {
            bool islist = false;

            Com.Public.PageModelResp pages = new Com.Public.PageModelResp();
            pages.PageIndex = int.Parse(PageIndex);
            pages.PageSize  = int.Parse(PageSize);
            SchSystem.BLL.SchClassUser  bllclassuser = new SchSystem.BLL.SchClassUser();
            SchSystem.BLL.SchGradeUsers bllgradeuser = new SchSystem.BLL.SchGradeUsers();
            #region 添加按钮和列表显示权限
            pages.isadd = false;
            if (Com.SoureSession.Souresystype == "1")//学校超管
            {
                islist = true;
                if (GradeId == "-1" || ClassId == "-1" || GradeId == "" || ClassId == "") //系统编辑状态为0,或者年级,班级其中一个选择了全部,则不允许出现添加按钮
                {
                    pages.isadd = false;
                }
                else
                {
                    pages.isadd = true;
                }
            }
            else//普通老师账号
            {
                if (bllclassuser.ExistsIsMs(Com.Public.SqlEncStr(ClassId), Com.SoureSession.Soureuserid, Com.SoureSession.Soureschid, 1) == true)//班主任
                {
                    if (Com.Session.appeditstat == "1")
                    {
                        pages.isadd = true;
                    }
                    islist = true;
                }
                else
                {
                    pages.isadd = false;
                    if (bllgradeuser.ExistsGrade(Com.Public.SqlEncStr(GradeId), Com.SoureSession.Soureschid, Com.SoureSession.Soureuserid) == true)//年级主任
                    {
                        islist = true;
                    }
                    if (bllclassuser.ExistsIsMs(Com.Public.SqlEncStr(ClassId), Com.SoureSession.Soureuserid, Com.SoureSession.Soureschid, 0) == true)//任课老师
                    {
                        islist = true;
                    }
                }
                if (Com.Public.IsUserVal(Com.Session.userrolestr, 2))
                {
                    islist = true;
                }
                ;
            }
            #endregion
            if (islist)
            {
                string strWhere = "StuStat=1 ";
                if (!string.IsNullOrEmpty(Stuname))
                {
                    strWhere += " and stuname LIKE '%" + Com.Public.SqlEncStr(Stuname) + "%'";
                }
                if (GradeId == "-1" || GradeId == "")//获取当前用户的所有年级
                {
                    strWhere += " and GradeId in (" + Com.Public.GetIdsAllStu("4", Com.SoureSession.Soureschid) + ")";
                }
                else
                {
                    strWhere += " and GradeId=" + Com.Public.SqlEncStr(GradeId);
                }
                if (ClassId == "-1" || ClassId == "")//获取当前用户的所有班级
                {
                    if (GradeId == "")
                    {
                        GradeId = "-1";
                    }
                    strWhere += " and ClassId in (" + Com.Public.GetIdsAllStu("5", Com.Public.SqlEncStr(GradeId)) + ")";
                }
                else
                {
                    strWhere += " and ClassId=" + Com.Public.SqlEncStr(ClassId);
                }

                int    RowCount = 0; int PageCount = 0;//left('00000000',8-len(StuId))+convert(varchar(10),StuId)
                string cols = "  GradeId,ClassId,GradeName,ClassName,StuId,TestNo,StuName,CardNo,Sex,StuNo,TelNo,StudyType,LoginName,'' GenNameO,'' GenLoginNameO ,'' GenTelO,'' GenNameT,'' GenLoginNameT ,'' GenTelT,'0' isdel,'0' isedit,'0' islook";
                SchSystem.BLL.SchStuInfoV bllstuv = new SchSystem.BLL.SchStuInfoV();
                DataTable dtstuv = bllstuv.GetListCols(cols, strWhere, "StuName", "ASC", pages.PageIndex, pages.PageSize, ref RowCount, ref PageCount).Tables[0];
                pages.PageCount = PageCount;
                pages.RowCount  = RowCount;
                if (dtstuv != null && dtstuv.Rows.Count > 0)
                {
                    SchSystem.BLL.SchStuGenUV bllstugenv = new SchSystem.BLL.SchStuGenUV();
                    for (int i = 0; i < dtstuv.Rows.Count; i++)//将家长添加上,并且把权限加上
                    {
                        //获取家长
                        DataTable dtgenv = bllstugenv.GetList("GenName,LoginName,TelNo,Relation", "Stat=1 and StuId=" + dtstuv.Rows[i]["StuId"].ToString()).Tables[0];
                        if (dtgenv != null && dtgenv.Rows.Count > 0)
                        {
                            dtstuv.Rows[i]["GenNameO"]      = dtgenv.Rows[0]["GenName"].ToString();
                            dtstuv.Rows[i]["GenTelO"]       = dtgenv.Rows[0]["TelNo"].ToString();
                            dtstuv.Rows[i]["GenLoginNameO"] = dtgenv.Rows[0]["LoginName"].ToString();
                            if (dtgenv.Rows.Count > 1)
                            {
                                dtstuv.Rows[i]["GenNameT"]      = dtgenv.Rows[1]["GenName"].ToString();
                                dtstuv.Rows[i]["GenTelT"]       = dtgenv.Rows[1]["TelNo"].ToString();
                                dtstuv.Rows[i]["GenLoginNameT"] = dtgenv.Rows[1]["LoginName"].ToString();
                            }
                        }
                        //权限
                        if (Com.SoureSession.Souresystype == "1") //学校超管,可看
                        {
                            if (Com.Session.appeditstat == "1")   //系统未被屏蔽编辑功能,则可编辑和删除
                            {
                                dtstuv.Rows[i]["isdel"]  = "1";
                                dtstuv.Rows[i]["isedit"] = "1";
                            }
                            dtstuv.Rows[i]["islook"] = "1";
                        }
                        else//普通老师账号
                        {
                            if (bllclassuser.ExistsIsMs(dtstuv.Rows[i]["ClassId"].ToString(), Com.SoureSession.Soureuserid, Com.SoureSession.Soureschid, 1) == true)//班主任可查看
                            {
                                dtstuv.Rows[i]["islook"] = "1";
                                if (Com.Session.appeditstat == "1")
                                {
                                    dtstuv.Rows[i]["isdel"]  = "1";
                                    dtstuv.Rows[i]["isedit"] = "1";
                                }
                            }
                            else
                            {
                                if (bllgradeuser.ExistsGrade(dtstuv.Rows[i]["GradeId"].ToString(), Com.SoureSession.Soureschid, Com.SoureSession.Soureuserid) == true)//年级主任
                                {
                                    islist = true;
                                    dtstuv.Rows[i]["islook"] = "1";
                                }
                            }
                            if (Com.Public.IsUserVal(Com.Session.userrolestr, 2))
                            {
                                dtstuv.Rows[i]["islook"] = "1";
                                islist = true;
                            }
                        }
                    }
                    pages.list = dtstuv;
                }
            }

            return(Newtonsoft.Json.JsonConvert.SerializeObject(pages));
        }
Exemplo n.º 19
0
        //用户登录判断
        public static string UserLoginDo(string uname, bool iscookies, string schid)
        {
            string str = "";

            SchSystem.BLL.SchUserInfo userbll = new SchSystem.BLL.SchUserInfo();
            //查询登录用户记录数据
            DataTable SchUserInfoDs = userbll.GetList("UserId,UserName,UserTname,SchId,SysType,ImgUrl", "UserName='******' and Stat=1 and AccStat=1 and SchId=" + schid).Tables[0];

            if (SchUserInfoDs.Rows.Count > 0)
            {
                SchSystem.BLL.SchUserRoleV userroleV = new SchSystem.BLL.SchUserRoleV();
                DataTable dtroles = userroleV.GetList("UserName='******' and Stat=1 and AccStat=1 and SchId=" + schid).Tables[0];
                //if (dtroles.Rows.Count > 0)
                //{
                //设置Session信息
                Com.Session.usertid = SchUserInfoDs.Rows[0]["UserId"].ToString();
                Com.Session.userid  = SchUserInfoDs.Rows[0]["UserName"].ToString();
                Com.Session.uname   = SchUserInfoDs.Rows[0]["UserTname"].ToString();
                Com.Session.schid   = SchUserInfoDs.Rows[0]["SchId"].ToString();
                Com.Session.systype = SchUserInfoDs.Rows[0]["SysType"].ToString();
                Com.Session.imgurl  = SchUserInfoDs.Rows[0]["ImgUrl"].ToString();
                //合并普通权限串
                Com.Session.userrolestr = Com.Public.UserRoleStr(dtroles);
                //合并特殊权限串
                Com.Session.userrolestrext = Com.Public.UserRoleExtStr(dtroles);
                Com.Session.ulogintime     = DateTime.Now.ToString("yyyyMMddHHmmss");
                //设置cookies
                if (iscookies)
                {
                    CookieHelper.SetCookie("uname", uname, DateTime.Now.AddDays(7));
                }
                //获取老师身份
                if (Com.Session.usertp == "0")
                {
                    string tectype = "0";
                    //1年级主任,2科任组长,3班主任,4科任老师
                    SchSystem.BLL.SchGradeUserV bllgrade = new SchSystem.BLL.SchGradeUserV();
                    if (bllgrade.Exists(Com.Session.usertid))
                    {
                        tectype += ",1";
                    }
                    SchSystem.BLL.SchUserSubV bllsub = new SchSystem.BLL.SchUserSubV();
                    if (bllsub.Exists(Com.Session.usertid))
                    {
                        tectype += ",2";
                    }
                    SchSystem.BLL.SchClassUser bllclasssub = new SchSystem.BLL.SchClassUser();
                    if (bllclasssub.ExistsV(0, 1, Com.Session.usertid, 1))
                    {
                        tectype += ",3";
                    }
                    if (bllclasssub.ExistsV(0, 1, Com.Session.usertid, 0))
                    {
                        tectype += ",4";
                    }
                    Com.Session.usertectp = tectype;
                }
                //获取该学校的系统编辑状态
                SchSystem.BLL.SchInfo   schbll   = new SchSystem.BLL.SchInfo();
                SchSystem.Model.SchInfo schmodel = schbll.GetModel(int.Parse(Com.Session.schid));
                Com.Session.appeditstat = schmodel.SonSysStat.ToString();
                str = "1";
                //}
                // else
                // {
                //     str = "该账号没有相应的权限或者对应角色被屏蔽,请联系管理员进行分配处理";
                //  }
            }
            else
            {
                str = "该账号被屏蔽或不存在";
            }

            return(str);
        }
        public static Com.DataPack.DataRsp <string> page(string PageIndex, string PageSize, string txtname, string ustat, string txtcode, string drptype)
        {
            Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
            if (Com.Session.userid == null)
            {
                rsp.code = "expire";
                rsp.msg  = "页面已经过期,请重新登录";
            }
            else
            {
                try
                {
                    //Stat:0废弃,1正常,2被删除,正常界面不显示删除,超管界面可以考虑
                    string strwhere = "Stat<2 and SchId='" + Com.Session.schid + "' ";

                    if (!string.IsNullOrEmpty(txtname))
                    {
                        strwhere += " and Topic like '%" + Com.Public.SqlEncStr(txtname) + "%'";
                    }
                    if (!string.IsNullOrEmpty(ustat))
                    {
                        strwhere += " and Stat='" + Com.Public.SqlEncStr(ustat) + "'";
                    }
                    if (txtcode != "0")
                    {
                        strwhere += " and ChnId='" + Com.Public.SqlEncStr(txtcode) + "'";
                    }
                    if (drptype != "")
                    {
                        strwhere += " and Lv='" + Com.Public.SqlEncStr(drptype) + "'";
                    }
                    Com.Public.PageModelResp pages = new Com.Public.PageModelResp();
                    pages.PageIndex = int.Parse(PageIndex);
                    pages.PageSize  = int.Parse(PageSize);
                    int rowc = 0;
                    int pc   = 0;
                    SchSystem.BLL.WebSchChnNewsV userbll = new SchSystem.BLL.WebSchChnNewsV();
                    string    dbcols = "NewsId,ChnName,ChnId,Topic,RecTime,GradeId,ClassId,Lv,'' GradeName,'' ClassName,'' LvName,'0' isdel,'0' isedit,'1' islook,Stat,IsTop";
                    DataTable dt     = userbll.GetListCols(dbcols, strwhere, "IsTop Desc,RecTime DESC", "", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
                    pages.PageCount = pc;
                    pages.RowCount  = rowc;
                    if (dt.Rows.Count > 0)
                    {
                        SchSystem.BLL.SchClassUser  bllclassuser = new SchSystem.BLL.SchClassUser();
                        SchSystem.BLL.SchGradeUsers bllgradeuser = new SchSystem.BLL.SchGradeUsers();
                        SchSystem.BLL.SchClassInfo  bllclass     = new SchSystem.BLL.SchClassInfo();
                        SchSystem.BLL.SchGradeInfo  bllgrade     = new SchSystem.BLL.SchGradeInfo();
                        //权限
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            if (Com.Session.appeditstat == "1")                                                                                                                                            //允许编辑
                            {
                                if (dt.Rows[i]["Lv"].ToString() == "0")                                                                                                                                    //班级新闻
                                {
                                    if (Com.Public.IsUserVal(Com.Session.userrolestr, 14) || bllclassuser.ExistsIsMs(dt.Rows[i]["ClassId"].ToString(), Com.Session.usertid, Com.Session.schid, 1) == true) //如果有所有班级权限或是班主任
                                    {
                                        dt.Rows[i]["isdel"]  = "1";
                                        dt.Rows[i]["isedit"] = "1";
                                    }
                                    //获取年级,班级,类型
                                    dt.Rows[i]["GradeName"] = bllgrade.GetName(int.Parse(dt.Rows[i]["GradeId"].ToString()));
                                    dt.Rows[i]["ClassName"] = bllclass.GetName(int.Parse(dt.Rows[i]["ClassId"].ToString()));
                                    dt.Rows[i]["LvName"]    = "班级";
                                }
                                else if (dt.Rows[i]["Lv"].ToString() == "1")                                                                                                                             //年级新闻
                                {
                                    if (Com.Public.IsUserVal(Com.Session.userrolestr, 13) || bllgradeuser.ExistsGrade(dt.Rows[i]["GradeId"].ToString(), Com.Session.schid, Com.Session.usertid) == true) //如果有全校权限或是年级组长
                                    {
                                        dt.Rows[i]["isdel"]  = "1";
                                        dt.Rows[i]["isedit"] = "1";
                                    }
                                    //获取年级
                                    dt.Rows[i]["GradeName"] = bllgrade.GetName(int.Parse(dt.Rows[i]["GradeId"].ToString()));
                                    dt.Rows[i]["LvName"]    = "年级";
                                }
                                else if (dt.Rows[i]["Lv"].ToString() == "2")               //学校新闻
                                {
                                    if (Com.Public.IsUserVal(Com.Session.userrolestr, 13)) //如果有全校权限
                                    {
                                        dt.Rows[i]["isdel"]  = "1";
                                        dt.Rows[i]["isedit"] = "1";
                                    }
                                    dt.Rows[i]["LvName"] = "学校";
                                }
                            }
                        }
                        pages.list = dt;
                    }
                    rsp.RspData = Newtonsoft.Json.JsonConvert.SerializeObject(pages).Replace("\n\r", "");
                }
                catch (Exception ex)
                {
                    rsp.code = "error";
                    rsp.msg  = ex.Message;
                }
            }
            return(rsp);
        }
        public static string page(string txtname, string ustat, string cotycode, string schid, string gradeCode, string classid, string subcode)
        {
            string ret = "";

            Com.DataPack.DataRsp <Com.DataPack.UserInfo> rsp = Com.Public.UserFuncSoure(Com.SoureSession.jsid, Com.SoureSession.jstoken);
            if (rsp.code == "ERROR_TOKEN")
            {
                ret = "expire";
            }
            else
            {
                SchSystem.BLL.SchClassInfo sciBll = new SchSystem.BLL.SchClassInfo();
                //Stat:0废弃,1正常,2被删除,正常界面不显示删除,超管界面可以考虑
                string strwhere = "ClassStat=0 and SchId = '" + Com.Public.SqlEncStr(schid) + "'";
                if (!string.IsNullOrEmpty(ustat))
                {
                    strwhere += " and IsFinish=" + Com.Public.SqlEncStr(ustat);
                }
                else
                {
                    strwhere += " and IsFinish=0";
                }
                if (!string.IsNullOrEmpty(gradeCode))
                {
                    strwhere += " and GradeId='" + Com.Public.SqlEncStr(gradeCode) + "'";
                }
                if (!string.IsNullOrEmpty(classid))
                {
                    strwhere += " and ClassId='" + Com.Public.SqlEncStr(classid) + "'";
                }

                if (!string.IsNullOrEmpty(subcode))
                {
                    strwhere += " and ClassId in (select ClassId from SchClassUser where SubCode='" + Com.Public.SqlEncStr(subcode) + "' and schid='" + Com.Public.SqlEncStr(schid) + "')";
                }
                if (!string.IsNullOrEmpty(txtname))
                {
                    strwhere += " and ClassId in (select ClassId from SchClassUser where UserTname like '%" + Com.Public.SqlEncStr(txtname) + "%' and schid='" + Com.Public.SqlEncStr(schid) + "')";
                }
                int rowc = 0;
                int pc   = 0;
                //DataTable dt = userbll.GetListCols("*", strwhere, "SchName", "ASC", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
                DataTable ClassDt = sciBll.GetListV(strwhere + " order by GradeCode,ClassName").Tables[0];//得到班级数据列表
                //pages.PageCount = pc;
                if (ClassDt.Rows.Count > 0)
                {
                    ClassDt.Columns.Add("Ustat");
                    ClassDt.Columns.Add("Ucity");
                    ClassDt.Columns.Add("TeacherClass"); //班主任
                    //ClassDt.Columns.Add("Teacher");//任课老师
                    ClassDt.Columns.Add("TeacherSub");   //任课老师科目
                    SchSystem.BLL.SchClassUser scuBLL = new SchSystem.BLL.SchClassUser();
                    for (int i = 0; i < ClassDt.Rows.Count; i++)
                    {
                        ClassDt.Rows[i]["Ustat"] = ClassDt.Rows[i]["IsFinish"].ToString() == "0" ? "正常" : "停用";
                        string ClassId = ClassDt.Rows[i]["ClassId"].ToString();
                        //班级教师(班主任)
                        ClassDt.Rows[i]["TeacherClass"] = scuBLL.GetNames("ClassId='" + ClassId + "' and IsMs=1");
                        //任课老师
                        ClassDt.Rows[i]["TeacherSub"] = scuBLL.GetNames("ClassId='" + ClassId + "' and IsMs=0");
                    }
                    //pages.list = ClassDt;
                }
                //Newtonsoft.Json.JsonConvert();
                //string ddd = Newtonsoft.Json.JsonConvert.SerializeObject(pages);

                //string ddd = Newtonsoft.Json.JsonConvert.SerializeObject(ClassDt);
                ret = Newtonsoft.Json.JsonConvert.SerializeObject(ClassDt);
            }
            return(ret);
        }
        public static string udel(string type, string schid, string gradeid, string classid)
        {
            schid   = Com.Public.SqlEncStr(schid);
            gradeid = Com.Public.SqlEncStr(gradeid);
            classid = Com.Public.SqlEncStr(classid);
            string ret = "";

            Com.DataPack.DataRsp <Com.DataPack.UserInfo> rsp = Com.Public.UserFuncSoure(Com.SoureSession.jsid, Com.SoureSession.jstoken);
            if (rsp.code == "ERROR_TOKEN")
            {
                ret = "expire";
            }
            else
            {
                try
                {
                    if (!Com.Public.isVa(schid, ""))
                    {
                        return(ret = "无跨界权限");
                    }
                    if (schid == Com.Public.getKey("adminschid"))
                    {
                        ret = "此为系统学校,不允许操作";
                    }
                    else
                    {
                        if (type == "1")//删除年级
                        {
                            SchSystem.BLL.SchGradeInfo   bll   = new SchSystem.BLL.SchGradeInfo();
                            SchSystem.Model.SchGradeInfo model = new SchSystem.Model.SchGradeInfo();
                            model.GradeId     = int.Parse(gradeid);
                            model.IsFinish    = 2;
                            model.LastRecTime = DateTime.Now;
                            model.LastRecUser = Com.SoureSession.Soureuserid;
                            if (bll.UpdateStat(model))
                            {
                                ret = "success";
                            }
                            else
                            {
                                ret = "操作失败";
                            }
                        }
                        else if (type == "0")//删除班级
                        {
                            SchSystem.BLL.SchClassInfo classbll = new SchSystem.BLL.SchClassInfo();
                            bool resultBool = classbll.ExistsClassStuData(int.Parse(classid));
                            SchSystem.BLL.SchClassUser classuserbll = new SchSystem.BLL.SchClassUser();
                            bool resultBoolUser = classuserbll.ExistsClassUser(schid, classid);
                            if (resultBool || resultBoolUser)//如果为true说明是班级内有属性数据
                            {
                                ret = "success01";
                            }
                            else//否则即可删除班级记录
                            {
                                SchSystem.Model.SchClassInfo classmodel = new SchSystem.Model.SchClassInfo();
                                classmodel.ClassId     = int.Parse(classid);
                                classmodel.IsFinish    = 2;
                                classmodel.LastRecTime = DateTime.Now;
                                classmodel.LastRecUser = Com.SoureSession.Soureuserid;
                                if (classbll.UpdateStat(classmodel))
                                {
                                    SchSystem.BLL.SchClassUser scuBll = new SchSystem.BLL.SchClassUser();
                                    // bool ecu = scuBll.ExistsClassUser(int.Parse(schid), int.Parse(classid));
                                    bool scubool = scuBll.Delete(classid, schid);
                                    //if (scubool)
                                    // {
                                    ret = "success";
                                    //}
                                }
                                else
                                {
                                    ret = "操作失败";
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    ret = ex.Message;
                }
            }
            return(ret);
        }
Exemplo n.º 23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt      = new DataTable();
                string    dotype  = Request.Params["dotype"].ToString();
                var       gradeid = Request.Params["gradecode"].ToString();
                var       classid = Request.Params["classid"].ToString();
                if (dotype == "c")
                {
                    Stubh = Request.Params["Stubh"].ToString();
                    string stuid = Request.Params["id"].ToString();
                    string sql   = "select * from SchStuInfoV where StuId='" + stuid + "' ";//根据学生ID查询出学校,年级,班级等信息
                    dt = DbHelperSQL.Query(sql).Tables[0];
                    if (gradeid == "")
                    {
                        gradeid = dt.Rows[0]["GradeId"].ToString();
                    }
                    if (classid == "")
                    {
                        classid = dt.Rows[0]["ClassId"].ToString();
                    }
                    DataRow[] drr          = dt.Select();
                    string    oldclassname = drr[0]["OldClassId"].ToString();
                    if (!string.IsNullOrEmpty(oldclassname) || oldclassname != "")
                    {
                        oldClassName = oldclassname;
                    }
                    else
                    {
                        oldClassName = "";
                    }
                    SchSystem.BLL.SchStuInfo bll_stu = new SchSystem.BLL.SchStuInfo();
                    string  strWhere = " a.StuId=" + stuid;
                    DataSet ds       = bll_stu.GetList(strWhere);//修改绑定需要的数据
                    ds.Tables[0].Columns.Add("jzGenName2");
                    ds.Tables[0].Columns.Add("jzLoginName2");
                    ds.Tables[0].Columns.Add("jzTelNo2");
                    ds.Tables[0].Columns.Add("jzPwd2");
                    ds.Tables[0].Columns.Add("jzStat2");
                    ds.Tables[0].Columns.Add("jzRelation2");
                    ds.Tables[0].Columns.Add("jzGenId2");
                    ds.Tables[0].Columns.Add("jzUnId2");
                    if (ds.Tables[0].Rows.Count != 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            for (int j = i + 1; j < ds.Tables[0].Rows.Count; j++)
                            {
                                if (ds.Tables[0].Rows[i]["StuId"].ToString() == ds.Tables[0].Rows[j]["StuId"].ToString())
                                {
                                    ds.Tables[0].Rows[i]["jzGenName2"]   = ds.Tables[0].Rows[j]["jzGenName1"].ToString();
                                    ds.Tables[0].Rows[i]["jzLoginName2"] = ds.Tables[0].Rows[j]["jzLoginName1"].ToString();
                                    ds.Tables[0].Rows[i]["jzTelNo2"]     = ds.Tables[0].Rows[j]["jzTelNo1"].ToString();
                                    ds.Tables[0].Rows[i]["jzPwd2"]       = ds.Tables[0].Rows[j]["jzPwd1"].ToString();
                                    ds.Tables[0].Rows[i]["jzStat2"]      = ds.Tables[0].Rows[j]["jzStat1"].ToString();
                                    ds.Tables[0].Rows[i]["jzRelation2"]  = ds.Tables[0].Rows[j]["jzRelation1"].ToString();
                                    ds.Tables[0].Rows[i]["jzGenId2"]     = ds.Tables[0].Rows[j]["jzGenId1"].ToString();
                                    ds.Tables[0].Rows[i]["jzUnId2"]      = ds.Tables[0].Rows[j]["jzUnId1"].ToString();
                                    ds.Tables[0].Rows.RemoveAt(j);
                                }
                            }
                        }
                    }
                    #region 缺省值:年級領導、班主任和任課教師
                    SchSystem.BLL.SchGradeUsers sgiBll = new SchSystem.BLL.SchGradeUsers();
                    SchSystem.BLL.SchClassUser  scuBll = new SchSystem.BLL.SchClassUser();
                    DataTable dtgradeuser = sgiBll.GetList("*", "GradeId='" + gradeid + "'").Tables[0];
                    if (dtgradeuser.Rows.Count > 0)
                    {
                        StringBuilder sbgradeuser = new StringBuilder();
                        foreach (DataRow dr in dtgradeuser.Rows)
                        {
                            sbgradeuser.Append(dr["UserTname"].ToString() + ",");
                        }
                        if (sbgradeuser.ToString().Length > 0)
                        {
                            njld = sbgradeuser.ToString().Substring(0, sbgradeuser.ToString().Length - 1);//年級領導
                        }
                    }
                    DataTable dtclassuser = scuBll.GetList("*", "ClassId='" + classid + "'").Tables[0];
                    if (dtclassuser.Rows.Count > 0)
                    {
                        StringBuilder sbgradeuser01 = new StringBuilder();
                        StringBuilder sbgradeuser02 = new StringBuilder();
                        foreach (DataRow dr in dtclassuser.Rows)
                        {
                            if (dr["IsMs"].ToString() == "1")
                            {
                                sbgradeuser01.Append(dr["UserTname"].ToString() + ",");
                            }
                            else
                            {
                                sbgradeuser02.Append(dr["UserTname"].ToString() + ",");
                            }
                        }
                        if (sbgradeuser01.ToString().Length > 0)
                        {
                            bzr = sbgradeuser01.ToString().Substring(0, sbgradeuser01.ToString().Length - 1);//班主任
                        }
                        if (sbgradeuser02.ToString().Length > 0)
                        {
                            bjjs = sbgradeuser02.ToString().Substring(0, sbgradeuser02.ToString().Length - 1);//任課教師
                        }
                    }
                    #endregion
                    StringBuilder sbarea = new StringBuilder();

                    //获取年级
                    sbarea.Append("<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;年级:<select id=\"nj\" style=\"width:100px\" disabled=\"disabled\">");

                    sbarea.Append(Com.Public.GetDrpAreaShow("4", Com.Session.schid, ref gradeid, false));
                    sbarea.Append("</select>&nbsp;&nbsp;&nbsp;&nbsp;");
                    //获取年级主任
                    StudentList.namepack npgrade = (StudentList.namepack)Newtonsoft.Json.JsonConvert.DeserializeObject <StudentList.namepack>(getusers("1", gradeid));
                    sbarea.Append("<span id=\"njld\" style=\"color:	#808080	\">年级领导:" + npgrade.gradeboss + "</span><br/><br/>");
                    //获取班级
                    sbarea.Append(" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;班级:<select id=\"bj\" style=\"width:100px\" disabled=\"disabled\" >");

                    sbarea.Append(Com.Public.GetDrpAreaShow("5", gradeid, ref classid, false));
                    sbarea.Append("</select>&nbsp;&nbsp;&nbsp;&nbsp;");
                    //获取班主任及任课老师
                    StudentList.namepack np = (StudentList.namepack)Newtonsoft.Json.JsonConvert.DeserializeObject <StudentList.namepack>(getusers("2", classid));
                    sbarea.Append("<span id=\"bzr\" style=\"color:	#808080	\">班主任:"+ np.classms + "</span>&nbsp;&nbsp; ");
                    sbarea.Append("<span id=\"bjjs\" style=\"color:	#808080	\">任课老师:" + np.classtec + "</span><br/><br/>");

                    areastr = sbarea.ToString();

                    umodelstr = dttojson.DatSetToJSON2(ds);;
                }
            }
        }