/// <summary> /// 서비스 추가(설정파일에도 추가) /// </summary> private void AddService(string ServiceURL,String DBName) { try { ServiceURLControllers suc = new ServiceURLControllers(); suc.InsertServiceInfo(ServiceURL, DBName); this.WebServiceManager.AddService(new ConnectionVO(ServiceURL, DBName)); this.lvServiceList.Items.Clear(); foreach (string url in WebServiceServer.ServerMain.getInstance().ActiveServiceDic.Keys) { string[] data = new string[] { url, Convert.ToString(WebServiceServer.ServerMain.getInstance().ActiveServiceDic[url]) }; lvServiceList.Items.Add(new ListViewItem(data)); } } catch (Exception _e) { MessageBox.Show(_e.Message); } }
private void 서비스재시작ToolStripMenuItem_Click(object sender, EventArgs e) { string url = lvServiceList.SelectedItems[0].SubItems[0].Text; IList<ServiceInfo> ServiceList = new ServiceURLControllers().SelectServiceInfo(); this.StopService(url); foreach (ServiceInfo si in ServiceList) { if (si.ServiceURL == url) { this.StartService(si.ServiceURL, si.DBName ); break; } } }
private void 모든서비스재시작ToolStripMenuItem_Click(object sender, EventArgs e) { foreach (ListViewItem lvi in lvServiceList.Items) { if (lvi.SubItems[0].Text == "False") { continue; } string url = lvi.SubItems[0].Text; this.StopService(url); } IList<ServiceInfo> ServiceList = new ServiceURLControllers().SelectServiceInfo(); foreach (ServiceInfo si in ServiceList) { try { this.StartService(si.ServiceURL, si.DBName); } catch (Exception) { } } }
/// <summary> /// 설정을 가져와서 상황에 맞게 세팅(뷰단까지 모두 세팅) /// SetView,SetWebService에 종속 /// </summary> private void SetServer() { //공통설정 가져오기 this.CommonSettingsVO = new CommonSettingsController().SelectSettings(); //서비스 정보 목록 가져오기 IDictionary<string, string> serviceURLDic = new Dictionary<string, string>(); IList<ServiceInfo> ServiceInfoList = new ServiceURLControllers().SelectServiceInfo(); if (ServiceInfoList != null) { foreach (ServiceInfo si in ServiceInfoList) { serviceURLDic.Add(si.ServiceURL, si.DBName); } } //웹서비스 시작 SetWebService(this.CommonSettingsVO, serviceURLDic); //뷰단 세팅 SetView(this.CommonSettingsVO, serviceURLDic); }
/// <summary> /// 서비스 삭제(설정파일에서도 삭제됨) /// </summary> private void DeleteService(string ServiceURL) { try { ServiceURLControllers suc = new ServiceURLControllers(); //관련 서비스파일 삭제 suc.DeleteServiceInfo(ServiceURL); //관련 웹서비스 종료 this.WebServiceManager.DeleteService(ServiceURL); //관련DB드롭 new DBManager().DropDB(ServiceURL); this.lvServiceList.Items.Clear(); foreach (string _url in WebServiceServer.ServerMain.getInstance().ActiveServiceDic.Keys) { if (_url == ServiceURL) { //삭제된 URL은 목록에서 삭제 continue; } string[] data = new string[] { _url, Convert.ToString(WebServiceServer.ServerMain.getInstance().ActiveServiceDic[_url]) }; lvServiceList.Items.Add(new ListViewItem(data)); } } catch (KeyNotFoundException) { } catch (Exception) { throw; } }
private void DeleteAllServices( ) { try { ServiceURLControllers suc = new ServiceURLControllers(); IList<ServiceInfo> serviceList = suc.SelectServiceInfo(); DBManager dm = new DBManager(); //모든 서비스정보 삭제 suc.DeleteServiceInfoFile(); //모든 웹서비스 해제 this.WebServiceManager.DeleteService(); //모든 DB드롭 foreach (ServiceInfo si in serviceList) { dm.DropDB(si.ServiceURL); } this.lvServiceList.Items.Clear(); } catch(KeyNotFoundException) { return; } catch (Exception) { throw; } }