/// <summary>
 /// Clear data cache in web service.
 /// </summary>
 /// <param name="clientInformation">Information about the client that makes this web service call.</param>
 public void ClearCache(WebClientInformation clientInformation)
 {
     using (ClientProxy client = new ClientProxy(this, 1))
     {
         client.Client.ClearCache(clientInformation);
     }
 }
 public void Test_WeeklyMenuService_GetLastSunday() 
 {            
     ClientProxy proxy = new ClientProxy();
     var weeklyMenuService = proxy.GetContract<IWeeklyMenuService>();
     var lastSunDay = weeklyMenuService.GetLastSunday();
     Assert.AreNotEqual(DateTime.MinValue, lastSunDay);
 }
Пример #3
0
        public static void Main(string[] args)
        {
            Transaction.IdListInit();

            Console.WriteLine(GetConfiguration().AppSettings.Settings["port"].Value);
            var srv = new ClientProxy(int.Parse(GetConfiguration().AppSettings.Settings["port"].Value));

            var app = new Application("org.GtkApplication.GtkApplication", GLib.ApplicationFlags.None);

            Application.Init();
            app.Register(GLib.Cancellable.Current);
            var win = new Login(srv);

            try
            {
                win.App = app;
                Console.WriteLine("am ajuns");
                win.ShowAll();
                Application.Run();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
            }
        }
Пример #4
0
        /// <summary>
        /// IServerAdmin.LoadScriptFile impl
        ///  load script file. File needs to be on the server and in an accessible directory
        /// </summary>
        /// <param name="clientId"></param>
        /// <param name="scriptFilePath">path to file to load. If not an xml file will assume that the file contains a list of xml files</param>
        /// <param name="streamFileContentsBackToClient">should the server stream the files back to the client</param>
        public AsyncMethodResponse LoadScriptFile(Guid clientId, string scriptFilePath, bool streamFileContentsBackToClient)
        {
            AsyncMethodResponse response = new AsyncMethodResponse(clientId, null);

            //check for empty path
            if (string.IsNullOrEmpty(scriptFilePath))
            {
                response.AddError("Missing filePath", ErrorCode.Fatal);
                return(response);
            }

            //this call will return right away and
            //pass back an async ticket. the processing
            //will be done in a worker
            //and updates/information about the progress will
            //be sent back to the caller via a callback.
            response.AsyncTicket = Guid.NewGuid().ToString();

            ClientProxy clientProxy = CallbackManagerImpl.Instance.LookupClientProxy(clientId);

            //contructing the Impl will start a thread to do the work
            new LoadSciptFileMethodImpl(this, clientProxy, scriptFilePath, response.AsyncTicket, streamFileContentsBackToClient);

            return(response);
        }
Пример #5
0
 /// <summary>
 /// Checks for server response.
 /// </summary>
 /// <returns>If server are there.</returns>
 public Boolean AreYouThere()
 {
     using (ClientProxy client = new ClientProxy(this, 1))
     {
         return(client.Client.AreYouThere());
     }
 }
 public void Test_WeeklyMenuService_GetWeeklyMenu()
 {
     ClientProxy proxy = new ClientProxy();
     var weeklyMenuService = proxy.GetContract<IWeeklyMenuService>();
     var weeklyMenu = weeklyMenuService.GetWeeklyMenu();
     Assert.IsTrue(weeklyMenu.Any());
 }
Пример #7
0
 void OnJoinRoom()
 {
     if (SelectRoomId != -1)
     {
         ClientProxy.JoinRoom(SelectRoomId);
     }
 }
 /// <summary>
 /// Get information about all species facts.
 /// </summary>
 /// <param name="clientInformation">Information about the client that makes this web service call.</param>
 /// <param name="speciesFactIds">Ids for species facts to get information about.</param>
 /// <returns>Species fact information.</returns>
 public List <WebSpeciesFact> GetSpeciesFactsByIds(WebClientInformation clientInformation, List <int> speciesFactIds)
 {
     using (ClientProxy client = new ClientProxy(this, 2))
     {
         return(client.Client.GetSpeciesFactsByIds(clientInformation, speciesFactIds));
     }
 }
 /// <summary>
 /// Rollback a transaction.
 /// </summary>
 /// <param name="clientInformation">Information about the client that makes this web service call.</param>
 public void RollbackTransaction(WebClientInformation clientInformation)
 {
     using (ClientProxy client = new ClientProxy(this, 1))
     {
         client.Client.RollbackTransaction(clientInformation);
     }
 }
Пример #10
0
        /* Removes a given client obj from its current bin, unlinking it
         *     from the bin contents list. */
        public void RemoveFromBin(ClientProxy obj)
        {
            /* adjust pointers if obj is currently in a bin */
            if (obj.Bin != null)
            {
                /* If this obj is at the head of the list, move the bin
                 * pointer to the next item in the list (might be null). */
                if (_bins[obj.Bin.Value] == obj)
                {
                    _bins[obj.Bin.Value] = obj.Next;
                }

                /* If there is a prev obj, link its "next" pointer to the
                 * obj after this one. */
                if (obj.Prev != null)
                {
                    obj.Prev.Next = obj.Next;
                }

                /* If there is a next obj, link its "prev" pointer to the
                 * obj before this one. */
                if (obj.Next != null)
                {
                    obj.Next.Prev = obj.Prev;
                }
            }

            /* Null out prev, next and bin pointers of this obj. */
            obj.Prev = null;
            obj.Next = null;
            obj.Bin  = null;
        }
Пример #11
0
    static void Main(string[] args)
    {
        var app = AppDomain.CreateDomain("ImplDomain", null,
                                         AppDomain.CurrentDomain.BaseDirectory, AppDomain.CurrentDomain.RelativeSearchPath,
                                         true);

        var assmblyLoader = app.CreateInstanceFromAndUnwrap(
            typeof(AssemblyLoader).Assembly.Location, typeof(AssemblyLoader).FullName,
            false, BindingFlags.CreateInstance, null,
            new object[]
        {
            "_impl.dll"
        },
            null, null) as AssemblyLoader;

        var dataImpl  = assmblyLoader.CreateInstance("DataImpl") as IData;
        var logicImpl = assmblyLoader.CreateInstance("LogicImpl") as ILogic;

        logicImpl.Update(dataImpl);      // Works
        Console.WriteLine(dataImpl.Foo); // prints 1

        var clientDataProxy = new ClientProxy(typeof(IData), dataImpl);
        var clientDataImpl  = clientDataProxy.GetBaseTransparentProxy() as IData;

        var clientLogicProxy = new ClientProxy(typeof(ILogic), logicImpl);
        var clientLogicImpl  = clientLogicProxy.GetBaseTransparentProxy() as ILogic;

        clientLogicImpl.Update(dataImpl);       // Works
        Console.WriteLine(clientDataImpl.Foo);  // prints 2

        clientLogicImpl.Update(clientDataImpl); // throws System.Runtime.Remoting.RemotingException
        Console.WriteLine(clientDataImpl.Foo);
    }
 /// <summary>
 /// Creates the complete revision event.
 /// </summary>
 /// <param name="clientInformation">The client information.</param>
 /// <param name="revisionEvent">The revision event.</param>
 /// <returns></returns>
 public WebTaxonRevisionEvent CreateCompleteRevisionEvent(WebClientInformation clientInformation, WebTaxonRevisionEvent revisionEvent)
 {
     using (ClientProxy client = new ClientProxy(this, 1))
     {
         return(client.Client.CreateCompleteRevisionEvent(clientInformation, revisionEvent));
     }
 }
 /// <summary>
 /// Set revision species fact published flag to true
 /// </summary>revisionId
 /// <param name="clientInformation">clientInformation.</param>
 /// <param name="revisionId"></param>
 public bool SetRevisionSpeciesFactPublished(WebClientInformation clientInformation, int revisionId)
 {
     using (ClientProxy client = new ClientProxy(this, 1))
     {
         return(client.Client.SetRevisionSpeciesFactPublished(clientInformation, revisionId));
     }
 }
 /// <summary>
 /// Creates the dyntaxa revision species fact.
 /// </summary>
 /// <param name="clientInformation">The client information.</param>
 /// <param name="dyntaxaRevisionSpeciesFact">The dyntaxa revision species fact.</param>
 /// <returns></returns>
 public WebDyntaxaRevisionSpeciesFact CreateDyntaxaRevisionSpeciesFact(WebClientInformation clientInformation, WebDyntaxaRevisionSpeciesFact dyntaxaRevisionSpeciesFact)
 {
     using (ClientProxy client = new ClientProxy(this, 1))
     {
         return(client.Client.CreateDyntaxaRevisionSpeciesFact(clientInformation, dyntaxaRevisionSpeciesFact));
     }
 }
 /// <summary>
 ///  Gets all dyntaxa revision species facts.
 /// </summary>
 /// <param name="clientInformation"></param>
 /// <param name="taxonRevisionId"></param>
 /// <returns></returns>
 public List <WebDyntaxaRevisionSpeciesFact> GetAllDyntaxaRevisionSpeciesFacts(WebClientInformation clientInformation, Int32 taxonRevisionId)
 {
     using (ClientProxy client = new ClientProxy(this, 1))
     {
         return(client.Client.GetAllDyntaxaRevisionSpeciesFacts(clientInformation, taxonRevisionId));
     }
 }
 /// <summary>
 /// Gets the dyntaxa revision species fact.
 /// </summary>
 /// <param name="clientInformation">The client information.</param>
 /// <param name="factorId">The factor identifier.</param>
 /// <param name="taxonId">The taxon identifier.</param>
 /// <param name="taxonRevisionId">The taxon revision identifier.</param>
 /// <returns></returns>
 public WebDyntaxaRevisionSpeciesFact GetDyntaxaRevisionSpeciesFact(WebClientInformation clientInformation, Int32 factorId, Int32 taxonId, Int32 taxonRevisionId)
 {
     using (ClientProxy client = new ClientProxy(this, 1))
     {
         return(client.Client.GetDyntaxaRevisionSpeciesFact(clientInformation, factorId, taxonId, taxonRevisionId));
     }
 }
Пример #17
0
 public DALOrder(ClientProxy servicePort)
 {
     _servicePortType = servicePort;
     _gatewayOrder    = new GateWayOrder(_servicePortType);
     _loadSize        = Utility.intTryParse(ConfigurationManager.AppSettings["load_size"]);
     _progressStep    = Utility.intTryParse(ConfigurationManager.AppSettings["progress_step"]);
 }
 public void ReceiveTheMessages(List <ReceiveMessageDataModel> theMessages, string clientAddress)
 {
     using (theProxy = new ClientProxy(clientAddress))
     {
         theProxy.ReceiveTheMessages(theMessages);
     }
 }
 /// <summary>
 /// Get all species fact qualities.
 /// </summary>
 /// <param name="clientInformation">Information about the client that makes this web service call.</param>
 /// <returns>All species fact qualities.</returns>
 public List <WebSpeciesFactQuality> GetSpeciesFactQualities(WebClientInformation clientInformation)
 {
     using (ClientProxy client = new ClientProxy(this, 2))
     {
         return(client.Client.GetSpeciesFactQualities(clientInformation));
     }
 }
 /// <summary>
 /// Commit a transaction.
 /// </summary>
 /// <param name="clientInformation">Information about the client that makes this web service call.</param>
 public void CommitTransaction(WebClientInformation clientInformation)
 {
     using (ClientProxy client = new ClientProxy(this, 1))
     {
         client.Client.CommitTransaction(clientInformation);
     }
 }
 /// <summary>
 /// Get status for this web service.
 /// </summary>
 /// <param name="clientInformation">Information about the client that makes this web service call.</param>
 /// <returns>Status for this web service.</returns>
 public List <WebResourceStatus> GetStatus(WebClientInformation clientInformation)
 {
     using (ClientProxy client = new ClientProxy(this, 1))
     {
         return(client.Client.GetStatus(clientInformation));
     }
 }
 /// <summary>
 /// Get all factor data types.
 /// </summary>
 /// <param name="clientInformation">Information about the client that makes this web service call.</param>
 /// <returns>Factor data types.</returns>
 public List <WebFactorDataType> GetFactorDataTypes(WebClientInformation clientInformation)
 {
     using (ClientProxy client = new ClientProxy(this, 1))
     {
         return(client.Client.GetFactorDataTypes(clientInformation));
     }
 }
 /// <summary>
 /// Stop tracing usage of web service.
 /// </summary>
 /// <param name="clientInformation">Information about the client that makes this web service call.</param>
 public void StopTrace(WebClientInformation clientInformation)
 {
     using (ClientProxy client = new ClientProxy(this, 1))
     {
         client.Client.StopTrace(clientInformation);
     }
 }
 /// <summary>
 /// Get information about all factor field enumerations.
 /// </summary>
 /// <param name="clientInformation">Information about the client that makes this web service call.</param>
 /// <returns>Factor field enumerations.</returns>
 public List <WebFactorFieldEnum> GetFactorFieldEnums(WebClientInformation clientInformation)
 {
     using (ClientProxy client = new ClientProxy(this, 2))
     {
         return(client.Client.GetFactorFieldEnums(clientInformation));
     }
 }
Пример #25
0
        /// <summary>
        /// Generate a DPWSClientProxy source file from a wsdl service description.
        /// </summary>
        /// <param name="serviceDesc">A valid wsdl service description.</param>
        public void GenerateClientProxy(ServiceDescription serviceDesc, TargetPlatform platform)
        {
            // Well here's a nasty used in an attempt to make up a name
            string clientProxyClassName = serviceDesc.Name;
            string clientProxyNs = CodeGenUtils.GenerateDotNetNamespace(serviceDesc.TargetNamespace);
            string filename = serviceDesc.Name + "ClientProxy.cs";

            ClientProxies clientProxies = new ClientProxies(clientProxyNs);

            foreach (PortType portType in serviceDesc.PortTypes)
            {
                ClientProxy clientProxy = new ClientProxy(portType.Name, platform);
                foreach (Operation operation in portType.Operations)
                {
                    // Create action names
                    // Apply special naming rules if this is a notification (event) operation
                    string inAction = serviceDesc.TargetNamespace + "/" + operation.Name + "Request";
                    string outAction = serviceDesc.TargetNamespace + "/" + operation.Name + ((operation.Messages.Flow == OperationFlow.Notification) ? "" : "Response");
                    clientProxy.AddOperation(operation, inAction, outAction);
                }

                foreach (Message message in serviceDesc.Messages)
                {
                    clientProxy.Messages.Add(message);
                }

                if (clientProxy.ServiceOperations.Count > 0)
                    clientProxies.Add(clientProxy);
            }

            ClientProxyGenerator clientProxyGen = new ClientProxyGenerator();
            clientProxyGen.GenerateCode(filename, clientProxies);
        }
 /// <summary>
 /// Get all factor trees that matches search criteria.
 /// </summary>
 /// <param name="clientInformation">Information about the client that makes this web service call.</param>
 /// <param name="searchCriteria">The factor search criteria.</param>
 /// <returns>Factor trees.</returns>
 public List <WebFactorTreeNode> GetFactorTreesBySearchCriteria(WebClientInformation clientInformation, WebFactorTreeSearchCriteria searchCriteria)
 {
     using (ClientProxy client = new ClientProxy(this, 5))
     {
         return(client.Client.GetFactorTreesBySearchCriteria(clientInformation, searchCriteria));
     }
 }
 public void TheServiceStatusChanged(bool theStatus, string clientAddress)
 {
     using (theProxy = new ClientProxy(clientAddress))
     {
         theProxy.TheServiceStatusChanged(theStatus);
     }
 }
 /// <summary>
 /// Get all factor update modes.
 /// </summary>
 /// <param name="clientInformation">Information about the client that makes this web service call.</param>
 /// <returns>Factor update modes.</returns>
 public List <WebFactorUpdateMode> GetFactorUpdateModes(WebClientInformation clientInformation)
 {
     using (ClientProxy client = new ClientProxy(this, 2))
     {
         return(client.Client.GetFactorUpdateModes(clientInformation));
     }
 }
Пример #29
0
        public void Users_Should_Be_Notified_When_User_Joins()
        {
            //Arrange
            var repo    = new Repository();
            var service = new ChatService(repo);
            var hub     = new ChatHub(service);

            var contextMock = new Mock <HubCallerContext>();

            contextMock.SetupGet(x => x.ConnectionId).Returns("testconn");

            var groupMock = new Mock <IGroupManager>();

            groupMock.Setup(x => x.AddToGroupAsync(It.IsAny <string>(), It.IsAny <string>(), default));

            var clientProxyMock = new ClientProxy();
            var clientMock      = new Mock <IHubCallerClients>();

            clientMock.SetupGet(x => x.All).Returns(clientProxyMock);

            hub.Context = contextMock.Object;
            hub.Clients = clientMock.Object;
            hub.Groups  = groupMock.Object;

            //Act
            var success = hub.JoinChat("test").Result;

            //Assert
            success.Should().BeTrue();
            clientProxyMock.SendCoreAsyncInvokedCount.Should().Be(1);
        }
 /// <summary>
 /// Get all individual categories.
 /// </summary>
 /// <param name="clientInformation">Information about the client that makes this web service call.</param>
 /// <returns>All individual categories.</returns>
 public List <WebIndividualCategory> GetIndividualCategories(WebClientInformation clientInformation)
 {
     using (ClientProxy client = new ClientProxy(this, 2))
     {
         return(client.Client.GetIndividualCategories(clientInformation));
     }
 }
Пример #31
0
 /// <summary>
 /// Gets service version.
 /// </summary>
 /// <returns>The service version.</returns>
 public String GetServiceVersion()
 {
     using (ClientProxy client = new ClientProxy(this, 1))
     {
         return(client.Client.GetServiceVersion());
     }
 }
 /// <summary>
 /// Get all period types.
 /// </summary>
 /// <param name="clientInformation">Information about the client that makes this web service call.</param>
 /// <returns>Period types.</returns>
 public List <WebPeriodType> GetPeriodTypes(WebClientInformation clientInformation)
 {
     using (ClientProxy client = new ClientProxy(this, 2))
     {
         return(client.Client.GetPeriodTypes(clientInformation));
     }
 }
 public void ClientIsAvailable(string clientAddress)
 {
     using (theProxy = new ClientProxy(clientAddress))
     {
         theProxy.ClientIsAvailable();
     }
 }
Пример #34
0
        public static void GetOtStrategyMapAndSaveData(ClientProxy cp, int runDate)
        {
            //get all book/strategy from OT
            var partyList = Env.Current.StaticData.GetAllPartyRole("%", ConstBook) as List<Party>;
            SLog.log.InfoFormat("Book/Strategy count:  {0}", partyList != null ? partyList.Count : 0);

            SaveBookStrategy(ProcessBookStrategy(runDate, partyList), runDate);
            SLog.log.InfoFormat("GetOtStrategyMapAndSaveData DONE");
        }
Пример #35
0
 public ServiceClientAdapter(SubscriptionCloudCredentials creds, Uri baseUri)
 {
     System.Configuration.Configuration exeConfiguration = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Reflection.Assembly.GetExecutingAssembly().Location);
     System.Configuration.AppSettingsSection appSettings = (System.Configuration.AppSettingsSection)exeConfiguration.GetSection(AppSettingsSectionName);
     string recoveryServicesResourceNamespace = RecoveryServicesResourceNamespace;
     if (appSettings.Settings[ProviderNamespaceKey] != null)
     {
         recoveryServicesResourceNamespace = appSettings.Settings[ProviderNamespaceKey].Value;
     }
     BmsAdapter = new ClientProxy<RecoveryServicesNS.RecoveryServicesBackupManagementClient, RecoveryServicesModelsNS.CustomRequestHeaders>(
         clientRequestId => new RecoveryServicesModelsNS.CustomRequestHeaders() { ClientRequestId = clientRequestId },
                                creds, baseUri);
     BmsAdapter.Client.ResourceNamespace = recoveryServicesResourceNamespace;
 }
Пример #36
0
        public static void Import(ClientProxy cp, string templateName)
        {
            
            
            try
            {
                /* Swap Test */
                /*
                string[] fieldsStrings = new[] {"Product",  "Template Name", "CCP"   ,"Initial Party","Buy Sell", "Is Forward Start", "Premium Ccy", "Settle Date", "Rate",   "Pay Receive", "Expiry", "Swap Start Date", "Swap End Date", "StartDate", "EndDate",  "Option Style", "Settlement Type", "Fee Pay/Rec", "Fee Currency", "Fee Date", "Book",            "Nominal",  "Fee Amount", "Premium"};
                string[] rowStrings = new[] { "Swap",       "USD:LIBOR:3M:S","LCH_US","BAML_OTC",     "",         "",                 ""           , "",            "1.7500%","Receive",     "",        "",               "",              "16-Jun-15", "16-Jun-22", "",            "",                 "Rec",        "USD",          "10-Apr-15", "MLP:USDGAMMA10Y","20,000,000","109,300",   ""  };
                */
                /* Future Test */
                /*
                string[] fieldsStrings = new[] {"SecurityGroup","ContractTicker","Future","OptionContractTicker","Option","Option Type","Strike","Trade Price","Initial Party","Buy Sell","Qty","Book"};
                string[] rowStrings = new[] {"Future","TY Comdty","TYM5","","","","","1.29265625","BAML_F&O_EFP","Sell","170","MLP:USDGAMMATY"};
                 */
                /* Listed Option Test */

                // Once we've processed the file
                string[] fieldsStrings = new[] { "SecurityGroup", "ContractTicker", "Future", "OptionContractTicker", "Option", "Option Type", "Strike", "Trade Price", "Initial Party", "Buy Sell", "Qty", "Book" };


                string[] rowStrings = new[] {"ListedOption","","","FV Comdty","FVK5","Call","1.22","0.00015625","KYTE_F&O_ELEC","Buy","333","MLP:USDGAMMAFV"};

                

                var row= ImportRowHelper.ParseRow(rowStrings, fieldsStrings);

                SaveTrade(row);
            }
            catch (Exception ex)
            {
                Logger.Error("CreateSwap", ex);
            }
            
        }
Пример #37
0
        /* Adds a given client obj to a given bin, linking it into the bin
           contents list. */
        public void AddToBin(ref ClientProxy obj, int binIndex)
        {
            /* if bin is currently empty */
            if (bins[binIndex] == null)
            {
                obj.Prev = null;
                obj.Next = null;
            }
            else
            {
                obj.Prev = null;
                obj.Next = bins[binIndex];
                bins[binIndex].Prev = obj;
            }

            bins[binIndex] = obj;

            /* record bin ID in proxy obj */
            obj.Bin = binIndex;
        }
Пример #38
0
        /* Call for each client obj every time its location changes.  For
           example, in an animation application, this would be called each
           frame for every moving obj.  */
        public void UpdateForNewLocation(ref ClientProxy obj, Vector3 position)
        {
            /* find bin for new location */
            int newBin = BinForLocation(position);

            /* store location in client obj, for future reference */
            obj.Position = position;

            /* has obj moved into a new bin? */
            if (newBin != obj.Bin)
            {
                RemoveFromBin(ref obj);
                AddToBin(ref obj, newBin);
            }
        }
Пример #39
0
 /* public helper function */
 void RemoveAllObjectsInBin(ref ClientProxy bin)
 {
     while (bin != null)
     {
         RemoveFromBin(ref bin);
     }
 }
Пример #40
0
        /* Removes a given client obj from its current bin, unlinking it
           from the bin contents list. */
        public void RemoveFromBin(ref ClientProxy obj)
        {
            /* adjust pointers if obj is currently in a bin */
            if (obj.Bin != null)
            {
                /* If this obj is at the head of the list, move the bin
                   pointer to the next item in the list (might be null). */
                if (bins[obj.Bin.Value] == obj)
                    bins[obj.Bin.Value] = obj.Next;

                /* If there is a prev obj, link its "next" pointer to the
                   obj after this one. */
                if (obj.Prev != null)
                    obj.Prev.Next = obj.Next;

                /* If there is a next obj, link its "prev" pointer to the
                   obj before this one. */
                if (obj.Next != null)
                    obj.Next.Prev = obj.Prev;
            }

            /* Null out prev, next and bin pointers of this obj. */
            obj.Prev = null;
            obj.Next = null;
            obj.Bin = null;
        }
Пример #41
0
        /* Given a bin's list of client proxies, traverse the list and invoke
        the given lqCallBackFunction on each obj that falls within the
        search radius.  */
        public void TraverseBinClientObjectList(ref ClientProxy co, float radiusSquared, LQCallBackFunction func, Object state, Vector3 position)
        {
            while (co != null)
            {
                // compute distance (squared) from this client obj to given
                // locality sphere's centerpoint
                Vector3 d = position - co.Position;
                float distanceSquared = d.LengthSquared();

                // apply function if client obj within sphere
                if (distanceSquared < radiusSquared)
                    func(co.Obj, distanceSquared, state);

                // consider next client obj in bin list
                co = co.Next;
            }
        }
Пример #42
0
        /// <summary>
        /// CreateSourceFiles - Parse Wsdl Schema and generate DataContract, DataContractSerializer types,
        /// HostedServices and Client Proxies.
        /// </summary>
        /// <remarks>Currently only generates C# source files.</remarks>
        /// <param name="contractFilename">The name of a contract source code (.cs) file.</param>
        /// <param name="hostedServiceFilename">The name of a hosted service source code (.cs) file.</param>
        /// <param name="clientProxyFilename">The name of a client proxy source code (.cs) file.</param>
        /// <param name="targetPlatform">Specifies the target runtime platform.</param>
        public void CreateSourceFiles(string contractFilename, string hostedServiceFilename, string clientProxyFilename, TargetPlatform targetPlatform)
        {
            m_platform = targetPlatform;

            Logger.WriteLine("", LogLevel.Normal);
            Logger.WriteLine("Generating contract source: " + contractFilename + "...", LogLevel.Normal);

            if (contractFilename == null)
                throw new ArgumentNullException("codeFilename", "You must pass a valid code filename.");

            if (m_svcDesc.Types == null)
            {
                throw new Exception("No wsdl types found.");
            }

            string path = Path.GetDirectoryName(contractFilename).Trim();

            if(!string.IsNullOrEmpty(path) && !Directory.Exists(path)) 
            {
                Directory.CreateDirectory(path);
            }

            // Create code file stream
            FileStream dcStream = new FileStream(contractFilename, FileMode.Create, FileAccess.Write, FileShare.None);
            StreamWriter dcStreamWriter = new StreamWriter(dcStream);

            // Write the auto generated header
            dcStreamWriter.Write(AutoGenTextHeader.Message);

            try
            {

                // Set up data contract code generator
                CSharpCodeProvider cSharpCP = new CSharpCodeProvider();
                ICodeGenerator codeGen = cSharpCP.CreateGenerator(dcStreamWriter);
                CodeGeneratorOptions codeGenOptions = new CodeGeneratorOptions();
                codeGenOptions.BracingStyle = "C";

                // Cobble up a valid .net namespace. Turn any progression that's not a-z or A-Z to a single '.'
                string targetNamespaceName = CodeGenUtils.GenerateDotNetNamespace(m_svcDesc.TargetNamespace);

                // For some reason we have to force schemas to compile. Though it was suppose to automatically. Huh!
                foreach (XmlSchema schema in m_svcDesc.Types.Schemas)
                {
                    XmlSchemaSet schemaSet = new XmlSchemaSet();
                    schemaSet.Add(schema);
                    schemaSet.Compile();
                }
                

                // Create new code namespace
                CodeNamespace targetNamespace = new CodeNamespace(targetNamespaceName);

                // Add data contract using directives
                CodeSnippetCompileUnit compileUnit = new CodeSnippetCompileUnit("using System;");
                codeGen.GenerateCodeFromCompileUnit(compileUnit, dcStreamWriter, codeGenOptions);
                compileUnit.Value = "using System.Xml;";
                codeGen.GenerateCodeFromCompileUnit(compileUnit, dcStreamWriter, codeGenOptions);
                if (m_platform == TargetPlatform.MicroFramework)
                {
                    compileUnit.Value = "using System.Ext;";
                    codeGen.GenerateCodeFromCompileUnit(compileUnit, dcStreamWriter, codeGenOptions);
                    compileUnit.Value = "using System.Ext.Xml;";
                    codeGen.GenerateCodeFromCompileUnit(compileUnit, dcStreamWriter, codeGenOptions);
                }
                compileUnit.Value = "using Ws.ServiceModel;";
                codeGen.GenerateCodeFromCompileUnit(compileUnit, dcStreamWriter, codeGenOptions);
                compileUnit.Value = "using Ws.Services.Mtom;";
                codeGen.GenerateCodeFromCompileUnit(compileUnit, dcStreamWriter, codeGenOptions);
                compileUnit.Value = "using Ws.Services.Serialization;";
                codeGen.GenerateCodeFromCompileUnit(compileUnit, dcStreamWriter, codeGenOptions);
                compileUnit.Value = "using XmlElement = Ws.Services.Xml.WsXmlNode;";
                codeGen.GenerateCodeFromCompileUnit(compileUnit, dcStreamWriter, codeGenOptions);
                compileUnit.Value = "using XmlAttribute = Ws.Services.Xml.WsXmlAttribute;";
                codeGen.GenerateCodeFromCompileUnit(compileUnit, dcStreamWriter, codeGenOptions);
                compileUnit.Value = "using XmlConvert = Ws.Services.Serialization.WsXmlConvert;";
                codeGen.GenerateCodeFromCompileUnit(compileUnit, dcStreamWriter, codeGenOptions);
                compileUnit.Value = "";
                codeGen.GenerateCodeFromCompileUnit(compileUnit, dcStreamWriter, codeGenOptions);
                compileUnit.Namespaces.Add(targetNamespace);
                m_dcCodeGen.CodeNamespaces = compileUnit.Namespaces;

                Logger.WriteLine("", LogLevel.Normal);

                // Create HostedServices and ClientProxies collections
                HostedServices hostedServices = new HostedServices(targetNamespaceName);
                ClientProxies clientProxies = new ClientProxies(targetNamespaceName);

                // For each PortType process
                foreach (PortType portType in m_svcDesc.PortTypes)
                {
                    // For each operation in the port type:
                    // Get input and output message parts.
                    // If the message part is a simple type:
                    //   Build HostedService operation.
                    // Else if the message part is an element:
                    //   Find elements in Schema
                    //   If element type is native xml type:
                    //     Build HostedService operation.
                    //   Else if element references a simple or complex type:
                    //     If simpleType is base xml type with restrictions:
                    //       Build HostedService operation.
                    //     Else
                    //       Build DataContract and DataContractSerializer.
                    //       Build HostedService Operation.
                    //     

                    if (!CodeGenUtils.IsSoapBinding(portType, m_svcDesc))
                    {
                        continue;
                    }

                    // Create instance of a HostedService to hold the port type details
                    HostedService hostedService = new HostedService(portType.Name, m_svcDesc.TargetNamespace, m_platform);

                    // Create instance of ClientProxyGenerator
                    ClientProxy clientProxy = new ClientProxy(portType.Name, m_platform);

                    // Create service contract interface
                    CodeTypeDeclaration serviceCodeType = new CodeTypeDeclaration("I" + portType.Name);
                    CodeAttributeArgument codeAttr = new CodeAttributeArgument("Namespace", new CodePrimitiveExpression(m_svcDesc.TargetNamespace));
                    CodeAttributeDeclaration codeAttrDecl = new CodeAttributeDeclaration("ServiceContract", codeAttr);
                    serviceCodeType.CustomAttributes.Add(codeAttrDecl);

                    // Check for Policy assertions. If found add policy assertion attributes. Policy assertion attributes
                    // are required to regenerate policy assertions when converting a service to Wsdl.
                    List<PolicyAssertion> policyAssertions = GetPolicyAssertions();
                    bool OptimizedMimeEncoded = false;
                    foreach (PolicyAssertion assert in policyAssertions)
                    {
                        serviceCodeType.CustomAttributes.Add(CreatePolicyAssertions(assert.Name, assert.Namespace.ToString(), assert.PolicyID));
                    
                        // if Optimized Mime assertion id found set a processing flag
                        if (assert.Name == "OptimizedMimeSerialization")
                        {
                            OptimizedMimeEncoded = true;
                        }
                    }

                    // Add type declaration
                    serviceCodeType.TypeAttributes = TypeAttributes.Public;
                    serviceCodeType.IsInterface = true;

                    // Create service contract callback client interface
                    CodeTypeDeclaration serviceCallbackCodeType = new CodeTypeDeclaration("I" + portType.Name + "Callback");

                    // Add type declaration
                    serviceCallbackCodeType.TypeAttributes = TypeAttributes.Public;
                    serviceCallbackCodeType.IsInterface = true;

                    // If the binding contains a ref to Mtom encoding type set the Mtom flag
                    if (OptimizedMimeEncoded)
                    {
                        m_dcCodeGen.EncodingType = MessageEncodingType.Mtom;
                        hostedService.EncodingType = MessageEncodingType.Mtom;
                        clientProxy.EncodingType = MessageEncodingType.Mtom;
                    }

                    // Step through port operations, get method names and parse elements.
                    for (int pt_index = 0; pt_index < portType.Operations.Count; ++pt_index)
                    {
                        Operation operation = portType.Operations[pt_index];
                        string operationName = operation.Name;

                        string inputMessageName = null;
                        string outputMessageName = null;
                        MessagePartCollection inputMessageParts = null;
                        MessagePartCollection outputMessageParts = null;
                        string inAction = null;
                        string outAction = null;
                        GetAction(portType, operation, m_svcDesc.TargetNamespace, ref inAction, ref outAction);

                        // Oneway request port type
                        if (operation.Messages.Flow == OperationFlow.OneWay)
                        {
                            OperationInput input = operation.Messages.Input;
                            inputMessageName = input.Message.Name;

                            // Add operation for HostedService code generation
                            hostedService.AddOperation(operation, inAction, outAction);

                            // Add method for ClientProxy code generation
                            clientProxy.AddOperation(operation, inAction, outAction);
                        }
                        // Twoway request/response pattern
                        else if (operation.Messages.Flow == OperationFlow.RequestResponse)
                        {
                            OperationInput input = operation.Messages.Input;
                            inputMessageName = input.Message.Name;
                            OperationOutput output = operation.Messages.Output;
                            outputMessageName = output.Message.Name;

                            // Add operation for HostedService code generation
                            hostedService.AddOperation(operation, inAction, outAction);

                            // Add method for ClientProxy code generation
                            clientProxy.AddOperation(operation, inAction, outAction);
                        }
                        // Event pattern
                        else if (operation.Messages.Flow == OperationFlow.Notification)
                        {
                            OperationOutput output = operation.Messages.Output;
                            outputMessageName = output.Message.Name;

                            // Add operation for HostedService code generation
                            hostedService.AddOperation(operation, inAction, outAction);

                            // Add method for ClientProxy code generation
                            clientProxy.AddOperation(operation, inAction, outAction);
                        }

                        // Find input and output message parts collection in messages collection
                        // and store for later.
                        foreach (Message message in m_svcDesc.Messages)
                        {
                            if (inputMessageName != null)
                                if (message.Name == inputMessageName)
                                {
                                    inputMessageParts = message.Parts;

                                    // Add operation for HostedService code generation
                                    hostedService.Messages.Add(message);

                                    // Add Message to ClientProxy generator for later
                                    clientProxy.Messages.Add(message);
                                }

                            if (outputMessageName != null)
                                if (message.Name == outputMessageName)
                                {
                                    outputMessageParts = message.Parts;

                                    // Add operation for HostedService code generation
                                    hostedService.Messages.Add(message);

                                    // Add Message to ClientProxy generator for later
                                    clientProxy.Messages.Add(message);
                                }
                        }

                        try
                        {
                            // Try to generate Data Contracts and DataContractSerializers
                            GenerateTypeContracts(operation, inputMessageParts, outputMessageParts);

                            // If operation flow is notification (event) add OperationContract to ServiceContractCallback
                            // else add OperationContract to ServiceContract
                            if (operation.Messages.Flow == OperationFlow.Notification)
                            {
                                AddServiceOperationToInterface(operation, outAction, serviceCallbackCodeType);
                            }
                            else
                                AddServiceOperationToInterface(operation, inAction, serviceCodeType);
                        }
                        catch (Exception e)
                        {
                            dcStreamWriter.Close();
                            File.Delete(contractFilename);
                            Logger.WriteLine("Failed to generate service code. " + e.Message, LogLevel.Normal);
                            return;
                        }
                    }

                    // Add serviceCodeType Service Contract interface to namespace
                    // A serviceCodeType is added even if the wsdl only contains notifications. In that case
                    // the contract will be empty but the ServiceContract attribute and CallbackContract argument
                    // will be used to point to the notification or callback contract interace
                    targetNamespace.Types.Add(serviceCodeType);

                    // If service contract callback type contains members add callback contract to namespace
                    // and add CallbackContract reference attribute to serviceCodeType contract.
                    if (serviceCallbackCodeType.Members.Count > 0)
                    {
                        // Add the callback argument to the service description attribute
                        CodeAttributeArgument callbackArg = new CodeAttributeArgument("CallbackContract",
                            new CodeTypeOfExpression(serviceCallbackCodeType.Name)
                        );
                        serviceCodeType.CustomAttributes[0].Arguments.Add(callbackArg);

                        // Add the callback interface to namespace
                        targetNamespace.Types.Add(serviceCallbackCodeType);
                    }

                    // If the hosted service has opeations add to Hosted Services collection for Code Gen
                    if (hostedService.ServiceOperations.Count > 0)
                        hostedServices.Add(hostedService);

                    // If the client Proxy service has opeations add to client proxy collection for Code Gen
                    if (clientProxy.ServiceOperations.Count > 0)
                        clientProxies.Add(clientProxy);
                }

                // MOD: 12-02-08 Added code to handle multiple type namespaces
                // Generate contract source file
                foreach (CodeNamespace codeNamespace in compileUnit.Namespaces)
                {
                    codeGen.GenerateCodeFromNamespace(codeNamespace, dcStreamWriter, codeGenOptions);
                }
                dcStreamWriter.Flush();
                dcStreamWriter.Close();

                // Generate Hosted Service code
                Logger.WriteLine("Generating Hosted Service source: " + hostedServiceFilename + "...", LogLevel.Normal);
                HostedServiceGenerator hsGen = new HostedServiceGenerator();
                hsGen.GenerateCode(hostedServiceFilename, hostedServices);

                // Generate Client proxy code
                Logger.WriteLine("Generating Client Proxy source: " + clientProxyFilename + "...", LogLevel.Normal);
                ClientProxyGenerator cpGen = new ClientProxyGenerator();
                cpGen.GenerateCode(clientProxyFilename, clientProxies);
            }
            catch (Exception e)
            {
                dcStreamWriter.Close();
                File.Delete(contractFilename);
                Logger.WriteLine("Failed to generate service code. " + e.Message, LogLevel.Normal);
                throw new Exception("Failed to generate service code. ", e);
            }
        }
Пример #43
0
 /* public helper function */
 public void MapOverAllObjectsInBin(ClientProxy binProxyList, LQCallBackFunction func, Object clientQueryState)
 {
     // walk down proxy list, applying call-back function to each one
     while (binProxyList != null)
     {
         func(binProxyList.Obj, 0, clientQueryState);
         binProxyList = binProxyList.Next;
     }
 }
        static public void Execute(ClientProxy cp, string outputName, DateTime startDate)
        {
            var clientSession = cp.Session;
            

            var now = DateTime.Now; //Here replace by the Date at which you want to load the Trades
            SimpleDate fromDate = new SimpleDate(startDate);

            SimpleDate d2 = SimpleDate.Today;

            var x2 = d2 - fromDate;


            double days = (fromDate.ToDateTime() - d2.ToDateTime()).TotalDays;

            var cal = OrchestradeCommon.Util.CalendarHelper.Get("GBLO");

            const string filterName = "ClearedOTC_GrossNtl";
            const string setupName = "Symmetry";                // for market

            var filter = Env.Current.Trade.GetFilter(filterName) ??
                            new Filter { Name = "_AllCurrency_", Criteria = new List<FilterCriterion>() };

            DataTable tblOut = new DataTable("TimeSeries");
            tblOut.Columns.Add("Entity", typeof(string));
            tblOut.Columns.Add("Portfolio", typeof(string));
            tblOut.Columns.Add("Book", typeof(string));
            tblOut.Columns.Add("Strategy", typeof(string));
            tblOut.Columns.Add("Region", typeof(string));
            tblOut.Columns.Add("Date", typeof(DateTime));
            tblOut.Columns.Add("PositionDate", typeof(DateTime));
            tblOut.Columns.Add("ProductId", typeof(int));
            tblOut.Columns.Add("ProductDescription", typeof(string));
            tblOut.Columns.Add("Currency", typeof(string));
            tblOut.Columns.Add("UnderlierInfo", typeof(string));
            tblOut.Columns.Add("PricingType", typeof(string));
            tblOut.Columns.Add("TotalTradedQuantity", typeof(decimal));
            tblOut.Columns.Add("Current_Notional", typeof(decimal));
            tblOut.Columns.Add("Current_Notional_Base", typeof(decimal));

            tblOut.Columns.Add("MaturityDate", typeof(DateTime));
            tblOut.Columns.Add("ProcessingType", typeof(string));

            tblOut.Columns.Add("Ccp", typeof(decimal));
            tblOut.Columns.Add("Start_Date", typeof(DateTime));
            tblOut.Columns.Add("End_Date", typeof(DateTime));
            tblOut.Columns.Add("Fixed_Rate", typeof(double));
            tblOut.Columns.Add("PayOrReceive", typeof(string));
            tblOut.Columns.Add("Boxed_String1", typeof(string));
            tblOut.Columns.Add("Boxed_String2", typeof(string));
            tblOut.Columns.Add("Boxed_String3", typeof(string));
            tblOut.Columns.Add("Netting_String1", typeof(string));
            tblOut.Columns.Add("Netting_String2", typeof(string));
            tblOut.Columns.Add("Netting_String3", typeof(string));
            tblOut.Columns.Add("Tenor_Bucket", typeof(string));
            tblOut.Columns.Add("PFE_Factor", typeof(double));
            try
            {
                //Load Market First
                var setup = Env.Current.MarketData.GetPricingSetup(setupName);
                if (setup == null)
                {
                    Console.WriteLine("PricingSetup does not exist: " + setupName);
                    return;
                }
                while (fromDate.Year == 2015)
                {
                    if (!fromDate.IsBusinessDay(cal))
                    {
                        fromDate = fromDate.SubtractTenor(Tenor.Parse("1D"));
                        continue;
                    }
                    Console.WriteLine(fromDate.ToDateTime().ToString("dd MMM yyyy"));
                    var toDate = fromDate + 0;
                    var market = new Market {Setup = setup, Time = now};

                    var positions = LoadTradingPositions(filter, market, now, fromDate, toDate);
                    Console.WriteLine("Loading Trading Positions:");

                    var ccyList = getFxQuotes(fromDate, market, positions);


                    var outpos = positions.Select(p => new
                        object[]
                    {
                        p.Book.ParentName, // Entity
                        p.Book.Properties.ContainsKey("Portfolio") ? p.Book.Properties["Portfolio"] : string.Empty,
                        // Portfolio
                        p.Book.Code, // Book
                        p.Book.Properties.ContainsKey("Region") ? p.Book.Properties["Region"] : string.Empty,
                        // Strategy
                        p.Book.Properties.ContainsKey("Strategy") ? p.Book.Properties["Strategy"] : string.Empty,
                        // Region
                        p.Date.ToDateTime(), // Date
                        fromDate.ToDateTime(), // Position Date
                        p.ProductId, // Product Id
                        p.Product.Description, // Product Description
                        p.Product.Currency, // Currency
                        p.Product.UnderlierInfo, // Underlier Info
                        p.Product.PricingType, // Pricing Type
                        p.TotalTraded.Quantity, // Total Traded Quantity
                        Math.Abs(p.TotalTraded.Quantity), // Current Notional
                        // p.TotalTraded.Quantity * ccyList[p.Product.Currency],
                        Math.Abs(p.TotalTraded.Quantity*ccyList[p.Product.Currency]),
                        p.Product.ContractMaturity.ToDateTime(), // Maturity Date
                        p.Product.ProcessingType, // Processing Type
                        //** p.Product.Ccp, // CCP?
                        0,
                        p.Product.StartDate.ToDateTime(), // StartDate
                        p.Product.ContractMaturity.ToDateTime(), // End Date
                        p.Product.FixedRate, // Fixed Rate
                        PayOrReceive(p), // Pay / Rec
                        //Boxed String 1
                        string.Join(":",
                            new string[]
                            {
                                p.Product.Currency, p.Product.ProcessingType, p.Product.UnderlierInfo,
                                p.Product.StartDate.ToString(), p.Product.ContractMaturity.ToString(),
                                p.Book.Properties.ContainsKey("Portfolio")
                                    ? p.Book.Properties["Portfolio"]
                                    : string.Empty,
                                p.Book.Code
                            }),
                        //Boxed String 2
                        string.Join(":",
                            new string[]
                            {
                                p.Product.Currency, p.Product.ProcessingType, p.Product.UnderlierInfo,
                                p.Product.StartDate.ToString(), p.Product.ContractMaturity.ToString(),
                                p.Book.Properties.ContainsKey("Portfolio")
                                    ? p.Book.Properties["Portfolio"]
                                    : string.Empty,
                                p.Book.ParentName
                            }),
                        //Boxed String 3
                        string.Join(":",
                            new string[]
                            {
                                p.Product.Currency, p.Product.ProcessingType, p.Product.UnderlierInfo,
                                p.Product.StartDate.ToString(), p.Product.ContractMaturity.ToString(), p.Book.ParentName
                            }),
                        //Netting String 1
                        string.Join(":",
                            new string[]
                            {
                                p.Product.Currency, p.Product.ProcessingType, p.Product.StartDate.ToString(),
                                p.Product.ContractMaturity.ToString(), p.Product.FixedRate.ToString(),
                                p.Book.Properties.ContainsKey("Portfolio")
                                    ? p.Book.Properties["Portfolio"]
                                    : string.Empty,
                                p.Book.Code
                            }),
                        //Netting String 2
                        string.Join(":",
                            new string[]
                            {
                                p.Product.Currency, p.Product.ProcessingType, p.Product.StartDate.ToString(),
                                p.Product.ContractMaturity.ToString(), p.Product.FixedRate.ToString(),
                                p.Book.Properties.ContainsKey("Portfolio")
                                    ? p.Book.Properties["Portfolio"]
                                    : string.Empty,
                                p.Book.ParentName
                            }),
                        //Netting String 3
                        string.Join(":",
                            new string[]
                            {
                                p.Product.Currency, p.Product.ProcessingType, p.Product.StartDate.ToString(),
                                p.Product.ContractMaturity.ToString(), p.Product.FixedRate.ToString(), p.Book.ParentName
                            }),
                        TenorBucket(p),
                        TenorBucket(p) == ">5y" ? .05 : TenorBucket(p) == "1-5y" ? .005 : 0
                    });
                    foreach (var row in outpos)
                    {
                        tblOut.Rows.Add(row);
                    }


                    fromDate = fromDate.SubtractTenor(Tenor.Parse("1D"));
                }
                tblOut.WriteToCsvFile(outputName);

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

        }
        public static void GetRiskReportAndSaveData(ClientProxy cp, String runDate, String runTime, String strFilter, String setupName)
        {
            var intRunDate = 0;
            var atime = DateTime.Now;

            try
            {   
                intRunDate = Convert.ToInt32(Regex.Replace(runDate, "-", ""));
                if (intRunDate == 0)
                {
                    throw new Exception("RunDate is not valid!");
                }
            }
            catch (Exception e)
            {
                SLog.log.Error("Input string is not a sequence of digits.", e);
                throw new Exception("Please check RunDate");
            }

            SLog.log.InfoFormat("Process Risk result - get runDate: " + runDate);
            SLog.log.InfoFormat("Filter is {0}", strFilter);
            SLog.log.InfoFormat("Setup Name is {0}", setupName);

            SLog.log.InfoFormat("Run Risk Start");
            //Get the inputs
            var configName = "Default";
            var configItemNameS = "Base";
            var configItems = new[] { "FxExposureAnalysis" };
            if (!Utilities.IsNullOrEmpty(configItemNameS))
            {
                configItems = configItemNameS.Split('|');
            }

            if (!Utilities.IsNullOrEmpty(intRunDate + runTime))
            {
                DateTime.TryParseExact(intRunDate + runTime, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.None, out atime);
            }
            SLog.log.InfoFormat("Process Risk result - get atime: " + atime);

            var setup = Env.Current.MarketData.GetPricingSetup(setupName);
            if (setup == null)
            {
                SLog.log.Error("Setup " + setupName + " is not defined in the system");
                return;
            }
            var market = new Market { Setup = setup, Time = atime };

            var filterName = strFilter;

            var filter = Env.Current.Trade.GetFilter(filterName);
            if (filter == null)
            {
                SLog.log.Error("Filter " + filterName + " is not defined in the system");
                return;
            }

            ReportViewGroup aReportViewGroup = null;
            foreach (var configItemName in configItems)
            {
                aReportViewGroup = Run(configName, configItemName, market, filter, atime);
            }

            SLog.log.InfoFormat("Run Risk End");

            if (!object.ReferenceEquals(null, aReportViewGroup))
            {
                SLog.log.InfoFormat("Process Risk result Start");
                List<ReportViewItem> reportViewItemList = aReportViewGroup.reportViewItemList;
                Dictionary<long, Dictionary<string, double>> aReportViewItemByTradeBase = aReportViewGroup.reportViewItemByTradeBase;
                if (!object.ReferenceEquals(null, reportViewItemList) && !object.ReferenceEquals(null, aReportViewItemByTradeBase) && reportViewItemList.Count > 0 && aReportViewItemByTradeBase.Count>0)
                { 
                    SaveFxExposure(ProcessFxExposure(reportViewItemList, intRunDate), intRunDate);
                    SaveFxExposureDetail(ProcessFxExposureDetail(aReportViewItemByTradeBase, intRunDate), intRunDate);
                }
                SLog.log.InfoFormat("Process Risk result End");
            }
            else
            {
                SLog.log.Error("Empty GetRiskReportFX report returned");
            }
            SLog.log.InfoFormat("GetRiskReportFX Exposure Done");

        }
Пример #46
0
		/* Adds a given client obj to a given bin, linking it into the bin
		   contents list. */

	    private void AddToBin(ClientProxy obj, int binIndex)
		{
			/* if bin is currently empty */
			if (_bins[binIndex] == null)
			{
				obj.Prev = null;
				obj.Next = null;
			}
			else
			{
				obj.Prev = null;
				obj.Next = _bins[binIndex];
				_bins[binIndex].Prev = obj;
			}

			_bins[binIndex] = obj;

			/* record bin ID in proxy obj */
			obj.Bin = binIndex;
		}
 public void RemoveProxy(ClientProxy proxy)
 {
     proxyManager.RemoveProxy(proxy.GetServiceName(), proxy.GetName());
 }
 public virtual MvcResourceManagerBuilder DirectMethodProxy(ClientProxy value)
 {
     this.config.DirectMethodProxy = value;
     this.mgr.DirectMethodProxy = value;
     return this;
 }