Пример #1
0
 public UserTask(User_Tasks tasks)
 {
     InitializeComponent();
     id              = tasks.id;
     lblTitle.Text   = $"{tasks.task_title}";
     txtForTask.Text = $"{tasks.task_description}";
     lblDate.Text    = $"{tasks.task_date}";
     lblTime.Text    = $"{tasks.task_time}";
 }
Пример #2
0
        /// <summary>
        /// add task in tableLayoutPanel
        /// </summary>
        public void addTask(User_Tasks tasks, TableLayoutPanel panel)
        {
            UserTask todo = new UserTask(tasks);

            todo.Dock = DockStyle.Fill;
            panel.Controls.Add(todo, Column, Row);
            Column += 1;
            if (Column == 2)
            {
                Row   += 1;
                Column = 0;
            }
        }
Пример #3
0
 private void bunifuPictureBox1_Click(object sender, EventArgs e)
 {
     using (var db = TestDbContext.GetConnection())
     {
         User_Tasks task = db.User_Tasks.Where(x => x.id == id).First();
         db.User_Tasks.Remove(task);
         db.SaveChanges();
         lblTitle.Text   = "Deleted";
         txtForTask.Text = "Deleted";
     }
     //User_Tasks task = micron.GetRecord<User_Tasks>($"SELECT * FROM user_tasks WHERE id = {id}");
     //micron.Delete<User_Tasks>(task);
 }
Пример #4
0
        /// <summary>
        /// This method adds new task in database in user's account(when we click button "add")
        /// </summary>
        private void btnAddTasks_Click(object sender, EventArgs e)
        {
            valueForCircle = 0;

            if (taskTitleBox.Text == "")
            {
                MessageBox.Show("Plese enter title for your task!");
                return;
            }
            if (taskDescriptionBox.Text == "")
            {
                MessageBox.Show("Plese enter description for your task!");
                return;
            }
            if (taskDate.Text == "")
            {
                MessageBox.Show("Plese enter date for your task!");
                return;
            }
            if (taskTime.Text == "")
            {
                MessageBox.Show("Plese enter time for your task!");
                return;
            }
            if (percent.Text == "")
            {
                MessageBox.Show("Plese enter percentage for your task!");
                return;
            }
            using (var db = TestDbContext.GetConnection())
            {
                Users      user = db.Users.First(x => x.username == lblName.Text);
                User_Tasks task = new User_Tasks()
                {
                    user_id          = user.id,
                    task_title       = taskTitleBox.Text,
                    task_description = taskDescriptionBox.Text,
                    task_date        = taskDate.Text,
                    task_time        = taskTime.Text,
                    percentage       = int.Parse(percent.Text)
                };
                db.User_Tasks.Add(task);
                db.SaveChanges();
                circleValue(user);

                MessageBox.Show($"Task succesfully created!");

                taskTitleBox.Text = taskDescriptionBox.Text = taskDate.Text = taskTime.Text = percent.Text = string.Empty;
                Row    = 0;
                Column = 0;
                addTask(task, tableLayoutPanel1);
                Row    = 0;
                Column = 0;
                if (string.Compare(task.task_date, dateNow) == -1 ||
                    (string.Compare(task.task_time, timeNow) == -1 &&
                     string.Compare(task.task_date, dateNow) == 0))
                {
                    addTask(task, tableLayoutPanel2);
                }
            }
        }