예제 #1
0
        //저장
        public void InsertSettings(CommonSettingsVO vo)
        {
            string plainJson     = JsonConvert.SerializeObject(vo);
            string Encryptedjson = WebServiceServer.ServerMain.getInstance().GetEncryptedString(plainJson);

            Settings.Default.CommonSettingsVO = Encryptedjson;
            Settings.Default.Save();
        }
예제 #2
0
 public void SetCommonSetting(CommonSettingsVO CommonSetting)
 {
     this.CommonSetting                  = CommonSetting;
     ServerConsole                       = ServerMain.getInstance();
     ServerConsole.certPassword          = CommonSetting.certPassword;
     ServerConsole.certPath              = CommonSetting.certPath;
     ServerConsole.MessageCredentialType = CommonSetting.MessageCredentialType;
     ServerConsole.UseMirrorAlram        = CommonSetting.UseMirrorAlram;
     ServerConsole.SetSecurityToken(CommonSetting.SecurityTokenSeed);
 }
예제 #3
0
        //가져오기
        public CommonSettingsVO SelectSettings()
        {
            CommonSettingsVO settingData = null;

            try
            {
                string Encryptedjson = Settings.Default.CommonSettingsVO;
                string plainJson     = WebServiceServer.ServerMain.getInstance().GetDecryptedString(Encryptedjson);
                settingData = JsonConvert.DeserializeObject <CommonSettingsVO>(plainJson);
            }
            catch (Exception)
            {
                settingData = null;
            }
            return(settingData);
        }
예제 #4
0
파일: frmMain.cs 프로젝트: hesed7/hitpan
        /// <summary>
        /// 웹서비스를 상황에 맞게 세팅
        /// </summary>
        /// <param name="CommonSettingsVO">
        /// 공통설정정보VO
        /// 없으면 null입력
        /// </param>
        /// <param name="serviceURLDic">
        /// 서비스 정보 리스트
        /// key: url value:DBPath
        /// 없으면 null 입력
        /// </param>
        private void SetWebService(CommonSettingsVO CommonSettingsVO, IDictionary <string, string> serviceURLDic)
        {
            if (CommonSettingsVO == null)
            {
                //[1]공통설정정보가 없는 경우의 예외처리
                WebServiceManager = null;
                MessageBox.Show("서비스를 시작하지 못했습니다. 먼저 서버설정을 하여 주십시오");
                return;
            }
            else if (serviceURLDic == null || serviceURLDic.Count == 0)
            {
                //[2]서비스 정보 목록이 없는경우 예외처리
                WebServiceManager = new WebServiceManager(CommonSettingsVO);
                if (!WebServiceManager.ServerReady)
                {
                    WebServiceManager.ServerOn(rdSecurityMode.Checked);
                }
            }
            else
            {
                //[3] 정상적인 경우의 처리
                WebServiceManager = new WebServiceManager(CommonSettingsVO);
                if (!WebServiceManager.ServerReady)
                {
                    bool UseSecurity = false;
                    if (CommonSettingsVO.MessageCredentialType != MessageCredentialType.None)
                    {
                        UseSecurity = true;
                    }
                    WebServiceManager.ServerOn(UseSecurity);
                }

                IList <ConnectionVO> connList = new List <ConnectionVO>(); //웹서비스 Param
                foreach (string url in serviceURLDic.Keys)
                {
                    ConnectionVO cvo = new ConnectionVO(url, serviceURLDic[url]);
                    connList.Add(cvo);
                }
                WebServiceManager.AddService(connList);
            }
        }
예제 #5
0
        //수정
        public void UpdateSettings(CommonSettingsVO vo)
        {
            CommonSettingsVO originVO = SelectSettings();

            foreach (var prop in typeof(CommonSettingsVO).GetProperties())
            {
                if (vo[prop.Name] != null)
                {
                    if (originVO[prop.Name] != vo[prop.Name])
                    {
                        originVO[prop.Name] = vo[prop.Name];
                    }
                }
            }

            string plainJson     = JsonConvert.SerializeObject(originVO);
            string Encryptedjson = WebServiceServer.ServerMain.getInstance().GetEncryptedString(plainJson);

            Settings.Default.CommonSettingsVO = Encryptedjson;
            Settings.Default.Save();
        }
예제 #6
0
파일: frmMain.cs 프로젝트: hesed7/hitpan
        //private void linkSetMirrorPath_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        //{
        //    FolderBrowserDialog fbd = new FolderBrowserDialog();
        //    if (fbd.ShowDialog()==DialogResult.OK)
        //    {
        //        lbMirrorPaths.Items.Add(fbd.SelectedPath);
        //    }
        //}

        //private void linkDeleteMirrorPath_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        //{
        //    lbMirrorPaths.Items.RemoveAt(lbMirrorPaths.SelectedIndex);
        //}

        private void btnSetCommonSettings_Click(object sender, EventArgs e)
        {
            CommonSettingsVO cvo = new CommonSettingsVO();

            cvo.SecurityTokenSeed = txtSecureKey.Text;
            if (rdSecurityMode.Checked)
            {
                cvo.MessageCredentialType = MessageCredentialType.UserName;
            }
            else
            {
                cvo.MessageCredentialType = MessageCredentialType.None;
            }
            cvo.BackupDIRPath  = txtBackupPath.Text;
            cvo.BackupSchedule = new TimeSpan(Convert.ToInt32(cbBackupSchedule.Text), 0, 0, 0);
            cvo.certPassword   = "******";
            cvo.certPath       = string.Format("{0}\\HTPServer.pfx", Environment.CurrentDirectory);
            cvo.UseMirrorAlram = true;
            cvo.MirrorDIRPath  = new StringCollection();

            new CommonSettingsController().DeleteSettings();
            new CommonSettingsController().InsertSettings(cvo);
            linkWarning.Visible = true;
        }
예제 #7
0
 public WebServiceManager(CommonSettingsVO CommonSetting)
 {
     SetCommonSetting(CommonSetting);
 }
예제 #8
0
파일: frmMain.cs 프로젝트: hesed7/hitpan
 private void btnSettingClear_Click(object sender, EventArgs e)
 {
     new CommonSettingsController().DeleteSettings();
     this.CommonSettingsVO = null;
     linkWarning.Visible   = true;
 }
예제 #9
0
파일: frmMain.cs 프로젝트: hesed7/hitpan
        /// <summary>
        /// 뷰단을 상황에 맞게 세팅
        /// </summary>
        /// <param name="CommonSettingsVO">
        /// 공통설정정보VO
        /// 없으면 null입력
        /// </param>
        /// <param name="serviceURLDic">
        /// 서비스 정보 리스트
        /// 없으면 null 입력
        /// </param>
        private void SetView(CommonSettingsVO CommonSettingsVO, IDictionary <string, string> serviceURLDic)
        {
            if (CommonSettingsVO == null)
            {
                //[1]공통설정정보가 없는 경우의 예외처리
                txtSecureKey.Enabled      = true;
                rdNotSecurityMode.Enabled = true;
                rdSecurityMode.Enabled    = true;
                linkBackupPath.Enabled    = true;
                cbBackupSchedule.Enabled  = true;
                btnSetCommonSettings.Text = "세팅완료";
                btnSettingClear.Visible   = false;
                txtServiceURL.Enabled     = false;
                linkExternalIP.Enabled    = false;
            }
            else if (serviceURLDic == null || serviceURLDic.Count == 0)
            {
                //[2]서비스 정보 목록이 없는경우 예외처리
                txtSecureKey.Enabled      = false;
                rdNotSecurityMode.Enabled = false;
                rdSecurityMode.Enabled    = false;
                linkBackupPath.Enabled    = false;
                cbBackupSchedule.Enabled  = false;
                btnSetCommonSettings.Text = "세팅시작하기";
                btnSettingClear.Visible   = true;
                txtServiceURL.Enabled     = true;
                linkExternalIP.Enabled    = true;

                //공통 설정정보 입력
                txtSecureKey.Text = this.CommonSettingsVO.SecurityTokenSeed;
                if (this.CommonSettingsVO.MessageCredentialType != MessageCredentialType.None)
                {
                    rdSecurityMode.Checked = true;
                }
                txtBackupPath.Text    = this.CommonSettingsVO.BackupDIRPath;
                cbBackupSchedule.Text = this.CommonSettingsVO.BackupSchedule.Days.ToString();
            }
            else
            {
                //[3] 정상적인 경우의 처리
                txtSecureKey.Enabled      = false;
                rdNotSecurityMode.Enabled = false;
                rdSecurityMode.Enabled    = false;
                linkBackupPath.Enabled    = false;
                cbBackupSchedule.Enabled  = false;
                btnSetCommonSettings.Text = "세팅시작하기";
                btnSettingClear.Visible   = true;
                txtServiceURL.Enabled     = true;
                linkExternalIP.Enabled    = true;

                //공통 설정정보 입력
                txtSecureKey.Text = this.CommonSettingsVO.SecurityTokenSeed;
                if (this.CommonSettingsVO.MessageCredentialType != MessageCredentialType.None)
                {
                    rdSecurityMode.Checked = true;
                }
                txtBackupPath.Text    = this.CommonSettingsVO.BackupDIRPath;
                cbBackupSchedule.Text = this.CommonSettingsVO.BackupSchedule.Days.ToString();

                //서비스 주소 세팅
                foreach (string url in WebServiceServer.ServerMain.getInstance().ActiveServiceDic.Keys)
                {
                    string[] arrServiceStat = new string[] { url, Convert.ToString(WebServiceServer.ServerMain.getInstance().ActiveServiceDic[url]) };
                    lvServiceList.Items.Add(new ListViewItem(arrServiceStat));
                }
            }
        }