Beispiel #1
0
        private void button_findOverwriteDbName_Click(object sender, System.EventArgs e)
        {
            OpenResDlg dlg  = new OpenResDlg();
            Font       font = GuiUtil.GetDefaultFont();

            if (font != null)
            {
                dlg.Font = font;
            }

            dlg.Text           = "请选择要覆盖的目标数据库";
            dlg.EnabledIndices = new int[] { ResTree.RESTYPE_DB };
            //dlg.ap = this.applicationInfo;
            //dlg.ApCfgTitle = "pageimport_openresdlg";
            dlg.MultiSelect = false;
            dlg.Path        = textBox_overwriteDbName.Text;
            dlg.Initial(this.Servers,
                        this.Channels);
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            textBox_overwriteDbName.Text = dlg.Path;
        }
Beispiel #2
0
        private void button_findTarget_Click(object sender, System.EventArgs e)
        {
            OpenResDlg dlg = new OpenResDlg();

            dlg.Font = GuiUtil.GetDefaultFont();

            dlg.Text           = "请选择目标数据库";
            dlg.EnabledIndices = new int[] { ResTree.RESTYPE_DB };
            dlg.ap             = this.AppInfo;
            dlg.ApCfgTitle     = "dbnamemapitemdlg_origin";
            dlg.MultiSelect    = false;

            // 如果目标textbox有内容,优先用它决定缺省选定的数据库节点。否则用源textbox的内容
            if (string.IsNullOrEmpty(this.textBox_target.Text) == false)
            {
                dlg.Path = this.textBox_target.Text;
            }
            else if (string.IsNullOrEmpty(this.textBox_origin.Text) == false)
            {
                dlg.Path = this.textBox_origin.Text;
            }

            dlg.Initial(this.Servers,
                        this.Channels);
            // dlg.StartPositon = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);   // 对于数据库节点,不要主动展开其下一级

            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            textBox_target.Text = dlg.Path;
        }
Beispiel #3
0
        private void button_findOrigin_Click(object sender, System.EventArgs e)
        {
            OpenResDlg dlg = new OpenResDlg();

            dlg.Font = GuiUtil.GetDefaultFont();

            dlg.Text           = "请选择源数据库";
            dlg.EnabledIndices = new int[] { ResTree.RESTYPE_DB };
            dlg.ap             = this.AppInfo;
            dlg.ApCfgTitle     = "dbnamemapitemdlg_origin";
            dlg.MultiSelect    = false;
            dlg.Path           = this.textBox_origin.Text;
            dlg.Initial(this.Servers,
                        this.Channels);
            // dlg.StartPositon = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            textBox_origin.Text = dlg.Path;
        }
Beispiel #4
0
        private void button_findOverwriteDbName_Click(object sender, System.EventArgs e)
        {
            OpenResDlg dlg = new OpenResDlg();

            dlg.Text = "请选择要覆盖的目标数据库";
            dlg.EnabledIndices = new int[] { ResTree.RESTYPE_DB };
            //dlg.ap = this.applicationInfo;
            //dlg.ApCfgTitle = "pageimport_openresdlg";
            dlg.MultiSelect = false;
            dlg.Path = textBox_overwriteDbName.Text;
            dlg.Initial(this.Servers,
                this.Channels);
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
                return;

            textBox_overwriteDbName.Text = dlg.Path;
        }
Beispiel #5
0
        private void button_findServerUrl_Click(object sender, System.EventArgs e)
        {
            OpenResDlg dlg = new OpenResDlg();

            dlg.Text = "请选择主服务器";
            dlg.EnabledIndices = new int[] { ResTree.RESTYPE_SERVER };
            dlg.ap = this.SearchPanel.ap;
            dlg.ApCfgTitle = "findServerUrl_openresdlg";
            dlg.MultiSelect = false;
            dlg.Path = this.textBox_serverUrl.Text;
            dlg.Initial(this.SearchPanel.Servers,
                this.SearchPanel.Channels);
            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
                return;

            textBox_serverUrl.Text = dlg.Path;
        }
Beispiel #6
0
        private void button_findServer_Click(object sender, EventArgs e)
        {
            // 选择目标服务器
            OpenResDlg dlg = new OpenResDlg();

            dlg.Text = "请选择服务器";
            dlg.EnabledIndices = new int[] { ResTree.RESTYPE_SERVER };
            dlg.ap = this.SearchPanel.ap;
            dlg.ApCfgTitle = "getlinkdbdlg_findserver";
            dlg.Path = this.textBox_serverUrl.Text;
            dlg.Initial(this.SearchPanel.Servers,
                this.SearchPanel.Channels);
            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
                return;

            this.ServerUrl = dlg.Path;

            //

            string strError = "";
            int nRet = this.GetGlobalCfgFile(out strError);
            if (nRet == -1)
            {
                MessageBox.Show(this, strError);
                return;
            }

            FillList();

        }
Beispiel #7
0
		public void LoadTemplate()
		{
			if (this.Changed == true)
			{

				DialogResult result = MessageBox.Show(this, 
					"装载模板前,发现当前窗口中已有内容修改后未来得及保存。是否要继续装载模板到窗口中(这样将丢失先前修改的内容)?\r\n\r\n(是)继续装载模板 (否)不装载模板",
					"dp2rms",
					MessageBoxButtons.YesNo,
					MessageBoxIcon.Question,
					MessageBoxDefaultButton.Button2);
				if (result != DialogResult.Yes) 
				{
					MessageBox.Show(this, "装载模板操作被放弃...");
					return;
				}
			}

			OpenResDlg dlg = new OpenResDlg();
            dlg.Font = GuiUtil.GetDefaultFont();

			dlg.Text = "请选择目标数据库";
			dlg.EnabledIndices = new int[] { ResTree.RESTYPE_DB };
			dlg.ap = this.MainForm.AppInfo;
			dlg.ApCfgTitle = "detailform_openresdlg";
			dlg.Path = textBox_recPath.Text;
			dlg.Initial( MainForm.Servers,
				this.Channels);	
			// dlg.StartPosition = FormStartPosition.CenterScreen;
			dlg.ShowDialog(this);

			if (dlg.DialogResult != DialogResult.OK)
				return;

			textBox_recPath.Text = dlg.Path + "/?";	// 为了追加保存

			// 下载配置文件
			ResPath respath = new ResPath(dlg.Path);


			// 使用Channel

			RmsChannel channelSave = channel;

			channel = Channels.GetChannel(respath.Url);
			Debug.Assert(channel != null, "Channels.GetChannel 异常");

			try 
			{

				string strContent;
				string strError;

				string strCfgFilePath = respath.Path + "/cfgs/template";

                stop.OnStop += new StopEventHandler(this.DoStop);
				stop.Initial("正在下载文件" + strCfgFilePath);
				stop.BeginLoop();

				byte[] baTimeStamp = null;
				string strMetaData;
				string strOutputPath;

				long lRet = channel.GetRes(
					MainForm.cfgCache,
					strCfgFilePath,
					// this.eventClose,
					out strContent,
					out strMetaData,
					out baTimeStamp,
					out strOutputPath,
					out strError);

				stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
				stop.Initial("");


				if (lRet == -1) 
				{
					this.TimeStamp = null;
					MessageBox.Show(this, strError);
					return;
				}
				else 
				{
					// MessageBox.Show(this, strContent);
					SelectRecordTemplateDlg tempdlg = new SelectRecordTemplateDlg();
                    tempdlg.Font = GuiUtil.GetDefaultFont();

                    int nRet = tempdlg.Initial(strContent, out strError);
					if (nRet == -1) 
					{
						MessageBox.Show(this, "装载配置文件 '" + strCfgFilePath + "' 发生错误: " + strError);
						return;
					}

					tempdlg.ap = this.MainForm.AppInfo;
					tempdlg.ApCfgTitle = "detailform_selecttemplatedlg";
					tempdlg.ShowDialog(this);

					if (tempdlg.DialogResult != DialogResult.OK)
						return;


					this.TimeStamp = null;
					this.m_strMetaData = "";	// 记忆XML记录的元数据

                    this.strDatabaseOriginPath = ""; // 保存从数据库中来的原始path

					nRet = this.SetRecordToControls(tempdlg.SelectedRecordXml,
						out strError);
					if (nRet == -1)
					{
						MessageBox.Show(this, strError);
						return;
					}


					this.TimeStamp = baTimeStamp;

					this.Text = respath.ReverseFullPath;

				}

			}
			finally 
			{
				channel = channelSave;
			}

		}
Beispiel #8
0
		// 保存记录到模板配置文件
		// parameters:
		public void SaveToTemplate()
		{
			// 选择目标数据库
			OpenResDlg dlg = new OpenResDlg();
            dlg.Font = GuiUtil.GetDefaultFont();

			dlg.Text = "请选择目标数据库";
			dlg.EnabledIndices = new int[] { ResTree.RESTYPE_DB };
			dlg.ap = this.MainForm.AppInfo;
			dlg.ApCfgTitle = "detailform_openresdlg";
			dlg.Path = textBox_recPath.Text;
			dlg.Initial( MainForm.Servers,
				this.Channels);	
			// dlg.StartPosition = FormStartPosition.CenterScreen;
			dlg.ShowDialog(this);

			if (dlg.DialogResult != DialogResult.OK)
				return;


			// 下载模板配置文件
			ResPath respath = new ResPath(dlg.Path);

			string strError;
			string strContent;
			byte[] baTimeStamp = null;
			string strMetaData;
			string strOutputPath;

			string strCfgFilePath = respath.Path + "/cfgs/template";

			long lRet = 0;

			// 使用Channel
			RmsChannel channelSave = channel;

			channel = Channels.GetChannel(respath.Url);
			Debug.Assert(channel != null, "Channels.GetChannel 异常");

			try 
			{

                stop.OnStop += new StopEventHandler(this.DoStop);
				stop.Initial("正在下载文件" + strCfgFilePath);
				stop.BeginLoop();



				lRet = channel.GetRes(
					MainForm.cfgCache,
					strCfgFilePath,
					out strContent,
					out strMetaData,
					out baTimeStamp,
					out strOutputPath,
					out strError);

				stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
				stop.Initial("");

				if (lRet == -1) 
				{
					this.TimeStamp = null;
					MessageBox.Show(this, strError);
					return;
				}

			}
			finally 
			{
				channel = channelSave;
			}

			SelectRecordTemplateDlg tempdlg = new SelectRecordTemplateDlg();
            tempdlg.Font = GuiUtil.GetDefaultFont();

            int nRet = tempdlg.Initial(strContent, out strError);
			if (nRet == -1) 
				goto ERROR1;


			tempdlg.Text = "请选择要修改的模板记录";
			tempdlg.CheckNameExist = false;	// 按OK按钮时不警告"名字不存在",这样允许新建一个模板
			tempdlg.ap = this.MainForm.AppInfo;
			tempdlg.ApCfgTitle = "detailform_selecttemplatedlg";
			tempdlg.ShowDialog(this);

			if (tempdlg.DialogResult != DialogResult.OK)
				return;

			string strXmlBody = "";
            bool bHasUploadedFile = false;


			nRet = GetXmlRecord(out strXmlBody,
                out bHasUploadedFile,
                out strError);
			if (nRet == -1)
				goto ERROR1;



			// 修改配置文件内容
			if (tempdlg.textBox_name.Text != "")
			{
				// 替换或者追加一个记录
				nRet = tempdlg.ReplaceRecord(tempdlg.textBox_name.Text,
					strXmlBody,
					out strError);
				if (nRet == -1) 
				{
					goto ERROR1;
				}
			}

			if (tempdlg.Changed == false)	// 没有必要保存回去
				return;

			string strOutputXml = tempdlg.OutputXml;


			// 使用Channel
			channelSave = channel;

			// 重新获得一次channel, 是因为前面GetXmlRecord()函数有可能摧毁这个变量
			channel = Channels.GetChannel(respath.Url);
			Debug.Assert(channel != null, "Channels.GetChannel 异常");

			try 
			{


				// 存回配置文件
                stop.OnStop += new StopEventHandler(this.DoStop);
				stop.Initial("正在保存配置文件 " + strCfgFilePath);
				stop.BeginLoop();

				byte [] baOutputTimeStamp = null;
				// string strOutputPath = "";

				EnableControlsInLoading(true);

				lRet = channel.DoSaveTextRes(strCfgFilePath,
					strOutputXml,
					true,	// bInlucdePreamble
					"",	// style
					baTimeStamp,
					out baOutputTimeStamp,
					out strOutputPath,
					out strError);

				EnableControlsInLoading(false);

				stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
				stop.Initial("");


				if (lRet == -1) 
				{
					strError = "保存配置文件"+ strCfgFilePath +"失败,原因: "+strError;
					goto ERROR1;
				}
			}
			finally 
			{
				channel = channelSave;
			}

			MessageBox.Show(this, "修改模板配置文件成功。");

			return;

			ERROR1:
				MessageBox.Show(this, strError);

		}
Beispiel #9
0
		// 保存记录到另一数据库
		// parameters:
		public void SaveAsRecord()
		{
			OpenResDlg dlg = new OpenResDlg();
            dlg.Font = GuiUtil.GetDefaultFont();

			dlg.Text = "请选择目标数据库";
			dlg.EnabledIndices = new int[] { ResTree.RESTYPE_DB };
			dlg.ap = this.MainForm.AppInfo;
			dlg.ApCfgTitle = "detailform_openresdlg";
			dlg.Path = textBox_recPath.Text;
			dlg.Initial( MainForm.Servers,
				this.Channels);	
			// dlg.StartPosition = FormStartPosition.CenterScreen;
			dlg.ShowDialog(this);

			if (dlg.DialogResult != DialogResult.OK)
				return;

			SaveRecord(dlg.Path + "/?");
		}
Beispiel #10
0
        private void button_findServerUrl_Click(object sender, EventArgs e)
        {
            OpenResDlg dlg = new OpenResDlg();

            dlg.Text = "请选择服务器";
            dlg.EnabledIndices = new int[] { ResTree.RESTYPE_SERVER };
            dlg.Path = textBox_serverUrl.Text;
            dlg.Initial(this.SearchPanel.Servers,
                this.SearchPanel.Channels);
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
                return;

            this.textBox_serverUrl.Text = dlg.Path;
        }
Beispiel #11
0
		private void button_complex_server4_Click(object sender, System.EventArgs e)
		{
			string strOldUrl = (string)this.m_aComplexServer[3];

			// 选择目标服务器
			OpenResDlg dlg = new OpenResDlg();
            dlg.Font = GuiUtil.GetDefaultFont();

			dlg.Text = "请选择目标服务器";
			dlg.EnabledIndices = new int[] { ResTree.RESTYPE_SERVER };
			dlg.ap = this.MainForm.AppInfo;
			dlg.ApCfgTitle = "detailform_openresdlg";
			dlg.Path = strOldUrl;
			dlg.Initial( MainForm.Servers,
				this.Channels);	
			dlg.ShowDialog(this);

			if (dlg.DialogResult != DialogResult.OK)
				return;

			if (strOldUrl != dlg.Path)
			{
				this.m_aComplexServer[3] = dlg.Path;

				AfterServerChanged(3);
			}
		
		}
Beispiel #12
0
        private void button_findServerUrl_Click(object sender, EventArgs e)
        {
            OpenResDlg dlg = new OpenResDlg();

            dlg.Text = "请选择主服务器";
            dlg.EnabledIndices = new int[] { ResTree.RESTYPE_SERVER };
            dlg.ap = this.SearchPanel.ap;
            dlg.ApCfgTitle = "findServerUrl_openresdlg";
            dlg.MultiSelect = false;
            dlg.Path = this.textBox_serverUrl.Text;
            dlg.Initial(this.SearchPanel.Servers,
                this.SearchPanel.Channels);
            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
                return;

            textBox_serverUrl.Text = dlg.Path;

            // 填充list内容
            if (this.ServerUrl != "")
            {
                int nRet = 0;
                string strError = "";

                Cursor oldCursor = this.Cursor;
                this.Cursor = Cursors.WaitCursor;

                try
                {
                    nRet = GetDupCfgFile(out strError);
                }
                finally
                {
                    this.Cursor = oldCursor;
                }

                if (nRet == -1)
                {
                    MessageBox.Show(this, strError);
                    return;
                }

                FillList();

                this.textBox_projectName.Text = "";
            }
        }
Beispiel #13
0
        private void button_findPinyinDbPath_Click(object sender, EventArgs e)
        {
            // 选择目标数据库
            OpenResDlg dlg = new OpenResDlg();
            dlg.Font = GuiUtil.GetDefaultFont();

            dlg.Text = "请选择拼音库";
            dlg.EnabledIndices = new int[] { ResTree.RESTYPE_DB };
            dlg.ap = this.MainForm.AppInfo;
            dlg.ApCfgTitle = "preferencedlg_findpinyinpathdlg";
            dlg.Path = this.textBox_pinyin_pinyinDbPath.Text;
            dlg.Initial(MainForm.Servers,
                MainForm.SearchPanel.Channels);
            // dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
                return;

            this.textBox_pinyin_pinyinDbPath.Text = dlg.Path;
        }
Beispiel #14
0
        private void button_findTarget_Click(object sender, System.EventArgs e)
        {
            OpenResDlg dlg = new OpenResDlg();
            dlg.Font = GuiUtil.GetDefaultFont();

            dlg.Text = "请选择目标数据库";
            dlg.EnabledIndices = new int[] { ResTree.RESTYPE_DB };
            dlg.ap = this.AppInfo;
            dlg.ApCfgTitle = "dbnamemapitemdlg_origin";
            dlg.MultiSelect = false;

            // 如果目标textbox有内容,优先用它决定缺省选定的数据库节点。否则用源textbox的内容
            if (string.IsNullOrEmpty(this.textBox_target.Text) == false)
                dlg.Path = this.textBox_target.Text;
            else if (string.IsNullOrEmpty(this.textBox_origin.Text) == false)
                dlg.Path = this.textBox_origin.Text;

            dlg.Initial(this.Servers,
                this.Channels);
            // dlg.StartPositon = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);   // 对于数据库节点,不要主动展开其下一级

            if (dlg.DialogResult != DialogResult.OK)
                return;

            textBox_target.Text = dlg.Path;
        }
Beispiel #15
0
        private void button_findOrigin_Click(object sender, System.EventArgs e)
        {
            OpenResDlg dlg = new OpenResDlg();
            dlg.Font = GuiUtil.GetDefaultFont();

            dlg.Text = "请选择源数据库";
            dlg.EnabledIndices = new int[] { ResTree.RESTYPE_DB };
            dlg.ap = this.AppInfo;
            dlg.ApCfgTitle = "dbnamemapitemdlg_origin";
            dlg.MultiSelect = false;
            dlg.Path = this.textBox_origin.Text;
            dlg.Initial(this.Servers,
                this.Channels);
            // dlg.StartPositon = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
                return;

            textBox_origin.Text = dlg.Path;
        }