public void PromptChoice(RuleEngine env, ProAi.Clips.DataObject obj) { //规则中回调函数的参数说明: //RtnString(1):QuestionContent 问题详细内容,提示用户的信息 //RtnString(2):QuestionContent 问题简要内容,提示用户的信息 //RtnString(3):QuestionFactName问题,在规则中用到的事实的名称 //RtnString(4):Choice1 可选项1,提示用户的信息 //RtnString(5):AllowedValue1 可选项1,在规则中用到的值 //RtnString(6):Choice2 //RtnString(7):AllowedValue2 //...... //RtnString(2N+2):ChoiceN //RtnString(2N+3):AllowedValueN QuestionChoices stQC = new QuestionChoices(); stQC.Question = new CodeFull(env.UserFunctionManager.RtnString(1), env.UserFunctionManager.RtnString(2), env.UserFunctionManager.RtnString(3)); stQC.Choices = new List <CodeSimple>(); int nStart = 4;//参数从第4个开始为choice,每2个为一组 for (int i = nStart; i < env.UserFunctionManager.ArgCount; i = i + 2) { stQC.Choices.Add(new CodeSimple(env.UserFunctionManager.RtnString(i), env.UserFunctionManager.RtnString(i + 1))); } m_stInferResult.InterChoices.Questions.Add(stQC); }
public AdvanceViewModel(WorkflowQuestionChoices workflowQuestionChoices, UnliqudatedObjectsWorkflowQuestion question, Workflow workflow, DateTime?expectedDateForCompletion, bool expectedDateForCompletionEditable) { var workflowId = workflow.WorkflowId; WorkflowRowVersionString = workflow.WorkflowRowVersionString; EditingBeganAtUtc = DateTime.UtcNow; Answer = question != null ? question.Answer : ""; Comments = question != null ? question.Comments : ""; UnliqudatedWorkflowQuestionsId = question?.UnliqudatedWorkflowQuestionsId ?? 0; JustificationKey = question?.JustificationKey; ExpectedDateForCompletion = expectedDateForCompletion; ExpectedDateForCompletionEditable = expectedDateForCompletionEditable; var ulo = workflow.TargetUlo; PDN = ulo.PegasysDocumentNumber; IsValid = ulo.Valid; // workflow.WorkflowRowVersionString; if (workflowQuestionChoices != null) { QuestionLabel = workflowQuestionChoices.QuestionLabel; foreach (var questionChoice in workflowQuestionChoices.WhereMostApplicable(workflow.TargetUlo.DocType, workflow.MostRecentNonReassignmentAnswer, workflow.MostRecentRealAnswer)) { QuestionChoices.Add(new QuestionChoicesViewModel(questionChoice)); } } }
public ActionResult DeleteConfirmed(int id) { QuestionChoices QuestionChoices = db.QuestionChoices.Find(id); db.QuestionChoices.Remove(QuestionChoices); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "questionChoiceID,questionChoiceFull,questionID,ordinal")] QuestionChoices QuestionChoices) { if (ModelState.IsValid) { db.Entry(QuestionChoices).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.questionID = new SelectList(db.Questions, "questionID", "questionName", QuestionChoices.questionID); return(View(QuestionChoices)); }
// GET: QuestionChoices/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } QuestionChoices QuestionChoices = db.QuestionChoices.Find(id); if (QuestionChoices == null) { return(HttpNotFound()); } return(View(QuestionChoices)); }
// GET: QuestionChoices/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } QuestionChoices QuestionChoices = db.QuestionChoices.Find(id); if (QuestionChoices == null) { return(HttpNotFound()); } ViewBag.questionID = new SelectList(db.Questions, "questionID", "questionName", QuestionChoices.questionID); return(View(QuestionChoices)); }
public static MsCrmResultObject GetQuestionChoices(Guid questionId, SqlDataAccess sda) { MsCrmResultObject returnValue = new MsCrmResultObject(); try { #region | SQL QUERY | string query = @"SELECT c.new_questionchoiceId AS Id ,c.new_name AS Name ,c.new_iscorrect AS IsCorrect ,c.new_questionId AS QuestionId ,c.new_questionIdName AS QUestionIdName FROM new_questionchoice AS c (NOLOCK) WHERE c.new_questionId='{0}' AND c.statecode=0 ORDER BY NEWID()" ; #endregion DataTable dt = sda.getDataTable(string.Format(query, questionId)); if (dt != null && dt.Rows.Count > 0) { List <QuestionChoices> returnList = new List <QuestionChoices>(); for (int i = 0; i < dt.Rows.Count; i++) { QuestionChoices _questionChoices = new QuestionChoices(); _questionChoices.Id = (Guid)dt.Rows[i]["Id"]; _questionChoices.Name = dt.Rows[i]["Name"] != DBNull.Value ? dt.Rows[i]["Name"].ToString() : string.Empty; if (dt.Rows[i]["QuestionId"] != DBNull.Value) { EntityReference er = new EntityReference() { Id = (Guid)dt.Rows[i]["QuestionId"], Name = dt.Rows[i]["QuestionIdName"].ToString() }; _questionChoices.Question = er; } _questionChoices.IsCorrect = dt.Rows[i]["IsCorrect"] != DBNull.Value ? (bool)dt.Rows[i]["IsCorrect"] : false; returnList.Add(_questionChoices); } returnValue.Success = true; returnValue.ReturnObject = returnList; } else { returnValue.Success = false; returnValue.Result = "M030"; //"Soruya ait şıklar bulunamadı."; } } catch (Exception ex) { returnValue.Success = false; returnValue.Result = ex.Message; } return(returnValue); }
public static MsCrmResultObject GetQuestionChoices(Guid questionId, SqlDataAccess sda) { MsCrmResultObject returnValue = new MsCrmResultObject(); try { #region | SQL QUERY | string query = @"SELECT c.new_questionchoiceId AS Id ,c.new_name AS Name ,c.new_iscorrect AS IsCorrect ,c.new_questionId AS QuestionId ,c.new_questionIdName AS QUestionIdName FROM new_questionchoice AS c (NOLOCK) WHERE c.new_questionId='{0}' AND c.statecode=0 ORDER BY NEWID()"; #endregion DataTable dt = sda.getDataTable(string.Format(query, questionId)); if (dt != null && dt.Rows.Count > 0) { List<QuestionChoices> returnList = new List<QuestionChoices>(); for (int i = 0; i < dt.Rows.Count; i++) { QuestionChoices _questionChoices = new QuestionChoices(); _questionChoices.Id = (Guid)dt.Rows[i]["Id"]; _questionChoices.Name = dt.Rows[i]["Name"] != DBNull.Value ? dt.Rows[i]["Name"].ToString() : string.Empty; if (dt.Rows[i]["QuestionId"] != DBNull.Value) { EntityReference er = new EntityReference() { Id = (Guid)dt.Rows[i]["QuestionId"], Name = dt.Rows[i]["QuestionIdName"].ToString() }; _questionChoices.Question = er; } _questionChoices.IsCorrect = dt.Rows[i]["IsCorrect"] != DBNull.Value ? (bool)dt.Rows[i]["IsCorrect"] : false; returnList.Add(_questionChoices); } returnValue.Success = true; returnValue.ReturnObject = returnList; } else { returnValue.Success = false; returnValue.Result = "M030"; //"Soruya ait şıklar bulunamadı."; } } catch (Exception ex) { returnValue.Success = false; returnValue.Result = ex.Message; } return returnValue; }
public void PromptChoice(RuleEngine env, ProAi.Clips.DataObject obj) { //规则中回调函数的参数说明: //RtnString(1):QuestionContent 问题详细内容,提示用户的信息 //RtnString(2):QuestionContent 问题简要内容,提示用户的信息 //RtnString(3):QuestionFactName问题,在规则中用到的事实的名称 //RtnString(4):Choice1 可选项1,提示用户的信息 //RtnString(5):AllowedValue1 可选项1,在规则中用到的值 //RtnString(6):Choice2 //RtnString(7):AllowedValue2 //...... //RtnString(2N+2):ChoiceN //RtnString(2N+3):AllowedValueN QuestionChoices stQC = new QuestionChoices(); stQC.Question = new CodeFull(env.UserFunctionManager.RtnString(1), env.UserFunctionManager.RtnString(2), env.UserFunctionManager.RtnString(3)); stQC.Choices = new List<CodeSimple>(); int nStart = 4;//参数从第4个开始为choice,每2个为一组 for (int i = nStart; i < env.UserFunctionManager.ArgCount; i = i + 2) { stQC.Choices.Add(new CodeSimple(env.UserFunctionManager.RtnString(i), env.UserFunctionManager.RtnString(i + 1))); } m_stInferResult.InterChoices.Questions.Add(stQC); }