Esempio n. 1
0
 public FrmStatisticsConfig(IWorkspace pTmpWorkSpace)
 {
     _TmpWorkSpace = pTmpWorkSpace;
     if (pTmpWorkSpace != null)
     {
         SysCommon.ModSysSetting.CopyLayerTreeXmlFromDataBase(pTmpWorkSpace, _LayerTreePath);
         SysGisTable mSystable            = new SysCommon.Gis.SysGisTable(pTmpWorkSpace);
         Exception   err                  = null;
         Dictionary <string, object> pDic = mSystable.GetRow("SYSSETTING", "SETTINGNAME='统计配置'", out err);
         if (pDic != null)
         {
             if (pDic.ContainsKey("SETTINGVALUE2"))
             {
                 if (pDic["SETTINGVALUE2"] != null)  //这里仅能成功导出当初以文件类型导入的BLOB字段
                 {
                     object tempObj = pDic["SETTINGVALUE2"];
                     IMemoryBlobStreamVariant pMemoryBlobStreamVariant = tempObj as IMemoryBlobStreamVariant;
                     IMemoryBlobStream        pMemoryBlobStream        = pMemoryBlobStreamVariant as IMemoryBlobStream;
                     if (pMemoryBlobStream != null)
                     {
                         try
                         {
                             pMemoryBlobStream.SaveToFile(_QueryConfigPath);
                         }
                         catch { return; }
                     }
                 }
             }
         }
     }
     InitializeComponent();
 }
 private void CopyConfigXml(string Settingname, string SettingPath)
 {
     try
     {
         SysGisTable mSystable            = new SysCommon.Gis.SysGisTable(Plugin.ModuleCommon.TmpWorkSpace);
         Exception   err                  = null;
         Dictionary <string, object> pDic = mSystable.GetRow("SYSSETTING", "SETTINGNAME='" + Settingname + "'", out err);
         if (pDic != null)
         {
             if (pDic.ContainsKey("SETTINGVALUE2"))
             {
                 if (pDic["SETTINGVALUE2"] != null)  //这里仅能成功导出当初以文件类型导入的BLOB字段
                 {
                     object tempObj = pDic["SETTINGVALUE2"];
                     IMemoryBlobStreamVariant pMemoryBlobStreamVariant = tempObj as IMemoryBlobStreamVariant;
                     IMemoryBlobStream        pMemoryBlobStream        = pMemoryBlobStreamVariant as IMemoryBlobStream;
                     if (pMemoryBlobStream != null)
                     {
                         pMemoryBlobStream.SaveToFile(SettingPath);
                     }
                 }
             }
         }
     }
     catch (Exception err2)
     { }
 }
Esempio n. 3
0
        //当初当前系统参数的值,放在指定路径(限定该参数值是BLOB类型,并且存入时是选取文件存入的)
        private void buttonXExport_Click(object sender, EventArgs e)
        {
            if (!comboBoxDataType.Text.Contains("File"))
            {
                return;
            }
            SaveFileDialog pOpenFileDlg = new SaveFileDialog();

            pOpenFileDlg.Title = "选择文件";
            switch (comboBoxDataType.Text)
            {
            case "XmlFile":
                //弹出对话框供用户设置导出的xml文件

                pOpenFileDlg.Filter = "XML数据(*.xml)|*.xml";
                break;

            case "MxdFile":
                pOpenFileDlg.Filter = "mxd文件(*.mxd)|*.mxd";
                break;
            }
            if (pOpenFileDlg.ShowDialog() == DialogResult.OK)
            {   //获得系统参数表的BLOB字段值,并导出到指定文件中
                string      strPath              = pOpenFileDlg.FileName;
                SysGisTable mSystable            = new SysCommon.Gis.SysGisTable(_TmpWorkSpace);
                Exception   err                  = null;
                Dictionary <string, object> pDic = mSystable.GetRow("SYSSETTING", "SETTINGNAME='" + this.textBoxSettingName.Text + "'", out err);
                if (pDic != null)
                {
                    if (pDic.ContainsKey("SETTINGVALUE2"))
                    {
                        if (pDic["SETTINGVALUE2"] != null)  //这里仅能成功导出当初以文件类型导入的BLOB字段
                        {
                            object tempObj = pDic["SETTINGVALUE2"];
                            IMemoryBlobStreamVariant pMemoryBlobStreamVariant = tempObj as IMemoryBlobStreamVariant;
                            IMemoryBlobStream        pMemoryBlobStream        = pMemoryBlobStreamVariant as IMemoryBlobStream;
                            if (pMemoryBlobStream != null)
                            {
                                pMemoryBlobStream.SaveToFile(strPath);
                                MessageBox.Show("将文件" + strPath + "导出成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);//ygc 2012-12-17 新增提示信息
                            }
                        }
                    }
                }
                mSystable = null;
            }
        }