public static Com.DataPack.DataRsp <string> thdel(string AutoId)
 {
     Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
     if (Com.Session.userid == null)
     {
         rsp.code = "expire";
         rsp.msg  = "页面已经过期,请重新登录";
     }
     else
     {
         try
         {
             SchSystem.BLL.SchThdInfo bll_th = new SchSystem.BLL.SchThdInfo();
             if (bll_th.Delete(Convert.ToInt32(AutoId)))
             {
                 rsp.code = "success";
                 rsp.msg  = "页面已经过期,请重新登录";
             }
             else
             {
                 rsp.code = "error";
                 rsp.msg  = "操作失败";
             }
         }
         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 cotycode, string schid)
 {
     Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
     if (Com.Session.userid == null)
     {
         rsp.code = "expire";
         rsp.msg  = "页面已经过期,请重新登录";
     }
     else
     {
         try
         {
             SchSystem.BLL.SchThdInfo thdbll = new SchSystem.BLL.SchThdInfo();
             string strwhere = " ";
             if (!string.IsNullOrEmpty(schid))
             {
                 strwhere += " SchId = '" + Com.Public.SqlEncStr(schid) + "'";
             }
             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 = thdbll.GetListCols("*", strwhere, "", "", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
             pages.PageCount = pc;
             pages.RowCount  = rowc;
             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();
                    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> Save(string sendstr, string delAutoId, string schid)
 {
     Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
     if (Com.Session.userid == null)
     {
         rsp.code = "expire";
         rsp.msg  = "页面已经过期,请重新登录";
     }
     else
     {
         try
         {
             SchSystem.BLL.SchThdInfo   bll_th   = new SchSystem.BLL.SchThdInfo();
             SchSystem.Model.SchThdInfo model_th = new SchSystem.Model.SchThdInfo();
             sendstr = Com.Public.SqlEncStr(sendstr);
             if (delAutoId != "")//要删除的AutoId
             {
                 string[] aid = delAutoId.Split(',');
                 if (aid.Length > 0)
                 {
                     for (int i = 0; i < aid.Length; i++)
                     {
                         bll_th.Delete(Convert.ToInt32(aid[i]));
                     }
                 }
             }
             sendstr = sendstr.Replace("u_", "");//UID,UTNAME,SUB,ISMS
             string[] uss = sendstr.Split('|');
             if (uss.Length > 0)
             {
                 foreach (string item in uss)
                 {
                     string[] its = item.Split(',');
                     if (its.Length == 7)
                     {
                         if (its[0] == "0")//its[0]为AutoId 0添加 否则编辑
                         {
                             model_th.SysName         = its[1];
                             model_th.SysUrl          = its[2];
                             model_th.SysUserNameTips = its[3];
                             model_th.SysUserPwTips   = its[4];
                             model_th.SysLoginUrl     = its[5];
                             model_th.RecUser         = Com.Session.userid;
                             model_th.RecTime         = DateTime.Now;
                             model_th.SchId           = Convert.ToInt32(schid);
                             if (bll_th.ExistsSysUrl(its[2].ToString(), Convert.ToInt32(schid)))
                             {
                                 continue;
                             }
                             else
                             {
                                 bll_th.Add(model_th);
                             }
                         }
                         else
                         {
                             model_th.AutoId          = Convert.ToInt32(its[0]);
                             model_th.SysName         = its[1];
                             model_th.SysUrl          = its[2];
                             model_th.SysUserNameTips = its[3];
                             model_th.SysUserPwTips   = its[4];
                             model_th.SysLoginUrl     = its[5];
                             model_th.RecTime         = System.DateTime.Now;
                             model_th.RecUser         = Com.Session.userid.ToString();
                             model_th.SchId           = Convert.ToInt32(schid);
                             bll_th.Update(model_th);
                         }
                     }
                 }
             }
             rsp.code = "success";
             rsp.msg  = "操作成功!";
         }
         catch (Exception ex)
         {
             rsp.code = "error";
             rsp.msg  = ex.Message;
         }
     }
     return(rsp);
 }