コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public static AnswerDto ToAnswerDto(this Answare model)
 {
     return(new AnswerDto()
     {
         AnswerId = model.Id,
         Name = model.Name
     });
 }
コード例 #4
0
 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);
 }
コード例 #5
0
    // 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);
    }