Exemplo n.º 1
0
        /// <summary>
        /// 获取单条记录
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>参见模型</returns>
        public static T_SYS_LAYER_Model getModel(T_SYS_LAYER_SW sw)
        {
            DataTable         dt = BaseDT.T_SYS_LAYER.getDT2(sw);
            T_SYS_LAYER_Model m  = new T_SYS_LAYER_Model();

            if (dt.Rows.Count > 0)
            {
                int i = 0;
                //数据库表字段
                m.LAYERCODE          = dt.Rows[i]["LAYERCODE"].ToString();
                m.LAYERNAME          = dt.Rows[i]["LAYERNAME"].ToString();
                m.LAYERID            = dt.Rows[i]["LAYERID"].ToString();
                m.ISACTION           = dt.Rows[i]["ISACTION"].ToString();
                m.LAYERRIGHTID       = dt.Rows[i]["LAYERRIGHTID"].ToString();
                m.ISDEFAULTCH        = dt.Rows[i]["ISDEFAULTCH"].ToString();
                m.ISFIREROUNDDEFAULT = dt.Rows[i]["ISFIREROUNDDEFAULT"].ToString();
                m.ISFUROUNDDEFAULT   = dt.Rows[i]["ISFUROUNDDEFAULT"].ToString();
                m.LAYERPICNAME       = dt.Rows[i]["LAYERPICNAME"].ToString();
                m.ORDERBY            = dt.Rows[i]["ORDERBY"].ToString();
                //扩充字段
            }
            dt.Clear();
            dt.Dispose();
            return(m);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取树形三维图层控制菜单(所有节点默认为false)
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static string getTckzTreeChecked(T_SYS_LAYER_SW sw)
        {
            JArray    jObjects = new JArray();
            DataTable dtLayer  = BaseDT.T_SYS_LAYER.getDT(sw);

            DataRow[] drLayer = dtLayer.Select("", "LAYERCODE");
            if (drLayer.Length > 0)
            {
                if (drLayer[0]["LAYERCODE"].ToString().Length == 2)
                {
                    JObject root = new JObject {
                        { "id", drLayer[0]["LAYERCODE"].ToString() }, { "text", drLayer[0]["LAYERNAME"].ToString() }
                    };
                    root.Add("children", getTckzTreeChildChecked(dtLayer, drLayer[0]["LAYERCODE"].ToString()));
                    jObjects.Add(root);
                }
                else
                {
                    JObject root = new JObject {
                        { "id", drLayer[0]["LAYERCODE"].ToString() }, { "text", drLayer[0]["LAYERNAME"].ToString() }
                    };
                    jObjects.Add(root);
                }
            }
            dtLayer.Clear();
            dtLayer.Dispose();
            return(JsonConvert.SerializeObject(jObjects));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 判断记录是否存在
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>true存在 false不存在</returns>
        public static bool isExists(T_SYS_LAYER_SW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("select 1 from T_SYS_LAYER where 1=1");
            if (string.IsNullOrEmpty(sw.LAYERCODE) == false)
            {
                sb.AppendFormat(" and LAYERCODE= '{0}'", ClsSql.EncodeSql(sw.LAYERCODE));
            }
            if (string.IsNullOrEmpty(sw.LAYERID) == false)
            {
                sb.AppendFormat(" and LAYERID= '{0}'", ClsSql.EncodeSql(sw.LAYERID));
            }
            return(DataBaseClass.JudgeRecordExists(sb.ToString()));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取权限图层数据列表
        /// </summary>
        /// <returns>参见模型</returns>
        public static DataTable getDT(T_SYS_LAYER_SW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("SELECT   LAYERCODE, LAYERNAME, LAYERID, ISACTION, LAYERRIGHTID, ISDEFAULTCH,ISFIREROUNDDEFAULT,ISFUROUNDDEFAULT, ORDERBY FROM T_SYS_LAYER");
            sb.AppendFormat(" Where 1=1 ");
            sb.AppendFormat(" and ISACTION=0");
            sb.AppendFormat(" or(");
            sb.AppendFormat(" LAYERRIGHTID in( ");
            sb.AppendFormat(" select rightid from T_SYSSEC_ROLE_RIGHT where roleid in(select roleid from T_SYSSEC_USER_ROLE where USERID='{0}') ", ClsSql.EncodeSql(sw.USERID));
            sb.AppendFormat(" ))");
            DataSet ds = DataBaseClass.FullDataSet(sb.ToString());

            return(ds.Tables[0]);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 获取三维图层控制LAYERCODE
        /// </summary>
        public static string getLayerLAYERCODEStr(T_SYS_LAYER_SW sw)
        {
            DataTable dt        = BaseDT.T_SYS_LAYER.getDT(sw);
            string    LAYERCODE = "";

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (i != dt.Rows.Count - 1)
                {
                    LAYERCODE += dt.Rows[i]["LAYERCODE"].ToString() + ",";
                }
                else
                {
                    LAYERCODE += dt.Rows[i]["LAYERCODE"].ToString();
                }
            }
            return(LAYERCODE);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 获取三维图层控制ISDEFAULTCH
        /// </summary>
        public static string getLayerDEFAULTCHStr(T_SYS_LAYER_SW sw)
        {
            DataTable dt          = BaseDT.T_SYS_LAYER.getDT(sw);
            string    ISDEFAULTCH = "";

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (i != dt.Rows.Count - 1)
                {
                    ISDEFAULTCH += dt.Rows[i]["ISDEFAULTCH"].ToString() + ",";
                }
                else
                {
                    ISDEFAULTCH += dt.Rows[i]["ISDEFAULTCH"].ToString();
                }
            }
            return(ISDEFAULTCH);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 获取图层数据列表
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns></returns>
        public static DataTable getDT2(T_SYS_LAYER_SW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("SELECT  LAYERCODE, LAYERNAME, LAYERID, ISACTION, LAYERRIGHTID, ISDEFAULTCH,ISFIREROUNDDEFAULT,ISFUROUNDDEFAULT,LAYERPICNAME, ORDERBY FROM T_SYS_LAYER WHERE 1=1");
            if (!string.IsNullOrEmpty(sw.LAYERCODE))
            {
                sb.AppendFormat(" AND LAYERCODE = '{0}'", ClsSql.EncodeSql(sw.LAYERCODE));
            }
            if (!string.IsNullOrEmpty(sw.LAYERNAME))
            {
                sb.AppendFormat(" AND LAYERNAME like '%{0}%'", ClsSql.EncodeSql(sw.LAYERNAME));
            }
            string  sql = sb.ToString() + " ORDER BY LAYERCODE ";
            DataSet ds  = DataBaseClass.FullDataSet(sql);

            return(ds.Tables[0]);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 获取三维图层LAYERID用于护林员周边查询
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static string getLayerHuLinYuanLAYERID(T_SYS_LAYER_SW sw)
        {
            DataTable dt      = BaseDT.T_SYS_LAYER.getDT(sw);
            string    LAYERID = "";

            DataRow[] drOrg = dt.Select("ISFUROUNDDEFAULT = '1'");
            for (int i = 0; i < drOrg.Length; i++)
            {
                if (i != drOrg.Length - 1)
                {
                    LAYERID += drOrg[i]["LAYERID"].ToString() + ",";
                }
                else
                {
                    LAYERID += drOrg[i]["LAYERID"].ToString();
                }
            }
            return(LAYERID);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 获取树形图层用于火点周边查询
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static string getTreeFireQuery(T_SYS_LAYER_SW sw)
        {
            JArray    jObjects = new JArray();
            DataTable dtLayer  = BaseDT.T_SYS_LAYER.getDT(sw);

            if (dtLayer != null && dtLayer.Rows.Count > 0)
            {
                DataRow[] drOrg = dtLayer.Select("Len(LAYERCODE) = '2'");
                if (drOrg.Length > 0)
                {
                    JObject root = new JObject {
                        { "id", drOrg[0]["LAYERID"].ToString() }, { "text", drOrg[0]["LAYERNAME"].ToString() }
                    };
                    JArray    childArray = new JArray();
                    DataRow[] drOrg1     = dtLayer.Select("Len(LAYERCODE) = '4' AND SUBSTRING(LAYERCODE,1,3)='010'");//点,线,面
                    for (int i = 0; i < drOrg1.Length; i++)
                    {
                        JObject root1 = new JObject {
                            { "id", drOrg1[i]["LAYERID"].ToString() }, { "text", drOrg1[i]["LAYERNAME"].ToString() }
                        };
                        JArray    childArray1 = new JArray();
                        DataRow[] drOrg2      = dtLayer.Select("(ISFIREROUNDDEFAULT='1' AND SUBSTRING(LAYERCODE,1,5)='" + drOrg1[i]["LAYERCODE"].ToString() + "0" + "') OR (ISFIREROUNDDEFAULT='1' AND SUBSTRING(LAYERCODE,1,5)='" + drOrg1[i]["LAYERCODE"].ToString() + "1" + "')");
                        for (int j = 0; j < drOrg2.Length; j++)
                        {
                            JObject root2 = new JObject {
                                { "id", drOrg2[j]["LAYERID"].ToString() }, { "text", drOrg2[j]["LAYERNAME"].ToString() }
                            };
                            childArray1.Add(root2);
                        }
                        root1.Add("children", childArray1);
                        childArray.Add(root1);
                    }
                    root.Add("children", childArray);
                    jObjects.Add(root);
                }
            }
            dtLayer.Clear();
            dtLayer.Dispose();
            return(JsonConvert.SerializeObject(jObjects));
        }
Exemplo n.º 10
0
        /// <summary>
        /// 获取数据列表
        /// </summary>
        /// <param name="sw">参见模型PEST_REPORT_HAPPEN_SW</param>
        /// <returns>参见模型PEST_REPORT_HAPPEN_Model</returns>
        public static IEnumerable <T_SYS_LAYER_Model> getListModel(T_SYS_LAYER_SW sw)
        {
            var       result = new List <T_SYS_LAYER_Model>();
            DataTable dt     = BaseDT.T_SYS_LAYER.getDT2(sw);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                T_SYS_LAYER_Model m = new T_SYS_LAYER_Model();
                m.LAYERCODE          = dt.Rows[i]["LAYERCODE"].ToString();
                m.LAYERNAME          = dt.Rows[i]["LAYERNAME"].ToString();
                m.LAYERID            = dt.Rows[i]["LAYERID"].ToString();
                m.ISACTION           = dt.Rows[i]["ISACTION"].ToString();
                m.LAYERRIGHTID       = dt.Rows[i]["LAYERRIGHTID"].ToString();
                m.ISDEFAULTCH        = dt.Rows[i]["ISDEFAULTCH"].ToString();
                m.ISFIREROUNDDEFAULT = dt.Rows[i]["ISFIREROUNDDEFAULT"].ToString();
                m.ISFUROUNDDEFAULT   = dt.Rows[i]["ISFUROUNDDEFAULT"].ToString();
                m.LAYERPICNAME       = dt.Rows[i]["LAYERPICNAME"].ToString();
                m.ORDERBY            = dt.Rows[i]["ORDERBY"].ToString();
                result.Add(m);
            }
            dt.Clear();
            dt.Dispose();
            return(result);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 获取树形三维图层控制菜单
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static string getTree(T_SYS_LAYER_SW sw)
        {
            JArray    jObjects = new JArray();
            DataTable dtLayer  = BaseDT.T_SYS_LAYER.getDT(sw);

            if (dtLayer != null && dtLayer.Rows.Count > 0)
            {
                DataRow[] drOrg = dtLayer.Select("Len(LAYERCODE) = '2'");
                if (drOrg.Length > 0)
                {
                    JObject root = new JObject {
                        { "id", drOrg[0]["LAYERCODE"].ToString() }, { "text", drOrg[0]["LAYERNAME"].ToString() }
                    };
                    JArray    childArray = new JArray();
                    DataRow[] drOrg1     = dtLayer.Select("Len(LAYERCODE) = '4' AND SUBSTRING(LAYERCODE,1,3)='010'");//点,线,面
                    for (int i = 0; i < drOrg1.Length; i++)
                    {
                        JObject root1 = new JObject {
                            { "id", drOrg1[i]["LAYERCODE"].ToString() }, { "text", drOrg1[i]["LAYERNAME"].ToString() }
                        };
                        JArray    childArray1 = new JArray();
                        DataRow[] drOrg2      = dtLayer.Select("(Len(LAYERCODE) = '6' AND SUBSTRING(LAYERCODE,1,5)='" + drOrg1[i]["LAYERCODE"].ToString() + "0" + "') OR (Len(LAYERCODE) = '6' AND SUBSTRING(LAYERCODE,1,5)='" + drOrg1[i]["LAYERCODE"].ToString() + "1" + "')");
                        for (int j = 0; j < drOrg2.Length; j++)
                        {
                            JObject root2 = new JObject {
                                { "id", drOrg2[j]["LAYERCODE"].ToString() }, { "text", drOrg2[j]["LAYERNAME"].ToString() }, { "state", "closed" }
                            };
                            JArray    childArray2 = new JArray();
                            DataRow[] drOrg3      = dtLayer.Select("Len(LAYERCODE) = '8' AND SUBSTRING(LAYERCODE,1,7)='" + drOrg2[j]["LAYERCODE"].ToString() + "0" + "'");
                            for (int k = 0; k < drOrg3.Length; k++)
                            {
                                JObject root3 = new JObject {
                                    { "id", drOrg3[k]["LAYERCODE"].ToString() }, { "text", drOrg3[k]["LAYERNAME"].ToString() }
                                };
                                if (drOrg3[k]["ISDEFAULTCH"].ToString() == "1")
                                {
                                    root3 = new JObject {
                                        { "id", drOrg3[k]["LAYERCODE"].ToString() }, { "text", drOrg3[k]["LAYERNAME"].ToString() }, { "checked", true }
                                    };
                                }
                                JArray    childArray3 = new JArray();
                                DataRow[] drOrg4      = dtLayer.Select("Len(LAYERCODE) = '10' AND SUBSTRING(LAYERCODE,1,9)='" + drOrg3[k]["LAYERCODE"].ToString() + "0" + "'");
                                for (int m = 0; m < drOrg4.Length; m++)
                                {
                                    JObject root4 = new JObject {
                                        { "id", drOrg4[m]["LAYERCODE"].ToString() }, { "text", drOrg4[m]["LAYERNAME"].ToString() }
                                    };
                                    if (drOrg4[m]["ISDEFAULTCH"].ToString() == "1")
                                    {
                                        root4 = new JObject {
                                            { "id", drOrg4[m]["LAYERCODE"].ToString() }, { "text", drOrg4[m]["LAYERNAME"].ToString() }, { "checked", true }
                                        };
                                    }
                                    childArray3.Add(root4);
                                }
                                root3.Add("children", childArray3);
                                childArray2.Add(root3);
                            }
                            if (drOrg3.Count() > 0)
                            {
                                root2.Add("children", childArray2);
                            }
                            else
                            {
                                root2 = new JObject {
                                    { "id", drOrg2[j]["LAYERCODE"].ToString() }, { "text", drOrg2[j]["LAYERNAME"].ToString() }
                                }
                            };
                            if (drOrg2[j]["ISDEFAULTCH"].ToString() == "1")
                            {
                                root2 = new JObject {
                                    { "id", drOrg2[j]["LAYERCODE"].ToString() }, { "text", drOrg2[j]["LAYERNAME"].ToString() }, { "checked", true }
                                };
                            }

                            childArray1.Add(root2);
                        }
                        root1.Add("children", childArray1);
                        childArray.Add(root1);
                    }
                    root.Add("children", childArray);
                    jObjects.Add(root);
                }
            }
            dtLayer.Clear();
            dtLayer.Dispose();
            return(JsonConvert.SerializeObject(jObjects));
        }