Пример #1
0
 public void CrmParticipantsDidFinishWithResult(UPCRMRecordParticipants recordParticipants, object result)
 {
     this.ControllerState = GroupModelControllerState.Finished;
     this.Group           = this.GroupFromParticipantControl();
     if (signalFinished)
     {
         this.TheDelegate.GroupModelControllerFinished(this);
     }
 }
Пример #2
0
 public void CrmParticipantsDidFailWithError(UPCRMRecordParticipants recordParticipants, Exception error)
 {
     ControllerState = GroupModelControllerState.Error;
     Error           = error;
     Group           = null;
     if (signalFinished)
     {
         TheDelegate.GroupModelControllerFinished(this);
     }
 }
        private void UpdateGroup(UPCRMResultRow resultRow)
        {
            this.isNew = true;
            var parentInitialValues = this.EditPageContext.InitialValues;
            var participantsControl = new UPCRMRecordParticipants(
                this.ParticipantsViewReference(),
                this.RootInfoAreaId,
                this.ParticipantInfoAreaId,
                this.ParticipantLinkId,
                this.RecordIdentificationForNewParticipantsControl,
                this);

            this.ParticipantsControl = participantsControl;
            var childGroupKey = this.ChildGroupKey;

            var parentInitialValueDictionaries = parentInitialValues.ValueOrDefault(childGroupKey) as List <Dictionary <string, object> >;

            List <UPCRMRecord> offlineRecords = null;

            if (this.EditPageContext.OfflineRequest != null)
            {
                offlineRecords = this.EditPageContext.OfflineRequest.RecordsWithInfoAreaLinkId(this.ParticipantsControl.LinkParticipantsInfoAreaId, this.ParticipantsControl.LinkParticipantsLinkId);
            }

            if (this.AddRecordEnabled || parentInitialValueDictionaries?.Count > 0 || offlineRecords?.Count > 0)
            {
                this.ParticipantsControl.SetFieldsFromSearchAndListConfigurationName(this.LinkParticipantsName);
                if (parentInitialValueDictionaries?.Count > 0)
                {
                    this.ProcessParentInitialValueDictionaries(parentInitialValueDictionaries);
                }

                if (offlineRecords?.Count > 0)
                {
                    this.ProcessOfflineRecords(offlineRecords, resultRow);
                }

                this.ControllerState = GroupModelControllerState.Finished;
                this.Group           = this.GroupFromParticipantControl();
            }
            else
            {
                this.Group           = null;
                this.ControllerState = GroupModelControllerState.Empty;
            }

            this.signalFinished = true;
        }
        private UPCRMRecordParticipants CreateUPCRMRecordParticipants()
        {
            var participantsControl = new UPCRMRecordParticipants(
                this.ParticipantsViewReference(),
                this.RootInfoAreaId,
                !string.IsNullOrEmpty(this.LinkParticipantsName) ? this.LinkParticipantsName : this.ParticipantInfoAreaId,
                this.ParticipantLinkId,
                this.LinkRecordIdentification,
                this);

            if (!string.IsNullOrEmpty(this.ProtectedParentLinkString))
            {
                var protectedLinkRecordIdentification = this.ParentLinkFromPage(this.ProtectedParentLinkString);
                if (!string.IsNullOrEmpty(protectedLinkRecordIdentification))
                {
                    participantsControl.ProtectedLinkRecordIdentification = protectedLinkRecordIdentification;
                }
            }

            return(participantsControl);
        }
        /// <summary>
        /// Applies the result row.
        /// </summary>
        /// <param name="resultRow">The result row.</param>
        /// <returns></returns>
        public override UPMGroup ApplyResultRow(UPCRMResultRow resultRow)
        {
            this.ExplicitTabIdentifier = this.TabIdentifierForRecordIdentification(resultRow.RootRecordIdentification);
            int fieldCount = this.TabConfig.NumberOfFields;
            UPConfigFieldControlField participantsField = null;

            for (int i = 0; i < fieldCount; i++)
            {
                UPConfigFieldControlField fieldConfig = this.TabConfig.FieldAtIndex(i);
                if (fieldConfig.Field.FieldInfo.IsParticipantsField)
                {
                    participantsField = fieldConfig;
                    break;
                }
            }

            var tabTypeParts = this.TabConfig.Type.Split('_');

            this.linkParticipantsName = null;
            if (tabTypeParts.Length > 1)
            {
                this.linkParticipantsName = tabTypeParts[1];
                var configParts = this.linkParticipantsName.Split('#');
                if (configParts.Length > 1)
                {
                    this.linkParticipantsName = configParts[0];
                }
            }

            this.recordParticipants = !string.IsNullOrEmpty(this.linkParticipantsName)
                ? new UPCRMRecordParticipants(resultRow.RootRecordIdentification, this.linkParticipantsName, -1, this)
                : new UPCRMRecordParticipants(resultRow.RootRecordIdentification, this);

            if (this.linkParticipantsName != null && !this.recordParticipants.SetFieldsFromSearchAndListConfigurationName(this.linkParticipantsName))
            {
                this.linkParticipantsName = null;
            }

            if (participantsField != null)
            {
                this.recordParticipants.AddParticipantsFromString(resultRow.ValueAtIndex(participantsField.TabIndependentFieldIndex));
            }

            //2019-07-22 Rep Selection - Reverted if condition
            //if (!string.IsNullOrEmpty(this.linkParticipantsName))
            //{
            //    this.Group = null;
            //    this.ControllerState = GroupModelControllerState.Pending;
            //    this.recordParticipants.LinkParticipantsRequestOption = this.RequestOption;
            //    this.recordParticipants.Load();
            //}
            //else
            //{
            //    this.Group = this.CreateGroup();
            //    this.ControllerState = GroupModelControllerState.Finished;
            //}

            if (string.IsNullOrEmpty(this.linkParticipantsName))
            {
                this.Group           = null;
                this.ControllerState = GroupModelControllerState.Pending;
                this.recordParticipants.LinkParticipantsRequestOption = this.RequestOption;
                this.recordParticipants.Load();
            }
            else
            {
                this.Group           = this.CreateGroup();
                this.ControllerState = GroupModelControllerState.Finished;
            }
            //

            this.signalFinished = true;
            return(this.Group);
        }