Exemplo n.º 1
0
        /// <summary>
        /// 获取数据列表
        /// </summary>
        /// <param name="sw">参见条件模型CollectDataSW</param>
        /// <returns>参见模型CollectDataListModel</returns>
        public static IEnumerable <CollectDataListModel> get_CollectDataModelList(CollectDataSW sw)
        {
            var       result = new List <CollectDataListModel>();
            DataTable dt     = T_IPSCOL_COLLECTDATA.getUnionDT(sw);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                CollectDataListModel m = new CollectDataListModel();
                m.COLLECTID = long.Parse(dt.Rows[i]["COLLECTID"].ToString());
                m.HID       = int.Parse(dt.Rows[i]["HID"].ToString());
                m.LONGITUDE = (dt.Rows[i]["LONGITUDE"] == null) ? 0 : decimal.Parse(dt.Rows[i]["LONGITUDE"].ToString());
                m.LATITUDE  = (dt.Rows[i]["LATITUDE"] == null) ? 0 : decimal.Parse(dt.Rows[i]["LATITUDE"].ToString());
                //******************计算坐标偏移量
                string[] arr = PublicCls.switJWD(m.LATITUDE.ToString(), m.LONGITUDE.ToString());
                m.LATITUDE  = Convert.ToDecimal(arr[0]);
                m.LONGITUDE = Convert.ToDecimal(arr[1]);
                //******************计算坐标偏移量 End
                m.SYSTYPEVALUE = dt.Rows[i]["SYSTYPEVALUE"].ToString();
                m.COLLECTNAME  = dt.Rows[i]["COLLECTNAME"].ToString();
                m.ADDRESS      = dt.Rows[i]["ADDRESS"].ToString();
                //if (string.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["HEIGHT"])))//判断是否是空值
                //{
                //    dt.Rows[i]["HEIGHT"] = 0;
                //}
                m.COLLECTTIME = Convert.ToDateTime(dt.Rows[i]["COLLECTTIME"].ToString());

                result.Add(m);
            }
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 根据机构编码获取该机构下车辆数
        /// </summary>
        /// <param name="dtCar"></param>
        /// <param name="orgNo"></param>
        /// <returns></returns>
        public static string GetCarCount(DataTable dtCar, string orgNo)
        {
            string        count = "0";
            StringBuilder sb    = new StringBuilder();

            sb.AppendFormat("(");
            if (PublicCls.OrgIsShi(orgNo))
            {
                count = dtCar.Compute("count(BYORGNO)", "substring(BYORGNO,1,4)='" + orgNo.Substring(0, 4) + "'").ToString();
            }
            else if (PublicCls.OrgIsXian(orgNo))
            {
                count = dtCar.Compute("count(BYORGNO)", "substring(BYORGNO,1,6)='" + orgNo.Substring(0, 6) + "'").ToString();
            }
            else if (PublicCls.OrgIsZhen(orgNo))
            {
                count = dtCar.Compute("count(BYORGNO)", "substring(BYORGNO,1,9)='" + orgNo.Substring(0, 9) + "'").ToString();
            }
            else if (PublicCls.OrgIsCun(orgNo))
            {
                count = dtCar.Compute("count(BYORGNO)", "BYORGNO='" + orgNo + "'").ToString();
            }
            sb.AppendFormat("{0}", count);
            sb.AppendFormat(")");
            return(sb.ToString());
        }
Exemplo n.º 3
0
        /// <summary>
        /// 根据ID获取明细
        /// </summary>
        /// <param name="sw">sw.REPORTID</param>
        /// <returns>参见模型</returns>
        public static IEnumerable <T_IPSRPT_REPORT_Model> getDetailModelList(T_IPSRPT_REPORT_SW sw)
        {
            var       result = new List <T_IPSRPT_REPORT_Model>();
            DataTable dt     = BaseDT.T_IPSRPT_REPORT.getDetailDT(new T_IPSRPT_REPORT_SW {
                REPORTID = sw.REPORTID
            });

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                T_IPSRPT_REPORT_Model m = new T_IPSRPT_REPORT_Model();

                m.REPORTDETAILID = dt.Rows[i]["REPORTDETAILID"].ToString();
                m.REPORTID       = dt.Rows[i]["REPORTID"].ToString();
                m.LONGITUDE      = dt.Rows[i]["LONGITUDE"].ToString();
                m.LATITUDE       = dt.Rows[i]["LATITUDE"].ToString();
                //******************计算坐标偏移量
                string[] arr = PublicCls.switJWD(m.LATITUDE, m.LONGITUDE);
                m.LATITUDE  = arr[0];
                m.LONGITUDE = arr[1];
                //******************计算坐标偏移量 End
                m.HEIGHT    = dt.Rows[i]["HEIGHT"].ToString();
                m.DIRECTION = dt.Rows[i]["DIRECTION"].ToString();
                m.SBTIME    = ClsSwitch.SwitTM(dt.Rows[i]["SBTIME"].ToString());



                result.Add(m);
            }
            dt.Clear();
            dt.Dispose();
            return(result);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 护林员统计
        /// </summary>
        /// <returns>参见HUReport_HUCount_Model</returns>
        public static IEnumerable <HUReport_HUCount_Model> getHUCountModel(T_IPSFR_USER_SW sw)
        {
            var result = new List <HUReport_HUCount_Model>();

            T_SYS_ORGSW swOrg = new T_SYS_ORGSW();

            swOrg.SYSFLAG  = ConfigCls.getSystemFlag();
            swOrg.TopORGNO = sw.TopORGNO;

            if (PublicCls.OrgIsShi(sw.TopORGNO))
            {
                swOrg.GetContyORGNOByCity = sw.TopORGNO;//获取所有县
            }
            if (PublicCls.OrgIsXian(sw.TopORGNO))
            {
                swOrg.GetXZOrgNOByConty = sw.TopORGNO;//获取所有镇
            }
            DataTable dtOrg = BaseDT.T_SYS_ORG.getDT(swOrg);

            //DataTable dtOrg = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW { SYSFLAG = ConfigCls.getSystemFlag() });
            DataTable dtHU = BaseDT.T_IPSFR_USER.getDT(new T_IPSFR_USER_SW {
                ISENABLE = "1"
            });

            DataRow[] drOrg = dtOrg.Select("", "ORGNO");//取所有
            if (1 == 1)
            {
                HUReport_HUCount_Model m = new HUReport_HUCount_Model();

                m.ORGName = BaseDT.T_SYS_ORG.getName(sw.TopORGNO) + "合计";
                m.ORGNo   = "";

                m.HUCount       = getHUCountBySex(dtHU, sw.TopORGNO, "");
                m.Sex0Count     = getHUCountBySex(dtHU, sw.TopORGNO, "1");
                m.Sex1Count     = getHUCountBySex(dtHU, sw.TopORGNO, "0");
                m.Onstate0Count = getHUCountByOnstate(dtHU, sw.TopORGNO, "1");
                m.Onstate1Count = getHUCountByOnstate(dtHU, sw.TopORGNO, "2");
                result.Add(m);
            }
            for (int i = 0; i < drOrg.Length; i++)
            {
                HUReport_HUCount_Model m = new HUReport_HUCount_Model();
                string orgName           = drOrg[i]["ORGNAME"].ToString();
                m.ORGName = orgName;
                m.ORGNo   = drOrg[i]["ORGNO"].ToString();

                m.HUCount       = getHUCountBySex(dtHU, drOrg[i]["ORGNO"].ToString(), "");
                m.Sex0Count     = getHUCountBySex(dtHU, drOrg[i]["ORGNO"].ToString(), "1");
                m.Sex1Count     = getHUCountBySex(dtHU, drOrg[i]["ORGNO"].ToString(), "0");
                m.Onstate0Count = getHUCountByOnstate(dtHU, drOrg[i]["ORGNO"].ToString(), "1");
                m.Onstate1Count = getHUCountByOnstate(dtHU, drOrg[i]["ORGNO"].ToString(), "2");
                result.Add(m);
            }
            dtHU.Clear();
            dtHU.Dispose();
            dtOrg.Clear();
            dtOrg.Dispose();
            return(result);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 获取组织机构渐进名称
        /// </summary>
        /// <param name="topOrgNo">顶级单位编码</param>
        /// <param name="orgCode">当前单位编码</param>
        /// <returns>组织机构渐进名称</returns>
        public static string getOrgTDNameClass(string topOrgNo, string orgCode)
        {
            string str1 = "padding-left:0px;";
            string str2 = "padding-left:20px;";
            string str3 = "padding-left:40px;";
            string str4 = "padding-left:60px;";

            if (PublicCls.OrgIsShi(topOrgNo))
            {
                str1 = "padding-left:0px;";
                str2 = "padding-left:20px;";
                str3 = "padding-left:40px;";
                str4 = "padding-left:60px;";
            }
            else if (PublicCls.OrgIsXian(topOrgNo))
            {
                str1 = "padding-left:0px;";
                str2 = "padding-left:0px;";
                str3 = "padding-left:20px;";
                str4 = "padding-left:40px;";
            }
            else if (PublicCls.OrgIsZhen(topOrgNo))
            {
                str1 = "padding-left:0px;";
                str2 = "padding-left:0px;";
                str3 = "padding-left:0px;";
                str4 = "padding-left:20px;";
            }
            else if (PublicCls.OrgIsCun(topOrgNo))
            {
                str1 = "padding-left:0px;";
                str2 = "padding-left:0px;";
                str3 = "padding-left:0px;";
                str4 = "padding-left:0px;";
            }
            if (PublicCls.OrgIsShi(orgCode))//市
            {
                return(str1);
            }
            else if (PublicCls.OrgIsXian(orgCode))//县
            {
                return(str2);
            }
            else if (PublicCls.OrgIsZhen(orgCode))
            {
                return(str3);
            }
            else
            {
                return(str4);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 递归加载分类
        /// </summary>
        /// <param name="dt">dt</param>
        /// <param name="code">code</param>
        /// <returns></returns>
        private static JArray GetTreeChild(DataTable dt, string code)
        {
            JArray childobjArray = new JArray();

            if (dt != null && dt.Rows.Count > 0)
            {
                DataRow[] dr = null;
                if (string.IsNullOrEmpty(code))
                {
                    dr = dt.Select("SUBSTRING(BIOLOGICALTYPECODE,11,2) <> '00' AND SUBSTRING(BIOLOGICALTYPECODE,13,2)='00'");
                }
                else
                {
                    string str = "";
                    if (PublicCls.BioCodeIsKe(code))
                    {
                        str = PublicCls.GetKeBioCode(code);
                        dr  = dt.Select("SUBSTRING(BIOLOGICALTYPECODE,1,10) = '" + str + "' AND SUBSTRING(BIOLOGICALTYPECODE,11,2)<>'00' AND SUBSTRING(BIOLOGICALTYPECODE,13,2)='00'");
                    }
                    else if (PublicCls.BioCodeIsShu(code))
                    {
                        str = PublicCls.GetShuBioCode(code);
                        dr  = dt.Select("SUBSTRING(BIOLOGICALTYPECODE,1,12) = '" + str + "' AND SUBSTRING(BIOLOGICALTYPECODE,13,2)<>'00'");
                    }
                    else
                    {
                        str = PublicCls.GetZhongBioCode(code);
                        dr  = dt.Select("SUBSTRING(BIOLOGICALTYPECODE,1,14) = '" + str + "' AND LEN(BIOLOGICALTYPECODE)>'" + code.Length + "'");
                    }
                }
                if (dr != null && dr.Count() > 0)
                {
                    for (int i = 0; i < dr.Count(); i++)
                    {
                        code = dr[i]["BIOLOGICALTYPECODE"].ToString();
                        JObject root = new JObject
                        {
                            { "id", dr[i]["BIOLOGICALTYPECODE"].ToString() },
                            { "text", dr[i]["BIOLOGICALTYPECODENAME"].ToString() },
                            { "state", "closed" }
                        };
                        root.Add("children", GetTreeChild(dt, code));
                        childobjArray.Add(root);
                    }
                }
            }
            return(childobjArray);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 护林员周边
        /// </summary>
        /// <param name="sw">周边模型</param>
        /// <returns></returns>
        public static IEnumerable <T_IPS_REALDATATEMPORARYModel> getModelList(HlyAreaDataSW sw)
        {
            var       result = new List <T_IPS_REALDATATEMPORARYModel>();
            DataTable dt     = BaseDT.T_IPS_REALDATATEMPORARY.getDTByArea(sw);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                T_IPS_REALDATATEMPORARYModel m = new T_IPS_REALDATATEMPORARYModel();
                //m.REALDATAID = dt.Rows[i]["REALDATAID"].ToString();
                m.USERID       = dt.Rows[i]["USERID"].ToString();
                m.LONGITUDE    = dt.Rows[i]["LONGITUDE"].ToString();
                m.LATITUDE     = dt.Rows[i]["LATITUDE"].ToString();
                m.ORILONGITUDE = dt.Rows[i]["LONGITUDE"].ToString(); //原始经度
                m.ORILATITUDE  = dt.Rows[i]["LATITUDE"].ToString();  //原始纬度
                if (sw.MapType != "Skyline")
                {
                    //******************计算坐标偏移量
                    string[] arr = PublicCls.switJWD(m.LATITUDE, m.LONGITUDE);
                    m.LATITUDE  = arr[0];
                    m.LONGITUDE = arr[1];
                    //******************计算坐标偏移量 End
                }
                m.HEIGHT    = dt.Rows[i]["HEIGHT"].ToString();
                m.ELECTRIC  = dt.Rows[i]["ELECTRIC"].ToString();
                m.SPEED     = dt.Rows[i]["SPEED"].ToString();
                m.DIRECTION = dt.Rows[i]["DIRECTION"].ToString();
                m.SBTIME    = dt.Rows[i]["SBTIME"].ToString();
                if (string.IsNullOrEmpty(m.SBTIME) == false)
                {
                    m.SBTIME = PublicClassLibrary.ClsSwitch.SwitTM(m.SBTIME);
                }
                m.NOTE   = dt.Rows[i]["NOTE"].ToString();
                m.ORGNO  = dt.Rows[i]["ORGNO"].ToString();
                m.SBDATE = dt.Rows[i]["SBDATE"].ToString();
                if (string.IsNullOrEmpty(m.SBDATE) == false)
                {
                    m.SBDATE = PublicClassLibrary.ClsSwitch.SwitDate(m.SBDATE);
                }
                m.SBTIMEBEGIN  = dt.Rows[i]["SBTIMEBEGIN"].ToString();
                m.PATROLLENGTH = dt.Rows[i]["PATROLLENGTH"].ToString();

                result.Add(m);
            }
            return(result);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 获取组织机构渐进名称
        /// </summary>
        /// <param name="topOrgNo">顶级单位编码</param>
        /// <param name="orgCode">当前单位编码</param>
        /// <param name="orgName">单位名称</param>
        /// <returns>格式化后的单位名称(缩进)</returns>
        public static string getOrgTDName1(string topOrgNo, string orgCode, string orgName)
        {
            string str2 = "&nbsp;&nbsp;&nbsp;";
            string str3 = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
            string str4 = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

            if (PublicCls.OrgIsShi(topOrgNo))
            {
            }
            else if (PublicCls.OrgIsXian(topOrgNo))
            {
                str4 = str3;
                str3 = str2;
                str2 = "";
            }
            else if (PublicCls.OrgIsZhen(topOrgNo))
            {
                str4 = str3;
                str3 = "";
            }
            else if (PublicCls.OrgIsCun(topOrgNo))
            {
                str4 = "";
            }
            if (PublicCls.OrgIsShi(orgCode))//市
            {
                return(orgName);
            }
            else if (PublicCls.OrgIsXian(orgCode))//县
            {
                return(str2 + orgName);
            }
            else if (PublicCls.OrgIsZhen(orgCode))
            {
                return(str3 + orgName);
            }
            else
            {
                return(str4 + orgName);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 根据电话号码获取实时传输数据
        /// </summary>
        /// <example>
        /// sw.SearchTime   查询日期,查询某日的电量信息
        /// sw.USERID       护林员序号(多序号以逗号分隔)
        /// sw.DateBegin    开始日期
        /// sw.DateEnd      结束日期
        /// </example>
        /// <param name="sw">参见条件模型T_IPS_REALDATASW</param>
        /// <returns>参见模型T_IPS_REALDATAModel</returns>
        public static IEnumerable <T_IPS_REALDATAModel> getModelList(T_IPS_REALDATASW sw)
        {
            var       result = new List <T_IPS_REALDATAModel>();
            DataTable dt     = BaseDT.T_IPS_REALDATA.getDT(sw);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                T_IPS_REALDATAModel m = new T_IPS_REALDATAModel();
                m.REALDATAID = dt.Rows[i]["REALDATAID"].ToString();
                m.PHONE      = dt.Rows[i]["PHONE"].ToString();
                m.LONGITUDE  = dt.Rows[i]["LONGITUDE"].ToString(); //经度
                m.LATITUDE   = dt.Rows[i]["LATITUDE"].ToString();  //纬度
                if (sw.MapType != "Skyline")
                {
                    //******************计算坐标偏移量
                    string[] arr = PublicCls.switJWD(m.LATITUDE, m.LONGITUDE);
                    m.LATITUDE  = arr[0];
                    m.LONGITUDE = arr[1];
                    //******************计算坐标偏移量 End
                }
                m.HEIGHT    = dt.Rows[i]["HEIGHT"].ToString();
                m.ELECTRIC  = dt.Rows[i]["ELECTRIC"].ToString();
                m.SPEED     = dt.Rows[i]["SPEED"].ToString();
                m.DIRECTION = dt.Rows[i]["DIRECTION"].ToString();
                m.SBTIME    = dt.Rows[i]["SBTIME"].ToString();
                if (string.IsNullOrEmpty(m.SBTIME) == false)
                {
                    m.SBTIME = PublicClassLibrary.ClsSwitch.SwitTM(m.SBTIME);
                }
                m.NOTE = dt.Rows[i]["NOTE"].ToString();


                result.Add(m);
            }
            //dtHUser.Clear();
            //dtHUser.Dispose();
            dt.Clear();
            dt.Dispose();
            return(result);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 获取所有科级及以下生物及对应地区、调查类型已关联的生物列表
        /// </summary>
        /// <param name="joinList"></param>
        /// <param name="dtbiolog"></param>
        /// <param name="code"></param>
        /// <returns></returns>
        private static IEnumerable <T_SYS_BIOLOGICALTYPE_WILD_LOCALBOTANY_Model> GetWILD_LOCALBOTANYModel(List <WILD_LOCALBOTANY_Model> joinList, DataTable dtbiolog, string code)
        {
            var result = new List <T_SYS_BIOLOGICALTYPE_WILD_LOCALBOTANY_Model>();

            DataRow[] dr = null;
            if (string.IsNullOrEmpty(code))
            {
                dr = dtbiolog.Select("SUBSTRING(BIOLOCODE,9,2)<>'00' AND SUBSTRING(BIOLOCODE,11,4)='0000'");
            }
            else
            {
                string str = "";
                if (PublicCls.BioCodeIsKe(code))
                {
                    str = PublicCls.GetKeBioCode(code);
                    dr  = dtbiolog.Select("SUBSTRING(BIOLOCODE,1,10) = '" + str + "' AND SUBSTRING(BIOLOCODE,11,2)<>'00' AND SUBSTRING(BIOLOCODE,13,2)='00'");
                }
                else if (PublicCls.BioCodeIsShu(code))
                {
                    str = PublicCls.GetShuBioCode(code);
                    dr  = dtbiolog.Select("SUBSTRING(BIOLOCODE,1,12) = '" + str + "' AND SUBSTRING(BIOLOCODE,13,2)<>'00'");
                }
            }
            for (int i = 0; i < dr.Length; i++)
            {
                T_SYS_BIOLOGICALTYPE_WILD_LOCALBOTANY_Model m = new T_SYS_BIOLOGICALTYPE_WILD_LOCALBOTANY_Model();
                string chk = joinList.Exists(a => a.BIOLOGICALTYPECODE == dr[i]["BIOLOCODE"].ToString()) ? "1" : "0";
                m.isCheck   = chk;
                m.BIOLOCODE = dr[i]["BIOLOCODE"].ToString();
                m.BIOLONAME = dr[i]["BIOLONAME"].ToString();
                if (!PublicCls.BioCodeIsZHong(dr[i]["BIOLOCODE"].ToString()))
                {
                    m.subModel = GetWILD_LOCALBOTANYModel(joinList, dtbiolog, dr[i]["BIOLOCODE"].ToString());
                }
                result.Add(m);
            }
            return(result);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 获取预案列表
        /// </summary>
        /// <param name="sw">sw</param>
        /// <param name="org">org</param>
        /// <returns></returns>
        public static IEnumerable <JC_FIRE_PLAN_Model> getModelList(JC_FIRE_PLAN_SW sw, string org = "")
        {
            var result = new List <JC_FIRE_PLAN_Model>();

            DataTable dt = BaseDT.JC_FIRE_PLAN.getDT(sw);//列表

            DataTable dtORG = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW {
                SYSFLAG = ConfigCls.getSystemFlag()
            });                                                                                               //获取单位
            DataTable dtFIRELEVEL = BaseDT.T_SYS_DICT.getDT(new T_SYS_DICTSW {
                DICTTYPEID = "22"
            });                                                                                     //火险等级

            if (dt != null)
            {
                ArrayList aList = new ArrayList();
                if (PublicCls.OrgIsZhen(org))//乡镇
                {
                    aList.Add(org);
                }
                aList.Add(PublicCls.getXianIncOrgNo(org) + "000");  //县
                aList.Add(PublicCls.getShiIncOrgNo(org) + "00000"); //市
                for (int i = 0; i < aList.Count; i++)
                {
                    DataRow[] arrayDR = dt.Select(string.Format("BYORGNO='{0}'", aList[i].ToString()));
                    var       list    = GetYAList(arrayDR, dtORG, dtFIRELEVEL, org);
                    result.AddRange(list);
                }
            }

            dt.Clear();
            dt.Dispose();
            dtFIRELEVEL.Clear();
            dtFIRELEVEL.Dispose();
            dtFIRELEVEL.Clear();
            dtFIRELEVEL.Dispose();
            return(result);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 根据组织机构获取该行应用的样式名称
        /// </summary>
        /// <param name="topOrgNo">顶级单位编码</param>
        /// <param name="orgCode">当前单位编码</param>
        /// <returns>样式名称</returns>
        public static string getOrgTrClass(string topOrgNo, string orgCode)
        {
            string str1 = "danger";
            string str2 = "warning";
            string str3 = "";

            if (PublicCls.OrgIsShi(topOrgNo))
            {
                str1 = "danger";
                str2 = "warning";
                str3 = "";
            }
            else if (PublicCls.OrgIsXian(topOrgNo))
            {
                str1 = "";
                str2 = "danger";
                str3 = "warning";
            }
            else if (PublicCls.OrgIsZhen(topOrgNo))
            {
                str1 = "";
                str2 = "";
                str3 = "danger";
            }
            if (PublicCls.OrgIsShi(orgCode))//市
            {
                return(str1);
            }
            else if (PublicCls.OrgIsXian(orgCode))//县
            {
                return(str2);
            }
            else
            {
                return(str3);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// 根据ID获取明细
        /// </summary>
        /// <param name="sw">sw.COLLECTID</param>
        /// <returns>参见模型T_IPSCOL_COLLECT_Model</returns>
        public static IEnumerable <T_IPSCOL_COLLECT_Model> getDetailModelList(T_IPSCOL_COLLECT_SW sw)
        {
            var       result = new List <T_IPSCOL_COLLECT_Model>();
            DataTable dt     = BaseDT.T_IPSCOL_COLLECT.getDetailDT(new T_IPSCOL_COLLECT_SW {
                COLLECTID = sw.COLLECTID
            });

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                T_IPSCOL_COLLECT_Model m = new T_IPSCOL_COLLECT_Model();

                m.COLLECTDETAILID = dt.Rows[i]["COLLECTDETAILID"].ToString();
                m.COLLECTID       = dt.Rows[i]["COLLECTID"].ToString();
                m.LONGITUDE       = dt.Rows[i]["LONGITUDE"].ToString();
                m.LATITUDE        = dt.Rows[i]["LATITUDE"].ToString();
                m.ORILONGITUDE    = dt.Rows[i]["LONGITUDE"].ToString(); //原始经度
                m.ORILATITUDE     = dt.Rows[i]["LATITUDE"].ToString();  //原始纬度
                //******************计算坐标偏移量
                if (sw.MapType != "Skyline")
                {
                    string[] arr = PublicCls.switJWD(m.LATITUDE, m.LONGITUDE);
                    m.LATITUDE  = arr[0];
                    m.LONGITUDE = arr[1];
                }
                //******************计算坐标偏移量 End
                m.HEIGHT      = dt.Rows[i]["HEIGHT"].ToString();
                m.DIRECTION   = dt.Rows[i]["DIRECTION"].ToString();
                m.COLLECTTIME = PublicClassLibrary.ClsSwitch.SwitTM(dt.Rows[i]["COLLECTTIME"].ToString());


                result.Add(m);
            }
            dt.Clear();
            dt.Dispose();
            return(result);
        }
Exemplo n.º 14
0
        /// <summary>
        /// 查询漏检统计
        /// </summary>
        /// <param name="sw">参见OmitCheckCount_SW</param>
        /// <returns>参见HUCheck_OmitCount_Model</returns>
        public static IEnumerable <HUCheck_OmitCount_Model> getOmitCheckModel1(OmitCheckCount_SW sw)
        {
            var result = new List <HUCheck_OmitCount_Model>();

            if (string.IsNullOrEmpty(sw.DateBegin))//开始时间为空
            {
                return(result);
            }
            if (string.IsNullOrEmpty(sw.DateEnd))//结束时间为空
            {
                return(result);
            }
            if (string.IsNullOrEmpty(sw.ORGNO))//组织机构编码
            {
                return(result);
            }
            //根据机构编码获取下属组织机构 注意:这个函数含本级及所有下级的
            DataTable dtOrg = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW {
                TopORGNO = sw.ORGNO
            });

            DataTable dtHU = BaseDT.T_IPSFR_USER.getDT(
                new T_IPSFR_USER_SW
            {
                ISENABLE = "1",
                BYORGNO  = sw.ORGNO,
                HNAME    = sw.PhoneHname,
                HID      = sw.HID
            });
            //获取具体巡检情况
            DataTable dtPatrol = BaseDT.T_IPSFR_ROUTERAIL_PATROL.getDT(
                new T_IPSFR_ROUTERAIL_PATROL_SW
            {
                DateBegin  = sw.DateBegin,
                DateEnd    = sw.DateEnd,
                orgNo      = sw.ORGNO,
                PhoneHname = sw.PhoneHname,
                HID        = sw.HID
            });
            DateTime dt1 = Convert.ToDateTime(sw.DateBegin);
            DateTime dt2 = Convert.ToDateTime(sw.DateEnd);

            DataRow[] drOrg = dtOrg.Select("", "ORGNO");                        //取所有
            int       days  = ClsStr.getDateDiff(sw.DateBegin, sw.DateEnd) + 1; //日期包含天数

            for (int i = 0; i < drOrg.Length; i++)
            {
                HUCheck_OmitCount_Model m = new HUCheck_OmitCount_Model();
                string orgNo = drOrg[i]["ORGNO"].ToString();
                m.ORGNo = orgNo;
                string orgName = BaseDT.T_SYS_ORG.getName(dtOrg, orgNo);
                m.ORGName = orgName;
                //巡检与漏检
                string CCHr = BaseDT.T_IPSFR_ROUTERAIL_PATROL.getCountByOrgNo(dtPatrol, orgNo, "").ToString();
                if (CCHr != "0")
                {
                    string Chr0 = BaseDT.T_IPSFR_ROUTERAIL_PATROL.getCountByOrgNo(dtPatrol, orgNo, "1").ToString();
                    string Chr1 = ClsStr.getDiff(CCHr, Chr0).ToString("F0");
                    string Chr2 = ClsStr.getPercent(Chr0, CCHr).ToString("F0");
                    m.OmitCount0 = CCHr;       //总
                    m.OmitCount1 = Chr0;       //完成
                    m.OmitCount2 = Chr1;       //未完成
                    m.OmitCount3 = Chr2 + "%"; //完成率
                }
                result.Add(m);
            }
            if (PublicCls.OrgIsZhen(sw.ORGNO)) //显示所有护林员
            {
                DataRow[] drHU = dtHU.Select("", "");
                for (int k = 0; k < drHU.Length; k++)//循环护林员
                {
                    HUCheck_OmitCount_Model m = new HUCheck_OmitCount_Model();
                    string HID = dtHU.Rows[k]["HID"].ToString();
                    m.HID     = HID;
                    m.ORGName = dtHU.Rows[k]["HNAME"].ToString();//护林员姓名与机构名称共用一个

                    string CCHr1 = BaseDT.T_IPSFR_ROUTERAIL_PATROL.getCountByHID(dtPatrol, HID, "").ToString();
                    if (CCHr1 != "0")
                    {
                        string Chr0 = BaseDT.T_IPSFR_ROUTERAIL_PATROL.getCountByHID(dtPatrol, HID, "1").ToString();
                        string Chr1 = ClsStr.getDiff(CCHr1, Chr0).ToString("F0");
                        string Chr2 = ClsStr.getPercent(Chr0, CCHr1).ToString("F0");
                        m.OmitCount0 = CCHr1;      //总
                        m.OmitCount1 = Chr0;       //完成
                        m.OmitCount2 = Chr1;       //未完成
                        m.OmitCount3 = Chr2 + "%"; //完成率
                    }
                    result.Add(m);
                }
            }
            dtHU.Clear();
            dtHU.Dispose();
            dtPatrol.Clear();
            dtPatrol.Dispose();
            dtOrg.Clear();
            dtOrg.Dispose();
            return(result);
        }
Exemplo n.º 15
0
        /// <summary>
        /// 查询怠工统计
        /// </summary>
        /// <param name="sw">参见SabotageCount_SW</param>
        /// <returns>参见getSabotageCount_Model</returns>
        public static IEnumerable <getSabotageCount_Model> getSabotageCountModel(SabotageCount_SW sw)
        {
            var result = new List <getSabotageCount_Model>();

            if (string.IsNullOrEmpty(sw.DateBegin))//开始时间为空
            {
                return(result);
            }
            if (string.IsNullOrEmpty(sw.DateEnd))//结束时间为空
            {
                return(result);
            }

            DateTime dt1  = Convert.ToDateTime(sw.DateBegin);
            DateTime dt2  = Convert.ToDateTime(sw.DateEnd);
            int      days = ClsStr.getDateDiff(sw.DateBegin, sw.DateEnd) + 1;//日期包含天数

            DataTable dtHU = new DataTable();
            DataTable dt   = BaseDT.T_IPS_REALDATATEMPORARY.getDTSabotageByOrgNo(sw);

            if (PublicCls.OrgIsShi(sw.TopORGNO))
            {
                dtHU = BaseDT.T_IPSFR_USER.getDTShi(new T_IPSFR_USER_SW {
                });
            }
            else if (PublicCls.OrgIsXian(sw.TopORGNO))
            {
                dtHU = BaseDT.T_IPSFR_USER.getDTXain(new T_IPSFR_USER_SW {
                    BYORGNO = sw.TopORGNO
                });
            }
            else
            {
                dtHU = BaseDT.T_IPSFR_USER.getDT(new T_IPSFR_USER_SW {
                    ISENABLE = "1", BYORGNO = sw.TopORGNO
                });
            }

            if (PublicCls.OrgIsZhen(sw.TopORGNO))
            {
                DataRow[] drOrg = dtHU.Select("", "");
                for (int i = 0; i < drOrg.Length; i++)
                {
                    getSabotageCount_Model m = new getSabotageCount_Model();
                    m.ORGName = drOrg[i]["HNAME"].ToString();
                    m.ORGNo   = drOrg[i]["HID"].ToString();
                    string CHr = dt.Compute("sum(C)", "BYORGNO='" + m.ORGNo + "'").ToString();
                    CHr = (string.IsNullOrEmpty(CHr) ? "0" : CHr);
                    string cList = "";
                    for (DateTime tm = dt1; tm <= dt2; tm = tm.AddDays(1))
                    {
                        string tm1 = PublicClassLibrary.ClsSwitch.SwitDate(tm).ToString();
                        if (string.IsNullOrEmpty(cList) == false)
                        {
                            cList += ",";
                        }
                        string tmp = dt.Compute("sum(C)", "BYORGNO='" + m.ORGNo + "' and SBDATE='" + tm1 + "'  and PatrolLenErro=1").ToString(); //计算该日期下人数
                        cList += (string.IsNullOrEmpty(tmp) ? "0" : tmp);                                                                        //各日期以逗号分隔
                    }
                    m.DayCountList = cList;                                                                                                      //日期考勤列表

                    string Chr0 = dt.Compute("sum(C)", "BYORGNO='" + m.ORGNo + "' and PatrolLenErro=0").ToString();
                    Chr0 = (string.IsNullOrEmpty(Chr0) ? "0" : Chr0);
                    string Chr1 = ClsStr.getDiff(CHr, Chr0).ToString("F0");
                    string Chr2 = ClsStr.getPercent(Chr0, CHr).ToString("F0");
                    m.Count    = CHr;        //总
                    m.Count0   = Chr0;       //完成
                    m.Count1   = Chr1;       //未完成
                    m.CountPer = Chr2 + "%"; //完成率

                    result.Add(m);
                }
                dtHU.Clear();
                dtHU.Dispose();
            }
            else
            {
                T_SYS_ORGSW swOrg = new T_SYS_ORGSW();
                swOrg.SYSFLAG  = ConfigCls.getSystemFlag();
                swOrg.TopORGNO = sw.TopORGNO;

                if (PublicCls.OrgIsShi(sw.TopORGNO))
                {
                    swOrg.GetContyORGNOByCity = sw.TopORGNO;//获取所有县
                }
                if (PublicCls.OrgIsXian(sw.TopORGNO))
                {
                    swOrg.GetXZOrgNOByConty = sw.TopORGNO;//获取所有镇
                }
                DataTable dtOrg = BaseDT.T_SYS_ORG.getDT(swOrg);

                DataRow[] drOrg = dtOrg.Select("", "ORGNO");//取所有
                for (int i = 0; i < drOrg.Length; i++)
                {
                    // string orgName = drOrg[i]["ORGNAME"].ToString();
                    //string orgNo = drOrg[i]["ORGNO"].ToString();

                    getSabotageCount_Model m = new getSabotageCount_Model();
                    m.ORGName = drOrg[i]["ORGNAME"].ToString();
                    m.ORGNo   = drOrg[i]["ORGNO"].ToString();



                    string CHr = dt.Compute("sum(C)", "BYORGNO='" + m.ORGNo + "'").ToString();
                    CHr = (string.IsNullOrEmpty(CHr) ? "0" : CHr);
                    string cList = "";
                    for (DateTime tm = dt1; tm <= dt2; tm = tm.AddDays(1))
                    {
                        string tm1 = PublicClassLibrary.ClsSwitch.SwitDate(tm).ToString();
                        if (string.IsNullOrEmpty(cList) == false)
                        {
                            cList += ",";
                        }
                        string tmp = dt.Compute("sum(C)", "BYORGNO='" + m.ORGNo + "' and SBDATE='" + tm1 + "'  and PatrolLenErro=0").ToString(); //计算该日期下人数
                        cList += (string.IsNullOrEmpty(tmp) ? "0" : tmp);                                                                        //各日期以逗号分隔
                    }
                    m.DayCountList = cList;                                                                                                      //日期考勤列表

                    string Chr0 = dt.Compute("sum(C)", "BYORGNO='" + m.ORGNo + "' and PatrolLenErro=1").ToString();
                    Chr0 = (string.IsNullOrEmpty(Chr0) ? "0" : Chr0);
                    string Chr1 = ClsStr.getDiff(CHr, Chr0).ToString("F0");
                    string Chr2 = ClsStr.getPercent(Chr0, CHr).ToString("F0");
                    m.Count    = CHr;        //总
                    m.Count0   = Chr0;       //完成
                    m.Count1   = Chr1;       //未完成
                    m.CountPer = Chr2 + "%"; //完成率


                    result.Add(m);
                }
                dtOrg.Clear();
                dtOrg.Dispose();
            }
            dt.Clear();
            dt.Dispose();
            if (1 == 1)
            {
                getSabotageCount_Model m = new getSabotageCount_Model();
                m.ORGName = "合计";
                string LineCount = result.Sum(item => Convert.ToDecimal(item.Count)).ToString();
                string Count0    = result.Sum(item => Convert.ToDecimal(item.Count0)).ToString();
                string Count1    = result.Sum(item => Convert.ToDecimal(item.Count1)).ToString();
                m.Count    = LineCount;
                m.Count0   = Count0;
                m.Count1   = Count1;
                m.CountPer = ClsStr.getPercent(m.Count0, m.Count).ToString("F0") + "%";

                int[] arrI = new int[days];
                foreach (var v in result)
                {
                    string[] a = v.DayCountList.Split(',');//组合列表
                    for (int i = 0; i < days; i++)
                    {
                        if (string.IsNullOrEmpty(arrI[i].ToString()))
                        {
                            arrI[i] = 0;
                        }
                        arrI[i] += int.Parse(a[i]);
                    }
                }
                string cList = "";
                for (int i = 0; i < days; i++)
                {
                    if (string.IsNullOrEmpty(cList) == false)
                    {
                        cList += ",";
                    }
                    cList += arrI[i];
                }
                m.DayCountList = cList;


                result.Insert(0, m);
            }
            return(result);
        }
Exemplo n.º 16
0
        /// <summary>
        /// 考勤统计 Model
        /// </summary>
        /// <param name="sw">参见HUCheckINCount_SW</param>
        /// <returns>参见HUCheck_CheckInCount_Model</returns>getOutRaiLCountModel
        public static IEnumerable <OutRaiLCount_Model> getOutRaiLCountModel(OutRaiLCount_SW sw)
        {
            var result = new List <OutRaiLCount_Model>();

            if (string.IsNullOrEmpty(sw.DateBegin))//开始时间为空
            {
                return(result);
            }
            if (string.IsNullOrEmpty(sw.DateEnd))//结束时间为空
            {
                return(result);
            }
            if (string.IsNullOrEmpty(sw.TopORGNO))//组织机构编码
            {
                return(result);
            }

            DateTime dt1  = Convert.ToDateTime(sw.DateBegin);
            DateTime dt2  = Convert.ToDateTime(sw.DateEnd);
            int      days = ClsStr.getDateDiff(sw.DateBegin, sw.DateEnd) + 1;//日期包含天数

            DataTable dt = BaseDT.T_IPSFR_ROUTERAIL_RAIL.getDTByOrgNoToDate(new OutRaiLCount_SW {
                DateBegin = sw.DateBegin, DateEnd = sw.DateEnd, TopORGNO = sw.TopORGNO
            });

            DataTable dtHU = BaseDT.T_IPSFR_USER.getDTByOrgSum(new T_IPSFR_USER_SW {
                BYORGNO = sw.TopORGNO, ISENABLE = "1"
            });

            if (PublicCls.OrgIsZhen(sw.TopORGNO) == false) //市、县处理
            {                                              //只获取该市下面的县 县下面的乡
                T_SYS_ORGSW swOrg = new T_SYS_ORGSW();
                swOrg.SYSFLAG  = ConfigCls.getSystemFlag();
                swOrg.TopORGNO = sw.TopORGNO;

                if (PublicCls.OrgIsShi(sw.TopORGNO))
                {
                    swOrg.GetContyORGNOByCity = sw.TopORGNO;//获取所有县
                }
                if (PublicCls.OrgIsXian(sw.TopORGNO))
                {
                    swOrg.GetXZOrgNOByConty = sw.TopORGNO;//获取所有镇
                }
                DataTable dtOrg = BaseDT.T_SYS_ORG.getDT(swOrg);
                DataRow[] drOrg = dtOrg.Select("", "ORGNO");//取所有

                for (int i = 0; i < drOrg.Length; i++)
                {
                    OutRaiLCount_Model m = new OutRaiLCount_Model();


                    m.ORGName = drOrg[i]["ORGNAME"].ToString();
                    m.ORGNo   = drOrg[i]["ORGNO"].ToString();
                    string CHr = dt.Compute("sum(C)", "BYORGNO=" + m.ORGNo).ToString();//计算该单位下总数
                    CHr     = (string.IsNullOrEmpty(CHr) ? "0" : CHr);
                    m.Count = CHr;
                    string cList = "";
                    for (DateTime tm = dt1; tm <= dt2; tm = tm.AddDays(1))
                    {
                        string tm1 = PublicClassLibrary.ClsSwitch.SwitDate(tm).ToString();
                        if (string.IsNullOrEmpty(cList) == false)
                        {
                            cList += ",";
                        }
                        string tmp = dt.Compute("sum(C)", "BYORGNO='" + m.ORGNo + "' and SBDATE='" + tm1 + "'").ToString(); //计算该日期下数量
                        cList += (string.IsNullOrEmpty(tmp) ? "0" : tmp);                                                   //各日期以逗号分隔
                    }
                    m.DayCountList = cList;                                                                                 //日期考勤列表

                    result.Add(m);
                }
                dtOrg.Clear();
                dtOrg.Dispose();
            }
            else//显示乡的,乡的列出各个护林员
            {
                DataRow[] drOrg = dtHU.Select("", "");//取所有

                for (int i = 0; i < drOrg.Length; i++)
                {
                    OutRaiLCount_Model m = new OutRaiLCount_Model();


                    m.ORGName = drOrg[i]["hname"].ToString();
                    m.ORGNo   = drOrg[i]["hid"].ToString();
                    string CHr = dt.Compute("sum(C)", "BYORGNO=" + m.ORGNo).ToString();//计算该单位下总数
                    CHr     = (string.IsNullOrEmpty(CHr) ? "0" : CHr);
                    m.Count = CHr;

                    string cList = "";
                    for (DateTime tm = dt1; tm <= dt2; tm = tm.AddDays(1))
                    {
                        if (string.IsNullOrEmpty(cList) == false)
                        {
                            cList += ",";
                        }
                        string tmp = dt.Compute("sum(C)", "BYORGNO='" + m.ORGNo + "' and SBDATE='" + PublicClassLibrary.ClsSwitch.SwitDate(tm).ToString() + "'").ToString(); //计算该日期下人数
                        cList += (string.IsNullOrEmpty(tmp) ? "0" : tmp);                                                                                                    //各日期以逗号分隔
                    }
                    m.DayCountList = cList;                                                                                                                                  //日期列表
                    result.Add(m);
                }
            }
            dtHU.Clear();
            dtHU.Dispose();

            dt.Clear();
            dt.Dispose();

            if (1 == 1)
            {
                OutRaiLCount_Model m = new OutRaiLCount_Model();
                m.ORGName = "合计";
                string CHr = result.Sum(item => Convert.ToDecimal(item.Count)).ToString();//总数//计算该单位下总数
                CHr     = (string.IsNullOrEmpty(CHr) ? "0" : CHr);
                m.Count = CHr;
                int[] arrI = new int[days];
                foreach (var v in result)
                {
                    string[] a = v.DayCountList.Split(',');//组合列表
                    for (int i = 0; i < days; i++)
                    {
                        if (string.IsNullOrEmpty(arrI[i].ToString()))
                        {
                            arrI[i] = 0;
                        }
                        arrI[i] += int.Parse(a[i]);
                    }
                }
                string cList = "";
                for (int i = 0; i < days; i++)
                {
                    if (string.IsNullOrEmpty(cList) == false)
                    {
                        cList += ",";
                    }
                    cList += arrI[i];
                }
                m.DayCountList = cList;
                result.Insert(0, m);
            }

            return(result);
        }
Exemplo n.º 17
0
        /// <summary>
        /// 获取一条数据
        /// </summary>
        /// <example>
        /// sw.ALARMID       热点ID
        /// </example>
        /// <param name="sw">参见条件模型T_IPS_HOTS_SW</param>
        /// <returns>参见模型T_IPS_HOTS_Model</returns>
        public static T_IPS_HOTS_Model getModel(T_IPS_HOTS_SW sw)
        {
            DataTable        dt = BaseDT.T_IPS_HOTS.getDT(sw);
            T_IPS_HOTS_Model m  = new T_IPS_HOTS_Model();

            if (dt.Rows.Count > 0)
            {
                int i = 0;
                m.HOTSID = dt.Rows[i]["HOTSID"].ToString();
                m.BH     = dt.Rows[i]["BH"].ToString();
                m.WXBH   = dt.Rows[i]["WXBH"].ToString();
                m.DQRDBH = dt.Rows[i]["DQRDBH"].ToString();
                m.HLY    = dt.Rows[i]["HLY"].ToString();
                m.ZQWZ   = dt.Rows[i]["ZQWZ"].ToString();
                m.JD     = dt.Rows[i]["JD"].ToString();
                m.WD     = dt.Rows[i]["WD"].ToString();
                //******************计算坐标偏移量
                string[] arr = PublicCls.switJWD(m.WD, m.JD);
                m.WD = arr[0];
                m.JD = arr[1];
                //******************计算坐标偏移量 End
                m.XS     = dt.Rows[i]["XS"].ToString();
                m.DL     = dt.Rows[i]["DL"].ToString();
                m.YY     = dt.Rows[i]["YY"].ToString();
                m.JXHQSJ = dt.Rows[i]["JXHQSJ"].ToString();
                m.FXSJ   = dt.Rows[i]["FXSJ"].ToString();
                if (string.IsNullOrEmpty(m.FXSJ) == false)
                {
                    m.FXSJ = PublicClassLibrary.ClsSwitch.SwitTM(m.FXSJ);
                }
                m.SBSJ = dt.Rows[i]["SBSJ"].ToString();
                if (string.IsNullOrEmpty(m.SBSJ) == false)
                {
                    m.SBSJ = PublicClassLibrary.ClsSwitch.SwitTM(m.SBSJ);
                }
                m.BZW       = dt.Rows[i]["BZW"].ToString();
                m.FJBH      = dt.Rows[i]["FJBH"].ToString();
                m.WLBH      = dt.Rows[i]["WLBH"].ToString();
                m.XZQH      = dt.Rows[i]["XZQH"].ToString();
                m.CZW       = dt.Rows[i]["CZW"].ToString();
                m.MANSTATE  = dt.Rows[i]["MANSTATE"].ToString();
                m.MANRESULT = dt.Rows[i]["MANRESULT"].ToString();
                m.MANTIME   = dt.Rows[i]["MANTIME"].ToString();
                m.MANUSERID = dt.Rows[i]["MANUSERID"].ToString();

                if (!string.IsNullOrEmpty(m.MANUSERID))
                {
                    DataTable dtUser = BaseDT.T_SYSSEC_USER.getDT(new T_SYSSEC_IPSUSER_SW {
                        USERID = m.MANUSERID
                    });
                    DataRow[] drUser = dtUser.Select("USERID='" + m.MANUSERID + "'");
                    if (drUser.Length > 0)
                    {
                        m.ManUserName = drUser[0]["USERNAME"].ToString();
                    }

                    dtUser.Clear();
                    dtUser.Dispose();
                }
                //权限获取
                //var userid = SystemCls.getUserID();
                //var rightsw = new T_SYSSEC_IPSUSER_SW();
                //rightsw.USERID = userid;
                //m.Rights = T_SYSSEC_RIGHTCls.getRightStrByUID(rightsw);
            }
            dt.Clear();
            dt.Dispose();
            return(m);
        }
Exemplo n.º 18
0
        /// <summary>
        /// 获取视频列表
        /// </summary>
        /// <param name="orgno"></param>
        /// <param name="eid"></param>
        /// <returns></returns>
        public static string getSynTree(string orgno, string eid)
        {
            JArray jObjects   = new JArray();
            string curUserOrg = SystemCls.getCurUserOrgNo();//获取当前登录用户的机构编码

            if (string.IsNullOrEmpty(orgno) == false)
            {
                curUserOrg = orgno;
            }
            if (string.IsNullOrEmpty(orgno))
            {
                var str = "";
                if (PublicCls.OrgIsZhen(curUserOrg))
                {
                    str = PublicCls.GetOrgNameByOrgNO(curUserOrg.Substring(0, 6) + "000000000");
                }
                else
                {
                    str = PublicCls.GetOrgNameByOrgNO(curUserOrg);
                }

                JObject root = new JObject();
                if (PublicCls.OrgIsShi(curUserOrg))
                {
                    root = new JObject
                    {
                        { "id", "1111" },//ORGNO
                        { "text", str }
                    };
                }

                var resultlist = JC_MONITORCls.getListModel(new JC_MONITOR_BASICINFO_SW {
                    BYORGNO = curUserOrg
                });                                                                                                //获取所有有权限的监控摄像
                if (resultlist.Any())
                {
                    var devOrgSXList = resultlist.Select(p => p.BYORGNO.Substring(0, 6) + "000000000").Distinct();
                    if (devOrgSXList.Any())
                    {
                        JArray devSXArrary = new JArray();
                        foreach (var orgsx in devOrgSXList)
                        {
                            JObject rootSX = new JObject
                            {
                                { "id", orgsx },//ORGNO
                                { "text", PublicCls.GetOrgNameByOrgNO(orgsx) }
                                //{"state","closed"}
                            };
                            var devOrgXZList = resultlist.Select(p => new { p.BYORGNO, p.ORGNAME }).Distinct()
                                               .Where(p => p.BYORGNO.Substring(0, 6) + "000000000" == orgsx);
                            if (devOrgXZList.Any())
                            {
                                JArray devXZArrary = new JArray();
                                foreach (var orgxz in devOrgXZList)
                                {
                                    JObject rootXZ = new JObject
                                    {
                                        { "id", orgxz.BYORGNO },//ORGNO
                                        { "text", orgxz.ORGNAME }
                                        // {"state","closed"}
                                    };
                                    var devlist = resultlist.Where(p => p.BYORGNO == orgxz.BYORGNO);
                                    if (devlist.Any())
                                    {
                                        JArray devArrary = new JArray();
                                        foreach (var dev in devlist)
                                        {
                                            JObject rootDevice = new JObject
                                            {
                                                { "id", dev.EMID }, { "text", dev.EMNAME },
                                                { "objId", dev.OBJID }, { "templateId", dev.TEMPLATEDID }, { "ip", dev.IP },
                                                { "port", dev.PORT }, { "type", dev.TYPE }, { "isVideo", true }
                                            };
                                            devArrary.Add(rootDevice);
                                        }
                                        rootXZ.Add("children", devArrary);
                                        if (PublicCls.OrgIsZhen(curUserOrg))//乡镇级用户
                                        {
                                            jObjects.Add(rootXZ);
                                            break;
                                        }
                                        devXZArrary.Add(rootXZ);
                                    }
                                }
                                rootSX.Add("children", devXZArrary);
                                if (PublicCls.OrgIsXian(curUserOrg))//县级用户
                                {
                                    jObjects.Add(rootSX);
                                    break;
                                }
                                devSXArrary.Add(rootSX);
                            }
                        }
                        if (PublicCls.OrgIsShi(curUserOrg))//市级用户
                        {
                            root.Add("children", devSXArrary);
                        }
                    }
                    if (PublicCls.OrgIsShi(curUserOrg))
                    {
                        jObjects.Add(root);
                    }
                }
            }
            else
            {
                var     str  = PublicCls.GetOrgNameByOrgNO(curUserOrg);
                JObject root = new JObject
                {
                    { "id", "1111" },  //ORGNO
                    { "text", str }
                };
                var devlist = JC_MONITORCls.getListModel(new JC_MONITOR_BASICINFO_SW {
                    BYORGNO = curUserOrg, EMID = eid
                });                                                                                                         //获取所有有权限的监控摄像
                if (devlist.Any())
                {
                    JArray devArrary = new JArray();
                    foreach (var dev in devlist)
                    {
                        JObject rootDevice = new JObject
                        {
                            { "id", dev.EMID }, { "text", dev.EMNAME },
                            { "objId", dev.OBJID }, { "templateId", dev.TEMPLATEDID }, { "ip", dev.IP },
                            { "port", dev.PORT }, { "type", dev.TYPE }, { "isVideo", true }
                        };
                        devArrary.Add(rootDevice);
                    }
                    root.Add("children", devArrary);
                    jObjects.Add(root);
                }
            }
            return(JsonConvert.SerializeObject(jObjects));
        }
Exemplo n.º 19
0
        /// <summary>
        /// 根据组织机构获取短信发送tree字符串
        /// </summary>
        /// <param name="orgno"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static SendMessage_Model getstr(string orgno, string type)
        {
            var s         = "";
            var d         = "";
            var dt        = new DataTable();
            var dtvillage = new DataTable();
            var dtipuser  = new DataTable();

            if (orgno == "1")
            {
                dt = BaseDT.T_SYS_ORG_LINK.getDT(new T_SYS_ORG_LINK_SW {
                    BYORGNO = SystemCls.getCurUserOrgNo()
                });                                                                                               //列表
            }
            else if (orgno == "2")
            {
                dtipuser = BaseDT.T_IPSFR_USER.getDT(new T_IPSFR_USER_SW {
                    BYORGNO = SystemCls.getCurUserOrgNo()
                });
            }
            else
            {
                if (PublicCls.OrgIsShi(orgno) == false && PublicCls.OrgIsXian(orgno) == false && PublicCls.OrgIsZhen(orgno) == false)
                {
                    dtvillage = BaseDT.T_SYS_ORG_CWH.getVillagecComDT(new T_SYS_ORG_CWH_SW {
                        CWHID = orgno
                    });
                }
                else
                {
                    dtvillage = BaseDT.T_SYS_ORG_CWH.getVillagecComDT(new T_SYS_ORG_CWH_SW {
                        BYORGNO = orgno
                    });
                    dt = BaseDT.T_SYS_ORG_LINK.getDT(new T_SYS_ORG_LINK_SW {
                        BYORGNO = orgno
                    });                                                                         //列表
                    dtipuser = BaseDT.T_IPSFR_USER.getDT(new T_IPSFR_USER_SW {
                        BYORGNO = orgno
                    });
                }
            }
            if (type == "1")
            {
                if (PublicCls.OrgIsShi(orgno) == false && PublicCls.OrgIsXian(orgno) == false && PublicCls.OrgIsZhen(orgno) == false)
                {
                    for (int i = 0; i < dtvillage.Rows.Count; i++)
                    {
                        T_SYS_ORG_LINK_Model m = new T_SYS_ORG_LINK_Model();
                        m.NAME  = dtvillage.Rows[i]["NAME"].ToString();
                        m.PHONE = dtvillage.Rows[i]["PHONE"].ToString();
                        s      += m.NAME + ",";
                        d      += m.PHONE + ",";
                    }
                }
                else
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        T_SYS_ORG_LINK_Model m = new T_SYS_ORG_LINK_Model();
                        m.NAME  = dt.Rows[i]["NAME"].ToString();
                        m.PHONE = dt.Rows[i]["PHONE"].ToString();
                        s      += m.NAME + ",";
                        d      += m.PHONE + ",";
                    }
                    for (int i = 0; i < dtvillage.Rows.Count; i++)
                    {
                        T_SYS_ORG_LINK_Model m = new T_SYS_ORG_LINK_Model();
                        m.NAME  = dtvillage.Rows[i]["NAME"].ToString();
                        m.PHONE = dtvillage.Rows[i]["PHONE"].ToString();
                        s      += m.NAME + ",";
                        d      += m.PHONE + ",";
                    }
                }
            }
            if (type == "2")
            {
                for (int i = 0; i < dtipuser.Rows.Count; i++)
                {
                    T_SYS_ORG_LINK_Model m = new T_SYS_ORG_LINK_Model();
                    m.NAME  = dtipuser.Rows[i]["HNAME"].ToString();
                    m.PHONE = dtipuser.Rows[i]["PHONE"].ToString();
                    s      += m.NAME + ",";
                    d      += m.PHONE + ",";
                }
            }
            s = s.TrimEnd(',');
            d = d.TrimEnd(',');
            SendMessage_Model m1 = new SendMessage_Model();

            m1.PHONELIST = d;
            m1.NAMELIST  = s;
            dt.Clear();
            dt.Dispose();
            dtvillage.Clear();
            dtvillage.Dispose();
            dtipuser.Clear();
            dtipuser.Dispose();
            return(m1);
        }
Exemplo n.º 20
0
        /// <summary>
        /// 巡检路线统计总表
        /// </summary>
        /// <param name="sw">参见PatrolRouteStat_SW</param>
        /// <returns>参见HUReport_PatrolRouteStat_Model</returns>
        public static IEnumerable <HUReport_PatrolRouteStat_Model> getPatrolRouteStatModel(PatrolRouteStat_SW sw)
        {
            var result = new List <HUReport_PatrolRouteStat_Model>();

            if (string.IsNullOrEmpty(sw.DateBegin))//开始时间为空
            {
                return(result);
            }
            if (string.IsNullOrEmpty(sw.DateEnd))//结束时间为空
            {
                return(result);
            }

            //DataTable dtOrg = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW { SYSFLAG = ConfigCls.getSystemFlag(), TopORGNO=sw.orgNo });
            //获取护林员每日巡检信息
            //DataTable dtHRRealData = BaseDT.T_IPS_REALDATATEMPORARY.getHRAndRealDataDT(new T_IPS_REALDATATEMPORARYSW { DateBegin = sw.DateBegin, DateEnd = sw.DateEnd });
            //获取具体巡检情况
            //DataTable dtPatrol = BaseDT.T_IPSFR_ROUTERAIL_PATROL.getDT(new T_IPSFR_ROUTERAIL_PATROL_SW { DateBegin = sw.DateBegin, DateEnd = sw.DateEnd });
            // DataTable dtHRRealData = new DataTable();
            //DataTable dtPatrol = new DataTable();
            DataTable dtHU         = new DataTable();
            DataTable dtHRRealData = BaseDT.T_IPS_REALDATATEMPORARY.getDTByOrgNo(sw);

            //DataTable dtPatrol = BaseDT.T_IPS_REALDATATEMPORARY.getPATROLCOUNTDTByOrgNo(sw);//获取巡检信息 含未检和已检
            if (PublicCls.OrgIsShi(sw.TopORGNO))
            {
                //dtHRRealData = BaseDT.T_IPS_REALDATATEMPORARY.getDTShi(sw);
                //dtPatrol = BaseDT.T_IPSFR_ROUTERAIL_PATROL.getDTShi(sw);//获取巡检信息 含未检和已检
                dtHU = BaseDT.T_IPSFR_USER.getDTShi(new T_IPSFR_USER_SW {
                });
            }
            else if (PublicCls.OrgIsXian(sw.TopORGNO))
            {
                //dtHRRealData = BaseDT.T_IPS_REALDATATEMPORARY.getDTXain(sw);
                //dtPatrol = BaseDT.T_IPSFR_ROUTERAIL_PATROL.getDTXain(sw);//获取巡检信息 含未检和已检
                dtHU = BaseDT.T_IPSFR_USER.getDTXain(new T_IPSFR_USER_SW {
                    BYORGNO = sw.TopORGNO
                });
            }
            else
            {
                //dtHRRealData = BaseDT.T_IPS_REALDATATEMPORARY.getDTZhen(sw);
                //dtPatrol = BaseDT.T_IPSFR_ROUTERAIL_PATROL.getDTZhen(sw);//获取巡检信息 含未检和已检
                dtHU = BaseDT.T_IPSFR_USER.getDT(new T_IPSFR_USER_SW {
                    ISENABLE = "1", BYORGNO = sw.TopORGNO
                });
            }

            int days = ClsStr.getDateDiff(sw.DateBegin, sw.DateEnd) + 1;//日期包含天数

            if (PublicCls.OrgIsZhen(sw.TopORGNO))
            {
                DataRow[] drOrg = dtHU.Select("", "");
                for (int i = 0; i < drOrg.Length; i++)
                {
                    HUReport_PatrolRouteStat_Model m = new HUReport_PatrolRouteStat_Model();
                    m.ORGName = drOrg[i]["HNAME"].ToString();
                    m.ORGNo   = drOrg[i]["HID"].ToString();



                    string CHr = "";// BaseDT.T_IPSFR_USER.getCountByOrgNo(dtHU, m.ORGNo).ToString();
                    if (CHr != "0")
                    {
                        CHr = days.ToString();
                        string Chr0 = BaseDT.T_IPS_REALDATATEMPORARY.getDTByOrgNoSum(dtHRRealData, m.ORGNo).ToString();
                        string Chr1 = ClsStr.getDiff(CHr, Chr0).ToString("F0");
                        string Chr2 = ClsStr.getPercent(Chr0, CHr).ToString("F0");
                        m.LineCount  = CHr;        //总
                        m.LineCount0 = Chr0;       //完成
                        m.LineCount1 = Chr1;       //未完成
                        m.LineCount2 = Chr2 + "%"; //完成率
                    }

                    //巡检与漏检
                    string CCHr = dtHRRealData.Compute("sum(C1)", "BYORGNO='" + m.ORGNo + "'").ToString();
                    CCHr = (string.IsNullOrEmpty(CCHr) ? "0" : CCHr);
                    if (CCHr != "0")
                    {
                        string Chr0 = dtHRRealData.Compute("sum(C2)", "BYORGNO='" + m.ORGNo + "'").ToString(); // BaseDT.T_IPSFR_ROUTERAIL_PATROL.getSumByOrgNo(dtPatrol, m.ORGNo, "1");
                        Chr0 = (string.IsNullOrEmpty(Chr0) ? "0" : Chr0);
                        string Chr1 = dtHRRealData.Compute("sum(C3)", "BYORGNO='" + m.ORGNo + "'").ToString(); // BaseDT.T_IPSFR_ROUTERAIL_PATROL.getSumByOrgNo(dtPatrol, m.ORGNo, "0");
                        Chr1 = (string.IsNullOrEmpty(Chr1) ? "0" : Chr1);
                        string Chr2 = ClsStr.getPercent(Chr0, CCHr).ToString("F0");
                        m.PointCount  = CCHr;
                        m.PointCount0 = Chr0;
                        m.PointCount1 = Chr1;
                        m.PointCount2 = Chr2 + "%";
                    }

                    result.Add(m);
                }
                dtHU.Clear();
                dtHU.Dispose();
            }
            else
            {
                T_SYS_ORGSW swOrg = new T_SYS_ORGSW();
                swOrg.SYSFLAG  = ConfigCls.getSystemFlag();
                swOrg.TopORGNO = sw.TopORGNO;

                if (PublicCls.OrgIsShi(sw.TopORGNO))
                {
                    swOrg.GetContyORGNOByCity = sw.TopORGNO;//获取所有县
                }
                if (PublicCls.OrgIsXian(sw.TopORGNO))
                {
                    swOrg.GetXZOrgNOByConty = sw.TopORGNO;//获取所有镇
                }
                DataTable dtOrg = BaseDT.T_SYS_ORG.getDT(swOrg);

                DataRow[] drOrg = dtOrg.Select("", "ORGNO");//取所有
                for (int i = 0; i < drOrg.Length; i++)
                {
                    // string orgName = drOrg[i]["ORGNAME"].ToString();
                    //string orgNo = drOrg[i]["ORGNO"].ToString();

                    HUReport_PatrolRouteStat_Model m = new HUReport_PatrolRouteStat_Model();
                    m.ORGName = drOrg[i]["ORGNAME"].ToString();
                    m.ORGNo   = drOrg[i]["ORGNO"].ToString();



                    string CHr = BaseDT.T_IPSFR_USER.getSumByOrgNo(dtHU, m.ORGNo);//各单位护林员个数
                    if (CHr != "0")
                    {
                        CHr = (int.Parse(CHr) * days).ToString();
                        string Chr0 = BaseDT.T_IPS_REALDATATEMPORARY.getDTByOrgNoSum(dtHRRealData, m.ORGNo).ToString();
                        string Chr1 = ClsStr.getDiff(CHr, Chr0).ToString("F0");
                        string Chr2 = ClsStr.getPercent(Chr0, CHr).ToString("F0");
                        m.LineCount  = CHr;        //总
                        m.LineCount0 = Chr0;       //完成
                        m.LineCount1 = Chr1;       //未完成
                        m.LineCount2 = Chr2 + "%"; //完成率
                    }
                    //巡检与漏检

                    //巡检与漏检
                    string CCHr = dtHRRealData.Compute("sum(C1)", "BYORGNO='" + m.ORGNo + "'").ToString();
                    CCHr = (string.IsNullOrEmpty(CCHr) ? "0" : CCHr);
                    if (CCHr != "0")
                    {
                        string Chr0 = dtHRRealData.Compute("sum(C2)", "BYORGNO='" + m.ORGNo + "'").ToString(); // BaseDT.T_IPSFR_ROUTERAIL_PATROL.getSumByOrgNo(dtPatrol, m.ORGNo, "1");
                        Chr0 = (string.IsNullOrEmpty(Chr0) ? "0" : Chr0);
                        string Chr1 = dtHRRealData.Compute("sum(C3)", "BYORGNO='" + m.ORGNo + "'").ToString(); // BaseDT.T_IPSFR_ROUTERAIL_PATROL.getSumByOrgNo(dtPatrol, m.ORGNo, "0");
                        Chr1 = (string.IsNullOrEmpty(Chr1) ? "0" : Chr1);
                        string Chr2 = ClsStr.getPercent(Chr0, CCHr).ToString("F0");
                        m.PointCount  = CCHr;
                        m.PointCount0 = Chr0;
                        m.PointCount1 = Chr1;
                        m.PointCount2 = Chr2 + "%";
                    }

                    result.Add(m);
                }
                dtOrg.Clear();
                dtOrg.Dispose();
            }
            //dtPatrol.Clear();
            //dtPatrol.Dispose();
            dtHRRealData.Clear();
            dtHRRealData.Dispose();
            if (1 == 1)
            {
                HUReport_PatrolRouteStat_Model m = new HUReport_PatrolRouteStat_Model();
                m.ORGName = "合计";
                string LineCount   = result.Sum(item => Convert.ToDecimal(item.LineCount)).ToString();
                string LineCount0  = result.Sum(item => Convert.ToDecimal(item.LineCount0)).ToString();
                string PointCount  = result.Sum(item => Convert.ToDecimal(item.PointCount)).ToString();
                string PointCount0 = result.Sum(item => Convert.ToDecimal(item.PointCount0)).ToString();
                m.LineCount   = LineCount;
                m.LineCount0  = LineCount0;
                m.LineCount1  = result.Sum(item => Convert.ToDecimal(item.LineCount1)).ToString();
                m.LineCount2  = ClsStr.getPercent(LineCount0, LineCount).ToString("F0") + "%";
                m.PointCount  = PointCount;
                m.PointCount0 = PointCount0;
                m.PointCount1 = result.Sum(item => Convert.ToDecimal(item.PointCount1)).ToString();
                m.PointCount2 = ClsStr.getPercent(PointCount0, PointCount).ToString("F0") + "%";
                result.Insert(0, m);
            }
            return(result);
        }
Exemplo n.º 21
0
        /// <summary>
        /// 获取单条数据
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>参见模型</returns>
        public static PEST_MONITORINGSTATION_Model getModel(PEST_MONITORINGSTATION_SW sw)
        {
            DataTable dt    = BaseDT.PEST_MONITORINGSTATION.getDT(sw);//列表
            DataTable dtORG = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW {
                SYSFLAG = ConfigCls.getSystemFlag()
            });                                                                                               //获取单位
            DataTable dt119 = BaseDT.T_SYS_DICT.getDT(new T_SYS_DICTSW {
                DICTTYPEID = "119"
            });                                                                                //无线电传输方式
            DataTable dt120 = BaseDT.T_SYS_DICT.getDT(new T_SYS_DICTSW {
                DICTTYPEID = "120"
            });                                                                                //使用现状
            DataTable dt121 = BaseDT.T_SYS_DICT.getDT(new T_SYS_DICTSW {
                DICTTYPEID = "121"
            });                                                                                //维护类型
            PEST_MONITORINGSTATION_Model m = new PEST_MONITORINGSTATION_Model();

            if (dt.Rows.Count > 0)
            {
                int i = 0;
                m.PEST_MONITORINGSTATIONID = dt.Rows[i]["PEST_MONITORINGSTATIONID"].ToString();
                m.NUMBER  = dt.Rows[i]["NUMBER"].ToString();
                m.NAME    = dt.Rows[i]["NAME"].ToString();
                m.ADDRESS = dt.Rows[i]["ADDRESS"].ToString();
                m.MODEL   = dt.Rows[i]["MODEL"].ToString();
                m.BYORGNO = dt.Rows[i]["BYORGNO"].ToString();
                if (PublicCls.OrgIsShi(m.BYORGNO) || PublicCls.OrgIsXian(m.BYORGNO))
                {
                    m.ORGName   = BaseDT.T_SYS_ORG.getName(dtORG, m.BYORGNO);
                    m.ORGXSName = "--";
                }
                else
                {
                    m.ORGName   = BaseDT.T_SYS_ORG.getName(dtORG, m.BYORGNO.Substring(0, 6) + "000");
                    m.ORGXSName = BaseDT.T_SYS_ORG.getName(dtORG, m.BYORGNO);
                }
                m.TRANSFERMODETYPE     = dt.Rows[i]["TRANSFERMODETYPE"].ToString();
                m.TRANSFERMODETYPEName = BaseDT.T_SYS_DICT.getName(dt119, m.TRANSFERMODETYPE);
                m.MONICONTENT          = dt.Rows[i]["MONICONTENT"].ToString();
                m.BUILDDATE            = PublicClassLibrary.ClsSwitch.SwitDate(dt.Rows[i]["BUILDDATE"].ToString());
                m.USESTATE             = dt.Rows[i]["USESTATE"].ToString();
                m.USESTATEName         = BaseDT.T_SYS_DICT.getName(dt120, m.USESTATE);
                m.MANAGERSTATE         = dt.Rows[i]["MANAGERSTATE"].ToString();
                m.MANAGERSTATEName     = BaseDT.T_SYS_DICT.getName(dt121, m.MANAGERSTATE);
                m.MARK  = dt.Rows[i]["MARK"].ToString();
                m.JD    = dt.Rows[i]["JD"].ToString();
                m.WD    = dt.Rows[i]["WD"].ToString();
                m.WORTH = dt.Rows[i]["WORTH"].ToString();
            }
            dt.Clear();
            dt.Dispose();
            dtORG.Clear();
            dtORG.Dispose();
            dt119.Clear();
            dt119.Dispose();
            dt120.Clear();
            dt120.Dispose();
            dt121.Clear();
            dt121.Dispose();
            return(m);
        }
Exemplo n.º 22
0
        /// <summary>
        /// 组织机构联系人TREE
        /// </summary>
        /// <param name="OrgNo">组织结构编码</param>
        /// <returns></returns>
        public static string GetOrgTree(string OrgNo)
        {
            JArray jObjects   = new JArray();
            string curUserOrg = SystemCls.getCurUserOrgNo();//获取当前登录用户的机构编码

            if (string.IsNullOrEmpty(OrgNo) == false)
            {
                curUserOrg = OrgNo;
            }
            var dtOrg = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW {
                TopORGNO = curUserOrg, SYSFLAG = ConfigCls.getSystemFlag()
            });                                                                                                                //获取当前登录用户有权限查看的单位

            DataTable dtLink             = BaseDT.T_SYS_ORG_LINK.getDT(new T_SYS_ORG_LINK_SW {
            });
            DataTable dtVillagecommittee = BaseDT.T_SYS_ORG_CWH.getDT(new T_SYS_ORG_CWH_SW {
            });

            //JObject root = new JObject
            //     {
            //      { "id", "1"+"|" + "1" },
            //       { "text", "组织机构成员" }
            //     };
            #region 市级用户
            if (PublicCls.OrgIsShi(curUserOrg))
            {
                DataRow[] drOrg = dtOrg.Select("", "ORGNO");
                //JArray childArrayroot = new JArray();
                JObject root1 = new JObject
                {
                    { "id", drOrg[0]["ORGNO"].ToString() },
                    { "text", drOrg[0]["ORGNAME"].ToString() },
                    { "treeType", "1" },
                    { "flag", "" }
                };
                //childArrayroot.Add(root1);
                //root.Add("children", childArrayroot);
                JArray    childArray = new JArray();
                DataRow[] drLink     = dtLink.Select("BYORGNO = '" + curUserOrg + "'", "");
                for (int i = 0; i < drLink.Length; i++)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.AppendFormat("<font title={0}>", drLink[i]["PHONE"].ToString());
                    sb.AppendFormat("{0}[{1}] </font>", drLink[i]["NAME"].ToString(), drLink[i]["USERJOB"].ToString());
                    JObject roota = new JObject
                    {
                        { "id", drLink[i]["PHONE"].ToString() },
                        { "text", sb.ToString() },
                        { "flag", drLink[i]["NAME"].ToString() },
                        { "phone", drLink[i]["PHONE"].ToString() }
                    };
                    childArray.Add(roota);
                }
                DataRow[] drOrgC = dtOrg.Select("SUBSTRING(ORGNO,1,4) = '" + curUserOrg.Substring(0, 4) + "' AND ORGNO<>'" + curUserOrg + "' and SUBSTRING(ORGNO,7,9)='000000000'", "");//获取所有县且〈〉市的
                for (int i = 0; i < drOrgC.Length; i++)
                {
                    JObject rootb = new JObject
                    {
                        { "id", drOrgC[i]["ORGNO"].ToString() },//ORGNO
                        { "text", drOrgC[i]["ORGNAME"].ToString() },
                        { "flag", "" },
                        { "state", "closed" },
                    };
                    childArray.Add(rootb);
                }
                root1.Add("children", childArray);
                jObjects.Add(root1);
            }

            #endregion

            #region 县级用户
            else if (PublicCls.OrgIsXian(curUserOrg))
            {
                DataRow[] drOrg = dtOrg.Select("", "ORGNO");
                //JArray childArrayroot = new JArray();
                JObject root1 = new JObject
                {
                    { "id", drOrg[0]["ORGNO"].ToString() },
                    { "text", drOrg[0]["ORGNAME"].ToString() },
                    { "flag", "" }
                };
                //childArrayroot.Add(root1);
                //root.Add("children", childArrayroot);
                JArray    jObjectsC = new JArray();
                DataRow[] drLink    = dtLink.Select("BYORGNO = '" + curUserOrg + "'", "");
                for (int i = 0; i < drLink.Length; i++)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.AppendFormat("<font title={0}>", drLink[i]["PHONE"].ToString());
                    sb.AppendFormat("{0}[{1}] </font>", drLink[i]["NAME"].ToString(), drLink[i]["USERJOB"].ToString());
                    JObject rootc = new JObject
                    {
                        { "id", drLink[i]["PHONE"].ToString() },
                        { "text", sb.ToString() },
                        { "flag", drLink[i]["NAME"].ToString() },
                        { "phone", drLink[i]["PHONE"].ToString() }
                    };
                    jObjectsC.Add(rootc);
                    if (string.IsNullOrEmpty(OrgNo) == false)//异步加载,不显示县名
                    {
                        jObjects.Add(rootc);
                    }
                }
                DataRow[] drOrgC = dtOrg.Select("SUBSTRING(ORGNO,1,6) = '" + curUserOrg.Substring(0, 6) + "' AND ORGNO<>'" + curUserOrg + "' and SUBSTRING(ORGNO,10,6)='000000'", ""); //获取所有镇且〈〉县的
                for (int i = 0; i < drOrgC.Length; i++)
                {
                    JObject rootd = new JObject
                    {
                        { "id", drOrgC[i]["ORGNO"].ToString() },//ORGNO
                        { "text", drOrgC[i]["ORGNAME"].ToString() },
                        { "flag", "" },
                        { "state", "closed" },
                    };
                    jObjectsC.Add(rootd);
                    if (string.IsNullOrEmpty(OrgNo) == false)//异步加载,不显示县名
                    {
                        jObjects.Add(rootd);
                    }
                }
                if (string.IsNullOrEmpty(OrgNo))//县级用户登录
                {
                    jObjects.Add(root1);
                    root1.Add("children", jObjectsC);
                }
            }
            #endregion

            #region 乡镇级用户
            else if (PublicCls.OrgIsZhen(curUserOrg))
            {
                DataRow[] drOrg = dtOrg.Select("", "ORGNO");
                //JArray childArrayroot = new JArray();
                JObject root1 = new JObject
                {
                    { "id", drOrg[0]["ORGNO"].ToString() },
                    { "text", drOrg[0]["ORGNAME"].ToString() },
                    { "flag", "" },
                    { "treeType", "1" },
                };
                //childArrayroot.Add(root1);
                //root.Add("children", childArrayroot);
                JArray    childArray = new JArray();
                DataRow[] drLink     = dtLink.Select("BYORGNO = '" + curUserOrg + "'", "");
                for (int i = 0; i < drLink.Length; i++)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.AppendFormat("<font title={0}>", drLink[i]["PHONE"].ToString());
                    sb.AppendFormat("{0}[{1}] </font>", drLink[i]["NAME"].ToString(), drLink[i]["USERJOB"].ToString());
                    JObject rootf = new JObject
                    {
                        { "id", drLink[i]["PHONE"].ToString() },
                        { "text", sb.ToString() },
                        { "flag", drLink[i]["NAME"].ToString() },
                        { "phone", drLink[i]["PHONE"].ToString() }
                    };
                    childArray.Add(rootf);
                    if (string.IsNullOrEmpty(OrgNo) == false)//异步加载
                    {
                        jObjects.Add(rootf);
                    }
                }
                DataRow[] drVillagecommittee = dtVillagecommittee.Select("BYORGNO = '" + curUserOrg + "'", "");//获取乡下面的村委会
                for (int i = 0; i < drVillagecommittee.Length; i++)
                {
                    JObject rootg = new JObject
                    {
                        { "id", drVillagecommittee[i]["CWHID"].ToString() },//ORGNO
                        { "text", drVillagecommittee[i]["CWHNAME"].ToString() },
                        { "state", "closed" }
                    };
                    childArray.Add(rootg);
                    if (string.IsNullOrEmpty(OrgNo) == false)//异步加载
                    {
                        jObjects.Add(rootg);
                    }
                }
                if (string.IsNullOrEmpty(OrgNo))//乡镇用户登录
                {
                    //jObjects.Add(root);
                    root1.Add("children", childArray);
                }
            }
            else
            {
                JArray    childArray = new JArray();
                DataRow[] drLink     = dtLink.Select("BYORGNO = '" + curUserOrg + "'", "");
                for (int i = 0; i < drLink.Length; i++)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.AppendFormat("<font title={0}>", drLink[i]["PHONE"].ToString());
                    if (string.IsNullOrEmpty(drLink[i]["UNITNAME"].ToString()) == false)
                    {
                        sb.AppendFormat("{0}[{1}][{2}] </font>", drLink[i]["NAME"].ToString(), drLink[i]["USERJOB"].ToString(), drLink[i]["UNITNAME"].ToString());
                    }
                    else
                    {
                        sb.AppendFormat("{0}[{1}][{2}] </font>", drLink[i]["NAME"].ToString(), drLink[i]["USERJOB"].ToString(), "--");
                    }
                    JObject rootf = new JObject
                    {
                        { "id", drLink[i]["PHONE"].ToString() },
                        { "text", sb.ToString() },
                        { "flag", drLink[i]["NAME"].ToString() },
                        { "phone", drLink[i]["PHONE"].ToString() }
                    };
                    childArray.Add(rootf);
                    if (string.IsNullOrEmpty(OrgNo) == false)//异步加载
                    {
                        jObjects.Add(rootf);
                    }
                }
            }
            #endregion

            dtOrg.Clear();
            dtOrg.Dispose();
            return(JsonConvert.SerializeObject(jObjects));
        }
Exemplo n.º 23
0
        /// <summary>
        /// 巡检路线明细表
        /// </summary>
        /// <param name="sw">参见PatrolRouteStat_SW</param>
        /// <returns>参见HUReport_PatrolRouteDetail_Model</returns>
        public static IEnumerable <HUReport_PatrolRouteDetail_Model> getPatrolRouteDetailModel(PatrolRouteStat_SW sw)
        {
            var result = new List <HUReport_PatrolRouteDetail_Model>();

            if (string.IsNullOrEmpty(sw.DateBegin))//开始时间为空
            {
                return(result);
            }
            if (string.IsNullOrEmpty(sw.DateEnd))//结束时间为空
            {
                return(result);
            }
            if (string.IsNullOrEmpty(sw.orgNo))//组织机构编码
            {
                return(result);
            }

            T_SYS_ORGSW swOrg = new T_SYS_ORGSW();

            swOrg.SYSFLAG  = ConfigCls.getSystemFlag();
            swOrg.TopORGNO = sw.TopORGNO;

            if (PublicCls.OrgIsShi(sw.TopORGNO))
            {
                swOrg.GetContyORGNOByCity = sw.TopORGNO;//获取所有县
            }
            if (PublicCls.OrgIsXian(sw.TopORGNO))
            {
                swOrg.GetXZOrgNOByConty = sw.TopORGNO;//获取所有镇
            }
            DataTable dtOrg = BaseDT.T_SYS_ORG.getDT(swOrg);
            //DataTable dtOrg = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW { SYSFLAG = ConfigCls.getSystemFlag() });
            DataTable dtHU = BaseDT.T_IPSFR_USER.getDT(new T_IPSFR_USER_SW {
                ISENABLE = "1", PhoneHname = sw.PhoneHname, BYORGNO = sw.orgNo
            });
            //获取护林员每日巡检信息
            DataTable dtHRRealData = BaseDT.T_IPS_REALDATATEMPORARY.getHRAndRealDataDT(new T_IPS_REALDATATEMPORARYSW {
                DateBegin = sw.DateBegin, DateEnd = sw.DateEnd, ORGNO = sw.orgNo, PhoneHname = sw.PhoneHname
            });
            //获取具体巡检情况
            DataTable dtPatrol = BaseDT.T_IPSFR_ROUTERAIL_PATROL.getDT(new T_IPSFR_ROUTERAIL_PATROL_SW {
                DateBegin = sw.DateBegin, DateEnd = sw.DateEnd
            });

            int days = ClsStr.getDateDiff(sw.DateBegin, sw.DateEnd) + 1; //日期包含天数

            for (int i = 0; i < dtHU.Rows.Count; i++)                    //获取每个护林员
            {
                string orgNo   = dtHU.Rows[i]["BYORGNO"].ToString();
                string HID     = dtHU.Rows[i]["HID"].ToString();
                string orgName = BaseDT.T_SYS_ORG.getName(dtOrg, orgNo);
                HUReport_PatrolRouteDetail_Model m = new HUReport_PatrolRouteDetail_Model();
                m.ORGName = orgName;
                m.ORGNo   = orgNo;
                m.HNAME   = dtHU.Rows[i]["HNAME"].ToString();
                m.PHONE   = dtHU.Rows[i]["PHONE"].ToString();
                string CHr = "1";//每天一条路线
                if (CHr != "0")
                {
                    CHr = (int.Parse(CHr) * days).ToString();
                    string Chr0 = BaseDT.T_IPS_REALDATATEMPORARY.getCountByHID(dtHRRealData, HID).ToString();
                    string Chr1 = ClsStr.getDiff(CHr, Chr0).ToString("F0");
                    string Chr2 = ClsStr.getPercent(Chr0, CHr).ToString("F0");
                    m.LineCount  = CHr;        //总
                    m.LineCount0 = Chr0;       //完成
                    m.LineCount1 = Chr1;       //未完成
                    m.LineCount2 = Chr2 + "%"; //完成率
                }
                //巡检与漏检
                string CCHr = BaseDT.T_IPSFR_ROUTERAIL_PATROL.getCountByHID(dtPatrol, HID, "").ToString();
                if (CCHr != "0")
                {
                    // CCHr = (int.Parse(CCHr) * days).ToString();
                    string Chr0 = BaseDT.T_IPSFR_ROUTERAIL_PATROL.getCountByHID(dtPatrol, HID, "1").ToString();
                    string Chr1 = ClsStr.getDiff(CCHr, Chr0).ToString("F0");
                    string Chr2 = ClsStr.getPercent(Chr0, CCHr).ToString("F0");
                    m.PointCount  = CCHr;       //总
                    m.PointCount0 = Chr0;       //完成
                    m.PointCount1 = Chr1;       //未完成
                    m.PointCount2 = Chr2 + "%"; //完成率
                }
                result.Add(m);
            }
            dtHU.Clear();
            dtHU.Dispose();
            dtHRRealData.Clear();
            dtHRRealData.Dispose();
            dtPatrol.Clear();
            dtPatrol.Dispose();
            dtOrg.Clear();
            dtOrg.Dispose();
            return(result);
        }
Exemplo n.º 24
0
        /// <summary>
        /// 护林员定位 获取护林员最新一条位置信息
        /// </summary>
        /// <param name="sw">传递护林员列表 参见条件模型T_IPS_REALDATATEMPORARYSW</param>
        /// <returns>参见模型T_IPS_REALDATATEMPORARYModel</returns>
        public static IEnumerable <T_IPS_REALDATATEMPORARYModel> getTopOneModelList(T_IPS_REALDATATEMPORARYSW sw)
        {
            var       result = new List <T_IPS_REALDATATEMPORARYModel>();
            DataTable dt     = BaseDT.T_IPS_REALDATATEMPORARY.getTopOneDT(sw);
            DataTable dtOrg  = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW {
                SYSFLAG = ConfigCls.getSystemFlag()
            });                                                                                               //获取当前登录用户有权限查看的组织机构
            DataTable dtFRUser = BaseDT.T_IPSFR_USER.getDT(new T_IPSFR_USER_SW {
                ISENABLE = "1", HID = sw.USERID
            });                                                                                                     //获取所有有权限查看的护林员

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                T_IPS_REALDATATEMPORARYModel m = new T_IPS_REALDATATEMPORARYModel();
                //m.REALDATAID = dt.Rows[i]["REALDATAID"].ToString();
                m.USERID       = dt.Rows[i]["USERID"].ToString();
                m.LONGITUDE    = dt.Rows[i]["LONGITUDE"].ToString();
                m.LATITUDE     = dt.Rows[i]["LATITUDE"].ToString();
                m.ORILONGITUDE = dt.Rows[i]["LONGITUDE"].ToString(); //原经度
                m.ORILATITUDE  = dt.Rows[i]["LATITUDE"].ToString();  //原纬度
                if (sw.MapType != "Skyline")
                {
                    //******************计算坐标偏移量
                    string[] arr = PublicCls.switJWD(m.LATITUDE, m.LONGITUDE);
                    m.LATITUDE  = arr[0];
                    m.LONGITUDE = arr[1];
                    //******************计算坐标偏移量 End
                }
                m.HEIGHT    = dt.Rows[i]["HEIGHT"].ToString();
                m.ELECTRIC  = dt.Rows[i]["ELECTRIC"].ToString();
                m.SPEED     = dt.Rows[i]["SPEED"].ToString();
                m.DIRECTION = dt.Rows[i]["DIRECTION"].ToString();
                m.SBTIME    = dt.Rows[i]["SBTIME"].ToString();
                if (string.IsNullOrEmpty(m.SBTIME) == false)
                {
                    m.SBTIME = PublicClassLibrary.ClsSwitch.SwitTM(m.SBTIME);
                }
                m.NOTE      = dt.Rows[i]["NOTE"].ToString();
                m.ORGNO     = dt.Rows[i]["ORGNO"].ToString();
                m.SBDATE    = dt.Rows[i]["SBDATE"].ToString();
                m.ISOUTRAIL = dt.Rows[i]["ISOUTRAIL"].ToString();//是否出围
                if (string.IsNullOrEmpty(m.SBDATE) == false)
                {
                    m.SBDATE = PublicClassLibrary.ClsSwitch.SwitDate(m.SBDATE);
                }
                m.SBTIMEBEGIN  = dt.Rows[i]["SBTIMEBEGIN"].ToString();
                m.PATROLLENGTH = dt.Rows[i]["PATROLLENGTH"].ToString();
                DataRow[] drFRUser = dtFRUser.Select("HID=" + m.USERID);
                if (drFRUser.Length > 0)
                {
                    m.HNAME   = drFRUser[0]["HNAME"].ToString();
                    m.PHONE   = drFRUser[0]["PHONE"].ToString();
                    m.ORGNO   = drFRUser[0]["BYORGNO"].ToString();
                    m.ORGNAME = BaseDT.T_SYS_ORG.getName(dtOrg, m.ORGNO);
                }
                double intervalTime = ConfigCls.inLineTimeInterval();
                var    absTime      = Math.Abs(ClsStr.getMinutesDiff(DateTime.Now, m.SBTIME));
                m.HSTATE = absTime > intervalTime ? "0" : "1";//护林员在线状态 0 表示离线 1 表示在线

                //
                //m.ISOUTRAIL
                result.Add(m);
            }
            dt.Clear();
            dt.Dispose();
            dtOrg.Clear();
            dtOrg.Dispose();
            dtFRUser.Clear();
            dtFRUser.Dispose();

            return(result);
        }
Exemplo n.º 25
0
        /// <summary>
        /// 考勤统计 Model
        /// </summary>
        /// <param name="sw">参见HUCheckINCount_SW</param>
        /// <returns>参见HUCheck_CheckInCount_Model</returns>
        public static IEnumerable <HUCheck_CheckInCount_Model> getCheckInModel(HUCheckINCount_SW sw)
        {
            var result = new List <HUCheck_CheckInCount_Model>();

            if (string.IsNullOrEmpty(sw.DateBegin))//开始时间为空
            {
                return(result);
            }
            if (string.IsNullOrEmpty(sw.DateEnd))//结束时间为空
            {
                return(result);
            }
            if (string.IsNullOrEmpty(sw.ORGNO))//组织机构编码
            {
                return(result);
            }

            DateTime dt1  = Convert.ToDateTime(sw.DateBegin);
            DateTime dt2  = Convert.ToDateTime(sw.DateEnd);
            int      days = ClsStr.getDateDiff(sw.DateBegin, sw.DateEnd) + 1;//日期包含天数

            //根据机构编码获取下属组织机构 注意:这个函数含本级及所有下级的
            //DataTable dtOrg = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW { TopORGNO = sw.ORGNO });
            DataTable dtHRRealData = BaseDT.T_IPS_REALDATATEMPORARY.getDTByOrgNoToDate(new PatrolRouteStat_SW {
                DateBegin = sw.DateBegin, DateEnd = sw.DateEnd, TopORGNO = sw.ORGNO
            });

            DataTable dtHU = BaseDT.T_IPSFR_USER.getDTByOrgSum(new T_IPSFR_USER_SW {
                BYORGNO = sw.ORGNO, ISENABLE = "1"
            });

            if (PublicCls.OrgIsZhen(sw.ORGNO) == false) //市、县处理
            {                                           //只获取该市下面的县 县下面的乡
                T_SYS_ORGSW swOrg = new T_SYS_ORGSW();
                swOrg.SYSFLAG  = ConfigCls.getSystemFlag();
                swOrg.TopORGNO = sw.ORGNO;

                if (PublicCls.OrgIsShi(sw.ORGNO))
                {
                    swOrg.GetContyORGNOByCity = sw.ORGNO;//获取所有县
                }
                if (PublicCls.OrgIsXian(sw.ORGNO))
                {
                    swOrg.GetXZOrgNOByConty = sw.ORGNO;//获取所有镇
                }
                DataTable dtOrg = BaseDT.T_SYS_ORG.getDT(swOrg);
                DataRow[] drOrg = dtOrg.Select("", "ORGNO");//取所有

                for (int i = 0; i < drOrg.Length; i++)
                {
                    HUCheck_CheckInCount_Model m = new HUCheck_CheckInCount_Model();


                    m.ORGName = drOrg[i]["ORGNAME"].ToString();
                    m.ORGNo   = drOrg[i]["ORGNO"].ToString();
                    string CHr = dtHU.Compute("sum(C)", "BYORGNO=" + m.ORGNo).ToString(); //计算该单位下总人数
                    CHr       = (string.IsNullOrEmpty(CHr) ? "0" : CHr);
                    m.HUCount = CHr;                                                      //考勤人数
                    string cList = "";
                    for (DateTime tm = dt1; tm <= dt2; tm = tm.AddDays(1))
                    {
                        string tm1 = PublicClassLibrary.ClsSwitch.SwitDate(tm).ToString();
                        if (string.IsNullOrEmpty(cList) == false)
                        {
                            cList += ",";
                        }
                        string tmp = dtHRRealData.Compute("sum(C)", "BYORGNO='" + m.ORGNo + "' and SBDATE='" + tm1 + "'").ToString(); //计算该日期下人数
                        cList += (string.IsNullOrEmpty(tmp) ? "0" : tmp);                                                             //各日期以逗号分隔
                    }
                    m.DayCountList = cList;                                                                                           //日期考勤列表
                    if (CHr != "0")
                    {
                        CHr = (int.Parse(CHr) * days).ToString();

                        string Chr0 = dtHRRealData.Compute("sum(C)", "BYORGNO='" + m.ORGNo + "'").ToString();
                        Chr0 = (string.IsNullOrEmpty(Chr0) ? "0" : Chr0);; // BaseDT.T_IPS_REALDATATEMPORARY.getCountByOrgNo(dtHRRealData, orgNo).ToString();
                        string Chr1 = ClsStr.getDiff(CHr, Chr0).ToString("F0");
                        Chr1 = (string.IsNullOrEmpty(Chr1) ? "0" : Chr1);
                        string Chr2 = ClsStr.getPercent(Chr0, CHr).ToString("F0");
                        Chr2      = (string.IsNullOrEmpty(Chr2) ? "0" : Chr2);
                        m.daysC   = CHr;        //总
                        m.daysOK  = Chr0;       //完成
                        m.daysPer = Chr2 + "%"; //完成率
                    }
                    result.Add(m);
                }
                dtOrg.Clear();
                dtOrg.Dispose();
            }
            else//显示乡的,乡的列出各个护林员
            {
                DataRow[] drOrg = dtHU.Select("", "");//取所有

                for (int i = 0; i < drOrg.Length; i++)
                {
                    HUCheck_CheckInCount_Model m = new HUCheck_CheckInCount_Model();


                    m.ORGName = drOrg[i]["hname"].ToString();
                    m.ORGNo   = drOrg[i]["hid"].ToString();
                    string CHr = "1";                                    // dtHU.Compute("BYORGNO=" + m.ORGNo, "").ToString();//计算该单位下总人数
                    m.HUCount = (string.IsNullOrEmpty(CHr) ? "0" : CHr); //考勤人数
                    string cList = "";
                    for (DateTime tm = dt1; tm <= dt2; tm = tm.AddDays(1))
                    {
                        if (string.IsNullOrEmpty(cList) == false)
                        {
                            cList += ",";
                        }
                        string tmp = dtHRRealData.Compute("sum(C)", "BYORGNO='" + m.ORGNo + "' and SBDATE='" + PublicClassLibrary.ClsSwitch.SwitDate(tm).ToString() + "'").ToString(); //计算该日期下人数
                        cList += (string.IsNullOrEmpty(tmp) ? "0" : tmp);                                                                                                              //各日期以逗号分隔
                    }
                    m.DayCountList = cList;                                                                                                                                            //日期考勤列表
                    if (CHr != "0")
                    {
                        CHr = (int.Parse(CHr) * days).ToString();

                        string Chr0 = dtHRRealData.Compute("sum(C)", "BYORGNO='" + m.ORGNo + "'").ToString();
                        Chr0 = (string.IsNullOrEmpty(Chr0) ? "0" : Chr0);; // BaseDT.T_IPS_REALDATATEMPORARY.getCountByOrgNo(dtHRRealData, orgNo).ToString();
                        string Chr1 = ClsStr.getDiff(CHr, Chr0).ToString("F0");
                        Chr1 = (string.IsNullOrEmpty(Chr1) ? "0" : Chr1);
                        string Chr2 = ClsStr.getPercent(Chr0, CHr).ToString("F0");
                        Chr2      = (string.IsNullOrEmpty(Chr2) ? "0" : Chr2);
                        m.daysC   = CHr;        //总
                        m.daysOK  = Chr0;       //完成
                        m.daysPer = Chr2 + "%"; //完成率
                    }
                    result.Add(m);
                }
            }
            dtHU.Clear();
            dtHU.Dispose();

            //根据机构编码获取所有护林员信息
            // DataTable dtHU = BaseDT.T_IPSFR_USER.getDT(new T_IPSFR_USER_SW { BYORGNO = sw.ORGNO, ISENABLE = "1" });

            dtHRRealData.Clear();
            dtHRRealData.Dispose();

            if (1 == 1)
            {
                HUCheck_CheckInCount_Model m = new HUCheck_CheckInCount_Model();
                m.ORGName = "合计";
                string HUCount = result.Sum(item => Convert.ToDecimal(item.HUCount)).ToString();//总数
                string daysC   = result.Sum(item => Convert.ToDecimal(item.daysC)).ToString();
                string daysOK  = result.Sum(item => Convert.ToDecimal(item.daysOK)).ToString();
                HUCount = (string.IsNullOrEmpty(HUCount) ? "0" : HUCount);
                daysC   = (string.IsNullOrEmpty(daysC) ? "0" : daysC);
                daysOK  = (string.IsNullOrEmpty(daysOK) ? "0" : daysOK);
                //string PointCount0 = result.Sum(item => Convert.ToDecimal(item.PointCount0)).ToString();
                m.HUCount = HUCount;
                m.daysC   = daysC;  //总天数
                m.daysOK  = daysOK; //已出勤
                int[] arrI = new int[days];
                foreach (var v in result)
                {
                    string[] a = v.DayCountList.Split(',');//组合列表
                    for (int i = 0; i < days; i++)
                    {
                        if (string.IsNullOrEmpty(arrI[i].ToString()))
                        {
                            arrI[i] = 0;
                        }
                        arrI[i] += int.Parse(a[i]);
                    }
                }
                string cList = "";
                for (int i = 0; i < days; i++)
                {
                    if (string.IsNullOrEmpty(cList) == false)
                    {
                        cList += ",";
                    }
                    cList += arrI[i];
                }
                m.DayCountList = cList;
                //m.LineCount2 = ClsStr.getPercent(LineCount0, LineCount).ToString("F0") + "%";
                //m.PointCount = PointCount;
                //m.PointCount0 = PointCount0;
                //m.PointCount1 = result.Sum(item => Convert.ToDecimal(item.PointCount1)).ToString();
                m.daysPer = ClsStr.getPercent(m.daysOK, m.daysC).ToString("F0") + "%";
                result.Insert(0, m);
            }

            return(result);
        }
Exemplo n.º 26
0
        /// <summary>
        /// 获取多条数据
        /// </summary>
        /// <example>
        /// sw.orgNo            机构编码,用于获取该机构编码下所有的采集信息
        /// sw.MANSTATE       处理状态 0未处理1已处理
        /// sw.DateBegin    开始日期
        /// sw.DateEnd      结束日期
        /// </example>
        /// <param name="sw">参见条件模型T_IPSCOL_COLLECT_SW</param>
        /// <returns>参见模型T_IPSCOL_COLLECT_Model</returns>
        public static IEnumerable <T_IPSCOL_COLLECT_Model> getModelList(T_IPSCOL_COLLECT_SW sw)
        {
            DataTable dtHRUser = BaseDT.T_IPSFR_USER.getDT(new T_IPSFR_USER_SW {
                BYORGNO = sw.orgNo
            });
            DataTable dtUser        = BaseDT.T_SYSSEC_USER.getDT(new T_SYSSEC_IPSUSER_SW {
            });
            DataTable dtCollectType = BaseDT.T_SYS_DICT.getDT(new T_SYS_DICTSW {
                DICTFLAG = "数据采集"
            });
            var       result = new List <T_IPSCOL_COLLECT_Model>();
            DataTable dt     = null;

            if (sw.UnionHUser)
            {
                dt = BaseDT.T_IPSCOL_COLLECT.getDtUnionHUser(sw); //关联护林员表
            }
            else
            {
                dt = BaseDT.T_IPSCOL_COLLECT.getDT(sw);
            }
            string IDList = "";

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (i > 0)
                {
                    IDList += ",";
                }
                IDList += dt.Rows[i]["COLLECTID"].ToString();
            }
            DataTable dtDetail = BaseDT.T_IPSCOL_COLLECT.getDetailDT(new T_IPSCOL_COLLECT_SW {
                COLLECTID = IDList
            });
            DataTable dtUpload = BaseDT.T_IPSCOL_COLLECT.getUploadDT(new T_IPSCOL_COLLECT_SW {
                COLLECTID = IDList
            });

            //var userid = SystemCls.getUserID();
            //var rightsw = new T_SYSSEC_IPSUSER_SW();
            //rightsw.USERID = userid;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                T_IPSCOL_COLLECT_Model m = new T_IPSCOL_COLLECT_Model();

                m.HID          = dt.Rows[i]["HID"].ToString();
                m.COLLECTID    = dt.Rows[i]["COLLECTID"].ToString();
                m.SYSTYPEVALUE = dt.Rows[i]["SYSTYPEVALUE"].ToString();
                m.SYSTYPEName  = BaseDT.T_SYS_DICT.getName(dtCollectType, m.SYSTYPEVALUE);
                m.ADDRESS      = dt.Rows[i]["ADDRESS"].ToString();
                m.COLLECTTIME  = ClsSwitch.SwitTM(dt.Rows[i]["COLLECTTIME"].ToString());
                m.COLLECTNAME  = dt.Rows[i]["COLLECTNAME"].ToString();
                m.MANSTATE     = dt.Rows[i]["MANSTATE"].ToString();
                m.MANRESULT    = dt.Rows[i]["MANRESULT"].ToString();
                m.MANTIME      = ClsSwitch.SwitTM(dt.Rows[i]["MANTIME"].ToString());
                m.MANUSERID    = dt.Rows[i]["MANUSERID"].ToString();
                DataRow[] drDetail = dtDetail.Select("COLLECTID='" + m.COLLECTID + "'", "COLLECTTIME");
                if (drDetail.Length > 0)
                {
                    m.COLLECTDETAILID = drDetail[0]["COLLECTDETAILID"].ToString();
                    m.LONGITUDE       = drDetail[0]["LONGITUDE"].ToString();
                    m.LATITUDE        = drDetail[0]["LATITUDE"].ToString();
                    if (sw.MapType != "Skyline")
                    {
                        //******************计算坐标偏移量
                        string[] arr = PublicCls.switJWD(m.LATITUDE, m.LONGITUDE);
                        m.LATITUDE  = arr[0];
                        m.LONGITUDE = arr[1];
                        //******************计算坐标偏移量 End
                    }
                    m.HEIGHT    = drDetail[0]["HEIGHT"].ToString();
                    m.DIRECTION = drDetail[0]["DIRECTION"].ToString();
                    // m.COLLECTTIME = ClsSwitch.SwitTM(drDetail[0]["COLLECTTIME"].ToString());
                }

                DataRow[] drUpload = dtUpload.Select("COLLECTID='" + m.COLLECTID + "'", "COLLECTUPLOADID");
                if (drUpload.Length > 0)
                {
                    m.COLLECTUPLOADID = drUpload[0]["COLLECTUPLOADID"].ToString();
                    m.UPLOADURL       = drUpload[0]["UPLOADURL"].ToString();
                    m.UPLOADNAME      = drUpload[0]["UPLOADNAME"].ToString();
                    m.UPLOADDESCRIBE  = drUpload[0]["UPLOADDESCRIBE"].ToString();
                }

                DataRow[] drHRUser = dtHRUser.Select("HID='" + m.HID + "'");
                if (drHRUser.Length > 0)
                {
                    m.OrgNoName = drHRUser[0]["ORGNAME"].ToString();
                    m.HName     = drHRUser[0]["HNAME"].ToString();
                    m.Phone     = drHRUser[0]["PHONE"].ToString();
                    m.OrgNo     = drHRUser[0]["BYORGNO"].ToString();
                    m.Phone     = drHRUser[0]["PHONE"].ToString();
                }
                if (!string.IsNullOrEmpty(m.MANUSERID))
                {
                    DataRow[] drUser = dtUser.Select("USERID='" + m.MANUSERID + "'");
                    if (drUser.Length > 0)
                    {
                        m.ManUserName = drUser[0]["USERNAME"].ToString();
                    }
                }
                //权限获取
                //m.Rights = T_SYSSEC_RIGHTCls.getRightStrByUID(rightsw);
                result.Add(m);
            }
            dtUser.Clear();
            dtUser.Dispose();
            dtHRUser.Clear();
            dtHRUser.Dispose();
            dtDetail.Clear();
            dtDetail.Dispose();
            dtUpload.Clear();
            dtUpload.Dispose();
            dtCollectType.Clear();
            dtCollectType.Dispose();
            dt.Clear();
            dt.Dispose();
            return(result);
        }
Exemplo n.º 27
0
        /// <summary>
        ///异步获取json字符串(车辆)
        /// </summary>
        /// <param name="orgno">当前用户机构码</param>
        /// <param name="idorgno">选择机构码</param>
        /// <returns></returns>
        public static string GetJsonStrCar(string orgno, string idorgno)
        {
            DataTable dtCar    = BaseDT.DC_CAR.getDT(new DC_CAR_SW());
            JArray    jObjects = new JArray();

            if (string.IsNullOrEmpty(idorgno))
            {
                List <T_SYS_ORGModel> orgList = T_SYS_ORGCls.getListModel(new T_SYS_ORGSW {
                    ORGNO = orgno
                }).ToList();                                                                                         //获取机构
                if (orgList.Any())
                {
                    var bo = PublicCls.OrgIsShi(orgno);
                    if (bo)
                    {
                        List <T_SYS_ORGModel> citylist = orgList.Where(p => p.ORGNO.EndsWith("00000")).ToList();//市级别
                        foreach (var city in citylist)
                        {
                            var root = getJobejctCar(dtCar, city);
                            jObjects.Add(root);
                        }
                    }

                    var bb = PublicCls.OrgIsXian(orgno);
                    if (bb)
                    {
                        List <T_SYS_ORGModel> countylist = orgList.Where(p => p.ORGNO.EndsWith("000")).ToList();//县级别
                        foreach (var county in countylist)
                        {
                            var root = getJobejctCar(dtCar, county);
                            jObjects.Add(root);
                        }
                    }
                    var bx = PublicCls.OrgIsZhen(orgno);
                    if (bx)
                    {
                        List <T_SYS_ORGModel> towerlist = orgList.Where(p => !p.ORGNO.EndsWith("000")).ToList();//乡镇级别
                        foreach (var tower in towerlist)
                        {
                            var root = getJobejctCar(dtCar, tower);
                            jObjects.Add(root);
                        }
                    }
                }
            }
            else
            {
                List <T_SYS_ORGModel> orgList = T_SYS_ORGCls.getListModel(new T_SYS_ORGSW {
                    TopORGNO = idorgno
                }).ToList();                          //获取机构
                var bo = PublicCls.OrgIsShi(idorgno); //如果选择市,则列出所有县
                if (bo)
                {
                    List <T_SYS_ORGModel> countylist = orgList.Where(p => p.ORGNO.EndsWith("000000000") && p.ORGNO != idorgno).ToList();
                    foreach (var county in countylist)
                    {
                        var root = getJobejctCar(dtCar, county);
                        jObjects.Add(root);
                    }
                    List <DC_CAR_Model> citycarlist = DC_CARCls.getModelList(new DC_CAR_SW {
                        BYORGNO = idorgno
                    }).Where(p => p.BYORGNO == idorgno).ToList();                                                                                          //市(车辆)
                    if (citycarlist.Any())
                    {
                        foreach (var car in citycarlist)
                        {
                            var obj = getLastJobjectCar(car);
                            jObjects.Add(obj);
                        }
                    }
                }
                var bb = PublicCls.OrgIsXian(idorgno);//如果选择县,则列出所有乡镇
                if (bb)
                {
                    List <T_SYS_ORGModel> towerlist = orgList.Where(p => p.ORGNO.EndsWith("000000") && p.ORGNO != idorgno).ToList();
                    foreach (var tower in towerlist)
                    {
                        var root = getJobejctCar(dtCar, tower);
                        jObjects.Add(root);
                    }
                    List <DC_CAR_Model> countycarlist = DC_CARCls.getModelList(new DC_CAR_SW {
                        BYORGNO = idorgno
                    }).Where(p => p.BYORGNO == idorgno).ToList();                                                                                            //县(车辆)
                    if (countycarlist.Any())
                    {
                        foreach (var car in countycarlist)
                        {
                            var obj = getLastJobjectCar(car);
                            jObjects.Add(obj);
                        }
                    }
                }
                var bx = PublicCls.OrgIsZhen(idorgno);//如果选择乡镇,则列出所有乡镇的车辆
                if (bx)
                {
                    List <DC_CAR_Model> towercarlist = DC_CARCls.getModelList(new DC_CAR_SW {
                        BYORGNO = idorgno
                    }).ToList();                                                                                           //乡镇(车辆)
                    if (towercarlist.Any())
                    {
                        foreach (var car in towercarlist)
                        {
                            var obj = getLastJobjectCar(car);
                            jObjects.Add(obj);
                        }
                    }
                }
            }
            return(JsonConvert.SerializeObject(jObjects));
        }
Exemplo n.º 28
0
        /// <summary>
        /// 采集数据统计
        /// </summary>
        /// <param name="sw">参见模型  sw.TopORGNO 顶级单位编码 sw.DateBegin 开始日期 年月日 sw.DateEnd 结束日期 年月日</param>
        /// <param name="typeModel">参见模型</param>
        /// <returns>参见模型</returns>
        public static IEnumerable <T_IPSCOL_COLLECT_OrgCountModel> getModelCount(T_IPSCOL_COLLECT_SW sw, out IEnumerable <T_IPSCOL_COLLECT_TypeCountModel> typeModel)
        {
            var result = new List <T_IPSCOL_COLLECT_OrgCountModel>();
            //获取采集信息
            DataTable dt = BaseDT.T_IPSCOL_COLLECT.getDTByOrgHUse(sw);
            //获取单位

            T_SYS_ORGSW swOrg = new T_SYS_ORGSW();

            swOrg.SYSFLAG  = ConfigCls.getSystemFlag();
            swOrg.TopORGNO = sw.TopORGNO;

            if (PublicCls.OrgIsShi(sw.TopORGNO))
            {
                swOrg.GetContyORGNOByCity = sw.TopORGNO;//获取所有县
            }
            if (PublicCls.OrgIsXian(sw.TopORGNO))
            {
                swOrg.GetXZOrgNOByConty = sw.TopORGNO;//获取所有镇
            }
            DataTable dtOrg = BaseDT.T_SYS_ORG.getDT(swOrg);
            //采集类别
            DataTable dtReportType = BaseDT.T_SYS_DICT.getDT(new T_SYS_DICTSW {
                DICTTYPEID = "4"
            });                                                                                     //采集类别
            //out 类别
            var resultReportType = new List <T_IPSCOL_COLLECT_TypeCountModel>();

            for (int i = 0; i < dtReportType.Rows.Count; i++)
            {
                T_IPSCOL_COLLECT_TypeCountModel m = new T_IPSCOL_COLLECT_TypeCountModel();
                m.typeName = dtReportType.Rows[i]["DICTNAME"].ToString();
                resultReportType.Add(m);
            }
            typeModel = resultReportType;
            if (1 == 1)
            {
                T_IPSCOL_COLLECT_OrgCountModel m = new T_IPSCOL_COLLECT_OrgCountModel();

                m.HName        = BaseDT.T_SYS_ORG.getName(sw.TopORGNO) + "合计";
                m.ORGName      = m.HName;
                m.CollectCount = BaseDT.T_IPSRPT_REPORT.getCountByOrgHUse(dt, sw.TopORGNO, "");//总数
                var typeResult = new List <T_IPSCOL_COLLECT_TypeCountModel>();
                //循环类别
                for (int k = 0; k < dtReportType.Rows.Count; k++)
                {
                    T_IPSCOL_COLLECT_TypeCountModel mm = new T_IPSCOL_COLLECT_TypeCountModel();
                    mm.typeID    = dtReportType.Rows[k]["DICTVALUE"].ToString();
                    mm.typeName  = dtReportType.Rows[k]["DICTNAME"].ToString();
                    mm.typeCount = BaseDT.T_IPSRPT_REPORT.getCountByOrgHUse(dt, sw.TopORGNO, mm.typeID);//分类别统计
                    typeResult.Add(mm);
                }
                m.TypeCountModel = typeResult;
                result.Add(m);
            }

            if (PublicCls.OrgIsZhen(sw.TopORGNO) == false)
            {
                //循环单位
                for (int i = 0; i < dtOrg.Rows.Count; i++)
                {
                    T_IPSCOL_COLLECT_OrgCountModel m = new T_IPSCOL_COLLECT_OrgCountModel();
                    m.ORGName = dtOrg.Rows[i]["ORGNAME"].ToString();
                    m.ORGNo   = dtOrg.Rows[i]["ORGNO"].ToString();
                    //m.HID = dt.Rows[i]["HID"].ToString();
                    m.CollectCount = BaseDT.T_IPSCOL_COLLECT.getCountByOrgHUse(dt, m.ORGNo, "");//总数
                    var typeResult = new List <T_IPSCOL_COLLECT_TypeCountModel>();
                    //循环类别
                    for (int k = 0; k < dtReportType.Rows.Count; k++)
                    {
                        T_IPSCOL_COLLECT_TypeCountModel mm = new T_IPSCOL_COLLECT_TypeCountModel();
                        mm.typeID    = dtReportType.Rows[k]["DICTVALUE"].ToString();
                        mm.typeName  = dtReportType.Rows[k]["DICTNAME"].ToString();
                        mm.typeCount = BaseDT.T_IPSCOL_COLLECT.getCountByOrgHUse(dt, m.ORGNo, mm.typeID);//分类别统计
                        typeResult.Add(mm);
                    }
                    m.TypeCountModel = typeResult;
                    result.Add(m);
                }
            }
            else//if (PublicCls.OrgIsZhen(sw.TopORGNO))//如果查询的单位为镇,显示所有护林员的统计信息
            {
                DataTable dtHUser = BaseDT.T_IPSFR_USER.getDT(new T_IPSFR_USER_SW
                {
                    BYORGNO = sw.TopORGNO
                });
                for (int i = 0; i < dtHUser.Rows.Count; i++)
                {
                    T_IPSCOL_COLLECT_OrgCountModel m = new T_IPSCOL_COLLECT_OrgCountModel();
                    m.HID   = dtHUser.Rows[i]["HID"].ToString();
                    m.HName = dtHUser.Rows[i]["HNAME"].ToString();

                    m.CollectCount = BaseDT.T_IPSCOL_COLLECT.getCountByHID(dt, m.HID, "");//总数
                    var typeResult = new List <T_IPSCOL_COLLECT_TypeCountModel>();
                    //循环类别
                    for (int k = 0; k < dtReportType.Rows.Count; k++)
                    {
                        T_IPSCOL_COLLECT_TypeCountModel mm = new T_IPSCOL_COLLECT_TypeCountModel();
                        mm.typeID    = dtReportType.Rows[k]["DICTVALUE"].ToString();
                        mm.typeName  = dtReportType.Rows[k]["DICTNAME"].ToString();
                        mm.typeCount = BaseDT.T_IPSCOL_COLLECT.getCountByHID(dt, m.HID, mm.typeID);//分类别统计
                        typeResult.Add(mm);
                    }
                    m.TypeCountModel = typeResult;
                    result.Add(m);
                }
                dtHUser.Clear();
                dtHUser.Dispose();
            }
            dt.Clear();
            dt.Dispose();
            dtOrg.Clear();
            dtOrg.Dispose();
            dtReportType.Clear();
            dtReportType.Dispose();
            return(result);
        }
Exemplo n.º 29
0
        /// <summary>
        /// 获取一条数据
        /// </summary>
        /// <example>
        /// sw.ALARMID       报警ID
        /// </example>
        /// <param name="sw">参见条件模型T_IPS_ALARM_SW</param>
        /// <returns>参见模型T_IPS_ALARM_Model</returns>
        public static T_IPS_ALARM_Model getModel(T_IPS_ALARM_SW sw)
        {
            DataTable         dt = BaseDT.T_IPS_ALARM.getDT(sw);
            T_IPS_ALARM_Model m  = new T_IPS_ALARM_Model();

            if (dt.Rows.Count > 0)
            {
                int i = 0;
                m.ALARMID   = dt.Rows[i]["ALARMID"].ToString();
                m.LONGITUDE = dt.Rows[i]["LONGITUDE"].ToString();
                m.LATITUDE  = dt.Rows[i]["LATITUDE"].ToString();
                //******************计算坐标偏移量
                string[] arr = PublicCls.switJWD(m.LATITUDE, m.LONGITUDE);
                m.LATITUDE  = arr[0];
                m.LONGITUDE = arr[1];
                //******************计算坐标偏移量 End
                m.HEIGHT    = dt.Rows[i]["HEIGHT"].ToString();
                m.PHONE     = dt.Rows[i]["PHONE"].ToString();
                m.ADDRESS   = dt.Rows[i]["ADDRESS"].ToString();
                m.ALARMTIME = dt.Rows[i]["ALARMTIME"].ToString();
                if (string.IsNullOrEmpty(m.ALARMTIME) == false)
                {
                    m.ALARMTIME = PublicClassLibrary.ClsSwitch.SwitTM(m.ALARMTIME);
                }
                m.ALARMCONTENT = dt.Rows[i]["ALARMCONTENT"].ToString();
                m.MANSTATE     = dt.Rows[i]["MANSTATE"].ToString();
                m.MANRESULT    = dt.Rows[i]["MANRESULT"].ToString();
                m.MANTIME      = dt.Rows[i]["MANTIME"].ToString();
                if (string.IsNullOrEmpty(m.MANTIME) == false)
                {
                    m.MANTIME = PublicClassLibrary.ClsSwitch.SwitTM(m.MANTIME);
                }
                m.MANUSERID = dt.Rows[i]["MANUSERID"].ToString();

                DataTable dtHRUser = BaseDT.T_IPSFR_USER.getDT(new T_IPSFR_USER_SW {
                    PHONE = m.PHONE
                });
                DataTable dtUser = BaseDT.T_SYSSEC_USER.getDT(new T_SYSSEC_IPSUSER_SW {
                    USERID = m.MANUSERID
                });
                DataRow[] drHRUser = dtHRUser.Select("PHONE='" + m.PHONE + "'");
                if (drHRUser.Length > 0)
                {
                    m.OrgNoName = drHRUser[0]["ORGNAME"].ToString();
                    m.HName     = drHRUser[0]["HNAME"].ToString();
                    m.HID       = drHRUser[0]["HID"].ToString();
                    m.OrgNo     = drHRUser[0]["BYORGNO"].ToString();
                }

                if (!string.IsNullOrEmpty(m.MANUSERID))
                {
                    DataRow[] drUser = dtUser.Select("USERID='" + m.MANUSERID + "'");
                    if (drUser.Length > 0)
                    {
                        m.ManUserName = drUser[0]["USERNAME"].ToString();
                    }
                }
                dtUser.Clear();
                dtUser.Dispose();
                dtHRUser.Clear();
                dtHRUser.Dispose();

                ////权限获取
                //var userid = SystemCls.getUserID();
                //var rightsw = new T_SYSSEC_IPSUSER_SW();
                //rightsw.USERID = userid;
                //m.Rights = T_SYSSEC_RIGHTCls.getRightStrByUID(rightsw);
            }
            dt.Clear();
            dt.Dispose();
            return(m);
        }
Exemplo n.º 30
0
        /// <summary>
        /// 获取视频列表异步树
        /// </summary>
        /// <param name="OrgNo"></param>
        /// <param name="eid"></param>
        /// <returns></returns>
        public static string getTree(string OrgNo, string eid)
        {
            JArray jObjects   = new JArray();
            string curUserOrg = SystemCls.getCurUserOrgNo();//获取当前登录用户的机构编码

            if (string.IsNullOrEmpty(OrgNo) == false)
            {
                curUserOrg = OrgNo;
            }
            DataTable dtOrg = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW {
                TopORGNO = curUserOrg, SYSFLAG = ConfigCls.getSystemFlag()
            });                                                                                                                      //获取当前登录用户有权限查看的单位
            DataTable dtFRUser = BaseDT.JC_MONITOR_BASICINFO.getDT(new JC_MONITOR_BASICINFO_SW {
                BYORGNO = curUserOrg, EMID = eid
            });                                                                                                                      //获取所有有权限的监控摄像

            #region 市级用户
            if (PublicCls.OrgIsShi(curUserOrg))
            {
                DataRow[] drOrg = dtOrg.Select("", "ORGNO");
                if (drOrg.Length > 0)
                {
                    JObject root = new JObject
                    {
                        { "id", drOrg[0]["ORGNO"].ToString() },//ORGNO
                        { "text", drOrg[0]["ORGNAME"].ToString() },
                        { "treeType", "org" },
                    };
                    JArray    childArray = new JArray();
                    DataRow[] drOrgC     = dtOrg.Select("SUBSTRING(ORGNO,1,4) = '" + curUserOrg.Substring(0, 4) + "' AND ORGNO<>'" + curUserOrg + "' and SUBSTRING(ORGNO,7,3)='000'", "");//获取所有县且〈〉市的
                    for (int i = 0; i < drOrgC.Length; i++)
                    {
                        JObject rootC = new JObject
                        {
                            { "id", drOrgC[i]["ORGNO"].ToString() },//ORGNO
                            { "text", drOrgC[i]["ORGNAME"].ToString() },
                            { "state", "closed" },
                            { "treeType", "org" }
                        };
                        childArray.Add(rootC);
                    }
                    root.Add("children", childArray);
                    jObjects.Add(root);
                }
            }
            #endregion

            #region 县级用户
            else if (PublicCls.OrgIsXian(curUserOrg))
            {
                DataRow[] drOrg = dtOrg.Select("", "ORGNO");
                if (drOrg.Length > 0)
                {
                    JObject root = new JObject
                    {
                        { "id", drOrg[0]["ORGNO"].ToString() },//ORGNO
                        { "text", drOrg[0]["ORGNAME"].ToString() },
                        { "state", "closed" },
                        { "treeType", "org" }
                    };
                    JArray    jObjectsC = new JArray();
                    DataRow[] drOrgC    = dtOrg.Select("SUBSTRING(ORGNO,1,6) = '" + curUserOrg.Substring(0, 6) + "' AND ORGNO<>'" + curUserOrg + "'", ""); //获取所有县且〈〉市的
                    for (int i = 0; i < drOrgC.Length; i++)
                    {
                        JObject rootC = new JObject
                        {
                            { "id", drOrgC[i]["ORGNO"].ToString() },//ORGNO
                            { "text", drOrgC[i]["ORGNAME"].ToString() },
                            { "state", "closed" },
                            { "treeType", "org" }
                        };
                        //root.Add("children", getTreeChild(dtOrg, dtFRUser, dtRealTmp, drOrg[i]["ORGNO"].ToString()));//继续获取护林员
                        jObjectsC.Add(rootC);
                        if (string.IsNullOrEmpty(OrgNo) == false)//异步加载,不显示县名
                        {
                            jObjects.Add(rootC);
                        }
                    }
                    if (string.IsNullOrEmpty(OrgNo))//县级用户登录
                    {
                        jObjects.Add(root);
                        root.Add("children", jObjectsC);
                    }
                }
            }
            #endregion

            #region 乡镇用户
            else
            {
                DataRow[] drOrg = dtOrg.Select("", "ORGNO");
                if (drOrg.Length > 0)
                {
                    JObject root = new JObject
                    {
                        { "id", drOrg[0]["ORGNO"].ToString() },//ORGNO
                        { "text", drOrg[0]["ORGNAME"].ToString() },
                        { "state", "closed" },
                        { "treeType", "org" }
                    };
                    DataRow[] drFRUser  = dtFRUser.Select("BYORGNO = '" + curUserOrg + "'", "");//获取所有县且〈〉市的
                    JArray    jObjectsC = new JArray();
                    for (int i = 0; i < drFRUser.Length; i++)
                    {
                        StringBuilder sb    = new StringBuilder();
                        JObject       rootC = new JObject {
                            { "id", drFRUser[i]["EMID"].ToString() }, { "text", drFRUser[i]["EMNAME"].ToString() }, { "objId", drFRUser[i]["OBJID"].ToString() }, { "templateId", drFRUser[i]["TEMPLATEDID"].ToString() }, { "ip", drFRUser[i]["ip"].ToString() }, { "port", drFRUser[i]["PORT"].ToString() }, { "isVideo", true }
                        };
                        jObjectsC.Add(rootC);
                        if (string.IsNullOrEmpty(OrgNo) == false)//异步加载,不显示乡镇名
                        {
                            jObjects.Add(rootC);
                        }
                    }
                    if (string.IsNullOrEmpty(OrgNo))//乡镇级用户登录
                    {
                        jObjects.Add(root);
                        root.Add("children", jObjectsC);
                    }
                }
            }
            #endregion

            dtOrg.Clear();
            dtOrg.Dispose();
            return(JsonConvert.SerializeObject(jObjects));
        }