示例#1
0
        private void btnConnect_Click(object sender, EventArgs e)
        {
            bool isBlank = (txtServer.Text == "" || txtUserName.Text == "");

            if (!isBlank)
            {
                try
                {
                    textBox2.AppendText("Attempting to connect..... " + Environment.NewLine);
                    dbConnName = conn.GetDefaultDatabaseConnection(txtServer.Text);
                    _sessionId = conn.Connect(txtServer.Text, txtUserName.Text, txtPassword.Text, dbConnName);

                    striplabelConnected.Text      = "Connected. SessionID: " + _sessionId;
                    striplabelConnected.ForeColor = Color.Green;

                    textBox2.AppendText("Connected to: " + txtServer.Text + Environment.NewLine);
                    connected = true;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                    MessageBox.Show("Error: " + ex.ToString(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    textBox2.AppendText("Connection Attempt Failed. " + Environment.NewLine);
                }
            }
            else

            {
                MessageBox.Show("Fill In all credential information", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
示例#2
0
 public string SendMessage(string message)
 {
     using (var svr = new ConnectionServices())
     {
         svr.Connect(HsmIp, HsmPort);
         string hsmResponse = svr.SendCommand(message);
         return(hsmResponse);
     }
 }
        static void Main()
        {
            string server    = "cwagner01";        //API Server
            string dsn       = "FactoryLogix2019"; //Database Name
            string userName2 = "AegisAdmin";
            string password  = "";

            ConnectionServices cs = new ConnectionServices();

            sessionID = cs.Connect(server, userName2, password, dsn, System.Threading.Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName);

            //Enter part number
            Console.Write("Enter Part Number: ");
            var partnumber = Console.ReadLine();

            //retrieve part number
            var pn = _partServices.FindParts(sessionID, PartKind.Internal, RevisionKind.CurrentRevision, AssemblyKind.BasicPartsOnly, partnumber, "*", "*", 2, 1);

            //check to see if Part Number exists
            if (pn.Results.Count == 0)
            {
                Console.WriteLine("***The Part Number does not exist***");
            }
            else
            //Cast results as an InternalPart
            if (pn.Results[0] is InternalPart)
            {
                Console.WriteLine($"Description: " + ((InternalPart)pn.Results[0]).Description);
                Console.WriteLine($"Revision: " + ((InternalPart)pn.Results[0]).Revision);
                Console.WriteLine($"Allow Simultaneous Loading: " + ((InternalPart)pn.Results[0]).SimultaneousLoading);
                Console.WriteLine($"RoHS: " + ((InternalPart)pn.Results[0]).IsRoHS);
                Console.WriteLine($"Part Label: " + ((InternalPart)pn.Results[0]).PartLabel);
                Console.WriteLine($"Package Type: " + ((InternalPart)pn.Results[0]).PackageName);
                Console.WriteLine($"Part Type: " + ((InternalPart)pn.Results[0]).PartType);
                Console.WriteLine($"Technology: " + ((InternalPart)pn.Results[0]).MountingTechnology);
                Console.WriteLine($"Unit of Issue: " + ((InternalPart)pn.Results[0]).UnitOfIssue);
                Console.WriteLine($"Polarized: " + ((InternalPart)pn.Results[0]).IsPolarized);
                Console.WriteLine($"Socket: " + ((InternalPart)pn.Results[0]).IsSocket);
                Console.WriteLine($"Default Stock Location: " + ((InternalPart)pn.Results[0]).DefaultStockLocation);

                Console.WriteLine("");
            }
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
示例#4
0
        private static void Main()
        {
            //
            var serverAddress = ConfigurationManager.AppSettings["FlxApplicationServerName"];
            var username      = ConfigurationManager.AppSettings["FlxServiceAccountName"];
            var password      = ConfigurationManager.AppSettings["FlxServiceAccountPassword"];

            var testPartNumber   = ConfigurationManager.AppSettings["TestPartNumber"];
            var testSerialNumber = ConfigurationManager.AppSettings["TestSerialNumber"];

            var conn       = new ConnectionServices();
            var dbConnName = "FactoryLogix2019";

            _sessionId = conn.Connect(serverAddress, username, password, dbConnName);


            var assemblyParameter = new ParameterValue
            {
                DataSourceId = "WIP 1",
                ParameterId  = "Assembly"
            };

            assemblyParameter.Values.Add(testPartNumber);

            var serialNumberParameter = new ParameterValue
            {
                DataSourceId = "WIP 1",
                ParameterId  = "Serial Number"
            };

            serialNumberParameter.Values.Add(testSerialNumber);



            //System.ServiceModel.QuotaExceededException is thrown using GetDataTemplate
            var template = _reportingService.GetDataTemplate(_sessionId, "whippy");

            var result = _reportingService.RunDataTemplate(_sessionId, template.Id, new [] { assemblyParameter, serialNumberParameter });

            Console.ReadKey();
        }
示例#5
0
        static void Main(string[] args)
        {
            AtmRequestHelper atmRequestHelper = new AtmRequestHelper();
            string           ip = "127.0.0.1";
            int port            = 8000;

            Log.Debug(string.Format("Connect to {0}, Port {1}", ip, port));
            string isContinue = "y";

            while (isContinue == "y")
            {
                Console.WriteLine(@"How many ATM ?:");
                string input = Console.ReadLine(); // Read string from console

                int count;

                if (int.TryParse(input, out count)) // Try to parse the string as an integer
                {
                    string m1 = "<STX>00000000td2W0       <FS>S9111111       <FS>11<FS>";
                    string m3 = "<FS>4089670000392726=17112011000017980000<FS>00008900<FS>00000200<FS>76728398F76ED27D<FS><FS><FS>VA6.00.12WV02.70.10 V06.01.12 0  0T  00 100     00000302K0288000000002K028800000000000000000000000000000000000000<FS><FS><FS><ETX>";
                    for (int i = 1; i <= count; i++)
                    {
                        string             m2 = i.ToString("D4");
                        byte[]             rawMessageBytes = atmRequestHelper.BuildMessageBytesForAtmRequest(m1 + m2 + m3); // Bulid byte
                        ConnectionServices svc             = new ConnectionServices();
                        svc.Connect(i, ip, port);
                        svc.Send(rawMessageBytes);
                    }
                }
                else
                {
                    Console.WriteLine("Not an integer!");
                }
                Console.WriteLine("Input y to continue");
                isContinue = Console.ReadLine();
                Console.Clear();
            }
        }