private void CreateTasks(object Sender, SideBarEventArgs e) { int createdTaskActionID = 1; var centralDal = CssContext.Instance.GetDAL(string.Empty) as DAL; var gateway = new CentralGateway(centralDal); var assignment = gateway.FindAssignment(this.PropertyBag.AssignmentId, CssContext.Instance.Host.EmployeeId); var clientApi = new CloonyClient(); clientApi.Login(); clientApi.GetOrgSet(); clientApi.GetOrgInfo(); var clientList = clientApi.GetClientList(assignment.Client.ClientCode); var client = clientList.Data.FirstOrDefault(c => c.contactCode == assignment.Client.ClientCode); var timeline = clientApi.GetTimeline(client.contactId); var stepsForService = timeline.timeline.Where(s => s.serviceAgreementName == assignment.Name); foreach (var step in stepsForService) { var task = new CSSTask(centralDal); task.Description = step.processInstanceName + " - " + step.taskName; task.CodeId = 4; // crm task.Save(); task.AssignToContactAssignment(CSSTask.CSSAssignToType.Assignment, assignment.AssignmentId); task.AssignTo(CssContext.Instance.Host.EmployeeId, CssContext.Instance.Host.EmployeeId, DateTime.Now, "Assigned by cloony", createdTaskActionID); } MessageBox.Show("Done"); }
public CentralTask CreateTask(string description, DateTime dueDate, int employeeID) { var t = new CSSTask(); t.Description = description; t.DueEnd = dueDate; t.SetCodeAsSystemCRMCode(); t.Save(); t.AssignToContactAssignment(CSSTask.CSSAssignToType.Contact, _contactID); t.AssignTo(_employeeID, _employeeID, DateTime.Now, string.Empty, TASK_ACTION_CREATED); return new CentralTask() { TaskID = t.TaskId, Description = t.Description }; }
public CentralTask CreateTask(string description, DateTime dueDate, int employeeID) { var t = new CSSTask(); t.Description = description; t.DueEnd = dueDate; t.SetCodeAsSystemCRMCode(); t.Save(); t.AssignToContactAssignment(CSSTask.CSSAssignToType.Contact, _contactID); t.AssignTo(_employeeID, _employeeID, DateTime.Now, string.Empty, TASK_ACTION_CREATED); return(new CentralTask() { TaskID = t.TaskId, Description = t.Description }); }