Esempio n. 1
0
        public static async Task UpdateTaskDescriptionAsync(PlannerTask task, string description)
        {
            if (task.etag == null)
            {
                throw new ArgumentNullException("task.etag");
            }

            var accessToken   = AuthenticationHelper.GetGraphAccessTokenAsync();
            var tasksEndPoint = string.Format("{0}tasks/{1}/details", AADAppSettings.GraphBetaResourceUrl, task.id);

            var requestMessage = new HttpRequestMessage(new HttpMethod("PATCH"), tasksEndPoint);

            TaskDetails details = new TaskDetails {
                description = description, previewType = "description"
            };

            requestMessage.Content = new StringContent(JsonConvert.SerializeObject(details), System.Text.Encoding.UTF8, "application/json");

            using (var client = new HttpClient())
            {
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", await accessToken);
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client.DefaultRequestHeaders.IfMatch.Add(new EntityTagHeaderValue(task.etag.Tag, task.etag.IsWeak));
                var responseMessage = await client.SendAsync(requestMessage);

                if (responseMessage.StatusCode != System.Net.HttpStatusCode.NoContent)
                {
                    throw new Exception();
                }
            }
        }
Esempio n. 2
0
        public void ModifyTask(User user, TaskDetails task)
        {
            security.AuthorizeTask(user, SecurityService.AccessType.Modify, task.Id);
            int project_id = -1;

            foreach (var project in ctx.ProjectSet)
            {
                if (project.Task.Any(r => r.Id == task.Id))
                {
                    project_id = project.Id;
                }
            }
            if (project_id == -1)
            {
                throw new ProjectNotFoundException();
            }
            removeTask(task.Id);

            addTask(task, project_id);

            /*
             * var old_task = ctx.TaskSet.Find(task.Id);
             * int id = old_task.Id;
             * var project = ctx.ProjectSet.Where(r => r.Task.Any(t => t.Id == id)).First();
             * project.Task.Remove(old_task);
             * ctx.TaskSet.Remove(old_task);
             * var new_task = addTaskDetails(task);
             * new_task.Id = id;
             * project.Task.Add(new_task);
             * ctx.TaskSet.Add(new_task);*/
            ctx.SaveChanges();
        }
        private async Task writeinDb(string name, string details, string prior, string asign, string _startdate, string _enddate)
        {
            string n = await DataBase.findIddb("ST-");

            string[] assigned = asign.Split(" ");
            string   status   = "Open";
            string   coll     = pd.Selected.collective;
            var      dt       = DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss");
            bool     results  = await tdl.Write(n, name, details, assigned[0], assigned[1], pd.emp.name, pd.emp.id, dt, prior, status, coll, pd.Selected.id, pd.Selected.name, _startdate, _enddate);

            selected = new TaskDetails
            {
                id           = n,
                Assign_by    = pd.emp.name,
                Assign_by_id = pd.emp.id,
                Assign_to    = assigned[0],
                Assign_to_id = assigned[1],
                collective   = coll,
                details      = details,
                name         = name,
                updated      = DateTime.Now,
                createdDate  = DateTime.Now,
                priority     = prior,
                status       = status,
                taskid       = pd.Selected.id,
                taskname     = pd.Selected.name,
                startdate    = Convert.ToDateTime(_startdate),
                enddate      = Convert.ToDateTime(_enddate)
            };
            tds.Add(selected);
        }
Esempio n. 4
0
        public ActionResult Edit(int id)
        {
            TaskDetails CVM = new TaskDetails();

            CVM = taskDetailClient.find(id);
            return(View("Edit", CVM));
        }
Esempio n. 5
0
        public void EditTask(int taskId, TaskDetails taskModel)
        {
            try
            {
                var user = (from u in _context.UserDefn
                            where u.Email == taskModel.Email
                            select u).FirstOrDefault();

                if (user == null)
                {
                    UserDefn newUser = new UserDefn
                    {
                        Email = taskModel.Email
                    };
                    _context.UserDefn.Add(newUser);
                    _context.SaveChanges();
                }

                user = (from u in _context.UserDefn
                        where u.Email == taskModel.Email
                        select u).FirstOrDefault();

                _context.Database.ExecuteSqlRaw("UPDATE Tasks SET TaskName = '" + taskModel.Name + "', TaskDescription='" + taskModel.Description + "', TaskDate='" + taskModel.Date + "', UserId='" + user.UserId + "' where TaskId='" + taskId + "'");
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Called when [execute outdent task].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="System.Windows.Input.ExecutedRoutedEventArgs"/> instance containing the event data.</param>
        private static void OnExecuteOutdentTask(object sender, ExecutedRoutedEventArgs args)
        {
            GanttControl gantt = args.Source as GanttControl;

            /// The loop has been limitted to one, to perform the out-dent operation on only tge first item in the selected items collection.
            /// By replacing the condition of loop you can achieve it for all selected items.
            for (int i = 0; i < 1; i++)
            {
                TaskDetails currentTask = gantt.SelectedItems[i] as TaskDetails;

                /// Getting the parent of the current Task
                TaskDetails parentTask = gantt.Model.GetParentOfItem(currentTask) as TaskDetails;


                DateTime parentStart;
                DateTime parentEnd;

                if (parentTask == null)
                {
                    continue;
                }

                else
                {
                    parentStart = parentTask.StartDate;
                    parentEnd   = parentTask.FinishDate;
                    /// Getting the parent of the current Task
                    TaskDetails nextLevelParent = gantt.Model.GetParentOfItem(parentTask) as TaskDetails;
                    int         currentIndex    = parentTask.Child.IndexOf(currentTask);

                    parentTask.Child.Remove(currentTask);

                    while ((parentTask.Child.Count) > currentIndex)
                    {
                        TaskDetails child = parentTask.Child[currentIndex] as TaskDetails;
                        /// Changing the hierarchy to achieve indent
                        parentTask.Child.Remove(child);
                        currentTask.Child.Add(child);
                    }

                    if (nextLevelParent == null)
                    {
                        /// Changing the hierarchy to achieve indent
                        int parentIndex = gantt.Model.InbuiltTaskCollection.IndexOf(parentTask);
                        gantt.Model.InbuiltTaskCollection.Insert(parentIndex + 1, currentTask);
                    }
                    else
                    {
                        /// Changing the hierarchy to achieve indent
                        int parentIndex = nextLevelParent.Child.IndexOf(parentTask);
                        nextLevelParent.Child.Insert(parentIndex + 1, currentTask);
                    }

                    parentTask.StartDate  = parentStart;
                    parentTask.FinishDate = parentEnd;
                }
                gantt.SelectedItems.Clear();
                gantt.SelectedItems.Add(currentTask);
            }
        }
        //method called when Edit button is clicked
        private void btnEdit_Click(object sender, EventArgs e)
        {
            //check if any task is selected
            if (lvTasks.SelectedItems.Count == 0)
            {
                //if nothing is selected, show error
                MessageBox.Show("Select some task first", "Info", MessageBoxButtons.OK);
            }
            else
            {
                //get id of selected task - tha same way as when removing
                string taskId = lvTasks.SelectedItems[0].SubItems[0].Text;
                //find task by id
                TodoTask task = _todoTaskManager.FindTask(int.Parse(taskId));
                //display form and pass the task
                TaskDetails detailsForm = new TaskDetails(task);
                detailsForm.ShowDialog();

                //if task has been modified
                if (detailsForm.IsSaved)
                {
                    //update tasks in the file
                    _todoTaskManager.UpdateUserTasks(_logged.Id);
                    //update title and is finished
                    lvTasks.SelectedItems[0].SubItems[1].Text = task.Title;
                    lvTasks.SelectedItems[0].SubItems[2].Text = task.IsFinished ? "✓" : "✕";
                }
            }
        }
Esempio n. 8
0
        private async Task writeinDb(string name, string details, string prior, string asign, string coll)
        {
            string n = await DataBase.findIddb("T-");

            string[] assigned = asign.Split(" ");
            string   status   = "Open";
            var      dt       = DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss");

            click = new TaskDetails
            {
                id           = n,
                Assign_by    = emp.name,
                Assign_by_id = emp.id,
                Assign_to    = assigned[0],
                Assign_to_id = assigned[1],
                collective   = coll,
                details      = details,
                name         = name,
                updated      = DateTime.Now,
                createdDate  = DateTime.Now,
                priority     = prior,
                status       = status
            };
            tds.Add(click);
            string tableCommand = "INSERT INTO task(taskid,taskname,taskdetails,updated,createdDate,assignedby,assignedbyId,priority,status,assignedto,assignedtoId,collective,team)" +
                                  "VALUES('" + n + "','" + name + "','" + details + "','" + dt + "','" + dt + "','" + emp.name + "','" + emp.id + "','" + prior + "','" + status + "','" + assigned[0] + "','" + assigned[1] + "','" + coll + "','Assets/" + emp.id + ".jpg');";
            bool result = await DataBase.ExecuteCommand(tableCommand);

            if (!result)
            {
            }
        }
        //update Task
        public void Update(TaskDetails task)
        {
            var entry = db.Entry(task);

            entry.State = EntityState.Modified;
            db.SaveChanges();
        }
Esempio n. 10
0
 //Update the Task Details
 public async Task Update(string prior, TaskDetails selected, string value)
 {
     if (flag)
     {
         if (value == "priority")
         {
             string tableCommand = "UPDATE taskdetails SET Priority='" + prior + "' WHERE id='" + selected.id + "'";
             bool   result       = await DataBase.ExecuteCommand(tableCommand);
         }
         else if (value == "status")
         {
             string tableCommand = "UPDATE taskdetails SET Status='" + prior + "' WHERE id='" + selected.id + "'";
             bool   result       = await DataBase.ExecuteCommand(tableCommand);
         }
         else if (value == "collective")
         {
             string tableCommand = "UPDATE taskdetails SET Collective='" + prior + "' WHERE id='" + selected.id + "'";
             bool   result       = await DataBase.ExecuteCommand(tableCommand);
         }
         else if (value == "enddate")
         {
             string tableCommand = "UPDATE taskdetails SET enddate='" + prior + "' WHERE id='" + selected.id + "'";
             bool   result       = await DataBase.ExecuteCommand(tableCommand);
         }
         else if (value == "startdate")
         {
             string tableCommand = "UPDATE taskdetails SET startdate='" + prior + "' WHERE id='" + selected.id + "'";
             bool   result       = await DataBase.ExecuteCommand(tableCommand);
         }
     }
 }
Esempio n. 11
0
    /// <summary>
    /// Заполняет параметрами пустое задание
    /// </summary>
    /// <param name="statCategory">Категория задания</param>
    /// <param name="key">Ключевой предмет задания</param>
    /// <param name="amountToComplete">Количество предметов, требуемое для завершения задания</param>
    /// <param name="fromCharacter">Персонаж, давший задание</param>
    public void Create(string statCategory, string key, int amountToComplete, string fromCharacter)
    {
        Details    = new TaskDetails(statCategory, key, amountToComplete, fromCharacter);
        Details.ID = Details.GetHashCode();

        Save();
    }
Esempio n. 12
0
        private List <TaskDetails> BuildTaskList(List <Task> taskResp)
        {
            List <TaskDetails> tasks = new List <TaskDetails>();
            var parentList           = businessObj.GetAllParentTask();

            try
            {
                foreach (var item in taskResp)
                {
                    TaskDetails taskDetail = new TaskDetails();
                    taskDetail.TaskID    = item.TaskID;
                    taskDetail.TaskName  = item.TaskName;
                    taskDetail.ParentID  = item.ParentID;
                    taskDetail.ProjectID = item.ProjectID;
                    if (taskDetail.ParentID != null)
                    {
                        var resp = parentList.FirstOrDefault(x => x.ParentID == item.ParentID);
                        taskDetail.ParentTaskName = resp != null ? resp.ParentTaskName : null;
                    }
                    taskDetail.StartDate = item.StartDate;
                    taskDetail.EndDate   = item.EndDate;
                    taskDetail.Priority  = item.Priority;
                    taskDetail.Status    = item.Status;
                    taskDetail.UserID    = item.UserID;

                    tasks.Add(taskDetail);
                }
            }
            catch (Exception ex)
            {
                Logger.WriteLog(ex.Message);
            }

            return(tasks);
        }
        public ActionResult <CarWashVisitDataModel> GetDetails()
        {
            CarWashVisitDatabase  carWashVisitDatabase  = new CarWashVisitDatabase(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CarWashVisit_DatabaseNew.db3"));
            CarWashVisitDataModel carWashVisitDataModel = new CarWashVisitDataModel();

            carWashVisitDataModel.Code                = 200;
            carWashVisitDataModel.Message             = "successfully exicuted";
            carWashVisitDataModel.Success             = true;
            carWashVisitDataModel.CarwashVisitDetails = new ObservableCollection <CarwashVisitDetails>();

            ObservableCollection <Models.CarwashVisitDetails> ListOfCarwashVisitDetails = carWashVisitDatabase.GetCarwashVisitDetailsAsync();

            foreach (var item in ListOfCarwashVisitDetails)
            {
                CarwashVisitDetails carwashVisitDetails = ClassConverter.CastCarwashVisitDetails <CarwashVisitDetails>(item);
                //carwashVisitDetails.Tasks = new ObservableCollection<TaskDetails>();
                ObservableCollection <Models.TaskDetails> ListOfCarwashTaskDetails = carWashVisitDatabase.GetTaskDetailsAsync();
                foreach (var taskDetails in ListOfCarwashTaskDetails)
                {
                    TaskDetails carwashTaskDetails = ClassConverter.CastTaskDetails <TaskDetails>(taskDetails);
                    if (item.VisitId.ToString() == taskDetails.VisitTaskId)
                    {
                        carwashVisitDetails.Tasks.Add(carwashTaskDetails);
                    }
                }

                carWashVisitDataModel.CarwashVisitDetails.Add(carwashVisitDetails);
            }

            return(carWashVisitDataModel);
        }
Esempio n. 14
0
        private void TasksList_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var selected_index = TasksList.SelectedIndex;
            var view           = new TaskDetails(tasksDict[selected_index], _vm);

            view.Show();
        }
Esempio n. 15
0
        private void list_ItemClick(object sender, ItemClickEventArgs e)
        {
            var clickedItem = e.ClickedItem;
            var click1      = (TaskDetails)clickedItem;

            click = click1;
            initiaze();
        }
Esempio n. 16
0
 //Update the Task Details
 public async Task Update1(TaskDetails selected)
 {
     if (flag)
     {
         string tableCommand = "UPDATE taskdetails SET status='Close' WHERE id='" + selected.id + "'";
         bool   result       = await DataBase.ExecuteCommand(tableCommand);
     }
 }
Esempio n. 17
0
        public async Task Delete(TaskDetails selected)
        {
            string tableCommand = "DELETE FROM files WHERE taskid='" + selected.id + "';";
            bool   result       = await DataBase.ExecuteCommand(tableCommand);

            tableCommand = "DELETE FROM comment WHERE id='" + selected.id + "';";
            result       = await DataBase.ExecuteCommand(tableCommand);
        }
 public void EditTaskDetails(TaskDetails taskDetail)
 {
     using (var context = new FSD_SBAEntities())
     {
         int i = context.UpdateTaskDetails(taskDetail.ProjectName, taskDetail.TaskId, taskDetail.TaskName, taskDetail.ParentTaskName, taskDetail.StartDate, taskDetail.EndDate, taskDetail.Priority, taskDetail.UserID, taskDetail.IsEnded);
         context.SaveChangesAsync();
     }
 }
Esempio n. 19
0
        /// <summary>
        /// 签到任务特殊处理
        /// </summary>
        /// <param name="item"></param>
        /// <param name="memberIncomes"></param>
        /// <param name="taskInfo"></param>
        /// <returns></returns>
        private async Task <Tuple <bool, string, int> > SetSign(TaskItem item, TaskInfo taskInfo, List <MemberIncome> memberIncomes)
        {
            var nows    = System.DateTime.Now;
            var flag    = false;
            var message = "";
            // 今日签到数据
            var memberIncome = memberIncomes.FirstOrDefault(a => a.TaskCode == taskInfo.TaskCode);

            if (memberIncome == null)
            {
                // 昨日签到数据
                memberIncome = await _IMemberIncomeRepository.Query(a => a.TaskCode == taskInfo.TaskCode &&
                                                                    a.Status == 0 &&
                                                                    a.MemberId == item.MemberId &&
                                                                    a.CreateTime.Value.ToString("yyyy-MM-dd") == nows.AddDays(-1).ToString("yyyy-MM-dd"))
                               .SingleOrDefaultAsync();
            }

            var weeks = await _ITaskDetailsRepository.Query(a => a.TaskId == taskInfo.TaskId && a.IsEnable == 1)
                        .OrderBy(a => a.Sequence)
                        .ToListAsync();

            var beans  = 0;
            var number = 0;
            var week   = new TaskDetails();

            // 当天收入
            if (memberIncome == null)
            {
                week  = weeks.FirstOrDefault();
                beans = week.Beans.Value;
            }
            // 昨天收入
            else if (memberIncome.CreateTime.Value.ToString("yyyy-MM-dd") == nows.AddDays(-1).ToString("yyyy-MM-dd"))
            {
                number += memberIncome.SignNumber.Value;
                week    = weeks[number];
                beans   = week.Beans.Value;
            }
            if (beans > 0 && number < taskInfo.UpperNumber)
            {
                var thisIncome = new MemberIncome();
                thisIncome.SignNumber = number + 1;
                thisIncome.Beans      = beans = item.AdvanceSing == 1? beans * 2:beans;
                thisIncome.Title      = week.SaveDesc;
                // 添加签到数据
                await SetModal(item, taskInfo, thisIncome);

                flag = true;
            }
            else
            {
                flag    = false;
                message = "签到失败!";
                beans   = 0;
            }
            return(new Tuple <bool, string, int>(flag, message, beans));
        }
 private async Task GoToNavigation(Tasks task)
 {
     DetailViewModel vm   = new DetailViewModel(task);
     TaskDetails     view = new TaskDetails
     {
         BindingContext = vm
     };
     await App.Current.MainPage.Navigation.PushAsync(view);
 }
Esempio n. 21
0
        public void AddTask(User user, long project_id, TaskDetails task)
        {
            security.AuthorizeProject(user, SecurityService.AccessType.Modify, project_id);
            var dbtask = addTask(task, project_id);

            ctx.TaskSet.Add(dbtask);
            ctx.ProjectSet.Find(project_id).Task.Add(dbtask);
            ctx.SaveChanges();
        }
Esempio n. 22
0
 internal NewTask GetNewTask(TaskDetails expectedTask)
 {
     return(new NewTask
     {
         Task = expectedTask.Task,
         Assignees = expectedTask.Assignees.Select(a => a.Id).ToList(),
         DueDate = expectedTask.DueDate,
         File = expectedTask.File.GroupId
     });
 }
Esempio n. 23
0
 public ActionResult EditTask(TaskDetails task)
 {
     if (ModelState.IsValid)
     {
         db.Update(task);
         TempData["Message"] = "You have successfully saved your task";
         return(RedirectToAction("ViewTask", new { id = task.TaskId }));
     }
     return(View(task));
 }
Esempio n. 24
0
        private async void tasks_ItemClick(object sender, ItemClickEventArgs e)
        {
            var clickedItem = e.ClickedItem;

            click       = (TaskDetails)clickedItem;
            data.emp    = emp;
            data.click1 = click;
            data.tds    = tds;
            this.Frame.Navigate(typeof(TaskDetailedView), data);
        }
Esempio n. 25
0
        //Delete of a specific Task Details from DATABASE or API
        public async Task Delete(TaskDetails selected)
        {
            if (flag)
            {
                string tableCommand = "DELETE FROM taskdetails WHERE id='" + selected.id + "' OR taskid='" + selected.id + "';";
                bool   result       = await DataBase.ExecuteCommand(tableCommand);

                await DataBase.DeleteSubTask();
            }
        }
Esempio n. 26
0
        public void getTaskListById_test()
        {
            Mock <ITaskRepository> mock = new Mock <ITaskRepository>();
            var TaskRepository          = new Mock <ITaskRepository>();

            TaskRepository.Setup(m => m.GetTaskDetailById(2)).Returns(GetTaskDetail_Mock().Last());
            TaskDetails taskDetails = new TaskDetails(TaskRepository.Object);
            var         tasks       = taskDetails.getTaskListById(2);

            Assert.AreEqual(tasks.Status, "Done");
        }
        public IActionResult CreateSchedular(TaskDetails taskDetails)
        {
            try{
                //return Processes.GetProcessResult("param").ToString();
                // Get the service on the local machine
                using (TaskService ts = new TaskService())
                {
                    // Create a new task definition and assign properties
                    TaskDefinition td = ts.NewTask();
                    td.RegistrationInfo.Description = "Does something";

                    // Create a trigger that will fire the task at this time every other day
                    // td.Triggers.Add(new WeeklyTrigger { DaysOfWeek = DaysOfTheWeek.AllDays });
                    // td.Triggers.Add(new DailyTrigger { DaysInterval = 2 });
                    // td.Triggers.Add(new MonthlyTrigger { DaysOfMonth = new int[]{1,2,3} });
                    //td.Triggers.Add(new TimeTrigger { StartBoundary = new DateTime(2020, 5, 15, 9, 0, 0) });

                    td.Triggers.Add(new TimeTrigger {
                        StartBoundary = taskDetails.TimeToSchedule
                    });

                    // Create an action that will launch Notepad whenever the trigger fires
                    //td.Actions.Add(new ExecAction("notepad.exe", "c:\\test.log", null));
                    td.Actions.Add(new ExecAction(taskDetails.TaskPath));

                    // Register the task in the root folder

                    if (ts != null)
                    {
                        var result = string.Empty;
                        foreach (var t in ts.AllTasks.ToList())
                        {
                            result += t.Name;
                            if (t.Name == taskDetails.TaskName)
                            {
                                /*Task available already*/
                                return(Conflict("Task Available Already /\n" + result + " \n" + taskDetails.TaskName + " \n" + t.Name));
                            }
                        }
                        ts.RootFolder.RegisterTaskDefinition(taskDetails.TaskName, td);
                        //return "Task created successfully " + ts.RootFolder + ", " + result;
                        /*Task created successfully*/
                        return(Ok("201"));
                    }
                    return(Conflict("Task Definition returns null"));

                    // Remove the task we just created
                    //ts.RootFolder.DeleteTask("Test");
                }
            }
            catch (Exception ex) {
                return(BadRequest(ex.ToString()));
            }
        }
        // GET: Home

        public ActionResult Index()
        {
            TaskDetails t = new TaskDetails();

            GetTaskName();
            if (listSelectListItem.Count > 0)
            {
                t.TaskNames = listSelectListItem;
            }

            return(View(t));
        }
        public ActionResult Index(TaskDetails tmodel)
        {
            if (AddToTaskList(tmodel))
            {
                ViewBag.Message = "Task added in db";

                GetTaskName();
                tmodel.TaskNames = listSelectListItem;
            }

            return(View(tmodel));
        }
Esempio n. 30
0
        //Reading  subatsk Based on current task from DATABASE or API
        public async Task <ObservableCollection <TaskDetails> > LoadSub(TaskDetails task)
        {
            string tableCommand = "";
            ObservableCollection <TaskDetails> ts = new ObservableCollection <TaskDetails>();

            if (flag)
            {
                tableCommand = "SELECT * FROM taskdetails WHERE taskid='" + task.id + "';";
                ts           = await Task.Run(() => DataBase.ReadDataDb(tableCommand));
            }
            return(ts);
        }