Example #1
0
        public static string page(string PageIndex, string PageSize, string txtname, string ustat, string cotycode, string schid)
        {
            string ret = "";

            if (Com.Session.userid == null)
            {
                ret = "expire";
            }
            else
            {
                SchSystem.BLL.SchInfo userbll = new SchSystem.BLL.SchInfo();
                if (schid == "")
                {
                    schid = "0";
                }
                //Stat:0废弃,1正常,2被删除,正常界面不显示删除,超管界面可以考虑
                string strwhere = "Stat<2 ";
                if (!string.IsNullOrEmpty(cotycode))
                {
                    strwhere += " and AreaNo = '" + Com.Public.SqlEncStr(cotycode) + "'";
                }
                if (schid != "0")
                {
                    strwhere += " and SchId = '" + Com.Public.SqlEncStr(schid) + "'";
                }
                if (!string.IsNullOrEmpty(txtname))
                {
                    strwhere += " and SchName like '%" + Com.Public.SqlEncStr(txtname) + "%'";
                }
                if (!string.IsNullOrEmpty(ustat))
                {
                    strwhere += " and Stat=" + Com.Public.SqlEncStr(ustat);
                }
                Com.Public.PageModelResp pages = new Com.Public.PageModelResp();
                pages.PageIndex = int.Parse(PageIndex);
                pages.PageSize  = int.Parse(PageSize);
                int rowc = 0;
                int pc   = 0;

                DataTable dt = userbll.GetListCols("*", strwhere, "SchName", "ASC", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
                pages.PageCount = pc;
                pages.RowCount  = rowc;
                if (dt.Rows.Count > 0)
                {
                    dt.Columns.Add("Ustat");
                    dt.Columns.Add("Ucity");
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        dt.Rows[i]["Ustat"] = dt.Rows[i]["Stat"].ToString() == "1" ? "正常" : "停用";
                        dt.Rows[i]["Ucity"] = dt.Rows[i]["iscity"].ToString() == "1" ? "城区" : "非城区";
                    }
                    pages.list = dt;
                }
                //Newtonsoft.Json.JsonConvert();
                string ddd = Newtonsoft.Json.JsonConvert.SerializeObject(pages);
                ret = Newtonsoft.Json.JsonConvert.SerializeObject(pages);
            }
            return(ret);
        }
Example #2
0
        public static Com.DataPack.DataRsp <string> page(string PageIndex, string PageSize, string txtname, string ustat, string cotycode, string schid, string aprovserch, string acityserch, string txtschid)
        {
            Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
            if (Com.Session.userid == null)
            {
                rsp.code = "expire";
                rsp.msg  = "页面已经过期,请重新登录";
            }
            else
            {
                try
                {
                    SchSystem.BLL.SchInfo userbll = new SchSystem.BLL.SchInfo();
                    if (schid == "")
                    {
                        schid = "0";
                    }
                    //Stat:0废弃,1正常,2被删除,正常界面不显示删除,超管界面可以考虑
                    string strwhere = "Stat<2 ";
                    if (!string.IsNullOrEmpty(cotycode))
                    {
                        strwhere += " and AreaNo = '" + Com.Public.SqlEncStr(cotycode) + "'";
                    }
                    if (!string.IsNullOrEmpty(aprovserch))
                    {
                        strwhere += " and left(AreaNo,2) = '" + Com.Public.SqlEncStr(aprovserch.Substring(0, 2)) + "'";
                    }
                    if (!string.IsNullOrEmpty(acityserch))
                    {
                        strwhere += " and left(AreaNo,4) = '" + Com.Public.SqlEncStr(acityserch.Substring(0, 4)) + "'";
                    }
                    if (!string.IsNullOrEmpty(txtschid))
                    {
                        strwhere += " and Schid='" + Com.Public.SqlEncStr(txtschid) + "' ";
                    }
                    if (!string.IsNullOrEmpty(txtname))
                    {
                        strwhere += " and SchName like '%" + Com.Public.SqlEncStr(txtname) + "%'";
                    }
                    if (!string.IsNullOrEmpty(ustat))
                    {
                        strwhere += " and Stat='1' and HomeschServStat='" + Com.Public.SqlEncStr(ustat) + "'";
                    }
                    Com.Public.PageModelResp pages = new Com.Public.PageModelResp();
                    pages.PageIndex = int.Parse(PageIndex);
                    pages.PageSize  = int.Parse(PageSize);
                    int       rowc   = 0;
                    int       pc     = 0;
                    string    dbcols = "SchId,SchName,SchoolSection,ServiceName,AreaNo,RecTime,HomeSchEnableTime,HomeSchEndTime,HomeschServStat,HomeSchPlatName,HomeSchPlatIco,HomeSchPlatUrl,HomeSchPlatIP";
                    DataTable dt     = userbll.GetListCols(dbcols, strwhere, "SchName", "ASC", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
                    pages.PageCount = pc;
                    pages.RowCount  = rowc;
                    if (dt.Rows.Count > 0)
                    {
                        //dt.Columns.Add("Ustat");
                        dt.Columns.Add("SoureName");
                        dt.Columns.Add("SHENG");
                        dt.Columns.Add("SHI");
                        dt.Columns.Add("QU");
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            SchSystem.BLL.SchAppRoleXXT sarxxtBll = new SchSystem.BLL.SchAppRoleXXT();
                            DataTable dtsarxxt = sarxxtBll.GetList("SchId='" + dt.Rows[i]["SchId"].ToString() + "'").Tables[0];
                            if (dtsarxxt.Rows.Count > 0)
                            {
                                string[]      sarsAppCodearr = dtsarxxt.Rows[0]["AppStr"].ToString().Split(',');
                                StringBuilder sarsAppCodesb  = new StringBuilder();
                                StringBuilder sasSoureName   = new StringBuilder();
                                for (int j = 0; j < sarsAppCodearr.Length; j++)
                                {
                                    sarsAppCodesb.Append(sarsAppCodearr[j] + ",");
                                }
                                SchSystem.BLL.SchAppXXT saxxtBll = new SchSystem.BLL.SchAppXXT();
                                if (sarsAppCodesb.ToString() != "")
                                {
                                    try
                                    {
                                        DataTable dtsas = saxxtBll.GetList("AppName", "AppCode in (" + sarsAppCodesb.ToString().Substring(0, sarsAppCodesb.ToString().Length - 1) + ")").Tables[0];

                                        if (dtsas.Rows.Count > 0)
                                        {
                                            foreach (DataRow dr in dtsas.Rows)
                                            {
                                                sasSoureName.Append(dr["AppName"] + ",");
                                            }
                                            dt.Rows[i]["SoureName"] = sasSoureName.ToString().Substring(0, sasSoureName.Length - 1);
                                        }
                                    }
                                    catch (Exception e) { }
                                }
                                else
                                {
                                    dt.Rows[i]["SoureName"] = "";
                                }
                            }

                            string[] areanames = Com.Public.GetArea(dt.Rows[i]["AreaNo"].ToString()).Split('|');
                            dt.Rows[i]["SHENG"] = areanames[0];
                            dt.Rows[i]["SHI"]   = areanames[1];
                            dt.Rows[i]["QU"]    = areanames[2];
                        }
                        pages.list = dt;
                    }
                    rsp.data = Newtonsoft.Json.JsonConvert.SerializeObject(pages).Replace("\n\r", "");
                }
                catch (Exception ex)
                {
                    rsp.code = "error";
                    rsp.msg  = ex.Message;
                }
            }
            return(rsp);
        }
        public static Com.DataPack.DataRsp <string> page(string PageIndex, string PageSize, string txtname, string ustat, string cotycode, string aprovserch, string acityserch, string schname)
        {
            Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
            if (Com.Session.userid == null)
            {
                rsp.code = "expire";
                rsp.msg  = "页面已经过期,请重新登录";
            }
            else
            {
                try
                {
                    SchSystem.BLL.SchInfo userbll = new SchSystem.BLL.SchInfo();

                    //Stat:0废弃,1正常,2被删除,正常界面不显示删除,超管界面可以考虑
                    string strwhere = "Stat<2 ";
                    if (!string.IsNullOrEmpty(cotycode))
                    {
                        strwhere += " and AreaNo = '" + Com.Public.SqlEncStr(cotycode) + "'";
                    }
                    if (!string.IsNullOrEmpty(aprovserch))
                    {
                        strwhere += " and left(AreaNo,2) = '" + Com.Public.SqlEncStr(aprovserch.Substring(0, 2)) + "'";
                    }
                    if (!string.IsNullOrEmpty(acityserch))
                    {
                        strwhere += " and left(AreaNo,4) = '" + Com.Public.SqlEncStr(acityserch.Substring(0, 4)) + "'";
                    }
                    if (!string.IsNullOrEmpty(schname))
                    {
                        strwhere += " and SchName like '%" + Com.Public.SqlEncStr(schname) + "%'";
                    }
                    if (!string.IsNullOrEmpty(txtname))
                    {
                        strwhere += " and SchId  = '" + Com.Public.SqlEncStr(txtname) + "'";
                    }
                    if (!string.IsNullOrEmpty(ustat))
                    {
                        strwhere += " and HomeschServStat=" + Com.Public.SqlEncStr(ustat);
                    }
                    string currentYear = "";
                    if (DateTime.Now.Month < 8)
                    {
                        currentYear = (DateTime.Now.Year - 1).ToString();
                    }
                    else
                    {
                        currentYear = DateTime.Now.Year.ToString();
                    }
                    Com.Public.PageModelResp pages = new Com.Public.PageModelResp();
                    pages.PageIndex = int.Parse(PageIndex);
                    pages.PageSize  = int.Parse(PageSize);
                    int       rowc   = 0;
                    int       pc     = 0;
                    string    dbcols = "SchId,SchName,HomeSchPlatName,HomeSchPlatUrl,HomeSchPlatIco,HomeSchPlatIP,SchMaster,SchoolSection,ServiceName,Artisan,SchCreator,RecTime,HomeschServStat,AreaNo";
                    DataTable dt     = userbll.GetListCols(dbcols, strwhere, "SchName", "ASC", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
                    pages.PageCount = pc;
                    pages.RowCount  = rowc;
                    if (dt.Rows.Count > 0)
                    {
                        dt.Columns.Add("SHENG");
                        dt.Columns.Add("SHI");
                        dt.Columns.Add("QU");
                        dt.Columns.Add("graduated");
                        dt.Columns.Add("SoureName");
                        dt.Columns.Add("SchSubNames");
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            string[] areanames = Com.Public.GetArea(dt.Rows[i]["AreaNo"].ToString()).Split('|');
                            dt.Rows[i]["SHENG"] = areanames[0];
                            dt.Rows[i]["SHI"]   = areanames[1];
                            dt.Rows[i]["QU"]    = areanames[2];
                            //查询最近毕业年级
                            SchSystem.BLL.SchGradeInfo sgibll = new SchSystem.BLL.SchGradeInfo();
                            //dt.Rows[i]["graduated"] = sgibll.GetGradedYear("SchId=" + dt.Rows[i]["SchId"].ToString() + " and IsFinish=1");
                            string gradecurrent = " and isfinish=1 and ((left(GradeCode,1)='4' and " + currentYear + "-GradeYear=3) or (left(GradeCode,1)='3' and " + currentYear + "-GradeYear=3) or (left(GradeCode,1)='2' and " + currentYear + "-GradeYear=6) or (left(GradeCode,1)='1' and " + currentYear + "-GradeYear=5))";
                            dt.Rows[i]["graduated"] = sgibll.GetGradedYear("SchId=" + dt.Rows[i]["SchId"].ToString() + gradecurrent);
                            //查询子模块
                            SchSystem.BLL.SchAppRoleXXT sarxxtBll = new SchSystem.BLL.SchAppRoleXXT();
                            DataTable dtsarxxt = sarxxtBll.GetList("SchId='" + dt.Rows[i]["SchId"].ToString() + "'").Tables[0];
                            if (dtsarxxt.Rows.Count > 0)
                            {
                                string[]      sarsAppCodearr = dtsarxxt.Rows[0]["AppStr"].ToString().Split(',');
                                StringBuilder sarsAppCodesb  = new StringBuilder();
                                StringBuilder sasSoureName   = new StringBuilder();
                                for (int j = 0; j < sarsAppCodearr.Length; j++)
                                {
                                    sarsAppCodesb.Append(sarsAppCodearr[j] + ",");
                                }
                                SchSystem.BLL.SchAppXXT saxxtBll = new SchSystem.BLL.SchAppXXT();
                                if (sarsAppCodesb.ToString() != "")
                                {
                                    try
                                    {
                                        DataTable dtsas = saxxtBll.GetList("AppName", "AppCode in (" + sarsAppCodesb.ToString().Substring(0, sarsAppCodesb.ToString().Length - 1) + ")").Tables[0];

                                        if (dtsas.Rows.Count > 0)
                                        {
                                            foreach (DataRow dr in dtsas.Rows)
                                            {
                                                sasSoureName.Append(dr["AppName"] + ",");
                                            }
                                            dt.Rows[i]["SoureName"] = sasSoureName.ToString().Substring(0, sasSoureName.Length - 1);
                                        }
                                    }
                                    catch (Exception e) { }
                                }
                                else
                                {
                                    dt.Rows[i]["SoureName"] = "";
                                }
                            }
                            //查询科目
                            SchSystem.BLL.SchSub ssBll = new SchSystem.BLL.SchSub();
                            dt.Rows[i]["SchSubNames"] = ssBll.GetSubNames("Stat=1 and SchId='" + dt.Rows[i]["SchId"].ToString() + "'");
                        }
                        pages.list = dt;
                    }
                    rsp.data = Newtonsoft.Json.JsonConvert.SerializeObject(pages);
                }
                catch (Exception ex)
                {
                    rsp.code = "error";
                    rsp.msg  = ex.Message;
                }
            }
            return(rsp);
        }
Example #4
0
 public static Com.DataPack.DataRsp <string> page(string PageIndex, string PageSize, string txtname, string ustat, string cotycode, string schid, string aprovserch, string acityserch, string txtschid)
 {
     Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
     if (Com.Session.userid == null)
     {
         rsp.code = "expire";
         rsp.msg  = "页面已经过期,请重新登录";
     }
     else
     {
         try
         {
             SchSystem.BLL.SchInfo userbll = new SchSystem.BLL.SchInfo();
             if (schid == "")
             {
                 schid = "0";
             }
             //Stat:0废弃,1正常,2被删除,正常界面不显示删除,超管界面可以考虑
             string strwhere = "Stat<2 ";
             if (!string.IsNullOrEmpty(cotycode))
             {
                 strwhere += " and AreaNo = '" + Com.Public.SqlEncStr(cotycode) + "'";
             }
             if (!string.IsNullOrEmpty(aprovserch))
             {
                 strwhere += " and left(AreaNo,2) = '" + Com.Public.SqlEncStr(aprovserch.Substring(0, 2)) + "'";
             }
             if (!string.IsNullOrEmpty(acityserch))
             {
                 strwhere += " and left(AreaNo,4) = '" + Com.Public.SqlEncStr(acityserch.Substring(0, 4)) + "'";
             }
             if (!string.IsNullOrEmpty(txtschid))
             {
                 strwhere += " and SchId = " + int.Parse(Com.Public.SqlEncStr(txtschid));
             }
             else
             {
                 if (schid != "0")
                 {
                     strwhere += " and SchId = '" + Com.Public.SqlEncStr(schid) + "'";
                 }
             }
             if (!string.IsNullOrEmpty(txtname))
             {
                 strwhere += " and SchName like '%" + Com.Public.SqlEncStr(txtname) + "%'";
             }
             if (!string.IsNullOrEmpty(ustat))
             {
                 strwhere += " and Stat='1' and SonSysStat='" + Com.Public.SqlEncStr(ustat) + "'";
             }
             string currentYear = "";
             if (DateTime.Now.Month < 8)
             {
                 currentYear = (DateTime.Now.Year - 1).ToString();
             }
             else
             {
                 currentYear = DateTime.Now.Year.ToString();
             }
             Com.Public.PageModelResp pages = new Com.Public.PageModelResp();
             pages.PageIndex = int.Parse(PageIndex);
             pages.PageSize  = int.Parse(PageSize);
             int       rowc   = 0;
             int       pc     = 0;
             string    dbcols = "SchId,SchName,PlatformIP,AloneUser,AreaNo,AloneTime,PlatformUrl,IsAlone";
             DataTable dt     = userbll.GetListCols(dbcols, strwhere, "SchName", "ASC", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
             pages.PageCount = pc;
             pages.RowCount  = rowc;
             if (dt.Rows.Count > 0)
             {
                 dt.Columns.Add("SHENG");
                 dt.Columns.Add("SHI");
                 dt.Columns.Add("QU");
                 for (int i = 0; i < dt.Rows.Count; i++)
                 {
                     string[] areanames = Com.Public.GetArea(dt.Rows[i]["AreaNo"].ToString()).Split('|');
                     dt.Rows[i]["SHENG"] = areanames[0];
                     dt.Rows[i]["SHI"]   = areanames[1];
                     dt.Rows[i]["QU"]    = areanames[2];
                 }
                 pages.list = dt;
             }
             rsp.data = Newtonsoft.Json.JsonConvert.SerializeObject(pages).Replace("\n\r", "");
         }
         catch (Exception ex)
         {
             rsp.code = "error";
             rsp.msg  = ex.Message;
         }
     }
     return(rsp);
 }
        public static Com.DataPack.DataRsp <string> page(string PageIndex, string PageSize, string txtname, string ustat, string cotycode, string schid, string aprovserch, string acityserch, string txtschid)
        {
            Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
            if (Com.Session.userid == null)
            {
                rsp.code = "expire";
                rsp.msg  = "页面已经过期,请重新登录";
            }
            else
            {
                try
                {
                    SchSystem.BLL.SchInfo      userbll     = new SchSystem.BLL.SchInfo();
                    SchSystem.BLL.SchGradeInfo schgradebll = new SchSystem.BLL.SchGradeInfo();
                    string strwhere = "Stat<2 ";
                    if (!string.IsNullOrEmpty(cotycode))
                    {
                        strwhere += " and AreaNo = '" + Com.Public.SqlEncStr(cotycode) + "'";
                    }
                    if (!string.IsNullOrEmpty(aprovserch))
                    {
                        strwhere += " and left(AreaNo,2) = '" + Com.Public.SqlEncStr(aprovserch.Substring(0, 2)) + "'";
                    }
                    if (!string.IsNullOrEmpty(acityserch))
                    {
                        strwhere += " and left(AreaNo,4) = '" + Com.Public.SqlEncStr(acityserch.Substring(0, 4)) + "'";
                    }
                    if (!string.IsNullOrEmpty(txtschid))
                    {
                        strwhere += " and SchId = " + int.Parse(Com.Public.SqlEncStr(txtschid));
                    }
                    else
                    {
                        if (schid != "0")
                        {
                            strwhere += " and SchId = '" + Com.Public.SqlEncStr(schid) + "'";
                        }
                    }
                    if (!string.IsNullOrEmpty(ustat))
                    {
                        if (ustat == "1")
                        {
                            strwhere += " and schid in (select schid from SchThdInfo)";
                        }
                        else
                        {
                            strwhere += " and schid not in (select schid from SchThdInfo)";
                        }
                    }
                    //"schid in (select schid from SchThdInfo)"
                    if (!string.IsNullOrEmpty(txtname))
                    {
                        strwhere += " and SchName like '%" + Com.Public.SqlEncStr(txtname) + "%'";
                    }
                    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.SchThdInfo thdbll = new SchSystem.BLL.SchThdInfo();
                    string    clos = "SchId,SchName,AreaNo";
                    DataTable dt   = userbll.GetListCols(clos, strwhere, "SchName", "", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
                    pages.PageCount = pc;
                    pages.RowCount  = rowc;
                    if (dt.Rows.Count > 0)
                    {
                        dt.Columns.Add("Ustat");
                        dt.Columns.Add("SHENG");
                        dt.Columns.Add("SHI");
                        dt.Columns.Add("QU");
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            bool thdbool = thdbll.Exists(int.Parse(dt.Rows[i]["SchId"].ToString()));
                            if (thdbool)
                            {
                                dt.Rows[i]["Ustat"] = "有";
                            }
                            else
                            {
                                dt.Rows[i]["Ustat"] = "无";
                            }
                            string[] areanames = Com.Public.GetArea(dt.Rows[i]["AreaNo"].ToString()).Split('|');
                            dt.Rows[i]["SHENG"] = areanames[0];
                            dt.Rows[i]["SHI"]   = areanames[1];
                            dt.Rows[i]["QU"]    = areanames[2];
                        }
                        pages.list = dt;
                    }
                    rsp.data = Newtonsoft.Json.JsonConvert.SerializeObject(pages);
                }
                catch (Exception ex)
                {
                    rsp.code = "error";
                    rsp.msg  = ex.Message;
                }
            }
            return(rsp);
        }
        public static Com.DataPack.DataRsp <string> page(string PageIndex, string PageSize, string txtname, string ustat, string cotycode, string schid, string aprovserch, string acityserch, string txtschid, string gradelv, string isfinish)
        {
            Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
            if (Com.Session.userid == null)
            {
                rsp.code = "expire";
                rsp.msg  = "页面已经过期,请重新登录";
            }
            else
            {
                if (schid == "")
                {
                    schid = "0";
                }
                //Stat:0废弃,1正常,2被删除,正常界面不显示删除,超管界面可以考虑
                string strwhere = "Stat<2 ";
                if (!string.IsNullOrEmpty(cotycode))
                {
                    strwhere += " and AreaNo = '" + Com.Public.SqlEncStr(cotycode) + "'";
                }
                if (!string.IsNullOrEmpty(aprovserch))
                {
                    strwhere += " and  left(AreaNo,2)= '" + Com.Public.SqlEncStr(aprovserch.Substring(0, 2)) + "'";
                }
                if (!string.IsNullOrEmpty(acityserch))
                {
                    strwhere += " and left(AreaNo,4)= '" + Com.Public.SqlEncStr(acityserch.Substring(0, 4)) + "'";
                }
                if (!string.IsNullOrEmpty(txtschid))
                {
                    strwhere += " and SchId = " + int.Parse(Com.Public.SqlEncStr(txtschid));
                }
                else
                {
                    if (schid != "0")
                    {
                        strwhere += " and SchId = '" + Com.Public.SqlEncStr(schid) + "'";
                    }
                }
                if (!string.IsNullOrEmpty(txtname))
                {
                    strwhere += " and SchName like '%" + Com.Public.SqlEncStr(txtname) + "%'";
                }
                if (!string.IsNullOrEmpty(ustat))
                {
                    strwhere += " and SonSysStat=" + Com.Public.SqlEncStr(ustat);
                }
                string currentYear = "";
                if (DateTime.Now.Month < 8)
                {
                    currentYear = (DateTime.Now.Year - 1).ToString();
                }
                else
                {
                    currentYear = DateTime.Now.Year.ToString();
                }
                if (!string.IsNullOrEmpty(gradelv))      //选择了学段
                {
                    if (!string.IsNullOrEmpty(isfinish)) //并且选择了是否有毕业班需要升级
                    {
                        string yearlv = "0";
                        if (gradelv == "1")
                        {
                            yearlv = "4";
                        }
                        else if (gradelv == "2")
                        {
                            yearlv = "5";
                        }
                        else if (gradelv == "3")
                        {
                            yearlv = "3";
                        }
                        else if (gradelv == "4")
                        {
                            yearlv = "3";
                        }
                        if (isfinish == "0")//无毕业班,需要剔除有该学段毕业班学校
                        {
                            strwhere += " and schid not in (select schid from SchGradeInfo where isfinish=0 and left(GradeCode,1)='" + Com.Public.SqlEncStr(gradelv) + "' and " + currentYear + "-GradeYear>" + yearlv + ")";
                        }
                        else//有毕业班,含有该学段且有毕业班的学校
                        {
                            strwhere += " and schid in (select schid from SchGradeInfo where isfinish=0 and left(GradeCode,1)='" + Com.Public.SqlEncStr(gradelv) + "' and " + currentYear + "-GradeYear>" + yearlv + ")";
                        }
                    }
                    else//仅选择了学段,则选择有该学段的学校
                    {
                        strwhere += " and schid in (select schid from SchGradeInfo where isfinish=0 and left(GradeCode,1)='" + Com.Public.SqlEncStr(gradelv) + "')";
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(isfinish))
                    {
                        if (isfinish == "0")//无毕业班,需要剔除含有毕业班学校
                        {
                            strwhere += " and schid not in (select schid from SchGradeInfo where (isfinish=0 or isfinish=2) and ((left(GradeCode,1)='4' and " + currentYear + "-GradeYear>3) or (left(GradeCode,1)='3' and " + currentYear + "-GradeYear>3) or (left(GradeCode,1)='2' and " + currentYear + "-GradeYear>5) or (left(GradeCode,1)='1' and " + currentYear + "-GradeYear>4)))";
                        }
                        else//有毕业班,含有毕业班的学校
                        {
                            strwhere += " and schid in (select schid from SchGradeInfo where (isfinish=0 or isfinish=2) and ((left(GradeCode,1)='4' and " + currentYear + "-GradeYear>3) or (left(GradeCode,1)='3' and " + currentYear + "-GradeYear>3) or (left(GradeCode,1)='2' and " + currentYear + "-GradeYear>5) or (left(GradeCode,1)='1' and " + currentYear + "-GradeYear>4)))";
                        }
                    }
                }
                //isfinish=0 and SchId=@SchId and ((left(GradeCode,1)='4' and @GradeYear-GradeYear>3) or (left(GradeCode,1)='3' and @GradeYear-GradeYear>3) or (left(GradeCode,1)='2' and @GradeYear-GradeYear>5) or (left(GradeCode,1)='1' and @GradeYear-GradeYear>4))
                Com.Public.PageModelResp pages = new Com.Public.PageModelResp();
                pages.PageIndex = int.Parse(PageIndex);
                pages.PageSize  = int.Parse(PageSize);
                int rowc = 0;
                int pc   = 0;

                try
                {
                    SchSystem.BLL.SchInfo userbll = new SchSystem.BLL.SchInfo();
                    //查询最近毕业年级
                    SchSystem.BLL.SchGradeInfo sgibll = new SchSystem.BLL.SchGradeInfo();
                    SchSystem.BLL.SchApp       saBll  = new SchSystem.BLL.SchApp();
                    string    dbcols = "SchId,SchName,PlatformIP,SchoolSection,SonSysStat,RecTime,SchSonSysEnableTime,SchSonSysEndDateTime,AreaNo,Stat,PlatformUrl";//,PlatformIco,SchMaster,ServiceName,Artisan,SchCreator,iscity
                    DataTable dt     = userbll.GetListCols(dbcols, strwhere, "SchName", "Asc", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
                    pages.PageCount = pc;
                    pages.RowCount  = rowc;
                    if (dt.Rows.Count > 0)
                    {
                        dt.Columns.Add("IsUpgrade");
                        dt.Columns.Add("SHENG");
                        dt.Columns.Add("SHI");
                        dt.Columns.Add("QU");
                        dt.Columns.Add("SchoolSections");
                        dt.Columns.Add("graduated");
                        dt.Columns.Add("AppSonSys");
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            string[] areanames = Com.Public.GetArea(dt.Rows[i]["AreaNo"].ToString()).Split('|');
                            dt.Rows[i]["SHENG"] = areanames[0];
                            dt.Rows[i]["SHI"]   = areanames[1];
                            dt.Rows[i]["QU"]    = areanames[2];
                            StringBuilder sbstr = new StringBuilder();
                            string        ss    = dt.Rows[i]["SchoolSection"].ToString();
                            if (!string.IsNullOrEmpty(dt.Rows[i]["SchoolSection"].ToString()))
                            {
                                string[] str = dt.Rows[i]["SchoolSection"].ToString().Split(',');
                                for (int j = 0; j < str.Length; j++)
                                {
                                    if (str[j] == "1")
                                    {
                                        sbstr.Append("幼儿园,");
                                    }
                                    else if (str[j] == "2")
                                    {
                                        sbstr.Append("小学,");
                                    }
                                    else if (str[j] == "3")
                                    {
                                        sbstr.Append("初中,");
                                    }
                                    else if (str[j] == "4")
                                    {
                                        sbstr.Append("高中,");
                                    }
                                }
                                if (sbstr.ToString() != "")
                                {
                                    dt.Rows[i]["SchoolSections"] = sbstr.ToString().Substring(0, sbstr.ToString().Length - 1);
                                }
                                else
                                {
                                    dt.Rows[i]["SchoolSections"] = "";
                                }
                            }
                            bool resBool = false;
                            if (!string.IsNullOrEmpty(dt.Rows[i]["SchId"].ToString()))
                            {
                                resBool = sgibll.ExistsGradeFinish(int.Parse(dt.Rows[i]["SchId"].ToString()), int.Parse(currentYear));
                            }
                            if (resBool)
                            {
                                dt.Rows[i]["IsUpgrade"] = "1";
                            }
                            else
                            {
                                dt.Rows[i]["IsUpgrade"] = "0";
                            }
                            string gradecurrent = " and isfinish=1 and ((left(GradeCode,1)='4' and " + currentYear + "-GradeYear=3) or (left(GradeCode,1)='3' and " + currentYear + "-GradeYear=3) or (left(GradeCode,1)='2' and " + currentYear + "-GradeYear=6) or (left(GradeCode,1)='1' and " + currentYear + "-GradeYear=5))";
                            dt.Rows[i]["graduated"] = sgibll.GetGradedYear("SchId=" + dt.Rows[i]["SchId"].ToString() + gradecurrent);
                            //查询应用子系统
                            SchSystem.BLL.SchAppRole sarBll = new SchSystem.BLL.SchAppRole();
                            DataTable     dtsars            = sarBll.GetList("SchId='" + dt.Rows[i]["SchId"].ToString() + "'").Tables[0];
                            StringBuilder sbsars            = new StringBuilder();
                            if (dtsars.Rows.Count > 0)
                            {
                                string sarsarr = dtsars.Rows[0]["AppStr"].ToString();

                                StringBuilder sbsas = new StringBuilder();
                                DataTable     dtsas = saBll.GetList("AppName", "AppCode in (" + sarsarr + ")").Tables[0];
                                if (dtsas.Rows.Count > 0)
                                {
                                    foreach (DataRow drsas in dtsas.Rows)
                                    {
                                        sbsas.Append(drsas["AppName"] + ",");
                                    }
                                    dt.Rows[i]["AppSonSys"] = sbsas.ToString().Substring(0, sbsas.ToString().Length - 1);
                                }
                            }
                        }
                        pages.list = dt;
                    }
                    rsp.data = Newtonsoft.Json.JsonConvert.SerializeObject(pages);
                }
                catch (Exception ex)
                {
                    rsp.code = "ExcepError";
                    rsp.msg  = ex.Message;
                }
            }
            return(rsp);
        }
Example #7
0
 public static Com.DataPack.DataRsp <string> page(string PageIndex, string PageSize, string txtname, string ustat, string cotycode, string schid, string aprovserch, string acityserch)
 {
     Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
     if (Com.Session.userid == null)
     {
         rsp.code = "expire";
         rsp.msg  = "页面已经过期,请重新登录";
     }
     else
     {
         try
         {
             SchSystem.BLL.SchInfo userbll = new SchSystem.BLL.SchInfo();
             //Stat:0废弃,1正常,2被删除,正常界面不显示删除,超管界面可以考虑
             string strwhere = "Stat<2 ";
             if (!string.IsNullOrEmpty(cotycode))
             {
                 strwhere += " and AreaNo = '" + Com.Public.SqlEncStr(cotycode) + "'";
             }
             if (!string.IsNullOrEmpty(aprovserch))
             {
                 strwhere += " and  left(AreaNo,2)= '" + Com.Public.SqlEncStr(aprovserch.Substring(0, 2)) + "'";
             }
             if (!string.IsNullOrEmpty(acityserch))
             {
                 strwhere += " and left(AreaNo,4)= '" + Com.Public.SqlEncStr(acityserch.Substring(0, 4)) + "'";
             }
             if (schid != "")
             {
                 strwhere += " and SchId = '" + Com.Public.SqlEncStr(schid) + "'";
             }
             if (!string.IsNullOrEmpty(txtname))
             {
                 strwhere += " and SchName like '%" + Com.Public.SqlEncStr(txtname) + "%'";
             }
             if (!string.IsNullOrEmpty(ustat))
             {
                 strwhere += " and SonSysStat=" + Com.Public.SqlEncStr(ustat);
             }
             Com.Public.PageModelResp pages = new Com.Public.PageModelResp();
             pages.PageIndex = int.Parse(PageIndex);
             pages.PageSize  = int.Parse(PageSize);
             int       rowc   = 0;
             int       pc     = 0;
             string    dbcols = "SchId,SchName,PlatformName,PlatformUrl,PlatformIco,PlatformIP,SchMaster,SchoolSection,ServiceName,Artisan,SchCreator,RecTime,Stat,iscity,SonSysStat,AreaNo,SchType";
             DataTable dt     = userbll.GetListCols(dbcols, strwhere, "SchName", "ASC", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
             pages.PageCount = pc;
             pages.RowCount  = rowc;
             if (dt.Rows.Count > 0)
             {
                 dt.Columns.Add("SHENG");
                 dt.Columns.Add("SHI");
                 dt.Columns.Add("QU");
                 dt.Columns.Add("ManagerAcount");
                 dt.Columns.Add("InitialPwd");
                 dt.Columns.Add("graduated");
                 dt.Columns.Add("AppSonSys");
                 dt.Columns.Add("SchSubNames");
                 dt.Columns.Add("SchTypeName");
                 SchSystem.BLL.SysPer bllper = new SchSystem.BLL.SysPer();
                 DataTable            dtper  = bllper.GetList("PerName,PerCode", " Stat=1 ").Tables[0];
                 for (int i = 0; i < dt.Rows.Count; i++)
                 {
                     string[] areanames = Com.Public.GetArea(dt.Rows[i]["AreaNo"].ToString()).Split('|');
                     dt.Rows[i]["SHENG"] = areanames[0];
                     dt.Rows[i]["SHI"]   = areanames[1];
                     dt.Rows[i]["QU"]    = areanames[2];
                     DataRow[] dtr = dtper.Select("PerCode='" + dt.Rows[i]["SchType"].ToString() + "'");
                     if (dtr.Length > 0)
                     {
                         dt.Rows[i]["SchTypeName"] = dtr[0]["PerName"].ToString();
                     }
                     else
                     {
                         dt.Rows[i]["SchTypeName"] = "";
                     }
                     //获取管理员账号密码信息
                     SchSystem.BLL.SchUserInfo   suiBll        = new SchSystem.BLL.SchUserInfo();
                     SchSystem.Model.SchUserInfo modeluserinfo = suiBll.GetSupportModel(int.Parse(dt.Rows[i]["SchId"].ToString()), 1);
                     if (modeluserinfo != null)
                     {
                         if (modeluserinfo.UserName != "" && modeluserinfo.UserName != null)
                         {
                             dt.Rows[i]["ManagerAcount"] = modeluserinfo.UserName;
                         }
                         if (modeluserinfo.PassWord != "" && modeluserinfo.PassWord != null)
                         {
                             dt.Rows[i]["InitialPwd"] = 1;
                         }
                     }
                     else
                     {
                         dt.Rows[i]["ManagerAcount"] = "";
                         dt.Rows[i]["InitialPwd"]    = "";
                     }
                     //查询最近毕业年级
                     string currentYear = "";
                     if (DateTime.Now.Month < 8)
                     {
                         currentYear = (DateTime.Now.Year - 1).ToString();
                     }
                     else
                     {
                         currentYear = DateTime.Now.Year.ToString();
                     }
                     SchSystem.BLL.SchGradeInfo sgibll = new SchSystem.BLL.SchGradeInfo();
                     //dt.Rows[i]["graduated"] = sgibll.GetGradedYear("SchId=" + dt.Rows[i]["SchId"].ToString() + " and IsFinish=1");
                     string gradecurrent = " and isfinish=1 and ((left(GradeCode,1)='4' and " + currentYear + "-GradeYear=3) or (left(GradeCode,1)='3' and " + currentYear + "-GradeYear=3) or (left(GradeCode,1)='2' and " + currentYear + "-GradeYear=6) or (left(GradeCode,1)='1' and " + currentYear + "-GradeYear=5))";
                     dt.Rows[i]["graduated"] = sgibll.GetGradedYear("SchId=" + dt.Rows[i]["SchId"].ToString() + gradecurrent);
                     //
                     //查询应用子系统
                     SchSystem.BLL.SchAppRole sarBll = new SchSystem.BLL.SchAppRole();
                     DataTable     dtsars            = sarBll.GetList("SchId='" + dt.Rows[i]["SchId"].ToString() + "'").Tables[0];
                     StringBuilder sbsars            = new StringBuilder();
                     if (dtsars.Rows.Count > 0)
                     {
                         string sarsarr             = dtsars.Rows[0]["AppStr"].ToString();
                         SchSystem.BLL.SchApp saBll = new SchSystem.BLL.SchApp();
                         StringBuilder        sbsas = new StringBuilder();
                         DataTable            dtsas = saBll.GetList("AppName", "AppCode in (" + sarsarr + ")").Tables[0];
                         if (dtsas.Rows.Count > 0)
                         {
                             foreach (DataRow drsas in dtsas.Rows)
                             {
                                 sbsas.Append(drsas["AppName"] + ",");
                             }
                             dt.Rows[i]["AppSonSys"] = sbsas.ToString().Substring(0, sbsas.ToString().Length - 1);
                         }
                     }
                     //查询科目
                     SchSystem.BLL.SchSub ssBll = new SchSystem.BLL.SchSub();
                     dt.Rows[i]["SchSubNames"] = ssBll.GetSubNames("Stat=1 and SchId='" + dt.Rows[i]["SchId"].ToString() + "'");
                 }
                 pages.list = dt;
             }
             rsp.data = Newtonsoft.Json.JsonConvert.SerializeObject(pages);
         }
         catch (Exception ex)
         {
             rsp.code = "error";
             rsp.msg  = ex.Message;
         }
     }
     return(rsp);
 }
        public static Com.DataPack.DataRsp <string> page(string PageIndex, string PageSize, string txtname, string ustat, string cotycode, string schid, string aprovserch, string acityserch, string txtschid)
        {
            Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
            if (Com.Session.userid == null)
            {
                rsp.code = "expire";
                rsp.msg  = "页面已经过期,请重新登录";
            }
            else
            {
                try
                {
                    SchSystem.BLL.SchInfo userbll = new SchSystem.BLL.SchInfo();
                    if (schid == "")
                    {
                        schid = "0";
                    }
                    //Stat:0废弃,1正常,2被删除,正常界面不显示删除,超管界面可以考虑
                    string strwhere = "Stat<2 ";
                    if (!string.IsNullOrEmpty(cotycode))
                    {
                        strwhere += " and AreaNo = '" + Com.Public.SqlEncStr(cotycode) + "'";
                    }
                    if (!string.IsNullOrEmpty(aprovserch))
                    {
                        strwhere += " and left(AreaNo,2) = '" + Com.Public.SqlEncStr(aprovserch.Substring(0, 2)) + "'";
                    }
                    if (!string.IsNullOrEmpty(acityserch))
                    {
                        strwhere += " and left(AreaNo,4) = '" + Com.Public.SqlEncStr(acityserch.Substring(0, 4)) + "'";
                    }
                    if (!string.IsNullOrEmpty(txtschid))
                    {
                        strwhere += " and SchId = " + int.Parse(Com.Public.SqlEncStr(txtschid));
                    }
                    else
                    {
                        if (schid != "0")
                        {
                            strwhere += " and SchId = '" + Com.Public.SqlEncStr(schid) + "'";
                        }
                    }
                    if (!string.IsNullOrEmpty(txtname))
                    {
                        strwhere += " and SchName like '%" + Com.Public.SqlEncStr(txtname) + "%'";
                    }
                    if (!string.IsNullOrEmpty(ustat))
                    {
                        strwhere += " and Stat='1' and SonSysStat='" + Com.Public.SqlEncStr(ustat) + "'";
                    }
                    string currentYear = "";
                    if (DateTime.Now.Month < 8)
                    {
                        currentYear = (DateTime.Now.Year - 1).ToString();
                    }
                    else
                    {
                        currentYear = DateTime.Now.Year.ToString();
                    }
                    Com.Public.PageModelResp pages = new Com.Public.PageModelResp();
                    pages.PageIndex = int.Parse(PageIndex);
                    pages.PageSize  = int.Parse(PageSize);
                    int       rowc   = 0;
                    int       pc     = 0;
                    string    dbcols = "SchId,SchName,PlatformIP,SchoolSection,SonSysStat,RecTime,SchSonSysEnableTime,SchSonSysEndDateTime,AreaNo,Stat,PlatformUrl,SonSysStat";
                    DataTable dt     = userbll.GetListCols(dbcols, strwhere, "SchName", "ASC", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
                    pages.PageCount = pc;
                    pages.RowCount  = rowc;
                    if (dt.Rows.Count > 0)
                    {
                        dt.Columns.Add("SHENG");
                        dt.Columns.Add("SHI");
                        dt.Columns.Add("QU");
                        dt.Columns.Add("SchoolSections");
                        dt.Columns.Add("graduated");
                        dt.Columns.Add("AppSonSys");
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            string[] areanames = Com.Public.GetArea(dt.Rows[i]["AreaNo"].ToString()).Split('|');
                            dt.Rows[i]["SHENG"] = areanames[0];
                            dt.Rows[i]["SHI"]   = areanames[1];
                            dt.Rows[i]["QU"]    = areanames[2];

                            StringBuilder sbstr = new StringBuilder();
                            if (!string.IsNullOrEmpty(dt.Rows[i]["SchoolSection"].ToString()))
                            {
                                string[] str = dt.Rows[i]["SchoolSection"].ToString().Split(',');
                                for (int j = 0; j < str.Length; j++)
                                {
                                    if (str[j] == "1")
                                    {
                                        sbstr.Append("幼儿园,");
                                    }
                                    else if (str[j] == "2")
                                    {
                                        sbstr.Append("小学,");
                                    }
                                    else if (str[j] == "3")
                                    {
                                        sbstr.Append("初中,");
                                    }
                                    else if (str[j] == "4")
                                    {
                                        sbstr.Append("高中,");
                                    }
                                }
                                if (sbstr.ToString() != "")
                                {
                                    dt.Rows[i]["SchoolSections"] = sbstr.ToString().Substring(0, sbstr.ToString().Length - 1);
                                }
                                else
                                {
                                    dt.Rows[i]["SchoolSections"] = "";
                                }
                            }
                            //查询最近毕业年级
                            SchSystem.BLL.SchGradeInfo sgibll = new SchSystem.BLL.SchGradeInfo();
                            //dt.Rows[i]["graduated"] = sgibll.GetGradedYear("SchId=" + dt.Rows[i]["SchId"].ToString() + " and IsFinish=1");
                            string gradecurrent = " and isfinish=1 and ((left(GradeCode,1)='4' and " + currentYear + "-GradeYear=3) or (left(GradeCode,1)='3' and " + currentYear + "-GradeYear=3) or (left(GradeCode,1)='2' and " + currentYear + "-GradeYear=6) or (left(GradeCode,1)='1' and " + currentYear + "-GradeYear=5))";
                            dt.Rows[i]["graduated"] = sgibll.GetGradedYear("SchId=" + dt.Rows[i]["SchId"].ToString() + gradecurrent);
                            //查询应用子系统
                            SchSystem.BLL.SchAppRole sarBll = new SchSystem.BLL.SchAppRole();
                            DataTable     dtsars            = sarBll.GetList("SchId='" + dt.Rows[i]["SchId"].ToString() + "'").Tables[0];
                            StringBuilder sbsars            = new StringBuilder();
                            if (dtsars.Rows.Count > 0)
                            {
                                string sarsarr             = dtsars.Rows[0]["AppStr"].ToString();
                                SchSystem.BLL.SchApp saBll = new SchSystem.BLL.SchApp();
                                StringBuilder        sbsas = new StringBuilder();
                                DataTable            dtsas = saBll.GetList("AppName", "AppCode in (" + sarsarr + ")").Tables[0];
                                if (dtsas.Rows.Count > 0)
                                {
                                    foreach (DataRow drsas in dtsas.Rows)
                                    {
                                        sbsas.Append(drsas["AppName"] + ",");
                                    }
                                    //sbsas.ToString().Substring(0, sbsas.ToString().Length - 1);
                                    dt.Rows[i]["AppSonSys"] = sbsas.ToString().Substring(0, sbsas.ToString().Length - 1);
                                }
                            }
                        }
                        pages.list = dt;
                    }
                    rsp.data = Newtonsoft.Json.JsonConvert.SerializeObject(pages).Replace("\n\r", "");
                }
                catch (Exception ex)
                {
                    rsp.code = "error";
                    rsp.msg  = ex.Message;
                }
            }

            return(rsp);
        }