Esempio n. 1
0
 /// <summary>
 /// Objectives document did finish from sender.
 /// </summary>
 /// <param name="sender">The sender.</param>
 public void ObjectivesDocumentDidFinishFromSender(UPObjectivesItem sender)
 {
     if (this.currentItemDocumentIndex < this.itemDocumentsToLoad - 1)
     {
         this.currentItemDocumentIndex++;
     }
     else
     {
         this.LoadNextGroup();
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Objectives document from sender did fail with error.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="error">The error.</param>
 public void ObjectivesDocumentFromSenderDidFailWithError(UPObjectivesItem sender, Exception error)
 {
     if (this.currentItemDocumentIndex < this.itemDocumentsToLoad - 1)
     {
         this.currentItemDocumentIndex++;
     }
     else
     {
         this.LoadNextGroup();
     }
 }
Esempio n. 3
0
        private void BuildGroupWithConfigurationItemsUpdateableItems(UPObjectivesConfiguration groupConfiguration, List <UPCRMResultRow> items, Dictionary <string, UPCRMResultRow> updateableItems)
        {
            // search for group and create if not found
            string                   groupKey            = groupConfiguration.SectionName;
            UPObjectivesGroup        group               = this.GroupDictionary.ValueOrDefault(groupKey);
            UPCRMFilterBasedDecision filterBasedDecision = groupConfiguration.FilterBasedDecision;

            if (group == null)
            {
                group = new UPObjectivesGroup(groupKey, this, groupConfiguration);
                this.Groups.Add(group);
                this.GroupDictionary.SetObjectForKey(group, groupKey);
            }

            int count = items?.Count ?? 0;

            if (count == 0)
            {
                this.LoadNextGroup();
                return;
            }

            for (int i = 0; i < count; i++)
            {
                UPCRMResultRow row  = items[i];
                DateTime?      date = row.RawValueAtIndex(groupConfiguration
                                                          .FieldForFunction(Constants.FieldCompletedOnFunction)
                                                          .TabIndependentFieldIndex)
                                      .DateFromCrmValue();

                bool canBeDeleted = false;
                if (updateableItems != null)
                {
                    canBeDeleted = updateableItems.ValueOrDefault(row.RootRecordIdentification) != null;
                }

                // create item
                UPObjectivesItem item = new UPObjectivesItem(row.RootRecordIdentification, date ?? DateTime.MinValue, group, canBeDeleted, this);
                if (filterBasedDecision != null)
                {
                    List <UPConfigButton> actionButtons = filterBasedDecision.ButtonsForResultRow(row);
                    foreach (UPConfigButton button in actionButtons)
                    {
                        item.AddButtonAction(button);
                    }
                }

                item.SetFromResultRow(row);
                item.LoadDocumentsWithMaxResults(this.MaxDocuments);
                group.AddItem(item);
            }
        }
 /// <summary>
 /// Adds the item.
 /// </summary>
 /// <param name="item">The item.</param>
 public void AddItem(UPObjectivesItem item)
 {
     this.Items.Add(item);
     this.ItemDictionary[item.KeyValue] = item;
 }