private static void GetCommand(SqlCommand command1, List<Task> taskListFalse)
        {
            using (SqlDataReader dr = command1.ExecuteReader())
            {

                while (dr.Read())
                {
                    Task newItem = new Task();

                    newItem.id = dr.GetInt32(0);
                    newItem.name = dr.GetString(1);
                    newItem.text = dr.GetString(2);
                    newItem.TaskBegin = dr.GetDateTime(3);
                    newItem.TaskEnd = dr.GetDateTime(4);
                    newItem.TaskAdded = dr.GetDateTime(5);
                    //newItem.done = Convert.ToBoolean(dr.GetByte(6));
                    //newItem.delete = Convert.ToBoolean(dr.GetByte(7));

                    newItem.done = dr.GetBoolean(6);
                    newItem.delete = dr.GetBoolean(7);

                    //newItem.done = dr.GetByte(6);
                    //newItem.delete = dr.GetByte(7);

                    taskListFalse.Add(newItem);
                }
            }
        }
Esempio n. 2
0
        public ActionResult Add(Task task)
        {
            if (String.IsNullOrEmpty(task.name))
                ModelState.AddModelError("Name", "Введите свое name");

            if (String.IsNullOrEmpty(task.text))
                ModelState.AddModelError("Text", "Введите свое text");

            if (ModelState.IsValid)
            {
                MyDBDataContext db = new MyDBDataContext();
                MyTable125 item = new MyTable125
                {
                    name = task.name,
                    text = task.text,
                    TaskAdded = DateTime.Now,
                    TaskBegin = task.TaskBegin,
                    TaskEnd = task.TaskEnd,
                    delete = false
                };

                //item.done = !flagDone;

                db.MyTable125.InsertOnSubmit(item);
                db.SubmitChanges();
                return RedirectPermanent("/Home/Index");
            }
            else
                // Обнаружена ошибка проверки достоверности
                return RedirectPermanent("/Home/Index");

            return RedirectPermanent("/Home/Index");
            //return View();
        }
 public ActionResult ShowDD(Task model)
 {
     return View();
 }