protected ContactViewModel(ChatClient client, IContact contact)
 {
     this.client = client;
     this.contact = contact;
     Contact.Changed += OnContactChanged;
     OnContactChanged(Contact, null);
 }
        public FileTransfer(XmppClientConnection xmppCon, IQ iq, IContact from)
            : base(from)
        {
            _siIq = iq;
            _si = iq.SelectSingleElement(typeof (SI)) as SI;

            if (_si != null)
            {
                // get SID for file transfer
                _sid = _si.Id;
                _file = _si.File;

                Contact = from;

                if (_file != null)
                {
                    _fileLength = _file.Size;

                    FileDescription = _file.Description;
                    FileName = _file.Name;
                }

                _xmppConnection = xmppCon;
            }
        }
Beispiel #3
0
 protected internal Message(IContact contact, string text, DateTime time, bool online)
 {
     Contact = contact;
     Text = text;
     Online = online;
     Time = time;
 }
        public static void GetFundRedemptionsStep(IContact contact, out System.Collections.Generic.IList<Sage.Entity.Interfaces.IContactFundRedemptions> result)
        {
            //Get a list of all fund redemptions for this contact
               Sage.Platform.RepositoryHelper<Sage.Entity.Interfaces.IContactFundRedemptions> f = Sage.Platform.EntityFactory.GetRepositoryHelper<Sage.Entity.Interfaces.IContactFundRedemptions>();
               Sage.Platform.Repository.ICriteria crit = f.CreateCriteria();

               crit.Add(f.EF.Eq("ContactId", contact.Id.ToString()));

               result = crit.List<Sage.Entity.Interfaces.IContactFundRedemptions>();

               //Calculate the total values
               double totalRedemptions = (Double)(from h in result
                                           select h.TotalRedemptions).Distinct().Sum();
               int totalAccounts = (Int32)(from h in result
                                       select h.TotalNumberOfAccounts).Distinct().Sum();
               double totalYTDRedemptions = (Double)(from h in result
                                                select h.TotalYTDRedemptions).Distinct().Sum();

               //Add the totals to the the result set
               Sage.Entity.Interfaces.IContactFundRedemptions totalItem = Sage.Platform.EntityFactory.Create<Sage.Entity.Interfaces.IContactFundRedemptions>();
               totalItem.RepCode = "-";
               totalItem.FundName = "All";
               totalItem.FundCode = "-";
               totalItem.Redemptions = totalRedemptions;
               totalItem.NumberOfAccounts = totalAccounts;
               totalItem.YTDRedemptions = totalYTDRedemptions;

               result.Add(totalItem);
        }
        public FileTransfer(XmppClientConnection xmppCon, IContact recipient, string filename)
            : base(recipient, filename)
        {
            _xmppConnection = xmppCon;

            _fileLength = new FileInfo(filename).Length;
        }
        public TestBase()
        {
            var builder = new ContainerBuilder();
               builder.RegisterType<DatabaseFactory>().As<IDatabaseFactory>().InstancePerLifetimeScope();
               builder.RegisterType<UnityOfWork>().As<IUnitOfWork>();

               builder.RegisterType<ContactRepostory>().AsImplementedInterfaces();
               builder.RegisterType<ContactServices>().AsImplementedInterfaces();
               builder.RegisterType<ProductRepository>().AsImplementedInterfaces();
               builder.RegisterType<LodgingRepository>().AsImplementedInterfaces();
               builder.RegisterType<ResortRepository>().AsImplementedInterfaces();

               builder.RegisterType<ProductService>().AsImplementedInterfaces();
               builder.RegisterType<LodgingService>().AsImplementedInterfaces();
               builder.RegisterType<ResortService>().AsImplementedInterfaces();

               #region 权限
               builder.RegisterType<PermissionModuleRepository>().AsImplementedInterfaces();
               builder.RegisterType<PermissionRoleRepository>().AsImplementedInterfaces();
               builder.RegisterType<PermissionReRoleModuleRepostory>().AsImplementedInterfaces();
               builder.RegisterType<PermissionSvc>().AsImplementedInterfaces();
               #endregion
               container= builder.Build();
               this.unitOfWork = container.Resolve<IUnitOfWork>();
               this.contact=container.Resolve<IContact>();
               this.productsvc=container.Resolve<IProduct>();
               this.resortSvc = container.Resolve<IResort>();
               this.lodgingsvc = container.Resolve<ILodging>();
               this.permissionSvc = container.Resolve<IPermission>();
             //  StartUp();
        }
		public IPreviewResult Handle(IContact contact)
		{
			Point transformedCoordinates;
			IntPtr hWnd = desktop.GetWindowAt(new Point((int)contact.X, (int)contact.Y), out transformedCoordinates);

			if (new SystemWindow(hWnd).WindowState == FormWindowState.Normal)
			{
				switch (contact.State)
				{
					case ContactState.New:
						OnNewContact(hWnd, contact);
						break;
					case ContactState.Removed:
						OnContactRemoved(hWnd, contact);
						break;
					case ContactState.Moved:
						OnContactMoved(hWnd, contact);
						break;
					default:
						throw new ArgumentOutOfRangeException();
				}
			}
			TransformedContact newContact = new TransformedContact(contact);
			newContact.X = transformedCoordinates.X;
			newContact.Y = transformedCoordinates.Y;
			return new Result(hWnd, newContact);
		}
        public static int CompareAlphabetically(IContact contactA, IContact contactB)
        {
            int unknownCompare = CompareForUnknownContact(contactA, contactB);
            if (unknownCompare != 0)
            {
                return unknownCompare;
            }

            List<string> contactAParts = GetNamePartsFromContact(contactA);
            List<string> contactBParts = GetNamePartsFromContact(contactB);

            int compareResult;

            while ((contactAParts.Count > 0) && (contactBParts.Count > 0))
            {
                string aPart = contactAParts[0];
                string bPart = contactBParts[0];

                compareResult = string.Compare(aPart, bPart);
                if (compareResult != 0)
                {
                    return compareResult;
                }

                contactAParts.RemoveAt(0);
                contactBParts.RemoveAt(0);
            }

            if (contactAParts.Count != contactBParts.Count)
            {
                return contactAParts.Count - contactBParts.Count;
            }

            return string.Compare(contactA.PhoneNumbers[0].Number, contactB.PhoneNumbers[0].Number);
        }
Beispiel #9
0
        public void OpenUserChat(IContact friend)
        {
            if (MainChatViewModel == null) MainChatViewModel = new MainChatViewModel();

            if (!MainChatViewModel.IsActive)
            {
                _windowManager.ShowWindow(MainChatViewModel);
                MainChatView = MainChatViewModel.GetView() as Window;
            }
            else
            {
                if (MainChatView != null)
                {
                    if (MainChatView.WindowState == WindowState.Minimized) MainChatView.WindowState = WindowState.Normal;
                    MainChatView.Activate();
                }
            }

            var tab = (from f in OpenTabs where f.Key == friend.UserId select f).FirstOrDefault();

            // tab does exist ... Key == UserId
            if (tab.Key != 0)
            {
                int tabIndex = OpenTabs.FirstOrDefault(t => t.Value == tab.Key).Value;
                MainChatViewModel.Items.ElementAt(tabIndex).Activate();
                return;
            }

            MainChatViewModel.OpenTab(this, friend);
            OpenTabs.Add(friend.UserId, MainChatViewModel.Items.Count - 1);
        }
        public GroupsWindow(IContact contact)
            : base(_keyBase, string.Empty)
        {
            DataContext = contact;

            InitializeComponent();
        }
Beispiel #11
0
        public void GroupsOpenUI(IContact contact)
        {
            GroupsWindow groupsWindow = new GroupsWindow(contact);

            groupsWindow.Activate();
            groupsWindow.ShowDialog();
        }
        internal Conversation(ChatClient client, IContact who, ConversationEvents events)
        {
            this.client = client;
            this.events = events;
            Name = who.Name;
            Contact = who;

            events.UserAdded += OnUserAdded;
            events.UserChanged += OnUserChanged;
            events.UserRemoved += OnUserRemoved;
            events.UserTyping += OnUserTyping;
            events.ChatReceived += OnChatReceived;

            if (Contact is IUser)
            {
                participants.Add(new Participant(Contact as IUser));
            }
            else
            {
                foreach (var member in (Contact as IGroup).Members)
                {
                    participants.Add(new Participant(member));
                }
            }
        }
        public void Update(IContact entity)
        {
            var contact = contacts.SingleOrDefault(g => g.Id == entity.Id);

            contact.FirstName = entity.FirstName;
            contact.LastName = entity.LastName;
        }
        private string CreateShortenedContactName(IContact contact)
        {
            List<string> names = new List<string>();
            foreach (string namePart in new string[] { contact.FirstName, contact.MiddleName, contact.LastName})
            {
                if (!string.IsNullOrEmpty(namePart))
                {
                    names.Add(namePart);
                }
            }
            if (names.Count == 0)
            {
                return contact.DisplayName;
            }

            string name;
            if (names.Count == 1)
            {
                name = names[0];
            }
            else // if (names.Count > 1)
            {
                char lastInitial = names[names.Count - 1][0];
                name = string.Format("{0} {1}.", names[0], lastInitial);
            }

            name = TruncateNameIfTooLong(name);
            return name;
        }
        private static void VerifyRightSideGreater(IContact contactA, IContact contactB)
        {
            int comparisonValue = ContactComparer_Accessor.CompareAlphabetically(contactA, contactB);
            int unitValue = ReduceToUnitValue(comparisonValue);

            Assert.AreEqual(1, unitValue);
        }
Beispiel #16
0
        public OperationResult CanDelete([PexAssumeUnderTest] ContactManager target, IContact contact)
        {
            OperationResult result = target.CanDelete(contact);
            return result;

            // TODO: add assertions to method ContactManagerTest.CanDelete(ContactManager, IContact)
        }
Beispiel #17
0
 public UserChatViewModel(ContactViewModel caller, IContact user)
 {
     base.DisplayName = user.Nick;
     ContactViewModel = caller;
     User = user;
     CharCounter = Settings.ClientSettings.Default.CharMax;
     _connection = FowaConnection.Instance;
 }
Beispiel #18
0
 public Contact(IContact other)
 {
     FullName = other.FullName;
     foreach (string email in other.Emails)
     {
         addMail(email);
     }
 }
 public AdminController(std s, Postings p, Filings f, Contactus c, Commenting com)
 {
     studnt = s;
     post = p;
     comment = com;
     file = f;
     cont = c;
 }
        public TwitterProfileViewModel(IMicroblog source, IContact contact, TwitterClient twitterClient)
            : this()
        {
            _twitterClient = twitterClient;

            Source = source;
            Contact = contact;
        }
Beispiel #21
0
 public ContactSendingOption(IContact contact, SendableDocumentCategories sendableDocumentCategory, 
                               SendingOptions sendingOption, bool value)
 {
     Contact = contact;
     SendableDocumentCategory = sendableDocumentCategory;
     SendingOption = sendingOption;
     Value = value;
 }
Beispiel #22
0
		public WindowContact(IContact copy)
		{
			Id = copy.Id;
			Position = new Point(copy.X, copy.Y);
			Width = copy.Width;
			Height = copy.Height;
			State = copy.State;
		}
Beispiel #23
0
 public GContact(RequestSettings rs, IContact other)
 {
     //System.Windows.Forms.MessageBox.Show("Creating a new Google contact for " + other.ToString() + " in memory");
     _rs = rs;
     _item = new Google.Contacts.Contact();
     _item.AtomEntry = new Google.GData.Contacts.ContactEntry();
     MergeFrom(other);
 }
Beispiel #24
0
 public ContactModel(IContact contact)
 {
     Name = contact.Name;
     Phone = contact.Phone;
     Email = contact.Email;
     ZIP = contact.ZIP;
     Street = contact.Street;
     City = contact.City;
 }
 internal static Cell BoolCell (PropertyInfo property, IContact context, Page parent = null)
 {
     var label = CreateLabel(property);
     var switchCell = new SwitchCell();
     switchCell.SetValue(SwitchCell.TextProperty, label);
     switchCell.SetBinding(SwitchCell.OnProperty, new Binding(property.Name, BindingMode.TwoWay));
     switchCell.BindingContext = context;
     return switchCell;
 }
Beispiel #26
0
		public void Handle(IntPtr hWnd, IContact contact)
		{
			if (contact.State == ContactState.New)
				SendDown(hWnd, contact);
			else if (contact.State == ContactState.Moved)
				SendMove(hWnd, contact);
			else if (contact.State == ContactState.Removed)
				SendUp(hWnd, contact);
		}
Beispiel #27
0
        public bool Equals(IContact other)
        {
            if (this.ContactId != other.ContactId)
            {
                return false;
            }

            return true;
        }
        public VCardDisplay(IContact contact)
            : base(_keyBase, contact.Jid.Bare)
        {
            DataContext = contact;

            InitializeComponent();

            Roster.Instance.SetFreshVcard(contact, 0);
        }
		public TransformedContact(IContact copy)
		{
			Id = copy.Id;
			X = copy.X;
			Y = copy.Y;
			Width = copy.Width;
			Height = copy.Height;
			State = copy.State;
		}
        public string GetDisplayName( IContact contact )
        {
            string[] properties = GetPropertiesFromString( Settings.Default.UI_DisplayFormat ) ;

            object[] values = GetValues( properties, contact ) ;

            return string.Format( PrepareFormatString( Settings.Default.UI_DisplayFormat, properties ),
                                    values ) ;
        }
Beispiel #31
0
 protected internal abstract bool TryGetIntersection(TimeStep step, Body first, Body second, out IContact contact);
 // constructor, indata är av typ interface
 // accessKontakt = lokal variabel
 // inAccessKontakt = inkommande data
 public ContactController(IContact inAccessKontakt)
 {
     accessKontakt = inAccessKontakt;
 }
        public void VerifyDatabaseRowsMatchSingleContact(List <ContactDatabaseRow> inputRows, IContact contactExpected)
        {
            List <IContact> contacts = new List <IContact>();

            contacts.Add(contactExpected);
            VerifyDatabaseRowsMatchContacts(inputRows, contacts);
        }
Beispiel #34
0
 public ProjectTask(string name, IContact owner, double timeRequired)
 {
     Name          = name;
     Owner         = owner;
     _timeRequired = timeRequired;
 }
 public static IHtmlString GetAddress(IContact that) => that.Value <IHtmlString>("address");
        public bool Delete(IContact contact)
        {
            string sqlDelete = $@"DELETE FROM Contact WHERE Id='{contact.Id}'";

            return(ExeNonQueryCommand(sqlDelete));
        }
 public static string GetPhone(IContact that) => that.Value <string>("phone");
Beispiel #38
0
 void OnContactMoved(IntPtr handle, IContact contact)
 {
     desktop.OnContactMoved(handle, contact);
 }
Beispiel #39
0
 void OnNewContact(IntPtr handle, IContact contact)
 {
     desktop.OnNewContact(handle, contact);
 }
Beispiel #40
0
 public ContactService(IConnectionService connectionService, IServiceDecorator serviceDecorator) : base(connectionService, serviceDecorator)
 {
     _contactService = RestService.For <IContact>(ConnectionService._lazyHttpClient.Value, new RefitSettings(new NewtonsoftJsonContentSerializer()));
 }
Beispiel #41
0
    string GetPhotoUrl(IContact contact)
    {
        var relativePath = Utils.GetContactPhotoUrl(contact.PhotoUrl);

        return(Server.MapPath(relativePath));
    }
Beispiel #42
0
 public static async Task DeleteContact(IContact contact)
 {
     await contact.DeleteAsync();
 }
Beispiel #43
0
        private IUpdateContactCommand CreateSut(string tokenType = null, string accessToken = null, DateTime?expires = null, string refreshToken = null, string externalIdentifier = null, bool hasMicrosoftGraphContact = true, IContact microsoftGraphContact = null, IContact appliedContactSupplement = null)
        {
            _microsoftGraphRepositoryMock.Setup(m => m.GetContactAsync(It.IsAny <IRefreshableToken>(), It.IsAny <string>()))
            .Returns(() => Task.Run(() => hasMicrosoftGraphContact ? microsoftGraphContact ?? _fixture.BuildContactMock().Object : null));
            _contactRepositoryMock.Setup(m => m.ApplyContactSupplementAsync(It.IsAny <IContact>()))
            .Returns(Task.Run(() => appliedContactSupplement ?? _fixture.BuildContactMock().Object));

            return(_fixture.Build <BusinessLogic.Contacts.Commands.UpdateContactCommand>()
                   .With(m => m.TokenType, tokenType ?? _fixture.Create <string>())
                   .With(m => m.AccessToken, accessToken ?? _fixture.Create <string>())
                   .With(m => m.Expires, expires ?? _fixture.Create <DateTime>())
                   .With(m => m.RefreshToken, refreshToken ?? _fixture.Create <string>())
                   .With(m => m.ExternalIdentifier, externalIdentifier ?? _fixture.Create <string>())
                   .Create());
        }
 public static string GetTwitter(IContact that) => that.Value <string>("twitter");
 public static string GetFacebook(IContact that) => that.Value <string>("facebook");
Beispiel #46
0
 public void SetAssignedTo(IContact contact)
 {
     AssignedTo = (Party)contact;
 }
 public static string GetInstagram(IContact that) => that.Value <string>("instagram");
Beispiel #48
0
 private void loadContextNumbers(IContact contact)
 {
     addContextContact("Home", contact.PhHome);
     addContextContact("Mobile", contact.PhMobile);
     addContextContact("Office", contact.PhOffice);
 }
 public static string GetEmail(IContact that) => that.Value <string>("email");
        public void UpdateContact(ViewContact contact)
        {
            IContact realContact = adapter.ModelConvert(contact);

            _dataBase.Update(realContact);
        }
Beispiel #51
0
 public ContactController(IContact contacts)
 {
     contacts = repository;
 }
Beispiel #52
0
 internal static Cell DefaultCell(PropertyInfo property, IContact context, Page parent = null)
 {
     return(StringCell(property, context, parent));
 }
        public static void OnLoad1Step(IInsertSalesOrder form, EventArgs args)
        {
            ISalesOrder so = form.CurrentEntity as ISalesOrder;

            if (so == null)
            {
                return;
            }
            if (String.IsNullOrEmpty(form.rdgSOType.SelectedValue))
            {
                form.rdgSOType.SelectedValue = "SalesOrder";
            }
            Sage.Platform.SData.IAppIdMappingService oMappingService = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.SData.IAppIdMappingService>(false);
            if (oMappingService != null && oMappingService.IsIntegrationEnabled())
            {
                if (!so.CanChangeOperatingCompany())
                {
                    form.lueERPApplication.Enabled = false;
                    form.luePriceList.Enabled      = false;
                }
                else
                {
                    form.lueERPApplication.Enabled = true;
                    form.luePriceList.Enabled      = (form.lueERPApplication.LookupResultValue != null);
                }
            }
            else
            {
                form.clIntegrationContract.Visible = false;
            }

            ISelectionService srv = ApplicationContext.Current.Services.Get <ISelectionService>(true);

            if (srv != null)
            {
                ISelectionContext sc = srv.GetSelectionContext("QuickInsertAccountContact");
                if (sc != null)
                {
                    List <string> sels = sc.GetSelectedIds();
                    if (sels.Count > 0)
                    {
                        string   newContactId = sels[0];
                        IContact newContact   = Sage.Platform.EntityFactory.GetById <IContact>(newContactId);
                        IAccount newAccount   = newContact.Account;
                        so.Account         = newAccount;
                        so.AccountManager  = newAccount.AccountManager;
                        so.BillingContact  = newContact;
                        so.ShippingContact = newContact;
                        so.BillToName      = newContact.NameLF;
                        so.ShipToName      = newContact.NameLF;

                        if (so.BillingAddress == null)
                        {
                            ISalesOrderAddress billAddr = Sage.Platform.EntityFactory.Create <ISalesOrderAddress>();
                            so.BillingAddress = billAddr;
                        }
                        so.SetSalesOrderBillingAddress(newContact.Address);

                        if (so.ShippingAddress == null)
                        {
                            ISalesOrderAddress shipAddr = Sage.Platform.EntityFactory.Create <ISalesOrderAddress>();
                            so.ShippingAddress = shipAddr;
                        }
                        so.SetSalesOrderShippingAddress(newContact.Address);
                        srv.SetSelectionContext("QuickInsertAccountContact", null);
                    }
                }
            }
        }
Beispiel #54
0
        /**
         * all article's processing should be performed in the resource thread
         * this function is called if article is downloaded from a group
         */
        public static void CreateArticle(string[] lines, IResource groupRes, string articleId)
        {
            // if user has already unsubscribed from the group or the
            // groups is already deleted then skip the article
            IResource server = new NewsgroupResource(groupRes).Server;

            if (server == null)
            {
                return;
            }

            articleId = ParseTools.EscapeCaseSensitiveString(articleId);
            // is article deleted?
            if (NewsArticleHelper.IsArticleDeleted(articleId))
            {
                return;
            }

            PrepareLines(lines);

            try
            {
                ServerResource serverRes   = new ServerResource(server);
                string         charset     = serverRes.Charset;
                bool           bodyStarted = false;
                string         line;
                string         content_type = string.Empty;
                string         content_transfer_encoding = string.Empty;
                IContact       sender = null;
                DateTime       date   = DateTime.MinValue;
                bool           mySelf = false;
                bool           newArticle;

                IResource article = Core.ResourceStore.FindUniqueResource(
                    NntpPlugin._newsArticle, NntpPlugin._propArticleId, articleId);
                if (article != null)
                {
                    if (!article.HasProp(NntpPlugin._propHasNoBody))
                    {
                        return;
                    }
                    article.BeginUpdate();
                    newArticle = false;
                }
                else
                {
                    article    = Core.ResourceStore.BeginNewResource(NntpPlugin._newsArticle);
                    newArticle = true;
                }

                for (int i = 0; i < lines.Length; ++i)
                {
                    line = lines[i];
                    if (line == null)
                    {
                        continue;
                    }
                    if (bodyStarted)
                    {
                        _bodyBuilder.Append(line);
                    }
                    else
                    {
                        _headersBuilder.Append(line);
                        _headersBuilder.Append("\r\n");
                        if (Utils.StartsWith(line, "from: ", true))
                        {
                            string from = line.Substring(6);
                            article.SetProp(NntpPlugin._propRawFrom, from);
                            mySelf = ParseFrom(article, TranslateHeader(charset, from), out sender);
                            UpdateLastCorrespondDate(sender, date);
                        }
                        else if (Utils.StartsWith(line, "subject: ", true))
                        {
                            string subject = line.Substring(9);
                            article.SetProp(NntpPlugin._propRawSubject, subject);
                            article.SetProp(Core.Props.Subject, TranslateHeader(charset, subject));
                        }
                        else if (Utils.StartsWith(line, "message-id: ", true))
                        {
                            ParseMessageId(article, ParseTools.EscapeCaseSensitiveString(line.Substring(12)), articleId);
                        }
                        else if (Utils.StartsWith(line, "newsgroups: ", true))
                        {
                            if (line.IndexOf(',') > 12)
                            {
                                ParseNewsgroups(article, groupRes, serverRes, line.Substring(12));
                            }
                        }
                        else if (Utils.StartsWith(line, "date: ", true))
                        {
                            date = ParseDate(article, line.Substring(6));
                            UpdateLastCorrespondDate(sender, date);
                        }
                        else if (Utils.StartsWith(line, "references: ", true))
                        {
                            ParseReferences(article, line.Substring(12));
                        }
                        else if (Utils.StartsWith(line, "content-type: ", true))
                        {
                            content_type = line.Substring(14);
                        }
                        else if (Utils.StartsWith(line, "followup-to: ", true))
                        {
                            article.SetProp(NntpPlugin._propFollowupTo, line.Substring(13));
                        }
                        else if (Utils.StartsWith(line, "content-transfer-encoding: ", true))
                        {
                            content_transfer_encoding = line.Substring(27);
                        }
                        else if (line == "\r\n")
                        {
                            bodyStarted = true;
                        }
                    }
                }
                ProcessBody(_bodyBuilder.ToString(), content_type, content_transfer_encoding, article, charset);
                article.SetProp(NntpPlugin._propArticleHeaders, _headersBuilder.ToString());
                article.AddLink(NntpPlugin._propTo, groupRes);
                if (article.GetPropText(NntpPlugin._propArticleId).Length == 0)
                {
                    article.SetProp(NntpPlugin._propArticleId, articleId);
                }
                if (newArticle)
                {
                    article.SetProp(NntpPlugin._propIsUnread, true);
                    IResourceList categories = Core.CategoryManager.GetResourceCategories(groupRes);
                    foreach (IResource category in categories)
                    {
                        Core.CategoryManager.AddResourceCategory(article, category);
                    }

                    Core.FilterEngine.ExecRules(StandardEvents.ResourceReceived, article);
                    CleanLocalArticle(articleId, article);
                }
                article.EndUpdate();

                CheckArticleInIgnoredThreads(article);
                CheckArticleInSelfThread(article);

                if (mySelf && serverRes.MarkFromMeAsRead)
                {
                    article.BeginUpdate();
                    article.DeleteProp(NntpPlugin._propIsUnread);
                    article.EndUpdate();
                }
                Core.TextIndexManager.QueryIndexing(article.Id);
            }
            finally
            {
                DisposeStringBuilders();
            }
        }
    /// <summary>
    /// Inners the page load.
    /// </summary>
    /// <param name="sender">The sender.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected override void InnerPageLoad(object sender, EventArgs e)
    {
        IContact contact = GetParentEntity() as IContact;

        Contact = contact;
    }
Beispiel #56
0
        /**
         * this function is called if article is downloaded from a group
         * article should be a newly created transient resource
         */
        public static void CreateArticleByProtocolHandler(string[] lines, IResource article)
        {
            if (!article.IsTransient)
            {
                throw new ArgumentException("Article should be a newly created transient resource", "article");
            }

            string articleId = article.GetPropText(NntpPlugin._propArticleId);

            if (Core.ResourceStore.FindUniqueResource(
                    NntpPlugin._newsArticle, NntpPlugin._propArticleId, articleId) != null)
            {
                return;
            }

            PrepareLines(lines);

            try
            {
                IResource server      = article.GetLinkProp(NntpPlugin._propTo);
                string    charset     = new ServerResource(server).Charset;
                bool      bodyStarted = false;
                string    line;
                string    content_type = string.Empty;
                string    content_transfer_encoding = string.Empty;
                IContact  sender = null;
                DateTime  date   = DateTime.MinValue;
                bool      mySelf = false;

                for (int i = 0; i < lines.Length; ++i)
                {
                    line = lines[i];
                    if (line == null)
                    {
                        continue;
                    }
                    if (bodyStarted)
                    {
                        _bodyBuilder.Append(line);
                    }
                    else
                    {
                        _headersBuilder.Append(line);
                        _headersBuilder.Append("\r\n");
                        if (Utils.StartsWith(line, "from: ", true))
                        {
                            string from = line.Substring(6);
                            article.SetProp(NntpPlugin._propRawFrom, from);
                            mySelf = ParseFrom(article, TranslateHeader(charset, from), out sender);
                            UpdateLastCorrespondDate(sender, date);
                        }
                        else if (Utils.StartsWith(line, "subject: ", true))
                        {
                            string subject = line.Substring(9);
                            article.SetProp(NntpPlugin._propRawSubject, subject);
                            article.SetProp(Core.Props.Subject, TranslateHeader(charset, subject));
                        }
                        else if (Utils.StartsWith(line, "message-id: ", true))
                        {
                            ParseMessageId(article, ParseTools.EscapeCaseSensitiveString(line.Substring(12)), articleId);
                        }
                        else if (Utils.StartsWith(line, "newsgroups: ", true))
                        {
                            Subscribe2Groups(article, line.Substring(12));
                        }
                        else if (Utils.StartsWith(line, "date: ", true))
                        {
                            date = ParseDate(article, line.Substring(6));
                            UpdateLastCorrespondDate(sender, date);
                        }
                        else if (Utils.StartsWith(line, "references: ", true))
                        {
                            ParseReferences(article, line.Substring(12));
                        }
                        else if (Utils.StartsWith(line, "content-type: ", true))
                        {
                            content_type = line.Substring(14);
                        }
                        else if (Utils.StartsWith(line, "followup-to: ", true))
                        {
                            article.SetProp(NntpPlugin._propFollowupTo, line.Substring(13));
                        }
                        else if (Utils.StartsWith(line, "content-transfer-encoding: ", true))
                        {
                            content_transfer_encoding = line.Substring(27);
                        }
                        else if (line == "\r\n")
                        {
                            bodyStarted = true;
                        }
                    }
                }
                ProcessBody(_bodyBuilder.ToString(), content_type, content_transfer_encoding, article, charset);
                article.SetProp(NntpPlugin._propArticleHeaders, _headersBuilder.ToString());
                article.SetProp(NntpPlugin._propIsUnread, true);
                Core.FilterEngine.ExecRules(StandardEvents.ResourceReceived, article);
                CleanLocalArticle(articleId, article);
                article.EndUpdate();
                if (mySelf && new ServerResource(server).MarkFromMeAsRead)
                {
                    article.BeginUpdate();
                    article.DeleteProp(NntpPlugin._propIsUnread);
                    article.EndUpdate();
                }
                Core.TextIndexManager.QueryIndexing(article.Id);
            }
            finally
            {
                DisposeStringBuilders();
            }
        }
 public ViewModel_ContactDetail(IContact contact)
 {
     PropertyContact = contact;
 }
        public override IList <IReportRow> GetRows(IList <string> columns, IReportFilterNode filterNode)
        {
            IList <IReportRow> reportRows = new List <IReportRow>();

            if (((EBSVirtualReportTablesPackage)this.Parent)._globalContext == null)
            {
                return(reportRows);
            }

            IRecordContext _context = ((EBSVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace;
            int            contactID = 0, rnowContactId = 0;

            if (_context == null)
            {
                /* cannot create filter based on the ebs contact party id because this column is not in the payload response
                 * there is SOLD_TO_CONTACT_ID, it does not match the input of the request payload
                 * so, cannot run the report in Report Explorer
                 */
                return(reportRows);
            }
            else
            {
                IContact contactRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact;
                contactID     = getContactPartyIdCustomAttr(contactRecord);
                rnowContactId = contactRecord.ID;
            }

            if (contactID == 0)
            {
                return(reportRows);
            }

            OutputParameters op = null;

            op = Order.LookupOrdersByContact(contactID, 0, rnowContactId);

            foreach (APPSOE_ORDER_CUST_ORX3349377X1X3 order in op.X_ORDERS)
            {
                ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count);
                foreach (string column in columns)
                {
                    ReportDataCell reportDataCell = new ReportDataCell();
                    // put the "SRData$SRDetailTable." package name back
                    string pkgNtblName      = "SRData$" + this.Name + ".";
                    string removePkgTblName = column.Replace(pkgNtblName, "");

                    string type = order.GetType().GetProperty(removePkgTblName).PropertyType.Name;

                    object propVal = order.GetType().GetProperty(removePkgTblName).GetValue(order, null);

                    if (propVal == null)
                    {
                        reportDataCell.GenericValue = null;
                    }
                    else if (type == "Nullable`1" &&
                             order.GetType().GetProperty(removePkgTblName).PropertyType.GetGenericArguments()[0].ToString() == "System.Decimal")
                    {
                        reportDataCell.GenericValue = Convert.ToInt32(propVal); // need to convert, otherwise show up as 0
                    }
                    else
                    {
                        reportDataCell.GenericValue = propVal;
                    }

                    reportDataRow.Cells.Add(reportDataCell);
                }
                reportRows.Add(reportDataRow);
            }
            return(reportRows);
        }
Beispiel #59
0
 /// <summary>
 /// The add contact.
 /// </summary>
 /// <param name="contact">
 /// The contact.
 /// </param>
 public void AddContact(IContact contact)
 {
     _context.Contacts.Add(contact as Contact);
 }
Beispiel #60
0
        /// <summary>
        /// The create app user with membership.
        /// </summary>
        /// <param name="appUser">
        /// The app user.
        /// </param>
        /// <param name="registeringUser">
        /// The registering user.
        /// </param>
        /// <param name="contact">
        /// The contact.
        /// </param>
        public void CreateAppUserWithMembership(IAppUser appUser, IRegistringUser registeringUser, IContact contact)
        {
            var memUser = MsMembership.CreateUser(registeringUser.UserName, registeringUser.Password, registeringUser.Email);
            var appuser = appUser.ToEntity();

            if (memUser.ProviderUserKey != null)
            {
                var user = GetUser(Guid.Parse(memUser.ProviderUserKey.ToString()));
                user.AppUsers.Add(appuser);
                Roles.AddUserToRole(registeringUser.UserName, registeringUser.Role);
                AddContact(contact);
                contact.AppUsers.Add(appuser);
                Commit();
            }
        }