/// <summary>
        /// Form 컨트롤을 초기화한다.
        /// </summary>
        private void InitializeFormControl()
        {
            string strFilePath = null;
            int    nPos        = 0;

            string[] arrNames = null;

            SAPServerConfig oSCfg = new SAPServerConfig();

            SAPServerConfig.SAPSeverInfo oInfo = new SAPServerConfig.SAPSeverInfo(oSCfg);

            RFCFilter oFilter = new RFCFilter();

            // XML 환경 파일을 읽는다.
            strFilePath  = Application.ExecutablePath;
            nPos         = strFilePath.LastIndexOf("\\");
            strFilePath  = strFilePath.Substring(0, ++nPos);
            strFilePath += SAP_CONFIG_FILE;
            ReadConfigurationFile(strFilePath);

            // lbSAPServer - 서버 목록 표시하는 리스트 박스를 초기화한다.
            lbSAPServer.Sorted        = true;
            lbSAPServer.SelectionMode = SelectionMode.One;

            // 서버 목록을 표시한다.
            arrNames = oSCfg.GetServerNames(m_strConfigXML);
            lbSAPServer.Items.Clear();
            if (arrNames != null)
            {
                for (int i = 0; i < arrNames.Length; ++i)
                {
                    lbSAPServer.Items.Add(arrNames[i]);
                }
            }

            // btnPrevious - 이전 단계를 수행하는 버튼 상태를 비활성화한다.
            btnPrevious.Visible = false;

            // pgServerConfig - Property Grid 속성을 설정한다.
            pgServerConfig.SelectedObject = oInfo;

            // 검색 필터 관련. PropertyGrid 컨트롤을 설정한다.
            pgRFCFilter.SelectedObject = oFilter;

            // 네임스페이스 이름을 초기화 한다.
            txtNamespace.Text = "ProxyBuilder";

            // 클라이언트 형태의 Proxy 모듈로 기본 선택한다.
            radioClient.Checked = true;
            radioServer.Checked = false;

            // PG Help 상자 보이기
            pgServerConfig.HelpVisible = true;
            pgRFCFilter.HelpVisible    = true;
        }
Exemple #2
0
        private void InitializeFormControl()
        {
            string strFilePath = null;
            int    nPos        = 0;

            string[] arrNames = null;

            SAPServerConfig oSCfg = new SAPServerConfig();

            SAPServerConfig.SAPSeverInfo oInfo = new SAPServerConfig.SAPSeverInfo(oSCfg);

            RFCFilter oFilter = new RFCFilter();

            strFilePath  = Application.ExecutablePath;
            nPos         = strFilePath.LastIndexOf("\\");
            strFilePath  = strFilePath.Substring(0, ++nPos);
            strFilePath += SAP_CONFIG_FILE;
            ReadConfigurationFile(strFilePath);

            lbSAPServer.Sorted        = true;
            lbSAPServer.SelectionMode = SelectionMode.One;

            arrNames = oSCfg.GetServerNames(m_strConfigXML);
            lbSAPServer.Items.Clear();
            if (arrNames != null)
            {
                for (int i = 0; i < arrNames.Length; ++i)
                {
                    lbSAPServer.Items.Add(arrNames[i]);
                }
            }

            btnPrevious.Visible           = false;
            pgServerConfig.SelectedObject = oInfo;
            pgRFCFilter.SelectedObject    = oFilter;

            txtNamespace.Text = "ProxyBuilder";

            radioClient.Checked = true;
            radioServer.Checked = false;

            pgServerConfig.HelpVisible = true;
            pgRFCFilter.HelpVisible    = true;
        }
        private void btnGetRFCFunctions_Click(object sender, System.EventArgs e)
        {
            string strFuncNameFilter  = "*";
            string strGroupNameFilter = "";
            string strLanguageFilter  = "EN";

            string       strErrMsg = "";
            DataTable    oDT       = null; // 데이터 테이블 개체
            CallSAPProxy oProxy    = null;

            SAPServerConfig.SAPSeverInfo oInfo = (SAPServerConfig.SAPSeverInfo)pgServerConfig.SelectedObject;
            SAPServerConfig oSCfg = oInfo.owner;

            RFCFilter oFilter = (RFCFilter)pgRFCFilter.SelectedObject;

            Cursor.Current = Cursors.WaitCursor;

            try
            {
                // 목록 초기화
                lbRFCFunctions.Items.Clear();
                txtSelectedFuncName.Text = "";

                if (!ValidateSAPServerInfo())
                {
                    MessageBox.Show(this, "SAP Check the server connection settings.", this.Name, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    Cursor.Current = Cursors.Arrow;
                    return;
                }

                strFuncNameFilter  = String.IsNullOrEmpty(oFilter.NameFilter) ? "*" : oFilter.NameFilter;
                strGroupNameFilter = oFilter.GroupFilter;
                strLanguageFilter  = String.IsNullOrEmpty(oFilter.Language) ? "EN" : oFilter.Language;

                oProxy = new CallSAPProxy(); // Proxy 개체를 생성한다.
                oProxy.SetConnectionInfo("3", oInfo.ASHOST, Convert.ToInt16(oInfo.SYSNR), Convert.ToInt16(oInfo.CLIENT),
                                         oInfo.LANG, txtUserID.Text, txtPassword.Text);

                if (!oProxy.ConnectSAPServer())
                {
                    MessageBox.Show(this, "SAP Cannot connect to server.", this.Name, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    Cursor.Current = Cursors.Arrow;
                    return;
                }

                oDT = oProxy.get_RFCFunctionNames(strFuncNameFilter, strGroupNameFilter, strLanguageFilter);

                // Add to Function Names
                for (int nCnt = 0; nCnt < oDT.Rows.Count; ++nCnt)
                {
                    lbRFCFunctions.Items.Add(oDT.Rows[nCnt].ItemArray[0].ToString());
                }
            }
            catch (Exception exp)
            {
                strErrMsg = exp.Message;

                if (strErrMsg.Length == 0)
                {
                    strErrMsg = "No results found with the condition . Reset the search terms.";
                }

                MessageBox.Show(this, strErrMsg, this.Name, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            finally
            {
                if (oProxy != null)
                {
                    oProxy.DisconnectSAPServer();
                }
            }

            Cursor.Current = Cursors.Arrow;

            return;
        }