예제 #1
0
        protected void AppendCommunicationItem(CommunicationItemViewModel item, bool isNew, bool isEditing)
        {
            if (item != null)
            {
                if (isNew)
                {
                    item.State        = CommunicationItemState.Appended;
                    item.IsEditing    = isEditing;
                    item.AuthorId     = _authorId;
                    item.AuthorName   = _authorName;
                    item.LastModified = DateTime.Now.ToUniversalTime();
                }

                DefItemCommands(item);
                item.RaiseCanExecuteChanged();

                Items.Add(item);


                if (isNew && ItemsCollection != null)
                {
                    RefreshItems();
                    ItemsCollection.MoveCurrentToFirst();
                }
                item.CommunicationItemPropertyChanged += CommunicationItem_OnPropertyChanged;

                OnPropertyChanged("OneItemInCommunicationIsInEditState");
                OnPropertyChanged("Items");
                OnPropertyChanged("IsShowEmpty");

                ModifiedRequest();
            }
        }
예제 #2
0
 protected void AviableKnowledgeBase(CommunicationItemViewModel item, string typeKnowledgeBase)
 {
     item.ItemCommands.Add(new CommunicationItemComands()
     {
         Icon    = "/VirtoCommerce.ManagementClient.Customers;component/Resources/images/black_book.png",
         ToolTip = "Knowledge base".Localize(),
         Command = new DelegateCommand <object>(OpenKnowledgeBaseDialog, (x) => item.IsEditing)
     });
 }
예제 #3
0
 protected void AviablePost(CommunicationItemViewModel item)
 {
     item.ItemCommands.Add(new CommunicationItemComands()
     {
         Icon       = "/VirtoCommerce.ManagementClient.Customers;component/Resources/images/save.png",
         ToolTip    = "Post".Localize(),
         Command    = new DelegateCommand <object>(x => ChangeItemState(x, CommunicationItemState.Modified, false)),
         SetVisible = () => item.IsEditing
     });
 }
예제 #4
0
 protected void AviableDelete(CommunicationItemViewModel item)
 {
     item.ItemCommands.Add(new CommunicationItemComands()
     {
         Icon       = "/VirtoCommerce.ManagementClient.Customers;component/Resources/images/delete.png",
         ToolTip    = "Delete".Localize(),
         Command    = new DelegateCommand <object>(DeleteCommunicationItem),
         SetVisible = () => true
     });
 }
예제 #5
0
 protected void AviableEdit(CommunicationItemViewModel item)
 {
     item.ItemCommands.Add(new CommunicationItemComands()
     {
         Icon    = "/VirtoCommerce.ManagementClient.Customers;component/Resources/images/edit.png",
         ToolTip = "Edit".Localize(),
         Command = new DelegateCommand <object>(x => ChangeItemState(x, CommunicationItemState.Modified, true)
                                                , x => x is CommunicationItemNoteViewModel && (DateTime.UtcNow - ((CommunicationItemViewModel)x).Created).Hours < 1),
         SetVisible = () => !item.IsEditing
     });
 }
        public MockCommunicationItemBuilder(CommunicationItemViewModel communocationItem)
        {
            _mock = communocationItem;
            var index = rnd.Next(titles.Length);
            _mock.Title = titles[index];
            _mock.Body = bodyes[index];

            index = rnd.Next(users.Length);
            _mock.AuthorName = users[index];
            _mock.AuthorId = users[index];

            index = rnd.Next(dates.Length);
            _mock.Created = dates[index];
            _mock.LastModified = dates[index];
            
            for (int i = 0; i < 5; i++)
            {
                index = rnd.Next(attachments.Length * 2);
                if (index < attachments.Length)
                {
                    _mock.Attachments.Add(new CommunicationAttachment() { FileUrl = attachments[index], State = CommunicationItemState.NotModified, Url=index.ToString() });
                }
            }
        }
		protected void AviableKnowledgeBase(CommunicationItemViewModel item, string typeKnowledgeBase)
		{
			item.ItemCommands.Add(new CommunicationItemComands()
			{
				Icon = "/VirtoCommerce.ManagementClient.Customers;component/Resources/images/black_book.png",
				ToolTip = "Knowledge base",
				Command = new DelegateCommand<object>(OpenKnowledgeBaseDialog, (x) => item.IsEditing)
			});
		}
		protected void AviablePost(CommunicationItemViewModel item)
		{
			item.ItemCommands.Add(new CommunicationItemComands()
			{
				Icon = "/VirtoCommerce.ManagementClient.Customers;component/Resources/images/save.png",
				ToolTip = "Post",
				Command = new DelegateCommand<object>(x => ChangeItemState(x, CommunicationItemState.Modified, false)),
				SetVisible = () => item.IsEditing
			});
		}
		protected void AviableEdit(CommunicationItemViewModel item)
		{
			item.ItemCommands.Add(new CommunicationItemComands()
			{
				Icon = "/VirtoCommerce.ManagementClient.Customers;component/Resources/images/edit.png",
				ToolTip = "Edit",
				Command = new DelegateCommand<object>(x => ChangeItemState(x, CommunicationItemState.Modified, true)
					, x => x is CommunicationItemNoteViewModel && (DateTime.UtcNow - ((CommunicationItemViewModel)x).Created).Hours < 1),
				SetVisible = () => !item.IsEditing
			});
		}
		protected void AviableDelete(CommunicationItemViewModel item)
		{
			item.ItemCommands.Add(new CommunicationItemComands()
			{
				Icon = "/VirtoCommerce.ManagementClient.Customers;component/Resources/images/delete.png",
				ToolTip = "Delete",
				Command = new DelegateCommand<object>(DeleteCommunicationItem),
				SetVisible = () => true
			});
		}
		protected void AppendCommunicationItem(CommunicationItemViewModel item, bool isNew, bool isEditing)
		{
			if (item != null)
			{
				if (isNew)
				{
					item.State = CommunicationItemState.Appended;
					item.IsEditing = isEditing;
					item.AuthorId = _authorId;
					item.AuthorName = _authorName;
				    item.LastModified = DateTime.Now.ToUniversalTime();
				}

				DefItemCommands(item);
				item.RaiseCanExecuteChanged();

				Items.Add(item);


				if (isNew && ItemsCollection != null)
				{
					RefreshItems();
					ItemsCollection.MoveCurrentToFirst();
				}
				item.CommunicationItemPropertyChanged += CommunicationItem_OnPropertyChanged;

				OnPropertyChanged("OneItemInCommunicationIsInEditState");
				OnPropertyChanged("Items");
				OnPropertyChanged("IsShowEmpty");

				ModifiedRequest();
			}
		}
 public MockCommunicationItemInboundCallBuilder(CommunicationItemViewModel communocationItem)
     : base(communocationItem)
 {
 }
		private bool RaiseNoteEditInteractionRequest(CommunicationItemViewModel itemVM, string title)
		{
			bool result = false;

			var confirmation = new ConditionalConfirmation(() => !string.IsNullOrEmpty(itemVM.Body));
			confirmation.Title = title;
			confirmation.Content = itemVM;

			CommonConfirmRequest.Raise(confirmation, (x) =>
			{
				result = x.Confirmed;
			});

			return result;
		}
예제 #14
0
 /// <summary>
 /// Define available operations (commands) for given item
 /// </summary>
 /// <example>
 /// item.ItemCommands.Add(new CommunicationItemComands() { Icon = "Url", ToolTip = "Comment", Command = new DelegateCommand<object>(x => Func(x)) });
 /// </example>
 abstract protected void DefItemCommands(CommunicationItemViewModel item);
		/// <summary>
		/// Define available operations (commands) for given item
		/// </summary>
		/// <example>
		/// item.ItemCommands.Add(new CommunicationItemComands() { Icon = "Url", ToolTip = "Comment", Command = new DelegateCommand<object>(x => Func(x)) });
		/// </example>
		abstract protected void DefItemCommands(CommunicationItemViewModel item);
 public MockCommunicationItemNoteBuilder(CommunicationItemViewModel communocationItem)
     : base(communocationItem)
 {
 }
		protected void AviableSelect(CommunicationItemViewModel item)
		{
			item.ItemCommands.Add(new CommunicationItemComands()
			{
				Icon = "/VirtoCommerce.ManagementClient.Customers;component/Resources/images/star_none.png",
				ToolTip = "Select".Localize(),
				Command = new DelegateCommand<object>(SelectCommunicationItem),
				SetVisible = () => true
			});
		}
		/// <summary>
		/// Определяет доступные комманды для полученного в параметре Item
		/// </summary>
		/// <param name="item">CommunicationItem для которого надо определить доступные комманды</param>
		/// <example>
		/// item.ItemCommands.Add(new CommunicationItemComands() { Icon = "Url", ToolTip = "Comment", Command = new DelegateCommand<object>(x => Func(x)) });
		/// </example>
		protected override void DefItemCommands(CommunicationItemViewModel item)
		{
			AviableEdit(item);
			AviablePost(item);
			if (item.State == CommunicationItemState.Appended)
			{
				AviableDelete(item);
			}
			AviableKnowledgeBase(item, "testBase");
		}
		/// <summary>
		/// Define available operations for given communication item
		/// Can add predefine such as AviableSelect, AviableEdit, AviableDelete.
		/// Can add any command (see example)
		/// </summary>
		/// <param name="item">CommunicationItem для которого надо определить доступные комманды</param>
		/// <example>
		/// item.ItemCommands.Add(new CommunicationItemComands() { Icon = "Url", ToolTip = "Comment", Command = new DelegateCommand<object>(x => Func(x)) });
		/// </example>
		protected override void DefItemCommands(CommunicationItemViewModel item)
		{
			AviableSelect(item);
			AviableEdit(item);
			AviableDelete(item);
		}