/// <summary> /// Loads the specified the delegate. /// </summary> /// <param name="theDelegate">The delegate.</param> /// <returns></returns> public bool Load(IQuestionnaireDelegate theDelegate) { if (this.LoadDelegate != null) { return(false); } this.LoadDelegate = theDelegate; this.currentQuery = new UPContainerMetaInfo(this.Manager.QuestionnaireList); if (!string.IsNullOrEmpty(this.RecordIdentification)) { this.currentQuery.SetLinkRecordIdentification(this.RecordIdentification); } else { UPConfigFilter filter = ConfigurationUnitStore.DefaultStore.FilterByName(this.Manager.QuestionnaireSearchAndList.FilterName); filter = filter.FilterByApplyingValueDictionary( new Dictionary <string, object> { { Constants.QuestionnaireQuestionnaireID, this.CatalogCode.ToString() } }); if (filter != null) { this.currentQuery.ApplyFilter(filter); } } this.requestOption = this.Manager.QuestionnaireRequestOption; this.loadStep = 0; this.currentQuery.Find(this.requestOption, this); return(true); }
/// <summary> /// Signals the error. /// </summary> /// <param name="error">The error.</param> public void SignalError(Exception error) { IQuestionnaireDelegate theDelegate = this.LoadDelegate; this.LoadDelegate = null; this.Manager.QuestionnaireLoadedError(this, error); theDelegate.QuestionnaireDidFailWithError(this, error); }
/// <summary> /// Loads the questionaire. /// </summary> /// <param name="recordIdentification">The record identification.</param> /// <param name="theDelegate">The delegate.</param> /// <returns></returns> public UPQuestionnaire LoadQuestionaire(string recordIdentification, IQuestionnaireDelegate theDelegate) { UPQuestionnaire quest = this.cacheByRecordIdentification.ValueOrDefault(recordIdentification); if (quest != null || theDelegate == null) { return(quest); } quest = new UPQuestionnaire(recordIdentification, this); this.pendingQuestionnaires.Add(quest); quest.Load(theDelegate); return(null); }
/// <summary> /// Loads the questionaire. /// </summary> /// <param name="code">The code.</param> /// <param name="theDelegate">The delegate.</param> /// <returns></returns> public UPQuestionnaire LoadQuestionaire(int code, IQuestionnaireDelegate theDelegate) { UPQuestionnaire quest = this.cacheByCode.ValueOrDefault(code); if (quest != null || theDelegate == null) { return(quest); } quest = new UPQuestionnaire(code, this); this.pendingQuestionnaires.Add(quest); quest.Load(theDelegate); return(null); }
/// <summary> /// Answerses from result. /// </summary> /// <param name="result">The result.</param> private void AnswersFromResult(UPCRMResult result) { int count = result.RowCount; for (int i = 0; i < count; i++) { UPQuestionnaireAnswer answer = new UPQuestionnaireAnswer((UPCRMResultRow)result.ResultRowAtIndex(i)); UPQuestionnaireQuestion question = this.QuestionForId(answer.QuestionId); question.AddAnswer(answer); } IQuestionnaireDelegate theDelegate = this.LoadDelegate; this.LoadDelegate = null; this.Manager.QuestionnaireLoadedError(this, null); theDelegate.QuestionnaireDidFinishWithResult(this, this); }