Exemplo n.º 1
0
 public DragRezult(Event onDrag, Event onEndDrag, EventPaint onPaint)
 {
     mRezult = Rezult.Drag;
     mOnDrag = onDrag;
     mOnEndDrag = onEndDrag;
     mOnPaint = onPaint;
 }
Exemplo n.º 2
0
 public DragRezult(Event onDrag, Event onEndDrag, EventPaint onPaint)
 {
     mRezult    = Rezult.Drag;
     mOnDrag    = onDrag;
     mOnEndDrag = onEndDrag;
     mOnPaint   = onPaint;
 }
Exemplo n.º 3
0
 public DragRezult(bool e)
 {
     mRezult = Rezult.Nodrag;
     mOnEndDrag = null;
     mOnDrag = null;
     mOnPaint = null;
 }
Exemplo n.º 4
0
 public DragRezult(bool e)
 {
     mRezult    = Rezult.Nodrag;
     mOnEndDrag = null;
     mOnDrag    = null;
     mOnPaint   = null;
 }
Exemplo n.º 5
0
        public ViewResult ViewResult(Rezult currentResult)
        {
            string currentUserFirstName = db.Users.Where(u => u.user_id_ == SystemInfo.UserId).FirstOrDefault().first_name;
            string currentUserSurname   = db.Users.Where(u => u.user_id_ == SystemInfo.UserId).FirstOrDefault().last_name;

            ViewBag.currentUserSurname   = currentUserSurname;
            ViewBag.currentUserFirstName = currentUserFirstName;


            string currentTest = db.Tests.Where(t => t.test_id == currentResult.test_id).FirstOrDefault().test_name;

            ViewBag.currentTest = currentTest;
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            System.Console.WriteLine("Enter first operand: ");
            double First = double.Parse(Console.ReadLine());

            System.Console.WriteLine("Enter second operand: ");
            double          Second = double.Parse(Console.ReadLine());
            Rezult <double> rez;

            System.Console.WriteLine("Choose operation:\nPush *1* --> to plus operands\nPush *2* --> to minus operands\nPush *3* to find multyplication\nPush *4* --> to divide them\n Your choise:");
            int choise = int.Parse(Console.ReadLine());

            switch (choise)
            {
            case 1:
                rez = new Rezult <double>(Calculator.Plus);
                Console.WriteLine(rez.Invoke(First, Second));
                break;

            case 2:
                rez = new Rezult <double>(Calculator.Minus);
                System.Console.WriteLine(rez.Invoke(First, Second));
                break;

            case 3:
                rez = new Rezult <double>(Calculator.Multyplication);
                Console.WriteLine(rez.Invoke(First, Second));
                break;

            case 4:
                if (Second == 0)
                {
                    System.Console.WriteLine("Error!");
                }
                else
                {
                    rez = new Rezult <double>(Calculator.Division);
                    Console.WriteLine(rez.Invoke(First, Second));
                }
                break;
            }
        }
Exemplo n.º 7
0
 public ActionResult Usercheck([FromBody]Model.UserInfo users)
 {
     try
     {
         var result = DAL.UserInfo.Instance.GetModel(users.userName);
         if (result == null)
             return Json(Result.Err("用户名错误"));
         else if (result.passWord == users.passWord)
         {
            
                 result.passWord = "******";
                 return Json(Result.Ok("登录成功", result));
             }
             else
                 return Json(Rezult.Err("密码错误"));  
     }
     catch (Exception ex)
     {
         return Json(Result.Err(ex.Message));
     }
 }
Exemplo n.º 8
0
        public RedirectToRouteResult CheckResult(Guid sessionId, string[] arr, string action)
        {
            TestSession      session   = Session[sessionId.ToString()] as TestSession;
            List <Questions> questions = session.CurrentTest.Questions.ToList();

            int       currentTest        = session.CurrentTest.test_id;
            int       questionsCount     = questions.Count();
            Questions currentQuestionObj = db.Questions.FirstOrDefault(q => q.test_id == currentTest);
            int       currentQuestion    = currentQuestionObj.question_id + session.CurrentQuestion;

            if (action == "Пропустити")
            {
                session.CurrentQuestion      += 1;
                Session[sessionId.ToString()] = session;
                return(RedirectToAction("GetQuestion"));
            }
            else if (action == "Відповісти")
            {
                bool isWrite = true;

                try
                {
                    if (arr.Length == 0)
                    {
                        isWrite = false;
                    }
                }
                catch (Exception ex)
                {
                    isWrite = false;
                }
                if (isWrite)
                {
                    List <string> checkData = arr.ToList();

                    List <Answers> storageData = db.Answers.Where(a => a.question_id == currentQuestion).ToList();
                    List <Answers> trueData    = new List <Answers>();

                    foreach (Answers elem in storageData)
                    {
                        if (elem.answer_score == ANSWERCOEF1 || elem.answer_score == ANSWERCOEF2 || elem.answer_score == ANSWERCOEF3)
                        {
                            trueData.Add(elem);
                        }
                    }

                    List <string> trueDataString = new List <string>();

                    foreach (Answers element in trueData)
                    {
                        string currentElement = element.answer_text;
                        trueDataString.Add(currentElement);
                    }

                    bool isEqual = trueDataString.SequenceEqual(checkData);
                    if (isEqual)
                    {
                        SystemInfo.points++;
                        foreach (Answers element in trueData)
                        {
                            int answerScore = (int)element.answer_score;
                            SystemInfo.totalScore += answerScore;
                        }
                    }

                    if (session.CurrentQuestion >= questionsCount - 1)
                    {
                        Rezult currentRezult = new Rezult
                        {
                            user_id_    = SystemInfo.UserId,
                            test_id     = currentTest,
                            points      = SystemInfo.points,
                            total_score = SystemInfo.totalScore,
                            data_time   = DateTime.Now
                        };

                        db.Rezult.Add(currentRezult);
                        db.SaveChanges();

                        ViewBag.CurrentTest = currentTest;
                        ViewBag.Score       = SystemInfo.points;
                        return(RedirectToAction("ViewResult", currentRezult));
                    }

                    session.CurrentQuestion      += 1;
                    Session[sessionId.ToString()] = session;

                    return(RedirectToAction("GetQuestion", new { sessionId }));
                }
                else
                {
                    return(RedirectToAction("GetQuestion", new { sessionId }));
                }
            }
            return(RedirectToAction("GetQuestion", new { sessionId }));
        }