public bool?UpdateApprovalForUsers(MembershipUserInfo[] users)
 {
     try
     {
         foreach (MembershipUserInfo user in users)
         {
             MembershipUser membershipUser = Membership.GetUser(user.UserName, user.IsOnline);
             membershipUser.IsApproved = user.IsApproved;
             if (membershipUser != null)
             {
                 Membership.UpdateUser(membershipUser);
             }
             else
             {
                 return(false);
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         ExceptionTrace.LogException(ex);
         string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString();
         throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message));
     }
 }
 private void OnStreamCompleted()
 {
     try
     {
         this.Reset();
     }
     catch (WebException webException1)
     {
         WebException   webException = webException1;
         ExceptionTrace exception    = Fx.Exception;
         object[]       absoluteUri  = new object[] { "WebStream.OnStreamCompleted uri: ", this.factoryEndpointUri.AbsoluteUri, " sbUri: ", this.sbUri };
         exception.TraceHandled(webException, string.Concat(absoluteUri), base.Activity);
     }
     catch (Exception exception2)
     {
         Exception exception1 = exception2;
         if (Fx.IsFatal(exception1))
         {
             throw;
         }
         ExceptionTrace exceptionTrace = Fx.Exception;
         object[]       objArray       = new object[] { "WebStream.OnStreamCompleted uri: ", this.factoryEndpointUri.AbsoluteUri, " sbUri: ", this.sbUri };
         exceptionTrace.TraceHandled(exception1, string.Concat(objArray), base.Activity);
     }
 }
Exemple #3
0
 public bool DeleteFairValues(EntitySelectionData entitySelectionData)
 {
     try
     {
         ExternalResearchEntities            entity = new ExternalResearchEntities();
         GreenField.DAL.GF_SECURITY_BASEVIEW data   = DimensionEntity.GF_SECURITY_BASEVIEW.Where(a => a.ISSUE_NAME == entitySelectionData.LongName).FirstOrDefault();
         if (data == null)
         {
             return(false);
         }
         int?securityId = int.Parse(data.SECURITY_ID);
         if (securityId == null)
         {
             return(false);
         }
         entity.DeleteDCFFairValueData(Convert.ToString(securityId));
         return(true);
     }
     catch (Exception ex)
     {
         ExceptionTrace.LogException(ex);
         string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString();
         throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message));
     }
 }
        public Boolean InsertMacroeconomicData(String countryCode, String field, int year, decimal?value, DateTime updateDate, String updateSource)
        {
            try
            {
                //ICPresentationEntities entity = new ICPresentationEntities();
                //Int32? result = entity.InsertMacroeconomic_Data(countryCode, field, year, value, updateDate, updateSource);

                Macroeconomic_Data macroeconomic_Data = new Macroeconomic_Data();
                macroeconomic_Data.COUNTRY_CODE  = countryCode;
                macroeconomic_Data.FIELD         = field;
                macroeconomic_Data.YEAR1         = year;
                macroeconomic_Data.VALUE         = value;
                macroeconomic_Data.UPDATE_DATE   = updateDate;
                macroeconomic_Data.UPDATE_SOURCE = updateSource;
                ExternalResearchEntity.Macroeconomic_Data.AddObject(macroeconomic_Data);
                int?result = ExternalResearchEntity.SaveChanges();
                return(result == 1);
            }
            catch (Exception ex)
            {
                ExceptionTrace.LogException(ex);
                string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString();
                throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message));
            }
        }
Exemple #5
0
 public List <PERIOD_FINANCIALS> RetrieveFairValue(EntitySelectionData entitySelectionData)
 {
     try
     {
         List <PERIOD_FINANCIALS>            result = new List <PERIOD_FINANCIALS>();
         GreenField.DAL.GF_SECURITY_BASEVIEW data   = DimensionEntity.GF_SECURITY_BASEVIEW.Where(a => a.ISSUE_NAME == entitySelectionData.LongName).FirstOrDefault();
         if (data == null)
         {
             return(new List <PERIOD_FINANCIALS>());
         }
         int?securityId = int.Parse(data.SECURITY_ID);
         if (securityId == null)
         {
             return(new List <PERIOD_FINANCIALS>());
         }
         ExternalResearchEntities entity = new ExternalResearchEntities();
         result = entity.GetDCFFairValue(Convert.ToString(securityId)).ToList();
         if (result == null)
         {
             return(new List <PERIOD_FINANCIALS>());
         }
         return(result);
     }
     catch (Exception ex)
     {
         ExceptionTrace.LogException(ex);
         string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString();
         throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message));
     }
 }
Exemple #6
0
        public bool InsertFairValues(EntitySelectionData entitySelectionData, string valueType, int?fvMeasure, decimal?fvbuy, decimal?fvSell, decimal?currentMeasureValue, decimal?upside, DateTime?updated)
        {
            try
            {
                ExternalResearchEntities            entity = new ExternalResearchEntities();
                GreenField.DAL.GF_SECURITY_BASEVIEW data   = DimensionEntity.GF_SECURITY_BASEVIEW.Where(a => a.ISSUE_NAME == entitySelectionData.LongName).FirstOrDefault();
                if (data == null)
                {
                    return(false);
                }
                int?securityId = int.Parse(data.SECURITY_ID);
                if (securityId == null)
                {
                    return(false);
                }
                if (valueType != null)
                {
                    valueType = valueType.ToUpper();
                }

                entity.InsertDCFFairValue(Convert.ToString(securityId), valueType, fvMeasure, fvbuy, fvSell, currentMeasureValue, upside, updated, "C", 0);
                return(true);
            }
            catch (Exception ex)
            {
                ExceptionTrace.LogException(ex);
                string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString();
                throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message));
            }
        }
Exemple #7
0
 internal ExceptionUtility(string name, string eventSourceName, object diagnosticTrace, object exceptionTrace)
 {
     this.diagnosticTrace = (LegacyDiagnosticTrace)diagnosticTrace;
     this.exceptionTrace  = (ExceptionTrace)exceptionTrace;
     this.name            = name;
     this.eventSourceName = eventSourceName;
 }
        public void HandleException_ValidLog_ExpectedTextIsReturned()
        {
            // Arrange
            var filters      = this.GetDefaultFilters();
            var output       = new ThreadCollectionOutputHandler(filters);
            var ex           = this.GenerateExceptionWithStackTrace();
            var entry        = new ExceptionTrace(ex, DateTime.Parse("2022-10-22 22:22:31.678"));
            var expectedText = String.Concat("".PadLeft(2, output.Formatter.IndentChar), "[Exception] 22:22:31.678 Attempted to divide by zero.");

            int threadId   = 22;
            var threadData = new ThreadData(threadId, "cotton", null);

            output.Initialise();

            // Act
            output.HandleThread(threadData);
            output.HandleException(entry, 1);
            output.Complete();

            // Assert
            var outputText = output.GetThreadEntries();

            Assert.That(outputText.Count, Is.EqualTo(1), "Expected one string entry to be returned");
            Assert.That(outputText[threadId][0], Is.EqualTo(expectedText), "Not the expected output text, you may need to adjust the test if the formatter has been changed.");
        }
Exemple #9
0
 public bool?SetDashboardPreference(ObservableCollection <tblDashboardPreference> dashBoardPreference, string userName)
 {
     try
     {
         ResearchEntities entity = new ResearchEntities();
         if (dashBoardPreference.Count > 0)
         {
             foreach (tblDashboardPreference item in dashBoardPreference)
             {
                 entity.SetDashBoardPreference(item.UserName, item.GadgetViewClassName, item.GadgetViewModelClassName, item.GadgetName, item.GadgetState, item.PreferenceGroupID, item.GadgetPosition);
             }
         }
         else
         {
             entity.SetDashBoardPreference(userName, "null", "null", "null", "null", "null", 0);
         }
         return(true);
     }
     catch (Exception ex)
     {
         ExceptionTrace.LogException(ex);
         string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString();
         throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message));
     }
 }
        public Task RegisterProcessorFactoryAsync(Lease lease, ICheckpointManager checkpointManager, IEventProcessorFactory eventProcessorFactory, EventProcessorOptions processorOptions)
        {
            base.ThrowIfDisposed();
            if (lease == null)
            {
                throw Fx.Exception.ArgumentNull("lease");
            }
            if (checkpointManager == null)
            {
                throw Fx.Exception.ArgumentNull("checkpointManager");
            }
            if (eventProcessorFactory == null)
            {
                throw Fx.Exception.ArgumentNull("eventProcessorFactory");
            }
            if (processorOptions == null)
            {
                throw Fx.Exception.ArgumentNull("processorOptions");
            }
            EventProcessorLifecycleManager eventProcessorLifecycleManager = null;

            if (this.handlers.TryGetValue(lease, out eventProcessorLifecycleManager))
            {
                ExceptionTrace exception = Fx.Exception;
                string         eventProcessorAlreadyRegistered = Resources.EventProcessorAlreadyRegistered;
                object[]       partitionId = new object[] { lease.PartitionId };
                throw exception.AsError(new InvalidOperationException(Microsoft.ServiceBus.SR.GetString(eventProcessorAlreadyRegistered, partitionId)), null);
            }
            eventProcessorLifecycleManager = new EventProcessorLifecycleManager(this, lease, checkpointManager, processorOptions);
            if (!this.handlers.TryAdd(lease, eventProcessorLifecycleManager))
            {
                return(TaskHelpers.GetCompletedTask <object>(null));
            }
            return(eventProcessorLifecycleManager.RegisterProcessorFactoryAsync(eventProcessorFactory));
        }
Exemple #11
0
        protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
        {
            IAsyncResult asyncResult;

            try
            {
                asyncResult = this.MessagingFactory.BeginClose(timeout, callback, state);
            }
            catch (MessagingException messagingException1)
            {
                MessagingException messagingException = messagingException1;
                throw Microsoft.ServiceBus.Messaging.FxTrace.Exception.AsError(this.ConvertException(messagingException), null);
            }
            catch (OperationCanceledException operationCanceledException1)
            {
                OperationCanceledException operationCanceledException = operationCanceledException1;
                ExceptionTrace             exception = Microsoft.ServiceBus.Messaging.FxTrace.Exception;
                string    entityClosedOrAborted      = SRClient.EntityClosedOrAborted;
                Exception innerException             = operationCanceledException.InnerException;
                if (innerException == null)
                {
                    innerException = operationCanceledException;
                }
                throw exception.AsError(new CommunicationObjectAbortedException(entityClosedOrAborted, innerException), null);
            }
            return(asyncResult);
        }
Exemple #12
0
 public Boolean UpdateDocumentsDataForUser(Int64 fileId, String fileName, String userName, String metaTags, String companyInfo
                                           , String categoryType, String comment, Byte[] overwriteStream)
 {
     try
     {
         ICPresentationEntities entity = new ICPresentationEntities();
         if (overwriteStream == null)
         {
             entity.UpdateDocumentsData(fileId, userName, metaTags, companyInfo, categoryType, comment);
         }
         else
         {
             FileMaster fileMaster = entity.FileMasters.Where(record => record.FileID == fileId).FirstOrDefault();
             if (fileMaster != null)
             {
                 String uploadUrl = UploadDocument(fileName, overwriteStream, fileMaster.Location);
                 Int32? result    = entity.SetUploadFileInfo(userName, fileName, uploadUrl, companyInfo, null, null
                                                             , categoryType, metaTags, comment).FirstOrDefault();
                 if (result == 0)
                 {
                     entity.DeleteFileMaster(fileMaster.FileID);
                 }
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         ExceptionTrace.LogException(ex);
         string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString();
         throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message));
     }
 }
Exemple #13
0
 internal ExceptionUtility(string name, string eventSourceName, object diagnosticTrace, object exceptionTrace)
 {
     this.diagnosticTrace = (LegacyDiagnosticTrace)diagnosticTrace;
     this.exceptionTrace = (ExceptionTrace)exceptionTrace;
     this.name = name;
     this.eventSourceName = eventSourceName;
 }
 private void SetWriteTimeOut(TimeSpan timeout, bool synchronous)
 {
     if (!synchronous)
     {
         this.SendTimeout = timeout;
         if (timeout == TimeSpan.MaxValue)
         {
             this.CancelSendTimer();
             return;
         }
         this.SendTimer.Set(timeout);
     }
     else
     {
         this.CancelSendTimer();
         if (timeout <= TimeSpan.Zero)
         {
             ExceptionTrace exception             = Fx.Exception;
             string         tcpConnectionTimedOut = Resources.TcpConnectionTimedOut;
             object[]       objArray = new object[] { timeout };
             throw exception.AsInformation(new TimeoutException(Microsoft.ServiceBus.SR.GetString(tcpConnectionTimedOut, objArray)), null);
         }
         if (BaseStreamConnection.UpdateTimeout(this.SendTimeout, timeout))
         {
             lock (this.ThisLock)
             {
                 this.ThrowIfClosed();
             }
             this.SendTimeout = timeout;
             return;
         }
     }
 }
Exemple #15
0
 private void SetWriteTimeout(TimeSpan timeout, bool synchronous)
 {
     if (!synchronous)
     {
         this.sendTimeout = timeout;
         if (timeout == TimeSpan.MaxValue)
         {
             this.CancelSendTimer();
             return;
         }
         this.SendTimer.Set(timeout);
     }
     else
     {
         this.CancelSendTimer();
         if (timeout <= TimeSpan.Zero)
         {
             ExceptionTrace exception             = Fx.Exception;
             string         tcpConnectionTimedOut = Resources.TcpConnectionTimedOut;
             object[]       objArray = new object[] { timeout };
             throw exception.TraceException <TimeoutException>(new TimeoutException(Microsoft.ServiceBus.SR.GetString(tcpConnectionTimedOut, objArray)), this.ExceptionEventType, this.Activity);
         }
         if (Microsoft.ServiceBus.Channels.SocketConnection.UpdateTimeout(this.sendTimeout, timeout))
         {
             lock (this.ThisLock)
             {
                 this.ThrowIfClosed();
                 this.socket.SendTimeout = Microsoft.ServiceBus.Common.TimeoutHelper.ToMilliseconds(timeout);
             }
             this.sendTimeout = timeout;
             return;
         }
     }
 }
Exemple #16
0
        protected override void OnOpen(TimeSpan timeout)
        {
            Microsoft.ServiceBus.Channels.IConnection connection;
            try
            {
                connection = this.connectionPoolHelper.EstablishConnection(timeout);
            }
            catch (TimeoutException timeoutException1)
            {
                TimeoutException timeoutException = timeoutException1;
                ExceptionTrace   exception        = Fx.Exception;
                string           timeoutOnOpen    = Resources.TimeoutOnOpen;
                object[]         objArray         = new object[] { timeout };
                throw exception.AsError(new TimeoutException(Microsoft.ServiceBus.SR.GetString(timeoutOnOpen, objArray), timeoutException), base.Activity);
            }
            bool flag = false;

            try
            {
                this.AcceptConnection(connection);
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    this.connectionPoolHelper.Abort();
                }
            }
        }
Exemple #17
0
        internal static void ValidateBufferBounds(int bufferSize, int offset, int size)
        {
            if (offset < 0)
            {
                throw Fx.Exception.AsError(new ArgumentOutOfRangeException("offset", (object)offset, Microsoft.ServiceBus.SR.GetString(Resources.ValueMustBeNonNegative, new object[0])), null);
            }
            if (offset > bufferSize)
            {
                ExceptionTrace exception = Fx.Exception;
                object         obj       = offset;
                string         offsetExceedsBufferSize = Resources.OffsetExceedsBufferSize;
                object[]       objArray = new object[] { bufferSize };
                throw exception.AsError(new ArgumentOutOfRangeException("offset", obj, Microsoft.ServiceBus.SR.GetString(offsetExceedsBufferSize, objArray)), null);
            }
            if (size <= 0)
            {
                throw Fx.Exception.AsError(new ArgumentOutOfRangeException("size", (object)size, Microsoft.ServiceBus.SR.GetString(Resources.ValueMustBePositive, new object[0])), null);
            }
            int num = bufferSize - offset;

            if (size > num)
            {
                ExceptionTrace exceptionTrace = Fx.Exception;
                object         obj1           = size;
                string         sizeExceedsRemainingBufferSpace = Resources.SizeExceedsRemainingBufferSpace;
                object[]       objArray1 = new object[] { num };
                throw exceptionTrace.AsError(new ArgumentOutOfRangeException("size", obj1, Microsoft.ServiceBus.SR.GetString(sizeExceedsRemainingBufferSpace, objArray1)), null);
            }
        }
Exemple #18
0
        public Boolean SendAlert(List <String> messageTo, List <String> messageCc, String messageBody, String messageSubject)
        {
            Boolean result = false;

            try
            {
                String networkWebmasterEmail = ConfigurationManager.AppSettings.Get("NetworkWebmasterEmail");

                String networkCredentialPassword = ConfigurationManager.AppSettings.Get("NetworkCredentialPassword");
                String networkCredentialUsername = ConfigurationManager.AppSettings.Get("NetworkCredentialUsername");
                String networkCredentialDomain   = Convert.ToString(ConfigurationManager.AppSettings.Get("NetworkCredentialDomain"));

                Int32  networkConnectionPort = Convert.ToInt32(ConfigurationManager.AppSettings.Get("NetworkConnectionPort"));
                String networkConnectionHost = Convert.ToString(ConfigurationManager.AppSettings.Get("NetworkConnectionHost"));

                MailMessage mm = new MailMessage();
                mm.From = new MailAddress(networkWebmasterEmail);

                foreach (String email in messageTo)
                {
                    mm.To.Add(new MailAddress(email));
                }

                foreach (String email in messageCc)
                {
                    mm.CC.Add(new MailAddress(email));
                }

                mm.Subject    = messageSubject;
                mm.Body       = messageBody;
                mm.IsBodyHtml = false;

                SmtpClient smtpClient = new SmtpClient();
                smtpClient.Host = networkConnectionHost;
                smtpClient.Port = networkConnectionPort;
                smtpClient.UseDefaultCredentials = true;
                smtpClient.EnableSsl             = true;

                NetworkCredential NetworkCred = new NetworkCredential();
                NetworkCred.UserName   = networkCredentialUsername;
                NetworkCred.Domain     = networkCredentialDomain;
                NetworkCred.Password   = networkCredentialPassword;
                smtpClient.Credentials = NetworkCred;

                ServicePointManager.ServerCertificateValidationCallback = delegate(object s
                                                                                   , X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); };

                smtpClient.Send(mm);
                result = true;
            }
            catch (Exception ex)
            {
                ExceptionTrace.LogException(ex);
                string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString();
                throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message));
            }

            return(result);
        }
            public SendAsyncResult(ServiceBusOutputChannel outputChannel, Message message, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state)
            {
                bool flag;
                bool flag1;

                this.outputChannel = outputChannel;
                outputChannel.AddHeadersTo(message);
                outputChannel.TraceSendingMessage(message);
                BrokeredMessage brokerMessage = null;

                try
                {
                    brokerMessage = outputChannel.ConvertToBrokerMessage(message, out this.bufferToReturn);
                    Microsoft.ServiceBus.Messaging.MessageSender messageSender = outputChannel.MessageSender;
                    BrokeredMessage[] brokeredMessageArray = new BrokeredMessage[] { brokerMessage };
                    if (base.SyncContinue(messageSender.BeginSend(brokeredMessageArray, timeout, base.PrepareAsyncCompletion(ServiceBusOutputChannel.SendAsyncResult.onSendComplete), this)))
                    {
                        base.Complete(true);
                    }
                }
                catch (MessagingException messagingException)
                {
                    CommunicationException communicationException = MessagingExceptionHelper.ConvertToCommunicationException(messagingException, out flag);
                    if (flag)
                    {
                        this.outputChannel.Fault();
                    }
                    throw Microsoft.ServiceBus.Messaging.FxTrace.Exception.AsError(communicationException, null);
                }
                catch (OperationCanceledException operationCanceledException1)
                {
                    OperationCanceledException operationCanceledException = operationCanceledException1;
                    MessagingException         innerException             = operationCanceledException.InnerException as MessagingException;
                    if (innerException != null)
                    {
                        MessagingExceptionHelper.ConvertToCommunicationException(innerException, out flag1);
                        if (flag1)
                        {
                            this.outputChannel.Fault();
                        }
                    }
                    ExceptionTrace exception             = Microsoft.ServiceBus.Messaging.FxTrace.Exception;
                    string         entityClosedOrAborted = SRClient.EntityClosedOrAborted;
                    Exception      innerException1       = operationCanceledException.InnerException;
                    if (innerException1 == null)
                    {
                        innerException1 = operationCanceledException;
                    }
                    throw exception.AsError(new CommunicationObjectAbortedException(entityClosedOrAborted, innerException1), null);
                }
                catch (Exception exception1)
                {
                    if (this.bufferToReturn != null)
                    {
                        this.outputChannel.ChannelFactory.BufferManager.ReturnBuffer(this.bufferToReturn);
                    }
                    throw;
                }
            }
        public string CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved)
        {
            try
            {
                MembershipCreateStatus status = new MembershipCreateStatus();
                Membership.CreateUser(username, password, email, passwordQuestion, passwordAnswer, isApproved, out status);

                switch (status)
                {
                case MembershipCreateStatus.DuplicateEmail:
                    return("DuplicateEmail");

                case MembershipCreateStatus.DuplicateProviderUserKey:
                    return("DuplicateProviderUserKey");

                case MembershipCreateStatus.DuplicateUserName:
                    return("DuplicateUserName");

                case MembershipCreateStatus.InvalidAnswer:
                    return("InvalidAnswer");

                case MembershipCreateStatus.InvalidEmail:
                    return("InvalidEmail");

                case MembershipCreateStatus.InvalidPassword:
                    return("InvalidPassword");

                case MembershipCreateStatus.InvalidProviderUserKey:
                    return("InvalidProviderUserKey");

                case MembershipCreateStatus.InvalidQuestion:
                    return("InvalidQuestion");

                case MembershipCreateStatus.InvalidUserName:
                    return("InvalidUserName");

                case MembershipCreateStatus.ProviderError:
                    return("ProviderError");

                case MembershipCreateStatus.Success:
                    return("Success");

                case MembershipCreateStatus.UserRejected:
                    return("UserRejected");

                default:
                    break;
                }

                return(null);
            }
            catch (Exception ex)
            {
                ExceptionTrace.LogException(ex);
                string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString();
                throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message));
            }
        }
Exemple #21
0
        public List <DocumentCategoricalData> RetrieveDocumentsDataForUser(String userName)
        {
            try
            {
                List <DocumentCategoricalData> result = new List <DocumentCategoricalData>();
                ICPresentationEntities         entity = new ICPresentationEntities();
                List <FileMaster> data = entity.FileMasters.Where(record => record.CreatedBy == userName).ToList();
                if (data == null)
                {
                    return(result);
                }

                foreach (FileMaster fileMasterRecord in data)
                {
                    DocumentCatalogData documentCatalogData = new DocumentCatalogData()
                    {
                        FileId         = fileMasterRecord.FileID,
                        FileMetaTags   = fileMasterRecord.MetaTags,
                        FileName       = fileMasterRecord.Name,
                        FilePath       = fileMasterRecord.Location,
                        FileUploadedBy = fileMasterRecord.CreatedBy,
                        FileUploadedOn = Convert.ToDateTime(fileMasterRecord.CreatedOn)
                    };

                    List <CommentInfo>    commentInfo    = fileMasterRecord.CommentInfoes.ToList();
                    List <CommentDetails> commentDetails = new List <CommentDetails>();
                    foreach (CommentInfo info in commentInfo)
                    {
                        commentDetails.Add(new CommentDetails()
                        {
                            Comment   = info.Comment,
                            CommentBy = info.CommentBy,
                            CommentOn = Convert.ToDateTime(info.CommentOn)
                        });
                    }

                    result.Add(new DocumentCategoricalData()
                    {
                        CommentDetails         = commentDetails,
                        DocumentCatalogData    = documentCatalogData,
                        DocumentCategoryType   = (DocumentCategoryType)EnumUtils.ToEnum(fileMasterRecord.Type, typeof(DocumentCategoryType)),
                        DocumentCompanyName    = fileMasterRecord.IssuerName,
                        DocumentSecurityName   = fileMasterRecord.SecurityName,
                        DocumentSecurityTicker = fileMasterRecord.SecurityTicker
                    });
                }

                return(result);
            }
            catch (Exception ex)
            {
                ExceptionTrace.LogException(ex);
                string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString();
                throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message));
            }
        }
Exemple #22
0
        public List <DCFTerminalValueCalculationsData> RetrieveTerminalValueCalculationsData(EntitySelectionData entitySelectionData)
        {
            try
            {
                List <DCFTerminalValueCalculationsData> result        = new List <DCFTerminalValueCalculationsData>();
                Dictionary <string, decimal?>           dataROIC_SDPR = new Dictionary <string, decimal?>();
                List <DCFCashFlowData> cashFlowResult = new List <DCFCashFlowData>();
                string issuerId;
                ExternalResearchEntities entity = new ExternalResearchEntities();
                if (entitySelectionData == null)
                {
                    return(new List <DCFTerminalValueCalculationsData>());
                }

                /*#region ServiceAvailabilityChecker
                 *
                 * bool isServiceUp;
                 * isServiceUp = CheckServiceAvailability.ServiceAvailability();
                 * if (!isServiceUp)
                 * {
                 *  throw new Exception("Services are not available");
                 * }
                 #endregion*/

                GreenField.DAL.GF_SECURITY_BASEVIEW securityDetails = DimensionEntity.GF_SECURITY_BASEVIEW
                                                                      .Where(record => record.ASEC_SEC_SHORT_NAME == entitySelectionData.InstrumentID &&
                                                                             record.ISSUE_NAME == entitySelectionData.LongName &&
                                                                             record.TICKER == entitySelectionData.ShortName).FirstOrDefault();

                issuerId = securityDetails.ISSUER_ID;
                if (issuerId == null)
                {
                    return(new List <DCFTerminalValueCalculationsData>());
                }
                decimal longTermGDPGrowth             = Convert.ToDecimal(entity.GetDCFGDP(Convert.ToString(securityDetails.ISO_COUNTRY_CODE)).FirstOrDefault());
                DCFTerminalValueCalculationsData data = new DCFTerminalValueCalculationsData();
                dataROIC_SDPR = GetROIC(issuerId);
                if (dataROIC_SDPR.ContainsKey("ROIC"))
                {
                    data.SustainableROIC = dataROIC_SDPR.Where(a => a.Key == "ROIC").Select(a => a.Value).FirstOrDefault();
                }
                if (dataROIC_SDPR.ContainsKey("SDPR"))
                {
                    data.SustainableDividendPayoutRatio = Convert.ToDecimal(dataROIC_SDPR.Where(a => a.Key == "SDPR").Select(a => a.Value).FirstOrDefault());
                }
                data.LongTermNominalGDPGrowth = longTermGDPGrowth;
                result.Add(data);
                return(result);
            }
            catch (Exception ex)
            {
                ExceptionTrace.LogException(ex);
                string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString();
                throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message));
            }
        }
            private static bool OnSendComplete(IAsyncResult result)
            {
                bool flag;
                bool flag1;
                bool flag2;

                ServiceBusOutputChannel.SendAsyncResult asyncState = (ServiceBusOutputChannel.SendAsyncResult)result.AsyncState;
                try
                {
                    try
                    {
                        asyncState.outputChannel.MessageSender.EndSend(result);
                        flag2 = true;
                    }
                    catch (MessagingException messagingException)
                    {
                        CommunicationException communicationException = MessagingExceptionHelper.ConvertToCommunicationException(messagingException, out flag);
                        if (flag)
                        {
                            asyncState.outputChannel.Fault();
                        }
                        throw Microsoft.ServiceBus.Messaging.FxTrace.Exception.AsError(communicationException, null);
                    }
                    catch (OperationCanceledException operationCanceledException1)
                    {
                        OperationCanceledException operationCanceledException = operationCanceledException1;
                        MessagingException         innerException             = operationCanceledException.InnerException as MessagingException;
                        if (innerException != null)
                        {
                            MessagingExceptionHelper.ConvertToCommunicationException(innerException, out flag1);
                            if (flag1)
                            {
                                asyncState.outputChannel.Fault();
                            }
                        }
                        ExceptionTrace exception             = Microsoft.ServiceBus.Messaging.FxTrace.Exception;
                        string         entityClosedOrAborted = SRClient.EntityClosedOrAborted;
                        Exception      innerException1       = operationCanceledException.InnerException;
                        if (innerException1 == null)
                        {
                            innerException1 = operationCanceledException;
                        }
                        throw exception.AsError(new CommunicationObjectAbortedException(entityClosedOrAborted, innerException1), null);
                    }
                }
                finally
                {
                    if (asyncState.bufferToReturn != null)
                    {
                        asyncState.outputChannel.ChannelFactory.BufferManager.ReturnBuffer(asyncState.bufferToReturn);
                    }
                }
                return(flag2);
            }
Exemple #24
0
        public void ExceptionTrace_Rountrip()
        {
            // arrange
            var entry = new ExceptionTrace(new Exception("test"), DateTime.Now);

            // act
            var deserialized = SerializationRoundtrip(entry);

            // assert
            Assert.IsNotNull(deserialized);
        }
Exemple #25
0
        private void TraceExceptionInternal(Exception exception)
        {
            if (exception == null)
            {
                return;
            }

            var entry = new ExceptionTrace(exception, DateTime.Now);

            Record(entry);
        }
Exemple #26
0
        public List <FreeCashFlowsData> RetrieveFreeCashFlowsData(EntitySelectionData entitySelectionData)
        {
            try
            {
                List <FreeCashFlowsData>       result            = new List <FreeCashFlowsData>();
                List <GetFreeCashFlows_Result> resultDB          = new List <GetFreeCashFlows_Result>();
                ExternalResearchEntities       dcf_FreeCashFlows = new ExternalResearchEntities();

                if (entitySelectionData == null)
                {
                    return(null);
                }

                DimensionEntities entity = DimensionEntity;

                /*  bool isServiceUp;
                 * isServiceUp = CheckServiceAvailability.ServiceAvailability();
                 *
                 * if (!isServiceUp)
                 *    throw new Exception("Services are not available");*/

                //Retrieving data from security view
                GreenField.DAL.GF_SECURITY_BASEVIEW data = entity.GF_SECURITY_BASEVIEW
                                                           .Where(record => record.TICKER == entitySelectionData.ShortName &&
                                                                  record.ISSUE_NAME == entitySelectionData.LongName &&
                                                                  record.ASEC_SEC_SHORT_NAME == entitySelectionData.InstrumentID &&
                                                                  record.SECURITY_TYPE == entitySelectionData.SecurityType)
                                                           .FirstOrDefault();

                if (data == null)
                {
                    return(null);
                }
                ////Retrieving data from Period Financials table
                resultDB = dcf_FreeCashFlows.ExecuteStoreQuery <GetFreeCashFlows_Result>("exec GetFreeCashFlows @IssuerID={0}", data.ISSUER_ID).ToList();

                foreach (GetFreeCashFlows_Result record in resultDB)
                {
                    FreeCashFlowsData item = new FreeCashFlowsData();
                    item.FieldName  = record.FIELD_NAME;
                    item.PeriodYear = record.PERIOD_YEAR;
                    item.Amount     = record.AMOUNT;
                    result.Add(item);
                }
                return(result);
            }
            catch (Exception ex)
            {
                ExceptionTrace.LogException(ex);
                string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString();
                throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message));
            }
        }
Exemple #27
0
        public List <DCFSummaryData> RetrieveSummaryData(EntitySelectionData entitySelectionData)
        {
            try
            {
                List <DCFSummaryData>    result         = new List <DCFSummaryData>();
                List <DCFSummaryDBData>  dbResult       = new List <DCFSummaryDBData>();
                List <DCFSummaryDBData>  dbResultShares = new List <DCFSummaryDBData>();
                ExternalResearchEntities entity         = new ExternalResearchEntities();
                if (entitySelectionData == null)
                {
                    return(new List <DCFSummaryData>());
                }

                /*  #region ServiceAvailabilityChecker
                 *
                 * bool isServiceUp;
                 * isServiceUp = CheckServiceAvailability.ServiceAvailability();
                 *
                 * if (!isServiceUp)
                 * {
                 *    throw new Exception("Services are not available");
                 * }
                 #endregion*/

                GreenField.DAL.GF_SECURITY_BASEVIEW securityDetails = DimensionEntity.GF_SECURITY_BASEVIEW
                                                                      .Where(record => record.ASEC_SEC_SHORT_NAME == entitySelectionData.InstrumentID &&
                                                                             record.ISSUE_NAME == entitySelectionData.LongName &&
                                                                             record.TICKER == entitySelectionData.ShortName).FirstOrDefault();

                string issuerId = securityDetails.ISSUER_ID;
                if (issuerId == null)
                {
                    return(new List <DCFSummaryData>());
                }
                dbResult       = entity.GetDCFSummaryData(issuerId).ToList();
                dbResultShares = entity.GetDCF_NumberOfShares(Convert.ToString(securityDetails.SECURITY_ID)).ToList();
                DCFSummaryData data = new DCFSummaryData();
                data.Cash           = dbResult.Where(a => a.DATA_ID == 255).Select(a => a.AMOUNT).FirstOrDefault();
                data.FVInvestments  = dbResult.Where(a => a.DATA_ID == 258).Select(a => a.AMOUNT).FirstOrDefault();
                data.GrossDebt      = dbResult.Where(a => a.DATA_ID == 256).Select(a => a.AMOUNT).FirstOrDefault();
                data.FVMinorities   = dbResult.Where(a => a.DATA_ID == 257).Select(a => a.AMOUNT).FirstOrDefault();
                data.NumberOfShares = dbResultShares.Select(a => a.AMOUNT).FirstOrDefault();
                result.Add(data);
                return(result);
            }
            catch (Exception ex)
            {
                ExceptionTrace.LogException(ex);
                string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString();
                throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message));
            }
        }
 public bool?DeleteRole(string username, bool throwOnPopulatedRole)
 {
     try
     {
         return(Roles.DeleteRole(username, throwOnPopulatedRole));
     }
     catch (Exception ex)
     {
         ExceptionTrace.LogException(ex);
         string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString();
         throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message));
     }
 }
Exemple #29
0
 public Session GetSession()
 {
     try
     {
         return(System.Web.HttpContext.Current.Session["Session"] as Session);
     }
     catch (Exception ex)
     {
         ExceptionTrace.LogException(ex);
         string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString();
         throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message));
     }
 }
 public bool?ValidateUser(string username, string password)
 {
     try
     {
         return(Membership.ValidateUser(username, password));
     }
     catch (Exception ex)
     {
         ExceptionTrace.LogException(ex);
         string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString();
         throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message));
     }
 }
 public string[] GetRolesForUser(string username)
 {
     try
     {
         return(Roles.GetRolesForUser(username));
     }
     catch (Exception ex)
     {
         ExceptionTrace.LogException(ex);
         string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString();
         throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message));
     }
 }
Exemple #32
0
 internal ExceptionUtility(string name, string eventSourceName, object exceptionTrace)
 {
     _exceptionTrace = (ExceptionTrace)exceptionTrace;
     _name = name;
     _eventSourceName = eventSourceName;
 }