Exemplo n.º 1
0
        public dynamic Invoke(DynamicViewPoint point, InvokeMemberBinder binder, object[] args)
        {
            string location = point.Location;

            string idValue = args.Length == 1 ? Convert.ToString(args[0]) : "";

            GetDataRequest request = new GetDataRequest
            {
                Credentials = GetCredentials(),
                Filter      = new DataFilter
                {
                    Location = location,
                    Criteria = new [] { new FilterEntry {
                                            Name = "Id", Value = idValue
                                        } },
                },
                View = new GetDataView
                {
                    Module = point.AmplaModule
                },
                OutputOptions = new GetDataOutputOptions
                {
                    ResolveIdentifiers = true
                },
            };
            GetDataResponse response = WebServiceClient.GetData(request);

            List <dynamic>         records         = new List <dynamic>();
            DynamicModelProperties modelProperties = new DynamicModelProperties(point);
            IAmplaBinding          binding         = new AmplaGetDataDynamicBinding(response, records, modelProperties);

            if (binding.Validate() && binding.Bind())
            {
                return(records.FirstOrDefault());
            }
            return(null);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            //try
            //{
            //    string exePath = args[0];

            //    List<string> allUserStrings = ReadAllUserStrings(exePath);

            //    File.WriteAllLines(exePath + ".txt", allUserStrings.Select(str => CSStringConverter.Convert(str)));

            //    Console.WriteLine("hotovo... ");
            //}
            //catch (Exception ex)
            //{
            //    Console.WriteLine("Exception: " + ex.ToString());
            //    Console.WriteLine("press a key...");
            //    Console.ReadKey();
            //}
            WebServiceClient client = new WebServiceClient();
            var str = client.GetData();

            Console.Write(str);
            Console.ReadKey();
        }