コード例 #1
0
ファイル: bCheckDB.Designer.cs プロジェクト: nilavghosh/VChk
 /// <summary>
 /// Create a new OpsChecklistTaskRole object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="checklistTaskID">Initial value of the ChecklistTaskID property.</param>
 /// <param name="opsChecklistID">Initial value of the OpsChecklistID property.</param>
 /// <param name="taskRoleId">Initial value of the TaskRoleId property.</param>
 /// <param name="securityUserLoginID">Initial value of the SecurityUserLoginID property.</param>
 /// <param name="lastUpdated">Initial value of the LastUpdated property.</param>
 /// <param name="lastUpdatedBy">Initial value of the LastUpdatedBy property.</param>
 public static OpsChecklistTaskRole CreateOpsChecklistTaskRole(global::System.Int32 id, global::System.Int32 checklistTaskID, global::System.Int32 opsChecklistID, global::System.Int32 taskRoleId, global::System.String securityUserLoginID, global::System.DateTime lastUpdated, global::System.String lastUpdatedBy)
 {
     OpsChecklistTaskRole opsChecklistTaskRole = new OpsChecklistTaskRole();
     opsChecklistTaskRole.ID = id;
     opsChecklistTaskRole.ChecklistTaskID = checklistTaskID;
     opsChecklistTaskRole.OpsChecklistID = opsChecklistID;
     opsChecklistTaskRole.TaskRoleId = taskRoleId;
     opsChecklistTaskRole.SecurityUserLoginID = securityUserLoginID;
     opsChecklistTaskRole.LastUpdated = lastUpdated;
     opsChecklistTaskRole.LastUpdatedBy = lastUpdatedBy;
     return opsChecklistTaskRole;
 }
コード例 #2
0
ファイル: bCheckDB.Designer.cs プロジェクト: nilavghosh/VChk
 /// <summary>
 /// Deprecated Method for adding a new object to the OpsChecklistTaskRoles EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToOpsChecklistTaskRoles(OpsChecklistTaskRole opsChecklistTaskRole)
 {
     base.AddObject("OpsChecklistTaskRoles", opsChecklistTaskRole);
 }
コード例 #3
0
        public HttpResponseMessage EditTask(List<TaskItem> editedTasks)
        {
            List<OpsChecklist> opstaskscreated = new List<OpsChecklist>();
            foreach (TaskItem task in editedTasks)
            {
                if (task.IsTaskFromOpsChecklist == false)
                {
                    OpsChecklist opschecklisttask = new OpsChecklist()
                    {
                        AlertTime = TimeSpan.Parse(task.AlertTime),
                        DueTime = TimeSpan.Parse(task.DueTime),
                        EscalationLevel1Time = TimeSpan.Parse(task.EscalationLevel1Time),
                        ChecklistTaskID = task.ChecklistTaskID,
                        ChecklistTaskVersion = task.ChecklistTaskVersion,
                        EffectiveStartDate = DateTime.Now,
                        //DateTime.Parse(task.EffectiveStartDate),
                        EffectiveEndDate = null,
                        CreatedDateLocal = task.CreatedDateLocal,
                        LateIncompleteReasonID = task.LateIncompleteReasonID,
                        LinkToProcess = task.LinkToProcess,
                        ManagementSignOffStatusID = task.ManagementSignOffStatusID,
                        StatusID = task.StatusID,
                        TimeTakenToComplete = null,
                        Version = task.Version
                    };
                    if (opschecklisttask.StatusID == 6)
                    {
                        opschecklisttask.TimeTakenToComplete = (DateTime.Now - DateTime.Parse(task.EffectiveStartDate)).Ticks;
                    }
                    opschecklisttask.LastUpdatedBy = ContextUserLoginID;
                    opschecklisttask.LastUpdated = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, DateTime.UtcNow.Minute, DateTime.UtcNow.Second);
                    bCheckUOW.OpsChecklistRepository.Add(opschecklisttask);
                    opstaskscreated.Add(opschecklisttask);

                }
                else
                {
                    var existingtask = (from otask in bCheckUOW.OpsChecklistRepository.All()
                                        where otask.ID == task.OpsChecklistTaskID
                                        select otask).First();
                    existingtask.EffectiveEndDate = DateTime.Now;
                    OpsChecklist opschecklisttask = new OpsChecklist()
                    {
                        AlertTime = TimeSpan.Parse(task.AlertTime),
                        DueTime = TimeSpan.Parse(task.DueTime),
                        EscalationLevel1Time = TimeSpan.Parse(task.EscalationLevel1Time),
                        ChecklistTaskID = task.ChecklistTaskID,
                        ChecklistTaskVersion = task.ChecklistTaskVersion,
                        EffectiveStartDate = DateTime.Now,
                        EffectiveEndDate = null,
                        CreatedDateLocal = task.CreatedDateLocal,
                        LateIncompleteReasonID = task.LateIncompleteReasonID,
                        LinkToProcess = task.LinkToProcess,
                        ManagementSignOffStatusID = task.ManagementSignOffStatusID,
                        TimeTakenToComplete = null,
                        StatusID = task.StatusID,
                        Version = task.Version
                    };
                    if (opschecklisttask.StatusID == 6)
                    {
                        opschecklisttask.TimeTakenToComplete = (DateTime.Now - DateTime.Parse(task.EffectiveStartDate)).Ticks;
                    }
                    opschecklisttask.LastUpdatedBy = ContextUserLoginID;
                    opschecklisttask.LastUpdated = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, DateTime.UtcNow.Minute, DateTime.UtcNow.Second);
                    bCheckUOW.OpsChecklistRepository.Add(opschecklisttask);
                    opstaskscreated.Add(opschecklisttask);

                }
            }
            bCheckUOW.Save();
            for (int i = 0; i < opstaskscreated.Count; i++)
            {
                foreach (var assignee in editedTasks[i].Assignees)
                {
                    OpsChecklistTaskRole opstaskrole = new OpsChecklistTaskRole();
                    opstaskrole.OpsChecklistID = opstaskscreated[i].ID;
                    opstaskrole.ChecklistTaskID = opstaskscreated[i].ChecklistTaskID;
                    opstaskrole.SecurityUserLoginID = assignee.UserLoginID;
                    opstaskrole.TaskRoleId = 3;
                    opstaskrole.LastUpdatedBy = ContextUserLoginID;
                    opstaskrole.LastUpdated = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, DateTime.UtcNow.Minute, DateTime.UtcNow.Second);
                    bCheckUOW.OpsChecklistTaskRoleRepository.Add(opstaskrole);
                }

                foreach (var manager in editedTasks[i].Managers)
                {
                    OpsChecklistTaskRole opstaskrole = new OpsChecklistTaskRole();
                    opstaskrole.OpsChecklistID = opstaskscreated[i].ID;
                    opstaskrole.ChecklistTaskID = opstaskscreated[i].ChecklistTaskID;
                    opstaskrole.SecurityUserLoginID = manager.UserLoginID;
                    opstaskrole.TaskRoleId = 4;
                    opstaskrole.LastUpdatedBy = ContextUserLoginID;
                    opstaskrole.LastUpdated = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, DateTime.UtcNow.Minute, DateTime.UtcNow.Second);
                    bCheckUOW.OpsChecklistTaskRoleRepository.Add(opstaskrole);
                }
            }
            bCheckUOW.Save();
            var taskIds = (from t in editedTasks
                           select t.OpsChecklistTaskID).ToList();

            Dictionary<string, object> TasksModified = new Dictionary<string, object>();
            TasksModified["OriginalTaskIds"] = taskIds;

            List<TaskItem> titemsChanged = new List<TaskItem>();
            for (int i = 0; i < editedTasks.Count; i++)
            {
                editedTasks[i].OpsChecklistTaskID = opstaskscreated[i].ID;
                editedTasks[i].IsTaskFromOpsChecklist = true;
            }

            TasksModified["ModifiedTasks"] = editedTasks;
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, TasksModified);
            return response;
        }