예제 #1
0
    public async Task<object> Invoke(dynamic options)
    {
        string connectionString = options.connectionString;
        bool useFake = options.useFake;

        CRMBridge bridge = new CRMBridge(connectionString, useFake);
        return new
        {
            Retrieve = (Func<object, Task<object>>)(
                async (i) =>
                {
                    return bridge.Retrieve(i);
                }
            ),
            RetrieveMultiple = (Func<object, Task<object>>)(
                async (i) =>
                {
                    return bridge.RetrieveMultiple((string)i);
                }
            ),
            Create = (Func<object, Task<object>>)(
                async (i) =>
                {
                    return bridge.Create(i);
                }
            ),
            Update = (Func<object, Task<object>>)(
                async (i) =>
                {
                    bridge.Update(i);
                    return null;
                }
            ),
            Delete = (Func<object, Task<object>>)(
                async (i) =>
                {
                    return bridge.Delete(i);
                }
            ),
            Associate = (Func<object, Task<object>>)(
                async (i) =>
                {
                    return bridge.Associate(i);
                }
            ),
            Disassociate = (Func<object, Task<object>>)(
                async (i) =>
                {
                    return bridge.Disassociate(i);
                }
            ),
            Execute = (Func<object, Task<object>>)(
                async (i) =>
                {
                    return bridge.Execute(i);
                }
            )
        };
    }
예제 #2
0
        public HttpBridge(int notReadyTime, int afterEndIVRTime, CRMBridge b)
        {
            js       = new JavaScriptSerializer();
            dg       = new DataGadget();
            dg.state = "READY";
            this.b   = b;
            count    = 0;
            txCount  = 0;
            AddrIP aip = new AddrIP();

            localIP              = aip.getIPAddresss();
            this.notReadyTime    = notReadyTime;
            this.afterEndIVRTime = afterEndIVRTime;
            string protocol = System.Configuration.ConfigurationSettings.AppSettings["protocol"];

            log.Info("Protocolo: " + protocol);
            string certHash = System.Configuration.ConfigurationSettings.AppSettings["certHash"];

            log.Debug("Local IP: " + localIP);
            log.Info("Tiempo de espera al cliente: " + notReadyTime);
            log.Info("Tiempo de espera al finalizar IVR: " + afterEndIVRTime);

            listener = new HttpListener();
            //URL's for pci
            listener.Prefixes.Add(protocol + "://127.0.0.1:8880/pci_bridge/sls/");
            listener.Prefixes.Add(protocol + "://127.0.0.1:8880/pci_bridge/dvl/");
            listener.Prefixes.Add(protocol + "://" + localIP + ":8880/pci_bridge/sls/");
            listener.Prefixes.Add(protocol + "://" + localIP + ":8880/pci_bridge/dvl/");
            //URL's for Gadget
            listener.Prefixes.Add(protocol + "://127.0.0.1:8880/pci_bridge/get-di/");
            listener.Prefixes.Add(protocol + "://127.0.0.1:8880/pci_bridge/get-di/");
            listener.Prefixes.Add(protocol + "://127.0.0.1:8880/pci_bridge/dialog/");
            listener.Prefixes.Add(protocol + "://127.0.0.1:8880/pci_bridge/tx/");
            listener.Prefixes.Add(protocol + "://127.0.0.1:8880/pci_bridge/clear/");
            //URL's for IVR
            listener.Prefixes.Add(protocol + "://127.0.0.1:8880/pci_bridge/ivr/");
            listener.Prefixes.Add(protocol + "://127.0.0.1:8880/pci_bridge/ivr-end/");
            listener.Prefixes.Add(protocol + "://" + localIP + ":8880/pci_bridge/ivr/");
            listener.Prefixes.Add(protocol + "://" + localIP + ":8880/pci_bridge/ivr-end/");

            dg       = new DataGadget();
            dg.state = "READY";
        }
예제 #3
0
    public async Task <object> Invoke(dynamic options)
    {
        string connectionString = options.connectionString;
        bool   useFake          = options.useFake;

        //foreach (var a in AppDomain.CurrentDomain.GetAssemblies()) Console.WriteLine(a.FullName);
        System.AppDomain.CurrentDomain.UnhandledException   += (x, y) => {
            //Console.WriteLine(y.ExceptionObject.ToString());
        };
        System.AppDomain.CurrentDomain.FirstChanceException += (x, y) => {
            //Console.WriteLine(y.Exception.ToString());
        };

        CRMBridge bridge = new CRMBridge(connectionString, useFake);

        return(new
        {
            Retrieve = (Func <object, Task <object> >)(
                async(i) =>
            {
                return bridge.Retrieve(i);
            }
                ),
            RetrieveMultiple = (Func <object, Task <object> >)(
                async(i) =>
            {
                return bridge.RetrieveMultiple((string)i);
            }
                ),
            Create = (Func <object, Task <object> >)(
                async(i) =>
            {
                return bridge.Create(i);
            }
                ),
            Update = (Func <object, Task <object> >)(
                async(i) =>
            {
                return bridge.Update(i);
            }
                ),
            Delete = (Func <object, Task <object> >)(
                async(i) =>
            {
                return bridge.Delete(i);
            }
                ),
            Associate = (Func <object, Task <object> >)(
                async(i) =>
            {
                return bridge.Associate(i);
            }
                ),
            Disassociate = (Func <object, Task <object> >)(
                async(i) =>
            {
                return bridge.Disassociate(i);
            }
                ),
            GetEntityMetadata = (Func <object, Task <object> >)(
                async(i) =>
            {
                return bridge.GetEntityMetadata(i);
            }
                ),
            Execute = (Func <object, Task <object> >)(
                async(i) =>
            {
                return bridge.Execute(i);
            }
                )
        });
    }