private DispatchedMessageInfo BuildDispatchMessageInfo(MessageItem message, PlanData planData, VisitData visitData)
 {
     MessageStateInfo info = new MessageStateInfo(message);
     DispatchedMessageInfo info3 = new DispatchedMessageInfo();
     info3.ID = info.ID;
     info3.Name = info.Name;
     info3.MessageType = info.Type;
     info3.Date = info.StartDate;
     info3.State = info.Status;
     DispatchedMessageInfo info2 = info3;
     if (planData != null)
     {
         DateTime time;
         DateTime time2;
         PlanStatistics planStatistics = AnalyticsFactory.Instance.GetPlanStatistics(planData);
         AnalyticsHelper.TryGetCampaignDates(message.CampaignId.ToGuid(), out time, out time2);
         info2.Sent = (time != time2) ? planStatistics.GetTotal() : 0;
         info2.OpenRate = planStatistics.GetOpenRate();
         info2.ClickRate = planStatistics.GetClickRate();
     }
     if (visitData != null)
     {
         info2.ValuePerVisit = visitData.ValuePerVisit;
         info2.Value = visitData.Value;
     }
     return info2;
 }
예제 #2
0
        public void ShowMessage(MessageItem message)
        {
            var messageBox = new IOPMessageBox(Application.Current.MainWindow);
            messageBox.DataContext = message;
            var result = messageBox.ShowDialog();

            if (message.Callback != null)
            {
                message.Callback(new MessageResult(result.Value));
            }
        }
예제 #3
0
    public MessageItem AddMessage(MessageItem item)
    {
        this.messages.Add(item);
        if(!pauseAutoScroll) {
            scrollPosition.y = lastTotalMessageHeight;
        }

        if(useCustomStyle)
            item.style = skin.GetStyle("messageitem");
        else
            item.style = skin.label;

        return item;
    }
예제 #4
0
 /// <summary>
 /// Displays all the buttons
 /// </summary>
 /// <param name="item">The item to display</param>
 private void DisplayButtons(MessageItem item)
 {
     switch (item.buttons)
     {
         case MessageBoxButtons.AbortRetryIgnore:
             GUI.SetNextControlName("Button1");
             Button(new Rect(5, messageBoxRect.height - 30, 50, 25), "Abort", DialogResult.Abort);
             GUI.SetNextControlName("Button2");
             Button(new Rect(60, messageBoxRect.height - 30, 50, 25), "Retry", DialogResult.Retry);
             GUI.SetNextControlName("Button3");
             Button(new Rect(115, messageBoxRect.height - 30, 55, 25), "Ignore", DialogResult.Ignore);
             break;
         case MessageBoxButtons.RetryCancel:
             GUI.SetNextControlName("Button1");
             Button(new Rect(5, messageBoxRect.height - 30, 50, 25), "Retry", DialogResult.Retry);
             GUI.SetNextControlName("Button2");
             Button(new Rect(60, messageBoxRect.height - 30, 55, 25), "Cancel", DialogResult.Cancel);
             break;
         case MessageBoxButtons.YesNoCancel:
             GUI.SetNextControlName("Button1");
             Button(new Rect(5, messageBoxRect.height - 30, 50, 25), "Yes", DialogResult.Yes);
             GUI.SetNextControlName("Button2");
             Button(new Rect(60, messageBoxRect.height - 30, 50, 25), "No", DialogResult.No);
             GUI.SetNextControlName("Button3");
             Button(new Rect(115, messageBoxRect.height - 30, 55, 25), "Cancel", DialogResult.Cancel);
             break;
         case MessageBoxButtons.YesNo:
             GUI.SetNextControlName("Button1");
             Button(new Rect(5, messageBoxRect.height - 30, 50, 25), "Yes", DialogResult.Yes);
             GUI.SetNextControlName("Button2");
             Button(new Rect(60, messageBoxRect.height - 30, 50, 25), "No", DialogResult.No);
             break;
         case MessageBoxButtons.OKCancel:
             GUI.SetNextControlName("Button1");
             Button(new Rect(5, messageBoxRect.height - 30, 50, 25), "Ok", DialogResult.Ok);
             GUI.SetNextControlName("Button2");
             Button(new Rect(60, messageBoxRect.height - 30, 55, 25), "Cancel", DialogResult.Cancel);
             break;
         case MessageBoxButtons.OK:
             GUI.SetNextControlName("Button1");
             Button(new Rect(messageBoxRect.width - 55, messageBoxRect.height - 30, 50, 25), "Ok", DialogResult.Ok);
             break;
         default:
             GUI.SetNextControlName("Button1");
             Button(new Rect(5, messageBoxRect.height - 30, 50, 25), "Close", DialogResult.None);
             break;
     }
     GUI.FocusControl(item.defaultButton.ToString());
 }
        private void QueryAndPrint()
        {
            try
            {
                FlyingMessageContext.Current = context;

                var configRepository = IocContainer.Container.Resolve<IConfigRepository>();
                var tradeService = IocContainer.Container.Resolve<ITradeService>();
                using (var printerService = IocContainer.Container.Resolve<IPrinterService>())
                {

                    printerService.InitializePrinter(new PrinterParameter()
                    {
                        Type = PrinterType.USB,
                        EncodingName = configRepository.PrinterEncodingName
                    });

                    var queryRule = new QueryRule()
                    {
                        PayType = PayTypeLite.All,
                        Status = TradeStatusLite.ToSend,
                        EndTime = DateTime.MinValue
                    };


                    while (true)
                    {
                        queryRule.StartTime = configRepository.QueryTime;

                        var trades = tradeService.GetAllTrades(queryRule, printerService.LastPrintedTrades);

                        if (trades != null && trades.Length > 0)
                        {
                            Message = new MessageItem(MessageLevel.Info, null, "trades.count:" + trades.Length);

                            foreach (var item in trades)
                            {
                                printerService.Print(item);

                                if (item.Created > queryRule.StartTime)
                                {
                                    queryRule.StartTime = item.Created;
                                }
                            }

                            printerService.Update();

                            configRepository.QueryTime = queryRule.StartTime;
                            configRepository.Update();
                        }
                        else
                        {
                            Thread.Sleep(configRepository.QueryInterval * 1000);
                        }
                    }
                }
            }
            catch(Exception ex)
            {
                LoggerUtility.WriteMessage(Severity.Error,
                    I18NUtility.GetString("I18N_QueryAndPrintFailed"), ex);
                Message = new MessageItem(MessageLevel.Error, null, 
                    I18NUtility.GetString("I18N_QueryAndPrintFailed", ex.Message));
            }
        }
예제 #6
0
        private void Login(bool saveCredential)
        {
            FlyingMessageContext context = null;
            var authorised = false;
            Exception exception = null;

            try
            {
                var loginService = IocContainer.Container.Resolve<ILoginService>();
                var config = IocContainer.Container.Resolve<IConfigRepository>();

                FlyingMessageContext.Current.HostUrl = config.HostUrl;
                FlyingMessageContext.Current.LoginName = userName;
                FlyingMessageContext.Current.Password = password.SecurePassword;

                context = FlyingMessageContext.Current;

                if (loginService.Login())
                {
                    if (saveCredential)
                    {
                        config.UserName = userName;
                        config.RememberAccount = rememberPassword;
                        if (rememberPassword)
                        {
                            var cryptographyService = IocContainer.Container.Resolve<ICryptographyService>();
                            config.EncryptedPassword = cryptographyService.Protect(
                                password.SecurePassword.ConvertToString());
                            config.RememberAccount = rememberPassword;
                        }
                        else
                        {
                            config.EncryptedPassword = string.Empty;
                        }
                        config.Update();
                    }
                    authorised = true;
                }
                else
                {
                    Message = new MessageItem(MessageLevel.Error,
                        I18NUtility.GetString("I18N_MessageBoxTitle"),
                        I18NUtility.GetString("I18N_LoginFailed"));
                }
            }
            catch(Exception ex)
            {
                exception = ex;
                LoggerUtility.WriteMessage(Severity.Error, 
                    I18NUtility.GetString("I18N_LoginFailedWithDetails"), ex);

                Message = new MessageItem(MessageLevel.Error,
                        I18NUtility.GetString("I18N_MessageBoxTitle"),
                        I18NUtility.GetString("I18N_LoginFailedWithDetails", ex.Message));
            }
            finally
            {
                FlyingMessageContext.Current = null;
            }

            var eventArgs = new AuthenticationCompletedEventArgs(context, authorised, exception);
            OnAuthenticationCompleted(eventArgs);
        }
 private TrickleInfo GetTrickleInfo(MessageItem message, VisitData visitData, PlanData planData)
 {
     MessageStateInfo messageStateInfo = this.GetMessageStateInfo(message);
     TrickleInfo info3 = new TrickleInfo();
     info3.ID = messageStateInfo.ID;
     info3.Name = messageStateInfo.Name;
     info3.HasAbn = messageStateInfo.HasAbn;
     TrickleInfo info2 = info3;
     int emailCount = -1;
     if (planData != null)
     {
         PlanStatistics planStatistics = this.analyticsFactory.GetPlanStatistics(planData);
         info2.OpenRate = planStatistics.GetOpenRate();
         info2.Recipients = planStatistics.GetTotal();
         emailCount = planStatistics.GetActual();
     }
     if (visitData != null)
     {
         info2.ValuePerVisit = visitData.ValuePerVisit;
         if (emailCount > -1)
         {
             info2.ValuePerEmail = this.analyticsFactory.GetVisitStatistics(visitData).GetValuePerEmail(emailCount);
         }
     }
     return info2;
 }
예제 #8
0
파일: InspWrap.cs 프로젝트: ProjectECS/ECS
        private void ForwardEmbeddedECS(MessageItem msg, string recips, Account account)
        {
            string pointerString;
            string serverName;
            string serverPort;
            string encryptKey2;
            string userAgent;
            Utils.GetChiaraHeaders(msg, out pointerString, out serverName, out serverPort, out encryptKey2, out userAgent);
            var sender = msg.Sender.SMTPAddress;
            var config = account.Configurations.Values.
                First(cfg => cfg.Server.Equals(serverName,
                    StringComparison.CurrentCultureIgnoreCase));
            if (string.IsNullOrEmpty(sender))
            {
                Logger.Warning("ForwardEmbeddedECS", string.Format(
                    "failed to retrieve sender for {0}, skipping call to AddRecipients",
                    msg.Subject));
                return;
            }

            if (string.IsNullOrEmpty(pointerString))
            {
                Logger.Warning("ForwardEmbeddedECS", string.Format(
                    "failed to retrieve pointer(s) for {0}, skipping call to AddRecipients",
                    msg.Subject));
                return;
            }
            var pointers = pointerString.Split(new char[' ']);
            foreach (var pointer in pointers)
            {
                string error;
                ContentHandler.AddRecipients(account.SMTPAddress, config,
                    sender, pointer, serverName, serverPort, recips, out error);
            }
        }
 private int GetTestValueIndex(MessageItem message, int testCandidateIndex)
 {
     AbnTest abnTest = CoreFactory.Instance.GetAbnTest(message);
     if (((abnTest == null) || (abnTest.TestDefinition == null)) || (abnTest.TestDefinition.Variables.Count == 0))
     {
         return 0;
     }
     List<PageLevelTestValueItem> values = abnTest.TestDefinition.Variables[0].Values;
     if (values.Count == 0)
     {
         return 0;
     }
     PageLevelTestValueItem winner = values[testCandidateIndex] ?? values[0];
     return abnTest.TestCandidates.FindIndex(delegate(Item v)
     {
         return v.ID == winner.Datasource.TargetID;
     });
 }
예제 #10
0
        private bool BindItemAndShowDialog(Event eventItem, string type)
        {
            MessageItem messageItem = null;
            bool        result;

            try
            {
                messageItem = Item.BindAsMessage(base.UserContext.MailboxSession, eventItem.ObjectId);
                if (messageItem != null)
                {
                    string text = ItemUtility.GetProperty <string>(messageItem, StoreObjectSchema.ItemClass, null);
                    if (text == null)
                    {
                        text = "IPM.Note";
                    }
                    this.Writer.Write("shwNwItmDlg(\"");
                    if (messageItem.From != null && messageItem.From.DisplayName != null)
                    {
                        Utilities.JavascriptEncode(Utilities.HtmlEncode(messageItem.From.DisplayName), this.Writer);
                    }
                    this.Writer.Write("\",\"");
                    if (messageItem.Subject != null)
                    {
                        Utilities.JavascriptEncode(Utilities.HtmlEncode(messageItem.Subject), this.Writer);
                    }
                    this.Writer.Write("\",\"" + type + "\",\"");
                    using (StringWriter stringWriter = new StringWriter())
                    {
                        SmallIconManager.RenderItemIcon(stringWriter, base.UserContext, text, false, "nwItmImg", new string[0]);
                        Utilities.JavascriptEncode(stringWriter.ToString(), this.Writer);
                    }
                    this.Writer.Write("\");");
                }
                result = true;
            }
            catch (ObjectNotFoundException)
            {
                if (type != null)
                {
                    if (!(type == "lnkNwMl"))
                    {
                        if (!(type == "lnkNwVMl"))
                        {
                            if (type == "lnkNwFx")
                            {
                                this.Writer.Write("shwNF(0);");
                            }
                        }
                        else
                        {
                            this.Writer.Write("shwNVM(0);");
                        }
                    }
                    else
                    {
                        this.Writer.Write("shwNM(0);");
                    }
                }
                result = false;
            }
            finally
            {
                if (messageItem != null)
                {
                    messageItem.Dispose();
                }
            }
            return(result);
        }
 // Token: 0x06001678 RID: 5752 RVA: 0x0007EC98 File Offset: 0x0007CE98
 protected override void HandleEventInternal(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item, List <KeyValuePair <string, object> > customDataToLog)
 {
     if (this.InternalIsEventInteresting(mapiEvent) && itemStore != null && item != null)
     {
         MessageItem messageItem = item as MessageItem;
         if (messageItem == null)
         {
             RecipientDLExpansionEventBasedAssistant.Tracer.TraceWarning((long)this.GetHashCode(), "The item being processed is not a message item.");
             return;
         }
         RecipientDLExpansionEventBasedAssistant.Tracer.TraceDebug <Guid, StoreObjectId, string>((long)this.GetHashCode(), "Processing mailbox guid: {0} and message id: {1} with subject: '{2}'", itemStore.MailboxGuid, messageItem.StoreObjectId, messageItem.Subject);
         StorageGlobals.EventLogger.LogEvent(StorageEventLogConstants.Tuple_RecipientDLExpansionIsProcessing, null, new object[]
         {
             messageItem.StoreObjectId,
             messageItem.Subject,
             itemStore.MailboxGuid
         });
         bool flag  = false;
         bool flag2 = true;
         try
         {
             ADUser adUser = DirectoryHelper.ReadADRecipient(itemStore.MailboxOwner.MailboxInfo.MailboxGuid, itemStore.MailboxOwner.MailboxInfo.IsArchive, itemStore.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid)) as ADUser;
             bool   flag3  = this.IsFlightingFeatureEnabled(adUser) || RecipientDLExpansionEventBasedAssistantHelper.IsRecipientDLExpansionTestHookEnabled();
             RecipientDLExpansionEventBasedAssistantHelper.GetComplianceMaxExpansionDGRecipientsAndNestedDGs(itemStore.OrganizationId, out this.maxDGExpansionRecipients, out this.maxExpansionNestedDGs);
             if (flag3 && this.maxDGExpansionRecipients != 0U)
             {
                 flag2 = false;
                 this.PerformDLExpansionOnItemRecipients(itemStore, messageItem, ref flag2);
             }
             else
             {
                 RecipientDLExpansionEventBasedAssistant.Tracer.TraceDebug <StoreObjectId, Guid, OrganizationId>((long)this.GetHashCode(), "Per tenant configuration or flighting framework, DL expansion is disabled, skip processing message id: {0}, mailbox guid: {1}, tenant: {2}", messageItem.StoreObjectId, itemStore.MailboxGuid, itemStore.OrganizationId);
                 StorageGlobals.EventLogger.LogEvent(StorageEventLogConstants.Tuple_RecipientDLExpansionSkipped, null, new object[]
                 {
                     messageItem.StoreObjectId,
                     itemStore.MailboxGuid,
                     itemStore.OrganizationId
                 });
             }
         }
         catch (Exception ex)
         {
             RecipientDLExpansionEventBasedAssistant.Tracer.TraceError((long)this.GetHashCode(), "Exception when updating the item with id: {0}, mailbox guid: {1}, tenant: {2}.\n\nThe exception is : {3}", new object[]
             {
                 messageItem.StoreObjectId,
                 itemStore.MailboxGuid,
                 itemStore.OrganizationId,
                 ex
             });
             StorageGlobals.EventLogger.LogEvent(StorageEventLogConstants.Tuple_RecipientDLExpansionFailed, null, new object[]
             {
                 messageItem.StoreObjectId,
                 itemStore.MailboxGuid,
                 itemStore.OrganizationId,
                 ex
             });
             this.PublishMonitoringResults(itemStore, ex);
             flag = true;
             if (!(ex is StorageTransientException) && !(ex is StoragePermanentException))
             {
                 throw;
             }
         }
         if (!flag && !flag2)
         {
             this.PublishMonitoringResults(itemStore, null);
         }
     }
 }
        // Token: 0x0600167E RID: 5758 RVA: 0x0007F8A0 File Offset: 0x0007DAA0
        private List <RecipientToIndex> ExpandGroupMemberRecipients(MessageItem messageItem, List <ADRecipient> groupRecipients, RecipientItemType recipientType, out DistributionGroupExpansionError errorCode)
        {
            errorCode = DistributionGroupExpansionError.NoError;
            DistributionGroupExpansionError tempErrorCode      = errorCode;
            List <RecipientToIndex>         finalExpansionList = new List <RecipientToIndex>();
            List <ADRecipient> list = new List <ADRecipient>(groupRecipients.Count);

            foreach (ADRecipient adrecipient in groupRecipients)
            {
                OrganizationId organizationId  = messageItem.Session.MailboxOwner.MailboxInfo.OrganizationId;
                string         uniqueLookupKey = RecipientDLExpansionCache.GetUniqueLookupKey(organizationId, adrecipient);
                RecipientDLExpansionEventBasedAssistant.Tracer.TraceDebug <string>((long)this.GetHashCode(), "Get recipients list from the cache for lookup key: {0}", uniqueLookupKey);
                List <RecipientToIndex> perRecipientExpansionList = RecipientDLExpansionCache.Instance.Get(uniqueLookupKey);
                if (perRecipientExpansionList != null)
                {
                    RecipientDLExpansionEventBasedAssistant.Tracer.TraceDebug <string>((long)this.GetHashCode(), "The recipients list exists in the cache for lookup key: {0}", uniqueLookupKey);
                    if (!this.AddPerRecipientListToFinalExpansionList(messageItem, perRecipientExpansionList, finalExpansionList, recipientType, out tempErrorCode))
                    {
                        break;
                    }
                    list.Add(adrecipient);
                }
                else
                {
                    RecipientDLExpansionEventBasedAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "Message with id: {0} and subject: '{1}' has recipient '{2}' which is not in the cache (with lookup key: {3}), hence need to make AD call.", new object[]
                    {
                        messageItem.StoreObjectId,
                        messageItem.Subject,
                        adrecipient.DisplayName,
                        uniqueLookupKey
                    });
                    perRecipientExpansionList = new List <RecipientToIndex>();
                    int numOfGroups = 0;
                    ADRecipientExpansion adrecipientExpansion = new ADRecipientExpansion(RecipientDLExpansionEventBasedAssistant.RecipientProperties, organizationId);
                    adrecipientExpansion.Expand(adrecipient, delegate(ADRawEntry recipient, ExpansionType recipientExpansionType, ADRawEntry parent, ExpansionType parentType)
                    {
                        if (recipientExpansionType == ExpansionType.GroupMembership)
                        {
                            if ((long)numOfGroups++ >= (long)((ulong)this.maxExpansionNestedDGs))
                            {
                                if (recipientType == RecipientItemType.Cc)
                                {
                                    tempErrorCode = DistributionGroupExpansionError.CcGroupExpansionHitDepthsLimit;
                                }
                                else if (recipientType == RecipientItemType.Bcc)
                                {
                                    tempErrorCode = DistributionGroupExpansionError.BccGroupExpansionHitDepthsLimit;
                                }
                                else
                                {
                                    tempErrorCode = DistributionGroupExpansionError.ToGroupExpansionHitDepthsLimit;
                                }
                                RecipientDLExpansionEventBasedAssistant.Tracer.TraceWarning((long)this.GetHashCode(), "DL expansion on message with id: {0}, mailbox guid: {1}, tenant: {2} is terminated because number of nested DLs ({3}) is greater than the limit ({4})", new object[]
                                {
                                    messageItem.StoreObjectId,
                                    messageItem.Session.MailboxGuid,
                                    organizationId,
                                    numOfGroups,
                                    this.maxExpansionNestedDGs
                                });
                                StorageGlobals.EventLogger.LogEvent(StorageEventLogConstants.Tuple_RecipientDLExpansionMaxNestedDLsLimit, null, new object[]
                                {
                                    this.maxExpansionNestedDGs,
                                    messageItem.StoreObjectId,
                                    messageItem.Session.MailboxGuid,
                                    organizationId
                                });
                                DistributionGroupExpansionError distributionGroupExpansionError = DistributionGroupExpansionError.NoError;
                                this.AddRecipientToExpansionList(messageItem, recipient, perRecipientExpansionList, finalExpansionList, recipientType, out distributionGroupExpansionError);
                                if (distributionGroupExpansionError != DistributionGroupExpansionError.NoError)
                                {
                                    tempErrorCode |= distributionGroupExpansionError;
                                }
                                return(ExpansionControl.Terminate);
                            }
                            RecipientDLExpansionPerfmon.TotalExpandedNestedDLs.Increment();
                            if (this.AddRecipientToExpansionList(messageItem, recipient, perRecipientExpansionList, finalExpansionList, recipientType, out tempErrorCode))
                            {
                                return(ExpansionControl.Continue);
                            }
                            return(ExpansionControl.Terminate);
                        }
                        else
                        {
                            if (!this.AddRecipientToExpansionList(messageItem, recipient, perRecipientExpansionList, finalExpansionList, recipientType, out tempErrorCode))
                            {
                                return(ExpansionControl.Terminate);
                            }
                            return(ExpansionControl.Skip);
                        }
                    }, delegate(ExpansionFailure expansionFailure, ADRawEntry recipient, ExpansionType recipientExpansionType, ADRawEntry parent, ExpansionType parentExpansionType)
                    {
                        if (recipientType == RecipientItemType.Cc)
                        {
                            tempErrorCode = DistributionGroupExpansionError.CcGroupExpansionFailed;
                        }
                        else if (recipientType == RecipientItemType.Bcc)
                        {
                            tempErrorCode = DistributionGroupExpansionError.BccGroupExpansionFailed;
                        }
                        else
                        {
                            tempErrorCode = DistributionGroupExpansionError.ToGroupExpansionFailed;
                        }
                        return(ExpansionControl.Skip);
                    });
                    errorCode = tempErrorCode;
                    if (tempErrorCode != DistributionGroupExpansionError.NoError)
                    {
                        RecipientDLExpansionEventBasedAssistant.Tracer.TraceDebug <string>((long)this.GetHashCode(), "Failed or partially success when performing the DG expansion: {0}", tempErrorCode.ToString());
                        break;
                    }
                    RecipientDLExpansionEventBasedAssistant.Tracer.TraceDebug <string>((long)this.GetHashCode(), "Add the recipients list to the cache for key: {0}", uniqueLookupKey);
                    RecipientDLExpansionCache.Instance.Add(uniqueLookupKey, perRecipientExpansionList);
                    list.Add(adrecipient);
                }
            }
            if (list.Count != groupRecipients.Count)
            {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.AppendFormat("There are total of {0} group recipients, which only {1} of them successfully expanded.\r\n", groupRecipients.Count, list.Count);
                StringBuilder stringBuilder2 = new StringBuilder();
                stringBuilder.AppendLine("List of successful expanded group recipients:");
                foreach (ADRecipient adrecipient2 in groupRecipients)
                {
                    if (list.Contains(adrecipient2))
                    {
                        stringBuilder.AppendLine(adrecipient2.DisplayName);
                    }
                    else
                    {
                        stringBuilder2.AppendLine(adrecipient2.DisplayName);
                    }
                }
                stringBuilder.AppendLine("List of not successful expanded group recipients:");
                stringBuilder.AppendLine(stringBuilder2.ToString());
                RecipientDLExpansionEventBasedAssistant.Tracer.TraceWarning((long)this.GetHashCode(), stringBuilder.ToString());
                if (!this.IsDLExpansionLimitError(errorCode))
                {
                    StorageGlobals.EventLogger.LogEvent(StorageEventLogConstants.Tuple_RecipientDLExpansionMismatchResults, null, new object[]
                    {
                        messageItem.StoreObjectId,
                        messageItem.Session.MailboxGuid,
                        messageItem.Session.MailboxOwner.MailboxInfo.OrganizationId,
                        stringBuilder.ToString()
                    });
                }
            }
            return(finalExpansionList);
        }
 // Token: 0x0600167C RID: 5756 RVA: 0x0007F59F File Offset: 0x0007D79F
 private bool MessageAlreadyHasRecipientsExpanded(MessageItem messageItem, StorePropertyDefinition property, out GroupExpansionRecipients ger)
 {
     ger = GroupExpansionRecipients.RetrieveFromStore(messageItem, property);
     return(ger != null && ger.Recipients.Count > 0);
 }
        // Token: 0x0600167A RID: 5754 RVA: 0x0007EF34 File Offset: 0x0007D134
        private void PerformDLExpansionOnItemRecipients(MailboxSession itemStore, MessageItem messageItem, ref bool isExpectedException)
        {
            Exception ex = null;

            try
            {
                GroupExpansionRecipients groupExpansionRecipients = null;
                if (this.MessageAlreadyHasRecipientsExpanded(messageItem, MessageItemSchema.GroupExpansionRecipients, out groupExpansionRecipients))
                {
                    RecipientDLExpansionEventBasedAssistant.Tracer.TraceDebug <StoreObjectId, string>((long)this.GetHashCode(), "Message with id: {0} and subject: '{1}' already have group recipients expanded.", messageItem.StoreObjectId, messageItem.Subject);
                    StorageGlobals.EventLogger.LogEvent(StorageEventLogConstants.Tuple_RecipientDLExpansionMessageAlreadyProcessed, null, new object[]
                    {
                        messageItem.StoreObjectId,
                        groupExpansionRecipients
                    });
                    return;
                }
                IRecipientSession  tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, itemStore.GetADSessionSettings(), 314, "PerformDLExpansionOnItemRecipients", "f:\\15.00.1497\\sources\\dev\\MailboxAssistants\\src\\assistants\\Compliance\\RecipientDLExpansionEventBasedAssistant.cs");
                List <ADRecipient> list  = new List <ADRecipient>();
                List <ADRecipient> list2 = new List <ADRecipient>();
                List <ADRecipient> list3 = new List <ADRecipient>();
                foreach (Recipient recipient in messageItem.Recipients)
                {
                    bool?flag = recipient.IsDistributionList();
                    if (flag != null && flag.Value)
                    {
                        if (recipient.RecipientItemType == RecipientItemType.To)
                        {
                            ADRecipient adrecipient = null;
                            if (recipient.Participant.TryGetADRecipient(tenantOrRootOrgRecipientSession, out adrecipient) && adrecipient != null && !list.Contains(adrecipient))
                            {
                                list.Add(adrecipient);
                            }
                        }
                        else if (recipient.RecipientItemType == RecipientItemType.Cc)
                        {
                            ADRecipient adrecipient2 = null;
                            if (recipient.Participant.TryGetADRecipient(tenantOrRootOrgRecipientSession, out adrecipient2) && adrecipient2 != null && !list2.Contains(adrecipient2))
                            {
                                list2.Add(adrecipient2);
                            }
                        }
                        else if (recipient.RecipientItemType == RecipientItemType.Bcc)
                        {
                            ADRecipient adrecipient3 = null;
                            if (recipient.Participant.TryGetADRecipient(tenantOrRootOrgRecipientSession, out adrecipient3) && adrecipient3 != null && !list3.Contains(adrecipient3))
                            {
                                list3.Add(adrecipient3);
                            }
                        }
                    }
                }
                if (list.Count > 0 || list2.Count > 0 || list3.Count > 0)
                {
                    RecipientDLExpansionPerfmon.TotalDLExpansionMessages.Increment();
                    RecipientDLExpansionPerfmon.TotalRecipientDLsInMessage.IncrementBy((long)(list.Count + list2.Count + list3.Count));
                    using (AverageTimeCounter averageTimeCounter = new AverageTimeCounter(RecipientDLExpansionPerfmon.AverageMessageDLExpansionProcessing, RecipientDLExpansionPerfmon.AverageMessageDLExpansionProcessingBase, true))
                    {
                        try
                        {
                            GroupExpansionRecipients        groupExpansionRecipients2       = new GroupExpansionRecipients();
                            DistributionGroupExpansionError distributionGroupExpansionError = DistributionGroupExpansionError.NoError;
                            distributionGroupExpansionError |= this.ExpandGroupMemberRecipients(messageItem, list, RecipientItemType.To, groupExpansionRecipients2);
                            distributionGroupExpansionError |= this.ExpandGroupMemberRecipients(messageItem, list2, RecipientItemType.Cc, groupExpansionRecipients2);
                            distributionGroupExpansionError |= this.ExpandGroupMemberRecipients(messageItem, list3, RecipientItemType.Bcc, groupExpansionRecipients2);
                            int num = 0;
                            while (num++ <= 1)
                            {
                                try
                                {
                                    groupExpansionRecipients2.SaveToStore(messageItem, MessageItemSchema.GroupExpansionRecipients);
                                    if (distributionGroupExpansionError != DistributionGroupExpansionError.NoError)
                                    {
                                        messageItem[MessageItemSchema.GroupExpansionError] = distributionGroupExpansionError;
                                    }
                                    SaveMode saveMode = SaveMode.NoConflictResolution;
                                    messageItem.Save(saveMode);
                                    break;
                                }
                                catch (TransientException ex2)
                                {
                                    RecipientDLExpansionEventBasedAssistant.Tracer.TraceError <TransientException>((long)this.GetHashCode(), "Got transient exception when trying to update the message: \r\n{0}", ex2);
                                    if (num > 1)
                                    {
                                        RecipientDLExpansionEventBasedAssistant.Tracer.TraceDebug <int>((long)this.GetHashCode(), "It still failed after retry for {0} times, so give up.", 1);
                                        throw;
                                    }
                                    if (ex2 is SaveConflictException)
                                    {
                                        RecipientDLExpansionEventBasedAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "Got SaveConflictException, will reload the item and retry immediately.");
                                        StoreId     id           = messageItem.Id;
                                        MessageItem messageItem2 = Item.BindAsMessage(itemStore, id, RecipientDLExpansionEventBasedAssistant.ItemProperties);
                                        messageItem.Dispose();
                                        messageItem = messageItem2;
                                    }
                                    else
                                    {
                                        RecipientDLExpansionEventBasedAssistant.Tracer.TraceDebug <int>((long)this.GetHashCode(), "Wait for {0} milliseconds before retry again.", 30000);
                                        Thread.Sleep(30000);
                                    }
                                }
                            }
                        }
                        finally
                        {
                            averageTimeCounter.Stop();
                        }
                        goto IL_382;
                    }
                }
                RecipientDLExpansionEventBasedAssistant.Tracer.TraceWarning <StoreObjectId, string>((long)this.GetHashCode(), "Message with id: {0} and subject: '{1}' does not have any DG recipients.", messageItem.StoreObjectId, messageItem.Subject);
                StorageGlobals.EventLogger.LogEvent(StorageEventLogConstants.Tuple_RecipientDLExpansionMessageNoDLRecipients, null, new object[]
                {
                    messageItem.StoreObjectId
                });
                IL_382 :;
            }
            catch (AccessDeniedException ex3)
            {
                ex = ex3;
                isExpectedException = true;
            }
            catch (ObjectNotFoundException ex4)
            {
                ex = ex4;
                isExpectedException = true;
            }
            catch (RecoverableItemsAccessDeniedException ex5)
            {
                isExpectedException = true;
                RecipientDLExpansionEventBasedAssistant.Tracer.TraceWarning((long)this.GetHashCode(), "Can't save DL expansion list to message with id: {0} and subject: '{1}' in mailbox: {2}, tenant: {3} because update item in Dumpster is not allowed. Exception: \r\n{4}", new object[]
                {
                    messageItem.StoreObjectId,
                    messageItem.Subject,
                    itemStore.MailboxGuid,
                    itemStore.OrganizationId,
                    ex5
                });
                StorageGlobals.EventLogger.LogEvent(StorageEventLogConstants.Tuple_RecipientDLExpansionUpdateItemInDumpster, null, new object[]
                {
                    messageItem.StoreObjectId,
                    messageItem.Subject,
                    itemStore.MailboxGuid,
                    itemStore.OrganizationId,
                    ex5
                });
            }
            if (ex != null)
            {
                RecipientDLExpansionEventBasedAssistant.Tracer.TraceWarning((long)this.GetHashCode(), "Can't process message with id: {0} and subject: '{1}' in mailbox: {2}, tenant: {3} because it may no longer exist. Exception: \r\n{4}", new object[]
                {
                    messageItem.StoreObjectId,
                    messageItem.Subject,
                    itemStore.MailboxGuid,
                    itemStore.OrganizationId,
                    ex
                });
                StorageGlobals.EventLogger.LogEvent(StorageEventLogConstants.Tuple_RecipientDLExpansionMessageNoLongerExist, null, new object[]
                {
                    messageItem.StoreObjectId,
                    itemStore.MailboxGuid,
                    itemStore.OrganizationId,
                    ex
                });
            }
        }
예제 #15
0
 /// <summary>
 /// Send this chat message to the user interface thread for display.
 /// </summary>
 /// <param name="id">The session id of the chat message.</param>
 /// <param name="sender">The name of the sender on the other device.</param>
 /// <param name="messsage">The message the sender sent.</param>
 public async void OnChat(uint id, string sender, string messsage)
 {
     await this.coreDispatcher.RunAsync(
         CoreDispatcherPriority.Normal,
         () =>
         {
             DateTime localtime = DateTime.Now;
             MessageItem msgItem = new MessageItem(id, localtime.ToString(), sender, messsage);
             ChatLog.Insert(0, msgItem);
         });
 }
예제 #16
0
        private SummaryReportMessageInfo GetSummaryInfo(MessageItem message, PlanData planData)
        {
            MessageStateInfo messageStateInfo = this.GetMessageStateInfo(message);
            SummaryReportMessageInfo info = new SummaryReportMessageInfo
            {
                ID = messageStateInfo.ID,
                Name = messageStateInfo.Name,
                Sent = messageStateInfo.Total, //returns GetAutomationStatesCount
                Delivered = messageStateInfo.Sent,   //return (this.Processed - this.Failed); Processed means all that are not in RecipientsQueued or Send In Progress state
                Date = messageStateInfo.Updated,

            };
            //int emailCount = -1;
            if (planData != null)
            {
                PlanStatistics planStatistics = this.analyticsFactory.GetPlanStatistics(planData);
                info.Opens = planStatistics.GetOpened();
                info.Clicks = planStatistics.GetClicked();
                //emailCount = planStatistics.GetActual(); //  return (((this.GetTotal() - this.Data.InvalidAddress) - this.Data.MailBounced) - this.Data.Unsent);

            }

            return info;
        }
 private BestMessageInfo CreateRow(MessageItem message, MessageData data)
 {
     MessageStateInfo info = new MessageStateInfo(message);
     BestMessageInfo info2 = new BestMessageInfo();
     info2.ID = info.ID;
     info2.CleanID = info.CleanID;
     info2.Name = info.Name;
     info2.Value = data.Value;
     info2.ValuePerVisit = data.ValuePerVisit;
     info2.VisitsPerEmail = data.VisitsPerEmail;
     info2.ValuePerEmail = data.ValuePerEmail;
     return info2;
 }
예제 #18
0
        /// <summary>
        /// 新增推荐 编辑界面
        /// </summary>
        /// <param name="code"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public ActionResult BookEdit(string code, string state,
                                     string libId,
                                     string userName,
                                     string subject,
                                     string msgId,
                                     string biblioPath,
                                     string returnUrl)
        {
            string strError = "";
            int    nRet     = 0;

            // 检查当前是否已经选择了图书馆绑定了帐号
            WxUserItem activeUser = null;

            nRet = this.GetActive(code, state,
                                  out activeUser,
                                  out strError);
            if (nRet == -1)
            {
                goto ERROR1;
            }
            if (nRet == 0)
            {
                ViewBag.RedirectInfo = dp2WeiXinService.GetSelLibLink(state, "/Library/BookEdit");
                return(View());
            }

            //// 登录检查
            //nRet = this.CheckLogin(code, state, out strError);
            //if (nRet == -1)
            //{
            //    goto ERROR1;
            //}
            //if (nRet == 0)
            //{
            //    return Redirect("~/Account/Bind?from=web");
            //}

            if (String.IsNullOrEmpty(libId) == true)
            {
                strError = "libId参数不能为空。";
                goto ERROR1;
            }

            if (String.IsNullOrEmpty(userName) == true)
            {
                strError = "userName参数不能为空。";
                goto ERROR1;
            }

            if (String.IsNullOrEmpty(subject) == true)
            {
                subject = ViewBag.remeberBookSubject;
            }



            // 栏目html
            ViewBag.SubjectHtml = dp2WeiXinService.Instance.GetSubjectHtml(libId,
                                                                           dp2WeiXinService.C_Group_Book,
                                                                           subject,
                                                                           true,
                                                                           null);

            // 将这些参数值设到model上,这里可以回传返回
            BookEditModel model = new BookEditModel();

            model._libId     = libId;
            model._userName  = userName;
            model._subject   = subject;
            model._returnUrl = returnUrl;


            if (string.IsNullOrEmpty(msgId) == false)
            {
                List <MessageItem> list = null;
                nRet = dp2WeiXinService.Instance.GetMessage(dp2WeiXinService.C_Group_Book,
                                                            libId,
                                                            msgId,
                                                            "",
                                                            "original",
                                                            out list,
                                                            out strError);
                if (nRet == -1)
                {
                    goto ERROR1;
                }

                if (list != null && list.Count == 1)
                {
                    MessageItem item = list[0];
                    model.id          = item.id;
                    model.title       = item.title;
                    model.remark      = item.remark;
                    model.content     = item.content;
                    model.creator     = item.creator;
                    model.publishTime = item.publishTime;
                }
                else
                {
                    strError = "根据id获取消息异常,未找到或者条数不对";
                    goto ERROR1;
                }
            }



            if (String.IsNullOrEmpty(biblioPath) == false)
            {
                model.content = biblioPath;
            }

            //model.msgItem = item;
            return(View(model));

ERROR1:
            ViewBag.Error = strError;
            return(View());//Content(strError);
        }
예제 #19
0
파일: Utils.cs 프로젝트: ProjectECS/ECS
 internal static void GetChiaraHeaders(MessageItem item, out string pointer, 
     out string server, out string port, out string contentKey, out string userAgent)
 {
     pointer = GetHeader(item, Resources.content_header);
     server = GetHeader(item, Resources.server_header);
     port = GetHeader(item, Resources.port_header);
     contentKey = GetHeader(item, Resources.encrypt_key_header2);
     userAgent = GetHeader(item, Resources.user_agent_header);
 }
        private async void GenerateEvents(MessageItem email, Funnel funnelDefinition, List <ContactData> contactsForThisEmail)
        {
            if (funnelDefinition == null)
            {
                return;
            }

            var contactIndex = 1;

            foreach (var contactId in contactsForThisEmail)
            {
                _specification.Job.Status = $"Generating events for contact {contactIndex++} of {contactsForThisEmail.Count}";

                var contact = _contactService.GetContact(contactId.ContactId);
                if (contact == null)
                {
                    continue;
                }

                if (_random.NextDouble() < funnelDefinition.Bounced / 100d)
                {
                    ExmEventsGenerator.GenerateBounce(_managerRoot.Settings.BaseURL, contact.ContactId.ToID(),
                                                      email.MessageId.ToID(), email.StartTime.AddMinutes(1));
                }
                else
                {
                    var userAgent = _userAgent();
                    var geoData   = _geoData();
                    var eventDay  = _eventDay();
                    var seconds   = _random.Next(60, 86400);
                    var eventDate = email.StartTime.AddDays(eventDay).AddSeconds(seconds);

                    var spamPercentage = funnelDefinition.SpamComplaints / 100d;

                    if (_random.NextDouble() < funnelDefinition.OpenRate / 100d)
                    {
                        if (_random.NextDouble() < funnelDefinition.ClickRate / 100d)
                        {
                            spamPercentage = Math.Min(spamPercentage, 0.01);

                            var link = "/";
                            if (_goalId != null)
                            {
                                var goal = _goalId();
                                ID  goalId;
                                if (ID.TryParse(goal, out goalId) && !ID.IsNullOrEmpty(goalId))
                                {
                                    var goalItem = _db.GetItem(goalId);
                                    if (goalItem != null)
                                    {
                                        link = LinkManager.GetItemUrl(goalItem);
                                    }
                                }
                            }

                            ExmEventsGenerator.GenerateHandlerEvent(_managerRoot.Settings.BaseURL, contact.ContactId, email,
                                                                    ExmEvents.Click, eventDate, userAgent, geoData, link);
                            eventDate = eventDate.AddSeconds(_random.Next(10, 300));
                        }
                        else
                        {
                            ExmEventsGenerator.GenerateHandlerEvent(_managerRoot.Settings.BaseURL, contact.ContactId, email,
                                                                    ExmEvents.Open, eventDate, userAgent, geoData);

                            eventDate = eventDate.AddSeconds(_random.Next(10, 300));
                        }
                    }

                    if (_random.NextDouble() < spamPercentage)
                    {
                        await ExmEventsGenerator.GenerateSpamComplaint(_managerRoot.Settings.BaseURL, contact.ContactId.ToID(), email.MessageId.ToID(), "email", eventDate);

                        eventDate = eventDate.AddSeconds(_random.Next(10, 300));
                    }

                    var unsubscribePercentage = funnelDefinition.Unsubscribed / 100d;
                    if (_random.NextDouble() < unsubscribePercentage)
                    {
                        //TODO - Warning: UnsubscribeFromAll not supported
                        var       unsubscribeFromAllPercentage = 0.5;
                        ExmEvents unsubscribeEvent;

                        if (_random.NextDouble() < unsubscribeFromAllPercentage)
                        {
                            unsubscribeEvent = ExmEvents.UnsubscribeFromAll;
                            _unsubscribeFromAllContacts.Add(contact.ContactId);
                        }
                        else
                        {
                            unsubscribeEvent = ExmEvents.Unsubscribe;
                        }

                        ExmEventsGenerator.GenerateHandlerEvent(_managerRoot.Settings.BaseURL, contact.ContactId, email,
                                                                unsubscribeEvent, eventDate, userAgent, geoData);
                    }
                }
                _specification.Job.CompletedEvents++;
            }
        }
 private DispatchedMessageInfo GetDispatchedInfo(MessageItem message, VisitData visitData, PlanData planData)
 {
     MessageStateInfo messageStateInfo = this.GetMessageStateInfo(message);
     DispatchedMessageInfo info3 = new DispatchedMessageInfo();
     info3.ID = messageStateInfo.ID;
     info3.Name = messageStateInfo.Name;
     info3.State = messageStateInfo.Status;
     info3.Date = messageStateInfo.Updated;
     info3.Sent = messageStateInfo.Sent;
     info3.NumSubscribers = messageStateInfo.NumSubscribers;
     info3.MessageState = messageStateInfo.MessageState;
     DispatchedMessageInfo info2 = info3;
     int emailCount = -1;
     if (planData != null)
     {
         PlanStatistics planStatistics = AnalyticsFactory.Instance.GetPlanStatistics(planData);
         info2.OpenRate = planStatistics.GetOpenRate();
         info2.ClickRate = planStatistics.GetClickRate();
         emailCount = planStatistics.GetActual();
     }
     if (visitData != null)
     {
         info2.ValuePerVisit = visitData.ValuePerVisit;
         if (emailCount > -1)
         {
             VisitStatistics visitStatistics = AnalyticsFactory.Instance.GetVisitStatistics(visitData);
             info2.ValuePerEmail = visitStatistics.GetValuePerEmail(emailCount);
             info2.VisitsPerEmail = visitStatistics.GetVisitPerEmail(emailCount);
         }
     }
     return info2;
 }
예제 #22
0
 public MemorySubmissionItem(MessageItem item, OrganizationId organizationId) : base("Microsoft SMTP Server")
 {
     base.Item           = item;
     this.organizationId = organizationId;
     this.submissionTime = DateTime.UtcNow;
 }
 protected virtual MessageStateInfo GetMessageStateInfo(MessageItem message)
 {
     return new MessageStateInfo(message);
 }
        // Token: 0x0600210F RID: 8463 RVA: 0x000BE23C File Offset: 0x000BC43C
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            applicationElement = ApplicationElement.Item;
            type   = string.Empty;
            action = string.Empty;
            state  = string.Empty;
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
            Item item  = null;
            Item item2 = null;
            Item item3 = null;

            try
            {
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type   = owaContext.FormsRegistryContext.Type;
                preFormActionResponse.State  = owaContext.FormsRegistryContext.State;
                preFormActionResponse.Action = "New";
                string type2;
                if ((type2 = preFormActionResponse.Type) != null)
                {
                    StoreObjectId storeObjectId;
                    if (!(type2 == "IPM.Contact"))
                    {
                        if (!(type2 == "IPM.DistList"))
                        {
                            if (!(type2 == "IPM.Task"))
                            {
                                goto IL_102;
                            }
                            storeObjectId = owaContext.UserContext.TasksFolderId;
                            item          = Utilities.GetItemForRequest <Task>(owaContext, out item2, false, new PropertyDefinition[0]);
                        }
                        else
                        {
                            storeObjectId = owaContext.UserContext.ContactsFolderId;
                            item          = Utilities.GetItemForRequest <DistributionList>(owaContext, out item2, false, new PropertyDefinition[0]);
                        }
                    }
                    else
                    {
                        storeObjectId = owaContext.UserContext.ContactsFolderId;
                        item          = Utilities.GetItemForRequest <Contact>(owaContext, out item2, false, new PropertyDefinition[0]);
                    }
                    if (item.MapiMessage == null)
                    {
                        item3 = MessageItem.Create(owaContext.UserContext.MailboxSession, storeObjectId);
                        Item.CopyItemContent(item, item3);
                    }
                    else
                    {
                        item3 = Item.CloneItem(owaContext.UserContext.MailboxSession, storeObjectId, item, false, false, null);
                    }
                    Utilities.SaveItem(item3);
                    item3.Load();
                    HttpRequest request = owaContext.HttpContext.Request;
                    if (Utilities.GetQueryStringParameter(request, "smemb", false) != null)
                    {
                        Utilities.Delete(owaContext.UserContext, true, false, new OwaStoreObjectId[]
                        {
                            OwaStoreObjectId.CreateFromStoreObject(item)
                        });
                    }
                    preFormActionResponse.AddParameter("id", item3.Id.ObjectId.ToBase64String());
                    preFormActionResponse.AddParameter("exdltdrft", "1");
                    return(preFormActionResponse);
                }
IL_102:
                throw new OwaInvalidRequestException("Item should be contact or PDL or task.");
            }
            finally
            {
                if (item != null)
                {
                    item.Dispose();
                    item = null;
                }
                if (item2 != null)
                {
                    item2.Dispose();
                    item2 = null;
                }
                if (item3 != null)
                {
                    item3.Dispose();
                    item3 = null;
                }
            }
            return(preFormActionResponse);
        }
예제 #25
0
        public void LoginAutomatically()
        {
            try
            {
                var cryptographyService = IocContainer.Container.Resolve<ICryptographyService>();
                var config = IocContainer.Container.Resolve<IConfigRepository>();

                UserName = config.UserName;
                Password.SecurePassword = cryptographyService.Unprotect(config.EncryptedPassword).
                    ConvertToSecureString();
                RememberPassword = config.RememberAccount;

                if (RememberPassword && Password.SecurePassword.Length > 0)
                {
                    Login(false);
                }
            }
            catch(Exception ex)
            {
                LoggerUtility.WriteMessage(Severity.Error,
                    I18NUtility.GetString("I18N_LoginFailedWithDetails"), ex);

                Message = new MessageItem(MessageLevel.Error,
                        I18NUtility.GetString("I18N_MessageBoxTitle"),
                        I18NUtility.GetString("I18N_LoginFailedWithDetails", ex.Message));
            }
        }
예제 #26
0
        // Token: 0x06000E64 RID: 3684 RVA: 0x0004FEB0 File Offset: 0x0004E0B0
        public static void SendRemoteWipeConfirmationMessage(string[] addresses, ExDateTime wipeAckTime, MailboxSession mailboxSession, DeviceIdentity deviceIdentity, object traceObject)
        {
            bool        flag            = false;
            MessageItem messageItem     = null;
            CultureInfo preferedCulture = mailboxSession.PreferedCulture;

            try
            {
                StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Drafts);
                messageItem           = MessageItem.Create(mailboxSession, defaultFolderId);
                messageItem.ClassName = "IPM.Note.Exchange.ActiveSync.RemoteWipeConfirmation";
                messageItem.Subject   = Strings.RemoteWipeConfirmationMessageSubject.ToString(preferedCulture);
                string format = (addresses == null) ? Strings.RemoteWipeConfirmationMessageBody1Owa.ToString(preferedCulture) : Strings.RemoteWipeConfirmationMessageBody1Task.ToString(preferedCulture);
                string text   = AirSyncUtility.HtmlEncode(string.Format(CultureInfo.InvariantCulture, format, new object[]
                {
                    wipeAckTime
                }), false);
                string text2 = AirSyncUtility.HtmlEncode(string.Format(CultureInfo.InvariantCulture, Strings.DeviceType.ToString(preferedCulture), new object[]
                {
                    deviceIdentity.DeviceType
                }), false);
                string text3 = AirSyncUtility.HtmlEncode(string.Format(CultureInfo.InvariantCulture, Strings.DeviceId.ToString(preferedCulture), new object[]
                {
                    deviceIdentity.DeviceId
                }), false);
                using (TextWriter textWriter = messageItem.Body.OpenTextWriter(BodyFormat.TextHtml))
                {
                    textWriter.Write("\r\n            <html>\r\n                <style>\r\n                    {0}\r\n                </style>\r\n                <body>\r\n                    <h1>{1}</h1>\r\n                    <br><br>\r\n                    <p>\r\n                        {2}\r\n                        <br><br>\r\n                        {3}\r\n                        <br>\r\n                        {4}\r\n                        <br><br>\r\n                        <font color=\"red\">\r\n                        {5}\r\n                        </font>\r\n                        <br><br>\r\n                        {6}\r\n                        <br><br>\r\n                    </p>\r\n                </body>\r\n            </html>\r\n            ", new object[]
                    {
                        "\r\n            body\r\n            {\r\n                font-family: Tahoma;\r\n                background-color: rgb(255,255,255);\r\n                color: #000000;\r\n                font-size:x-small;\r\n                width: 600px\r\n            }\r\n            p\r\n            {\r\n                margin:0in;\r\n            }\r\n            h1\r\n            {\r\n                font-family: Arial;\r\n                color: #000066;\r\n                margin: 0in;\r\n                font-size: medium; font-weight:bold\r\n            }\r\n            ",
                        AirSyncUtility.HtmlEncode(Strings.RemoteWipeConfirmationMessageHeader.ToString(preferedCulture), false),
                        text,
                        text2,
                        text3,
                        AirSyncUtility.HtmlEncode(Strings.RemoteWipeConfirmationMessageBody2.ToString(preferedCulture), false),
                        AirSyncUtility.HtmlEncode(Strings.RemoteWipeConfirmationMessageBody3.ToString(preferedCulture), false)
                    });
                }
                messageItem.From = null;
                Participant participant = new Participant(mailboxSession.MailboxOwner.MailboxInfo.DisplayName, mailboxSession.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(), "SMTP");
                messageItem.Recipients.Add(participant, RecipientItemType.To);
                if (addresses != null)
                {
                    foreach (string emailAddress in addresses)
                    {
                        Participant participant2 = new Participant(null, emailAddress, "SMTP");
                        messageItem.Recipients.Add(participant2, RecipientItemType.Bcc);
                    }
                }
                messageItem.Send();
                flag = true;
            }
            finally
            {
                if (messageItem != null)
                {
                    if (!flag)
                    {
                        ProvisionCommand.DeleteMessage(messageItem, mailboxSession, traceObject);
                    }
                    messageItem.Dispose();
                }
            }
        }
예제 #27
0
    /// <summary>
    /// Shows a message box
    /// </summary>
    /// <param name="callback">The method to call once the user has taken a action.</param>
    /// <param name="message">The text label of the message box</param>
    /// <param name="caption">The caption of the window</param>
    /// <param name="buttons">The buttons to display on the message box</param>
    /// <param name="icon">The icon to display on the message box.</param>
    /// <param name="defaultButton">The default button to be selected.</param>
    public static void Show(MessageCallback callback, string message, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
    {
        MessageItem item = new MessageItem();
        item.caption = caption;
        item.buttons = buttons;
        item.defaultButton = defaultButton;
        item.callback = callback;
        item.message.text = message;

        switch (icon)
        {
            case MessageBoxIcon.Error:
            case MessageBoxIcon.Stop:
            case MessageBoxIcon.Hand:
                item.message.image = i.error;
                break;
            case MessageBoxIcon.Exclamation:
            case MessageBoxIcon.Warning:
                item.message.image = i.warning;
                break;
            case MessageBoxIcon.Information:
            case MessageBoxIcon.Asterisk:
                item.message.image = i.info;
                break;
            default:
                break;
        }

        items.Add(item);
    }
예제 #28
0
    protected void Parse(List <pb_lex_words> aWords, int nStart, int nEnd)
    {
        int nPB_ID = 0;
        int nFind  = -1;

        for (int i = nStart; i < nEnd; ++i)
        {
            pb_lex_words words = aWords[i];
            if (words.m_type == pb_lex_words_type.lex_enum)
            {
                PBEnumDesc pEnum = ParseEnum(aWords, ref i, nEnd);
                if (pEnum != null)
                {
                    m_Enums.Add(pEnum);
                }
            }
            else if (words.m_type == pb_lex_words_type.lex_message)
            {
                PBMessage pChild = ParseMessage(aWords, ref i, nEnd);
                if (pChild != null)
                {
                    m_ChildMsgDesc.Add(pChild);
                }
            }
            else if (words.m_type == pb_lex_words_type.lex_oneof)
            {
                ParseOneOf(aWords, ref i, nEnd);
            }
            else if (words.m_type == pb_lex_words_type.lex_repeated)
            {
                // repeated type xxx = id;
                // List<type> xxxx = id;
                if (i + 5 < aWords.Count &&
                    aWords[i + 3].m_type == pb_lex_words_type.lex_set &&
                    aWords[i + 5].m_type == pb_lex_words_type.lex_semicolon
                    )
                {
                    pb_lex_words key_words  = aWords[i + 1];
                    pb_lex_words name_words = aWords[i + 2];
                    pb_lex_words id_words   = aWords[i + 4];
                    nPB_ID = PBLex.GetNumber(id_words);
                    nFind  = FindChild(nPB_ID);
                    if (nFind != -1)
                    {
                        i += 5;
                        continue;
                    }

                    MessageItem Item = new MessageItem();
                    Item.m_item_type    = PBValueType.Value_Array;
                    Item.m_key.m_type   = PBLex.GetPBType(key_words);
                    Item.m_key.m_szType = key_words.GetString();
                    Item.m_value        = Item.m_key;
                    Item.m_pOneOfDesc   = m_pCurOneOf;

                    Item.m_szName = name_words.GetString();
                    Item.m_ID     = nPB_ID;
                    m_Member.Add(Item);
                    if (m_pCurOneOf != null)
                    {
                        m_pCurOneOf.m_Childs.Add(Item);
                    }
                    i += 5;
                }
            }
            else if (words.m_type == pb_lex_words_type.lex_map)
            {
                // map<key, value>  xxx = id;
                if (i + 9 < aWords.Count &&
                    aWords[i + 1].m_type == pb_lex_words_type.lex_less &&
                    aWords[i + 3].m_type == pb_lex_words_type.lex_comma &&
                    aWords[i + 5].m_type == pb_lex_words_type.lex_greate &&
                    aWords[i + 7].m_type == pb_lex_words_type.lex_set &&
                    aWords[i + 9].m_type == pb_lex_words_type.lex_semicolon
                    )
                {
                    pb_lex_words key_words   = aWords[i + 2];
                    pb_lex_words value_words = aWords[i + 4];
                    pb_lex_words name_words  = aWords[i + 6];
                    pb_lex_words id_words    = aWords[i + 8];
                    nPB_ID = PBLex.GetNumber(id_words);
                    nFind  = FindChild(nPB_ID);
                    if (nFind != -1)
                    {
                        i += 8;
                        continue;
                    }

                    MessageItem Item = new MessageItem();
                    Item.m_item_type    = PBValueType.Value_Map;
                    Item.m_key.m_type   = PBLex.GetPBType(key_words);
                    Item.m_key.m_szType = key_words.GetString();
                    Item.m_value        = Item.m_key;

                    Item.m_value.m_type   = PBLex.GetPBType(value_words);
                    Item.m_value.m_szType = value_words.GetString();
                    Item.m_pOneOfDesc     = m_pCurOneOf;

                    Item.m_szName = name_words.GetString();
                    Item.m_ID     = PBLex.GetNumber(id_words);
                    m_Member.Add(Item);
                    if (m_pCurOneOf != null)
                    {
                        m_pCurOneOf.m_Childs.Add(Item);
                    }
                    i += 8;
                }
            }
            else
            {
                // xxx type = xx;
                if (i + 5 < aWords.Count && aWords[i + 2].m_type == pb_lex_words_type.lex_set && aWords[i + 4].m_type == pb_lex_words_type.lex_semicolon)
                {
                    // 是成员定义
                    pb_lex_words key_words  = aWords[i + 0];
                    pb_lex_words name_words = aWords[i + 1];
                    pb_lex_words id_words   = aWords[i + 3];
                    nPB_ID = PBLex.GetNumber(id_words);
                    nFind  = FindChild(nPB_ID);
                    if (nFind != -1)
                    {
                        i += 4;
                        continue;
                    }
                    MessageItem Item = new MessageItem();
                    Item.m_item_type    = PBValueType.Value_Base;
                    Item.m_key.m_type   = PBLex.GetPBType(key_words);
                    Item.m_key.m_szType = key_words.GetString();
                    Item.m_value        = Item.m_key;
                    Item.m_pOneOfDesc   = m_pCurOneOf;

                    Item.m_szName = name_words.GetString();
                    Item.m_ID     = PBLex.GetNumber(id_words);
                    m_Member.Add(Item);
                    if (m_pCurOneOf != null)
                    {
                        m_pCurOneOf.m_Childs.Add(Item);
                    }
                    i += 4;
                }
            }
        }
    }
예제 #29
0
    // -------------------------------------------------------------

    public void ExportFCScript(ref StringBuilder szOut, int nSpaceCount)
    {
        int nParentSpaceCount = nSpaceCount;

        szOut.Append("\r\n");
        // 先生成枚举
        ExportFC_InnerEnum(ref szOut, nSpaceCount);

        // 先将类内的函数,生成到类外吧
        ExportFC_InnerClass(ref szOut, nSpaceCount);
        szOut.Append("\r\n");

        // 导出类
        szOut.Append(' ', nParentSpaceCount);
        szOut.AppendFormat("public class {0}\r\n", m_szClassName);
        szOut.Append(' ', nParentSpaceCount);
        szOut.Append("{\r\n");

        nSpaceCount += 4;
        // 生成内部的枚举
        szOut.Append(' ', nSpaceCount);
        szOut.Append("//-----------------------------\r\n");
        ExportFC_OneofEnum(ref szOut, nSpaceCount);
        szOut.Append(' ', nSpaceCount);
        szOut.Append("//-----------------------------\r\n");

        // 生成变量
        int         nSize     = m_Member.Count;
        PBOneOfDesc pOneOfPtr = null;

        for (int i = 0; i < nSize; ++i)
        {
            MessageItem pItem = m_Member[i];
            if (pOneOfPtr != pItem.m_pOneOfDesc)
            {
                szOut.Append("    //-----------------------------\r\n");
                PBOneOfDesc pOneOf = pItem.m_pOneOfDesc;
                if (pOneOf != null)
                {
                    szOut.AppendFormat("    int  {0}; // {1}\r\n", pOneOf.m_szName, pOneOf.m_szClassName);
                }
            }
            pOneOfPtr = pItem.m_pOneOfDesc;
            szOut.AppendFormat("    public {0}  {1};// = {2}\r\n", GetValueTypeName(pItem), pItem.m_szName, pItem.m_ID);
        }
        if (pOneOfPtr != null)
        {
            szOut.Append("    //-----------------------------\r\n");
        }

        // 生成Set函数
        ExportFC_SetFunc(ref szOut, nSpaceCount);

        // 生成Get函数
        ExportFC_GetFunc(ref szOut, nSpaceCount);

        // 生成写函数
        ExportFC_WriteFunc(ref szOut, nSpaceCount);

        // 生成读函数
        ExportFC_ReadFunc(ref szOut, nSpaceCount);

        szOut.Append(' ', nParentSpaceCount);
        szOut.Append("};\r\n");
    }
예제 #30
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            string mid = "";

            if (NavigationContext.QueryString.TryGetValue("mid", out mid))
            {
                message = new MessageItem();
                message.Mid = Convert.ToInt32(mid);
                ListMessagesCallback();
            }
        }
예제 #31
0
 //Required so that classes that derive this class have access to the event OnClickedAction.
 //Events can only be called from the class they're defined in.
 protected virtual void RaiseOnClickedEvent(MessageItem item)
 {
     OnClickedAction(item);
 }
예제 #32
0
파일: Utils.cs 프로젝트: ProjectECS/ECS
 internal static bool HasChiaraHeader(MessageItem item)
 {
     if(!string.IsNullOrEmpty(GetHeader(item, Resources.content_header)))
         return true;
     //if that fails try parsing the mail header
     object prop;
     try
     {
         prop = item.Fields[ThisAddIn.PR_MAIL_HEADER];
     }
     catch
     {
         prop = null;
     }
     if (prop == null) return false;
     var header = Convert.ToString(prop);
     //only need Content-Pointer header to be legal
     return header.ToLower().Contains(
         Resources.content_header.ToLower());
 }
        public int AddMessage(int idChat, MessageItem mc) {
            ChatCache chat;
            chat = (ChatCache)chatsCache[idChat];
            if (chat.numMsg == 0)
                mc.Id = ChatMessage.FindLastIdMsg(idChat) + 1;
            else
                mc.Id = (chat.messageCache[chat.numMsg - 1]).Id + 1;
            chat.messageCache[chat.numMsg] = mc;

            chat.numMsg++;

            chatsCache[idChat] = chat;
            
            if (chat.numMsg == maxMsg)
                return 1;
            else
                return 0;
        }
예제 #34
0
파일: Utils.cs 프로젝트: ProjectECS/ECS
 private static string GetHeader(MessageItem item, string header)
 {
     try
     {
         var propTag = item.GetIDsFromNames(ThisAddIn.PS_INTERNET_HEADERS, header) | ThisAddIn.PT_STRING8;
         return Convert.ToString(item.Fields[propTag]);
     }
     catch
     {
         return string.Empty;
     }
 }
        private bool messageSentOnlyByContextUser(MessageItem message)
        {
            string currentUserName = Sitecore.Context.User.Name;
            string dispatcherUserName = message.InnerItem.Statistics.CreatedBy;

            if (currentUserName.ToLowerInvariant() == dispatcherUserName.ToLowerInvariant())
            {
                return true;
            }
            return false;
        }
예제 #36
0
 public void LoadMsg(MessageItem item, string parentKey, string index, 
     string parentId, Account account, string parentSender)
 {
     string source = _className + "LoadMsg";
     _parentKey = parentKey;
     Key = index;
     _sender = item.Sender.SMTPAddress;
     _account = account;
     if (ThisAddIn.AppVersion < 15)
     {
         msgHdr14.LoadMessage(item.Subject,
                              item.SenderName,
                              string.Format("{0} {1}",
                                            item.SentOn.ToString("ddd"),
                                            item.SentOn.ToString("g")),
                              item.To,
                              item.CC);
     }
     else
     {
         msgHdr15.LoadMessage(item.Subject,
                              item.SenderName,
                              string.Format("{0} {1}",
                                            item.SentOn.ToString("ddd"),
                                            item.SentOn.ToString("g")),
                              item.To,
                              item.CC, false);
     }
     wb1.DocumentText = item.HTMLBody;
     if (Utils.HasChiaraHeader(item))
     {
         string pointers;
         Utils.GetChiaraHeaders(item, out pointers, out _serverName, out _serverPort, out _encryptKey2, out _userAgent);
         _configuration = _account.Configurations.Values.First(config => config.Server == _serverName);
         if (!string.IsNullOrEmpty(pointers))
         {
             _pointers = pointers.Split(new[] {" "}, StringSplitOptions.None);
             string content;
             string error;
             ContentHandler.FetchContent(account.SMTPAddress, _configuration, _sender,
                 _pointers[0], _serverName, _serverPort, false, out content, out error);
             if (string.IsNullOrEmpty(error) || error == "success")
             {
                 if (!string.IsNullOrEmpty(_encryptKey2))
                 {
                     byte[] encrypted = Convert.FromBase64String(content);
                     content = Encoding.UTF8.GetString(
                         AES_JS.Decrypt(encrypted, _encryptKey2));
                 }
                 wb1.DocumentText = content;
             }
             else
             {
                 Logger.Warning(source,string.Format(
                     "failed to retrieve content for {0} using pointer {1}, supplying sender {2}: {3}",
                     item.Subject, _pointers[0], _sender, error));
             }
         }
     }
     _attachments = item.Attachments;
     if (_attachments.Count.Equals(0))
     {
         lblAttach.Visible = false;
         panelAttach.Visible = false;
     }
     else
     {
         //load them into the panel
         LoadAttachments();
     }
 }