public static List <model.DapAn> convertListDapAnFromAnswaresText(string Answares) { List <model.DapAn> lsAnswares = new List <model.DapAn>(); try { string[] strAnswareSplits = Answares.Split(new string[] { "$#@$#@" }, StringSplitOptions.RemoveEmptyEntries); foreach (string Answare in strAnswareSplits) { string[] strSplitTemp = Answare.Split(new string[] { "!!!$$$" }, StringSplitOptions.RemoveEmptyEntries); int iIDTemp = -1; if (strSplitTemp.Length > 1 && int.TryParse(strSplitTemp[0].Trim(), out iIDTemp)) { model.DapAn DapAnTemp1 = new model.DapAn() { CauHoiID = int.Parse(strSplitTemp[0].Trim()), Match = strSplitTemp[1].Trim() }; lsAnswares.Add(DapAnTemp1); } } } catch { } return(lsAnswares); }
public static List <model.DapAn> convertListDapAnFromAnswares(string Answares, out List <int> lsDapAnIDs) { lsDapAnIDs = new List <int>(); List <model.DapAn> lsAnswares = new List <model.DapAn>(); string[] strAnswareSplits = Answares.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); foreach (string Answare in strAnswareSplits) { string[] strSplitTemp = Answare.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries); int iIDTemp = -1; if (strSplitTemp.Length > 1 && int.TryParse(strSplitTemp[0].Trim(), out iIDTemp)) { model.DapAn DapAnTemp1 = new model.DapAn() { CauHoiID = int.Parse(strSplitTemp[0].Trim()), Match = strSplitTemp[1].Trim() }; lsAnswares.Add(DapAnTemp1); if (!lsDapAnIDs.Contains(iIDTemp)) { lsDapAnIDs.Add(iIDTemp); } } } return(lsAnswares); }
public static AnswerDto ToAnswerDto(this Answare model) { return(new AnswerDto() { AnswerId = model.Id, Name = model.Name }); }
public Questions() { answare = new Answare(); quest = new Quest(); Quests.Add(quest.question[0], answare.AnswereOne); Quests.Add(quest.question[1], answare.AnswereTwo); Quests.Add(quest.question[2], answare.AnswereThree); Quests.Add(quest.question[3], answare.AnswereFour); Quests.Add(quest.question[4], answare.AnswereFive); }
// this method define the answer based on the user interaction, that allows the process continuing from where it left off public static Task <object> DefineAnsware(string id, bool result) { if (!StatusReport.ContainsKey(id)) { return(Task.FromResult((object)"Success on the operation")); } // here I create a taskcompletaionsource to allow get the result of the process, and send for the user, without it would be impossible to do it TaskCompletionSource <object> completedTask = new TaskCompletionSource <object>(); StatusReport[id] = new Answare(completedTask) { HasAnswared = true, Value = result }; return(completedTask.Task); }