예제 #1
0
        public SAP_RFC_BASE()
        {
            RfcPara.Clear();
            RfcPara = new RfcConfigParameters();

            RfcConfigParameters configParams = new RfcConfigParameters();

            RfcPara.Add(RfcConfigParameters.SystemNumber, "04");
            RfcPara.Add(RfcConfigParameters.User, "SFC_USER");
            RfcPara.Add(RfcConfigParameters.Password, "yhpwd");
            RfcPara.Add(RfcConfigParameters.Client, "801");
            RfcPara.Add(RfcConfigParameters.Name, "LH1");
            RfcPara.Add(RfcConfigParameters.Language, "en");
            RfcPara.Add(RfcConfigParameters.PoolSize, "5");
            RfcPara.Add(RfcConfigParameters.MaxPoolSize, "10");
            RfcPara.Add(RfcConfigParameters.GatewayHost, "10.134.28.204");
            RfcPara.Add(RfcConfigParameters.LogonGroup, "PUBLIC");

            RfcDest = RfcDestinationManager.GetDestination(RfcPara);
        }
예제 #2
0
 public RfcConfigParameters Connector3SapRfcConnGroup(string connStr)
 {
     try
     {
         string[]            arrConn = connStr.Split(' ');
         RfcConfigParameters rfcPar  = new RfcConfigParameters();
         rfcPar.Clear();
         //rfcPar.Add(RfcConfigParameters.Name, DateTime.Now.ToString("yyyyMMddHHmmss"));
         rfcPar.Add(RfcConfigParameters.AppServerHost, arrConn[0].Split('=')[1]);
         rfcPar.Add(RfcConfigParameters.Name, arrConn[1].Split('=')[1]);
         rfcPar.Add(RfcConfigParameters.LogonGroup, arrConn[2].Split('=')[1]);
         rfcPar.Add(RfcConfigParameters.Client, arrConn[3].Split('=')[1]);
         rfcPar.Add(RfcConfigParameters.User, arrConn[4].Split('=')[1]);
         rfcPar.Add(RfcConfigParameters.Password, arrConn[5].Split('=')[1]);
         rfcPar.Add(RfcConfigParameters.Language, arrConn[6].Split('=')[1]);
         //rfcPar.Add(RfcConfigParameters.RepositoryConnectionIdleTimeout, "1");
         //rfcPar.Add(RfcConfigParameters.ConnectionIdleTimeout, "1");
         //rfcPar.Add(RfcConfigParameters.PeakConnectionsLimit, "1000");
         return(rfcPar);
     }
     catch (RfcCommunicationException ex)
     {
         WriteLogs.Write("Connector3SapRfcConnGroup", ex);
         return(null);
     }
     catch (RfcAbapException ex)
     {
         WriteLogs.Write("Connector3SapRfcConnGroup", ex);
         return(null);
     }
     catch (RfcLogonException ex)
     {
         WriteLogs.Write("Connector3SapRfcConnGroup", ex);
         return(null);
     }
     catch (Exception ex)
     {
         WriteLogs.Write("Connector3SapRfcConnGroup", ex);
         return(null);
     }
 }
예제 #3
0
        /// <summary>
        /// 初始化RFC對象,連接參數從配置文件中取得
        /// </summary>
        public SAP_RFC_BASE(string BU)
        {
            RfcPara.Clear();
            RfcPara = new RfcConfigParameters();
            //從App.Config中取得BU對應的SAP連接方式
            if (false)
            {
                if (BU.Substring(0, 3) == "MBD")
                {
                    //SystemNumber=10
                    //RfcPara.Add(RfcConfigParameters.SystemNumber,
                    //    System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_SystemNumber"]);
                    //SystemID=CNP:SAP實例ID
                    RfcPara.Add(RfcConfigParameters.SystemID,
                                System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_System"]);
                    //GROUPNAME=CNSBG_800
                    RfcPara.Add(RfcConfigParameters.LogonGroup,
                                System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_LogonGroup"]);
                    //Client=800
                    RfcPara.Add(RfcConfigParameters.Client,
                                System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_Client"]);
                    //LANGUAGE=EN
                    RfcPara.Add(RfcConfigParameters.Language,
                                System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_Language"]);
                    //USERID=NSGBG
                    RfcPara.Add(RfcConfigParameters.User,
                                System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_User"]);
                    //PASSWORD=MESEDICU
                    RfcPara.Add(RfcConfigParameters.Password,
                                System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_Password"]);
                    //正式庫MessageServer = 10.134.108.111
                    //RfcPara.Add(RfcConfigParameters.GatewayHost,
                    //    System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_MessageServerHost"]);
                    RfcPara.Add(RfcConfigParameters.MessageServerHost,
                                System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_MessageServerHost"]);
                    //測式庫AppServerHost = 10.134.108.152
                    //RfcPara.Add(RfcConfigParameters.AppServerHost,
                    //     System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_AppServerHost"]);
                    RfcPara.Add(RfcConfigParameters.Name, "CON" + (ConnCount++).ToString());
                    RfcPara.Add(RfcConfigParameters.PoolSize, "5");
                    RfcPara.Add(RfcConfigParameters.MaxPoolSize, "10");
                }
                else
                {
                    //RfcPara.Add(RfcConfigParameters.AppServerHost,
                    //    System.Configuration.ConfigurationSettings.AppSettings[BU+"_SAP_AppServerHost"]);
                    RfcPara.Add(RfcConfigParameters.SystemNumber, //"01");
                                System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_SystemNumber"]);
                    RfcPara.Add(RfcConfigParameters.User,
                                System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_User"]);
                    RfcPara.Add(RfcConfigParameters.Password,
                                System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_Password"]);
                    RfcPara.Add(RfcConfigParameters.Client,
                                System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_Client"]);
                    RfcPara.Add(RfcConfigParameters.Name, "CON" + (ConnCount++).ToString());
                    RfcPara.Add(RfcConfigParameters.Language,
                                System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_Language"]);
                    RfcPara.Add(RfcConfigParameters.PoolSize, "5");
                    RfcPara.Add(RfcConfigParameters.MaxPoolSize, "10");
                    //RfcPara.Add(RfcConfigParameters.MessageServerHost,
                    //    System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_MessageServerHost"]);
                    RfcPara.Add(RfcConfigParameters.GatewayHost,
                                "10.134.108.122");
                }
            }
            else
            {
                //RfcPara.Add(RfcConfigParameters.AppServerHost,
                //    "10.62.199.79");
                //RfcPara.Add(RfcConfigParameters.SystemNumber, "00");
                //RfcPara.Add(RfcConfigParameters.User,
                //    "NSGBG");
                //RfcPara.Add(RfcConfigParameters.Password,
                //    "12345678");
                //RfcPara.Add(RfcConfigParameters.Client,
                //    "868");
                //RfcPara.Add(RfcConfigParameters.Language,
                //    "EN");
                //RfcPara.Add(RfcConfigParameters.Name, "CON" + (ConnCount++).ToString());
                //RfcPara.Add(RfcConfigParameters.PoolSize, "5");
                //RfcPara.Add(RfcConfigParameters.MaxPoolSize, "10");

                RfcPara.Add(RfcConfigParameters.AppServerHost,
                            "10.134.108.152");
                RfcPara.Add(RfcConfigParameters.SystemNumber, "00");
                RfcPara.Add(RfcConfigParameters.User, "NSGBG");
                //"NSGBG");
                RfcPara.Add(RfcConfigParameters.Password,
                            "MESEDICU");
                RfcPara.Add(RfcConfigParameters.Client,
                            "800");
                RfcPara.Add(RfcConfigParameters.Language,
                            "EN");
                RfcPara.Add(RfcConfigParameters.Name, "CON" + (ConnCount++).ToString());
                RfcPara.Add(RfcConfigParameters.PoolSize, "5");
                RfcPara.Add(RfcConfigParameters.MaxPoolSize, "10");
            }
            //8300:代表繁體
            RfcPara.Add(RfcConfigParameters.Codepage, "8300");
            //初始化SAP連接對象RfcDest
            RfcDest = RfcDestinationManager.GetDestination(RfcPara);
        }
예제 #4
0
        /// <summary>
        /// 初始化RFC對象,連接參數從配置文件中取得
        /// </summary>
        public SAP_RFC_BASE(string BU)
        {
            RfcPara.Clear();
            RfcPara = new RfcConfigParameters();

            if (true)
            {
                //RfcPara.Add(RfcConfigParameters.AppServerHost,
                //    System.Configuration.ConfigurationSettings.AppSettings[BU+"_SAP_AppServerHost"]);
                //RfcPara.Add(RfcConfigParameters.SystemNumber, //"01");
                //System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_SystemNumber"]);
                //RfcPara.Add(RfcConfigParameters.User,
                //    System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_User"]);
                //RfcPara.Add(RfcConfigParameters.Password,
                //    System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_Password"]);
                //RfcPara.Add(RfcConfigParameters.Client,
                //    System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_Client"]);
                //RfcPara.Add(RfcConfigParameters.Name, "CON" + (ConnCount++).ToString());
                //RfcPara.Add(RfcConfigParameters.Language,
                //    System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_Language"]);
                //RfcPara.Add(RfcConfigParameters.PoolSize, "5");
                //RfcPara.Add(RfcConfigParameters.MaxPoolSize, "10");
                ////RfcPara.Add(RfcConfigParameters.MessageServerHost,
                ////    System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_MessageServerHost"]);
                //RfcPara.Add(RfcConfigParameters.GatewayHost,
                //    "10.134.108.122");
                ////RfcConfigParameters.MessageServerHost
                ////RfcConfigParameters.MessageServerService
                //RfcPara.Add(RfcConfigParameters.LogonGroup,
                //    System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_LogonGroup"]);
                RfcPara.Add(RfcConfigParameters.SystemNumber, //"01");
                            System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_SystemNumber"]);
                RfcPara.Add(RfcConfigParameters.User,
                            System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_User"]);
                RfcPara.Add(RfcConfigParameters.Password,
                            System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_Password"]);
                RfcPara.Add(RfcConfigParameters.Client,
                            System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_Client"]);
                RfcPara.Add(RfcConfigParameters.Name, "CON" + (ConnCount++).ToString());
                RfcPara.Add(RfcConfigParameters.Language,
                            System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_Language"]);
                RfcPara.Add(RfcConfigParameters.PoolSize, "5");
                RfcPara.Add(RfcConfigParameters.MaxPoolSize, "10");
                //RfcPara.Add(RfcConfigParameters.MessageServerHost,
                //    System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_MessageServerHost"]);
                RfcPara.Add(RfcConfigParameters.GatewayHost,
                            System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_MessageServerHost"]);
                //RfcConfigParameters.MessageServerHost
                //RfcConfigParameters.MessageServerService
                RfcPara.Add(RfcConfigParameters.LogonGroup,
                            System.Configuration.ConfigurationSettings.AppSettings[BU + "_SAP_LogonGroup"]);
            }
            else
            {
                //RfcPara.Add(RfcConfigParameters.AppServerHost,
                //    "10.62.199.79");
                //RfcPara.Add(RfcConfigParameters.SystemNumber, "00");
                //RfcPara.Add(RfcConfigParameters.User,
                //    "NSGBG");
                //RfcPara.Add(RfcConfigParameters.Password,
                //    "12345678");
                //RfcPara.Add(RfcConfigParameters.Client,
                //    "868");
                //RfcPara.Add(RfcConfigParameters.Language,
                //    "EN");
                //RfcPara.Add(RfcConfigParameters.Name, "CON" + (ConnCount++).ToString());
                //RfcPara.Add(RfcConfigParameters.PoolSize, "5");
                //RfcPara.Add(RfcConfigParameters.MaxPoolSize, "10");

                RfcPara.Add(RfcConfigParameters.AppServerHost,
                            "10.134.108.152");
                RfcPara.Add(RfcConfigParameters.SystemNumber, "00");
                RfcPara.Add(RfcConfigParameters.User, "NSGBG");
                //"NSGBG");
                RfcPara.Add(RfcConfigParameters.Password,
                            "MESEDICU");
                RfcPara.Add(RfcConfigParameters.Client,
                            "800");
                RfcPara.Add(RfcConfigParameters.Language,
                            "EN");
                RfcPara.Add(RfcConfigParameters.Name, "CON" + (ConnCount++).ToString());
                RfcPara.Add(RfcConfigParameters.PoolSize, "5");
                RfcPara.Add(RfcConfigParameters.MaxPoolSize, "10");
            }
            //RfcConfigParameters.LogonGroup

            RfcPara.Add(RfcConfigParameters.Codepage, "8300");

            RfcDest = RfcDestinationManager.GetDestination(RfcPara);
        }