/// <summary>
        /// 按目录获得
        /// </summary>
        /// <param name="FilePath"></param>
        /// <returns></returns>
        private string GetlyrTypeByFolder(string FilePath)
        {
            InfoEarthFrame.Data.IDatabase DBAccess = InfoEarthFrame.Data.Factory.GetDBAccess(ConfigurationManager.ConnectionStrings["Default"].ConnectionString, InfoEarthFrame.Data.AccessDBType.Oracle);

            string defaultValue = ""; // "地质环境条件类/中国地质环境分区图/地质环境分区";

            string[] FolderCC = FilePath.Split('\\');

            foreach (string s in FolderCC)
            {
                string cf = ConvertFolderName(s);
                if (cf != "")
                {
                    //List<Core.ElementType> TypeList = _ElementTypeRepository.GetAll().Where(a => a.TJName.IndexOf(cf.ToString()) != -1).ToList();
                    //if (TypeList.Count > 0)
                    //{
                    //    return TypeList[0].TXName + "/" + TypeList[0].TJName + "/" + TypeList[0].LayerName;
                    //}
                    //else
                    //{
                    //    return defaultValue;
                    //}


                    DataTable objDT = DBAccess.GetDataSetFromExcuteCommand("select * from DIC_ElementType where \"TJName\" like '%" + cf + "%'").Tables[0];
                    if (objDT.Rows.Count > 0)
                    {
                        defaultValue = objDT.Rows[0]["TXName"] + "/" + objDT.Rows[0]["TJName"] + "/" + objDT.Rows[0]["LayerName"];
                    }
                }
            }

            return(defaultValue);
        }
        /// <summary>
        /// 按文件名获得
        /// </summary>
        /// <param name="FilePath"></param>
        /// <returns></returns>
        private string GetlyrTypeByFile(string FilePath)
        {
            InfoEarthFrame.Data.IDatabase DBAccess = InfoEarthFrame.Data.Factory.GetDBAccess(ConfigurationManager.ConnectionStrings["Default"].ConnectionString, InfoEarthFrame.Data.AccessDBType.Oracle);

            string defaultValue = ""; // "地质环境条件类/中国地质环境分区图/地质环境分区";

            FileInfo fi = new FileInfo(FilePath);

            if (fi.Name.Length >= 8)
            {
                string code = fi.Name.Substring(3, 6);
                try
                {
                    int a = int.Parse(code);
                    if (a >= 101011 && a <= 502051)
                    {
                        //List<Core.ElementType> TypeList = _ElementTypeRepository.GetAll().Where(s => s.TCDM.IndexOf(a.ToString()) != -1).ToList();
                        //if (TypeList.Count > 0)
                        //{
                        //    return TypeList[0].TXName + "/" + TypeList[0].TJName + "/" + TypeList[0].LayerName;
                        //}
                        //else
                        //{
                        //    return defaultValue;
                        //}
                        DataTable objDT = DBAccess.GetDataSetFromExcuteCommand("select * from DIC_ElementType where TCDM like '%" + a + "%'").Tables[0];
                        if (objDT.Rows.Count > 0)
                        {
                            return(objDT.Rows[0]["TXName"] + "/" + objDT.Rows[0]["TJName"] + "/" + objDT.Rows[0]["LayerName"] + "/" + objDT.Rows[0]["TCDM"]);
                        }
                        else
                        {
                            return(defaultValue);
                        }
                    }
                    else
                    {
                        return(defaultValue);
                    }
                }
                catch
                {
                    return(defaultValue);
                }
            }
            return(defaultValue);
        }
Example #3
0
        private void GetData()
        {
            InfoEarthFrame.Data.IDatabase DBAccess = InfoEarthFrame.Data.Factory.GetDBAccess(ConfigurationManager.ConnectionStrings["Default"].ConnectionString, InfoEarthFrame.Data.AccessDBType.Oracle);

            _txLyrList.Clear();
            _lyrAttList.Clear();
            _attValueList.Clear();

            //图系图层信息
            //string sqlStr = "select trim(GUID) as GUID,trim(TXNAME) AS TXNAME,trim(TJNAME) AS TJNAME ,trim(LAYERNAME) AS LAYERNAME,trim(JHTZ) AS JHTZ from DIC_TX_LAYER order by SERIALNUM";
            string  sqlStr  = "select  Max(\"Id\") as GUID,\"TXName\",\"TJName\" ,\"LayerName\", \"DataLayer\" from DIC_TX_LAYERPROPERTY  group by \"TXName\",\"TJName\" ,\"LayerName\", \"DataLayer\"";
            DataSet dataset = DBAccess.GetDataSetFromExcuteCommand(sqlStr, null);

            if (dataset != null && dataset.Tables.Count > 0)
            {
                DataTable tbl = dataset.Tables[0];
                for (int i = 0; i < tbl.Rows.Count; i++)
                {
                    TxLayerInfo info = new TxLayerInfo()
                    {
                        Guid      = tbl.Rows[i]["GUID"] as string,
                        TxName    = tbl.Rows[i]["TXNAME"] as string,
                        TjName    = tbl.Rows[i]["TJNAME"] as string,
                        LayerName = tbl.Rows[i]["LAYERNAME"] as string,
                        DataLayer = tbl.Rows[i]["DataLayer"] as string,
                        GeoType   = "",//tbl.Rows[i]["JHTZ"] as string,
                    };
                    _txLyrList.Add(info);
                }
            }
            //图层属性信息
            //sqlStr = "select trim(GUID) as GUID,trim(LAYERID) AS LAYERID,trim(DATANAME) AS DATANAME ,trim(DATACODE) AS DATACODE,trim(DES) AS DES,trim(DATATYPE) AS DATATYPE,trim(CONSTRAINT) AS CONSTRAINT,trim(VALUETYPE) AS VALUETYPE,trim(UNIT) AS UNIT,trim(MEMO) AS MEMO from DIC_TX_LAYERPROPERTY order by LAYERID";
            sqlStr  = "select  \"Id\" as GUID,\"TXName\",\"TJName\" ,\"LayerName\",trim(\"FieldName\") AS DATANAME, trim(\"InputControl\") AS INPUTCONTROL, trim(\"DataLayer\") as DATALAYER ,trim(\"FieldCode\") AS DATACODE ,\"FieldType\", \"FieldLen\",\"FieldDec\",trim(\"InputControl\") AS CONSTRAINT from DIC_TX_LAYERPROPERTY";
            dataset = DBAccess.GetDataSetFromExcuteCommand(sqlStr, null);
            if (dataset != null && dataset.Tables.Count > 0)
            {
                DataTable tbl = dataset.Tables[0];
                for (int i = 0; i < tbl.Rows.Count; i++)
                {
                    LayerAttInfo info = new LayerAttInfo()
                    {
                        Guid         = tbl.Rows[i]["GUID"] as string,
                        TxName       = tbl.Rows[i]["TXName"] as string,
                        TjName       = tbl.Rows[i]["TJName"] as string,
                        LayerName    = tbl.Rows[i]["LayerName"] as string,
                        DataName     = tbl.Rows[i]["DATANAME"] as string,
                        DataCode     = tbl.Rows[i]["DATACODE"] as string,
                        Des          = "",                           //tbl.Rows[i]["DES"] as string,
                        DataLayer    = tbl.Rows[i]["DATALAYER"] as string,
                        DataType     = ConvertDataType(tbl.Rows[i]), //tbl.Rows[i]["DATATYPE"] as string,
                        Constraint   = tbl.Rows[i]["CONSTRAINT"] as string,
                        ValueType    = "自由文本",                       //tbl.Rows[i]["VALUETYPE"] as string,
                        Unit         = "/",                          //tbl.Rows[i]["U_NAME"] as string,
                        Memo         = "/",                          //tbl.Rows[i]["MEMO"] as string,
                        InputControl = tbl.Rows[i]["INPUTCONTROL"] as string,
                    };
                    _lyrAttList.Add(info);
                }
            }
            //字典项字段信息
            //sqlStr = "select trim(GUID) as GUID,trim(PROPERTYID) AS PROPERTYID,trim(VALUE) AS VALUE ,trim(MEMO) AS MEMO,trim(PARENTPROPERTYID) AS PARENTPROPERTYID from DIC_TX_PROPERTYVALUE";
            sqlStr  = "select trim(\"Id\") as GUID, trim(\"FieldValue\") AS VALUE from DIC_TX_PROPERTYVALUE";
            dataset = DBAccess.GetDataSetFromExcuteCommand(sqlStr, null);
            if (dataset != null && dataset.Tables.Count > 0)
            {
                DataTable tbl = dataset.Tables[0];
                for (int i = 0; i < tbl.Rows.Count; i++)
                {
                    AttValueInfo info = new AttValueInfo()
                    {
                        Guid     = tbl.Rows[i]["GUID"] as string,
                        AttId    = "", //tbl.Rows[i]["PROPERTYID"] as string,
                        Value    = tbl.Rows[i]["VALUE"] as string,
                        Memo     = "", //tbl.Rows[i]["MEMO"] as string,
                        ParentId = "", //tbl.Rows[i]["PARENTPROPERTYID"] as string
                    };
                    _attValueList.Add(info);
                }
            }
        }