public static ProxyParameter DeSerializeParams(String xmlText)
        {
            Type thisType = typeof(ProxyParameter);

            System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(thisType);
            using (TextReader reader = new StringReader(xmlText))
            {
                try
                {
                    ProxyParameter param = (ProxyParameter)x.Deserialize(reader);
                    return(param);
                }
                catch (Exception exc)
                {
                }
                return(null);
            }
            //this.ProxyID = proxy.ProxyID;
            //this.AppServerHost = proxy.AppServerHost;
            //this.Client = proxy.Client;
            //this.User = proxy.User;
            //this.Password = proxy.Password;
            //this.Language = proxy.Language;
            //this.PoolSize = proxy.PoolSize;
            //this.MaxPoolSize = proxy.MaxPoolSize;
            //this.IdleTimeout = proxy.IdleTimeout;
        }
Exemple #2
0
        public ProxyParameter ReadConnectionParam()
        {
            ProxyParameter param = new ProxyParameter();

            param.ProxyID = System.Guid.NewGuid().ToString();
            Console.Write("Application server: "); param.AppServerHost = Console.ReadLine();
            Console.Write("Client ID: "); param.Client  = Console.ReadLine();
            Console.Write("Username: "******"Password: "******"System Number: "); param.SystemNumber  = Console.ReadLine();
            Console.Write("Language [def. IT]: "); param.Language = Console.ReadLine();
            if (String.IsNullOrEmpty(param.Language))
            {
                param.Language = "IT";
            }

            /* param.AppServerHost = "svuni125";
             * param.Client = "030";
             * param.User = "******";
             * param.Password = "******";
             * param.SystemNumber = "10";
             * param.Language = "IT"; */

            param.MaxPoolSize = "10";
            param.PoolSize    = "1";
            param.IdleTimeout = "10";
            return(param);
        }
Exemple #3
0
        public bool Login(ProxyParameter parameter)
        {
            try
            {
                RfcConfigParameters confParam = new RfcConfigParameters();
                confParam.Add(RfcConfigParameters.Name, Guid.NewGuid().ToString());
                confParam.Add(RfcConfigParameters.AppServerHost, parameter.AppServerHost);
                confParam.Add(RfcConfigParameters.SAPRouter, parameter.SAPRouter);
                confParam.Add(RfcConfigParameters.Client, parameter.Client);
                confParam.Add(RfcConfigParameters.User, parameter.User);
                confParam.Add(RfcConfigParameters.Password, parameter.Password);
                confParam.Add(RfcConfigParameters.SystemNumber, parameter.SystemNumber);
                confParam.Add(RfcConfigParameters.Language, parameter.Language);
                confParam.Add(RfcConfigParameters.PoolSize, "1");
                confParam.Add(RfcConfigParameters.MaxPoolSize, "10");
                confParam.Add(RfcConfigParameters.IdleTimeout, "10");

                destination = RfcDestinationManager.GetDestination(confParam);
                destination.Ping();

                connected = true;
            }
            catch (Exception ex)
            {
                //Console.WriteLine(ex.Message + " " + ex.StackTrace);
                System.Diagnostics.Trace.WriteLine(ex.Message + " " + ex.StackTrace);
            }
            return(connected);
        }
        public static String SerializeParams(ProxyParameter param)
        {
            StringWriter writer   = new StringWriter();
            Type         thisType = typeof(ProxyParameter);

            System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(thisType);
            x.Serialize(writer, param);
            return(writer.ToString());
        }
        private void FormCompositeRoles_Load(object sender, EventArgs e)
        {
            if (!File.Exists("cache"))
            {
                return;
            }
            String       encryptedString     = File.ReadAllText("cache", Encoding.UTF8);
            SecureString sString             = EncryptProtectData.DecryptString(encryptedString);
            String       decryptedSerialized = EncryptProtectData.ToInsecureString(sString);

            proxy = CompositeRoleHelper.DeSerializeParams(decryptedSerialized);
            if (proxy == null)
            {
                proxy = new ProxyParameter();
            }

            proxy.ProxyID     = Guid.NewGuid().ToString();
            proxy.MaxPoolSize = "10";
            proxy.PoolSize    = "1";
            proxy.IdleTimeout = "10";
            textBox6.Text     = proxy.AppServerHost;
            textBox3.Text     = proxy.SystemNumber;
            textBox5.Text     = proxy.Client;
            textBox4.Text     = proxy.User;
            textBox1.Text     = proxy.Password;
            textBox2.Text     = proxy.Language;
            DataTable dt = new DataTable();

            dt.Columns.AddRange(new DataColumn[] { new DataColumn("Operation"), new DataColumn("Description") });
            Array items = Enum.GetValues(typeof(Operations));

            foreach (Operations item in items)
            {
                dt.LoadDataRow(new object[] { Enum.GetName(typeof(Operations), item), item.ToName() }, true);
            }
            cmbActions.DataSource    = dt;
            cmbActions.DisplayMember = "Description";
        }
Exemple #6
0
 public SapRsparam(ProxyParameter param)
 {
     this.connect = new ManageCompositeRole();
     this.connect.Login(param);
 }
 public FormCompositeRoles()
 {
     InitializeComponent();
     proxy = new ProxyParameter();
 }
Exemple #8
0
 public SAPImportHelper(ProxyParameter param)
 {
     this.connect = new ManageCompositeRole();
     this.connect.Login(param);
 }