public static string ValidateTaskID(int taskID) { var result = WTSPage.CreateDefaultResult(); DataTable dt = WorkloadItem.WorkItem_Get(taskID); if (dt != null && dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; result["title"] = dr["TITLE"] != DBNull.Value ? HttpUtility.HtmlEncode(dr["TITLE"].ToString()) : ""; result["exists"] = "true"; DataTable aorDT = AOR.AORTaskAORList_Get(taskID); if (aorDT != null && aorDT.Rows.Count > 0) { Dictionary <string, string> aors = new Dictionary <string, string>(); for (int i = 0; i < aorDT.Rows.Count; i++) { DataRow aorRow = aorDT.Rows[i]; aors.Add(aorRow["AORID"].ToString(), aorRow["AORName"].ToString()); } result["aors"] = JsonConvert.SerializeObject(aors, Newtonsoft.Json.Formatting.None); } } else { result["exists"] = "false"; } result["success"] = "true"; return(JsonConvert.SerializeObject(result, Newtonsoft.Json.Formatting.None)); }
private void loadWorkItem() { DataTable dt = WorkloadItem.WorkItem_Get(workItemID: this.WorkItemID); if (dt != null && dt.Rows.Count > 0) { this.labelWorkItemNumber.InnerText = dt.Rows[0]["WORKITEMID"].ToString(); int.TryParse(dt.Rows[0]["WORKREQUESTID"].ToString(), out this.WorkRequestID); int.TryParse(dt.Rows[0]["Comment_Count"].ToString(), out this.Comment_Count); int.TryParse(dt.Rows[0]["Attachment_Count"].ToString(), out this.Attachment_Count); int.TryParse(dt.Rows[0]["WorkRequest_Attachment_Count"].ToString(), out this.WR_Attachment_Count); } }
private void loadTask() { WorkItem_Task task = new WorkItem_Task(taskID: this.WorkItem_TaskID); if (task == null || !task.Load()) { return; } txtWorkloadNumber.Text = string.Format("{0} - {1}", task.WorkItemID.ToString(), task.Task_Number.ToString()); WTSUtility.SelectDdlItem(ddlPriority, task.PriorityID.ToString(), task.Priority.ToString()); txtParentTitle.Text = HttpUtility.HtmlDecode(Uri.UnescapeDataString(task.ParentTitle.Replace(" ", "").Trim())); txtTitle.Text = HttpUtility.HtmlDecode(Uri.UnescapeDataString(task.Title.Replace(" ", "").Trim())); ListItem li = null; li = ddlAssignedTo.Items.FindByValue(task.AssignedResourceID.ToString()); if (li == null) { li = new ListItem(task.AssignedResource.ToString(), task.AssignedResourceID.ToString()); int uID = 0; int.TryParse(task.AssignedResourceID.ToString(), out uID); WTS_User u = new WTS_User(uID); u.Load(); if (u.AORResourceTeam) { li.Attributes.Add("og", "Action Team"); DataTable dt = AOR.AORResourceTeamList_Get(AORID: 0, AORReleaseID: 0); dt.DefaultView.RowFilter = "ResourceTeamUserID = " + uID; dt = dt.DefaultView.ToTable(); if (dt.Rows.Count > 0) { li.Attributes.Add("aorid", dt.Rows[0]["AORID"].ToString()); } ddlAssignedTo.Items.Insert(1, li); } else { ddlAssignedTo.Items.Insert(0, li); } } li.Selected = true; WTSUtility.SelectDdlItem(ddlPrimaryResource, task.PrimaryResourceID.ToString(), task.PrimaryResource.ToString()); WTSUtility.SelectDdlItem(ddlSecondaryResource, task.SecondaryResourceID.ToString(), task.SecondaryResource.ToString()); WTSUtility.SelectDdlItem(ddlPrimaryBusResource, task.PrimaryBusResourceID.ToString(), task.PrimaryBusResource.ToString()); WTSUtility.SelectDdlItem(ddlSecondaryBusResource, task.SecondaryBusResourceID.ToString(), task.SecondaryBusResource.ToString()); txtStartDate_Planned.Text = task.EstimatedStartDate; txtStartDate_Actual.Text = task.ActualStartDate; txtEndDate_Actual.Text = task.ActualEndDate; WTSUtility.SelectDdlItem(ddlHours_Planned, task.EstimatedEffortID.ToString(), task.PlannedHours.ToString()); WTSUtility.SelectDdlItem(ddlHours_Actual, task.ActualEffortID.ToString(), task.ActualHours.ToString()); WTSUtility.SelectDdlItem(ddlPercentComplete, task.CompletionPercent.ToString(), task.CompletionPercent.ToString()); WTSUtility.SelectDdlItem(ddlStatus, task.StatusID.ToString(), task.Status); filterStatuses(false); txtBusinessRank.Text = task.BusinessRank.ToString(); txtSortOrder.Text = task.Sort_Order.ToString(); textAreaDescription.InnerHtml = task.Description; txtSRNumber.Text = task.SRNumber.ToString(); WTSUtility.SelectDdlItem(ddlAssignedToRank, task.AssignedToRankID.ToString(), ""); WTSUtility.SelectDdlItem(ddlProductVersion, task.ProductVersionID.ToString(), task.ProductVersion.ToString()); WTSUtility.SelectDdlItem(ddlWorkItemType, task.WorkItemTypeID.ToString(), task.WorkItemType.ToString()); this.ProductVersionID = task.ProductVersionID; this.lblProductVersion.Text = task.ProductVersion; this.SystemID = task.SystemID; this.UnclosedSRTasks = task.UnclosedSRTasks; txtDateNeeded.Text = task.NeedDate; chkBusinessReview.Checked = task.BusinessReview; if (!IsNew) { this.labelCreated.Text = task.CreatedBy + " - " + task.CreatedDate; this.labelUpdated.Text = task.UpdatedBy + " - " + task.UpdatedDate; } DataTable parentTaskData = WorkloadItem.WorkItem_Get(workItemID: WorkItemID); txtResourceGroup.Text = HttpUtility.HtmlDecode(Uri.UnescapeDataString(parentTaskData.Rows[0]["WorkType"].ToString().Replace(" ", "").Trim())); txtResourceGroup.Attributes.Add("ResourceGroupID", HttpUtility.HtmlDecode(Uri.UnescapeDataString(parentTaskData.Rows[0]["WorkTypeID"].ToString()))); txtFunctionality.Text = HttpUtility.HtmlDecode(Uri.UnescapeDataString(parentTaskData.Rows[0]["WorkloadGroup"].ToString().Replace(" ", "").Trim())); txtProductionStatus.Text = HttpUtility.HtmlDecode(Uri.UnescapeDataString(parentTaskData.Rows[0]["ProductionStatus"].ToString().Replace(" ", "").Trim())); txtSystemTask.Text = HttpUtility.HtmlDecode(Uri.UnescapeDataString(parentTaskData.Rows[0]["WTS_SYSTEM"].ToString().Replace(" ", "").Trim())); txtContract.Text = HttpUtility.HtmlDecode(Uri.UnescapeDataString(parentTaskData.Rows[0]["CONTRACT"].ToString().Replace(" ", "").Trim())); txtWorkloadAllocation.Text = HttpUtility.HtmlDecode(Uri.UnescapeDataString(parentTaskData.Rows[0]["WorkloadAllocation"].ToString().Replace(" ", "").Trim())); int workAreaID = 0, systemID = 0; int.TryParse(parentTaskData.Rows[0]["WorkAreaID"].ToString(), out workAreaID); int.TryParse(parentTaskData.Rows[0]["WTS_SYSTEMID"].ToString(), out systemID); txtSystemTask.Attributes["WTS_SYSTEMID"] = systemID.ToString(); txtWorkArea.Attributes["WorkAreaID"] = workAreaID.ToString(); this.labelTotalDaysOpened.Text = task.TotalDaysOpened.ToString(); this.labelTotalBusinessDaysOpened.Text = task.TotalBusinessDaysOpened.ToString(); this.labelInProgressDate.Text = (String.IsNullOrEmpty(task.InProgressDate.ToString())) ? null : task.InProgressDate.Value.ToShortDateString(); this.labelInProgressTime.Text = (String.IsNullOrEmpty(task.InProgressDate.ToString())) ? null : task.InProgressDate.Value.ToShortTimeString(); this.labelDeployedDate.Text = (String.IsNullOrEmpty(task.DeployedDate.ToString())) ? null : task.DeployedDate.Value.ToShortDateString(); this.labelDeployedTime.Text = (String.IsNullOrEmpty(task.DeployedDate.ToString())) ? null : task.DeployedDate.Value.ToShortTimeString(); this.labelReadyForReviewDate.Text = (String.IsNullOrEmpty(task.ReadyForReviewDate.ToString())) ? null : task.ReadyForReviewDate.Value.ToShortDateString(); this.labelReadyForReviewTime.Text = (String.IsNullOrEmpty(task.ReadyForReviewDate.ToString())) ? null : task.ReadyForReviewDate.Value.ToShortTimeString(); this.labelClosedDate.Text = (String.IsNullOrEmpty(task.ClosedDate.ToString())) ? null : task.ClosedDate.Value.ToShortDateString(); this.labelClosedTime.Text = (String.IsNullOrEmpty(task.ClosedDate.ToString())) ? null : task.ClosedDate.Value.ToShortTimeString(); this.labelTotalDaysInProgress.Text = task.TotalDaysInProgress.ToString(); this.labelTotalDaysDeployed.Text = task.TotalDaysDeployed.ToString(); this.labelTotalDaysReadyForReview.Text = task.TotalDaysReadyForReview.ToString(); this.labelTotalDaysClosed.Text = task.TotalDaysClosed.ToString(); DataTable dtWorkArea = MasterData.WorkArea_SystemList_Get(workAreaID: workAreaID); string workAreaText = string.Empty; if (dtWorkArea != null && dtWorkArea.Rows.Count > 1) { workAreaText = dtWorkArea.Rows[dtWorkArea.Rows.Count - 1]["ApprovedPriority"].ToString() + " - " + dtWorkArea.Rows[dtWorkArea.Rows.Count - 1]["WorkArea"].ToString(); } txtWorkArea.Text = HttpUtility.HtmlDecode(workAreaText.Replace(" ", "").Trim()); DataTable dtAORs = AOR.AORTaskAORList_Get(TaskID: WorkItemID); if (dtAORs != null && dtAORs.Rows.Count > 0) { foreach (DataRow dr in dtAORs.Rows) { if (dr["AORWorkTypeID"].ToString() == "1") { txtWorkloadAOR.Text = dr["AORID"].ToString() + " (" + dr["Abbreviation"].ToString() + ") - " + dr["AORName"].ToString(); txtWorkloadAOR.ToolTip = txtWorkloadAOR.Text; } if (dr["AORWorkTypeID"].ToString() == "2") { txtReleaseAOR.Text = dr["AORID"].ToString() + " (" + dr["Abbreviation"].ToString() + ") - " + dr["AORName"].ToString(); txtReleaseAOR.ToolTip = txtReleaseAOR.Text; ParentRelAORReleaseID = dr["AORReleaseID"].ToString(); } } } }
protected void Page_Load(object sender, EventArgs e) { this.CanEdit = UserManagement.UserCanEdit(WTSModuleOption.WorkItemTask); this.CanEditAOR = UserManagement.UserCanEdit(WTSModuleOption.AOR); this.CanEditWorkloadMGMT = UserManagement.UserCanEdit(WTSModuleOption.WorkloadMGMT); readQueryString(); LoadRelatedItemsMenu(); if (this.ReadOnly) { this.CanEdit = false; this.CanEditAOR = false; } loadLookupData(); if (this.WorkItem_TaskID > 0) { loadTask(); } else { WorkloadItem wi = WorkloadItem.WorkItem_GetObject(workItemID: this.WorkItemID); ListItem li = null; li = ddlAssignedTo.Items.FindByValue(wi.AssignedResourceID.ToString()); if (li == null) { int uID = 0; int.TryParse(wi.AssignedResourceID.ToString(), out uID); WTS_User u = new WTS_User(uID); u.Load(); li = new ListItem(u.First_Name + " " + u.Last_Name, wi.AssignedResourceID.ToString()); if (u.AORResourceTeam) { li.Attributes.Add("og", "Action Team"); DataTable dt = AOR.AORResourceTeamList_Get(AORID: 0, AORReleaseID: 0); dt.DefaultView.RowFilter = "ResourceTeamUserID = " + uID; dt = dt.DefaultView.ToTable(); if (dt.Rows.Count > 0) { li.Attributes.Add("aorid", dt.Rows[0]["AORID"].ToString()); } ddlAssignedTo.Items.Insert(1, li); } else { ddlAssignedTo.Items.Insert(0, li); } } li.Selected = true; WTSUtility.SelectDdlItem(ddlPrimaryResource, wi.PrimaryResourceID.ToString(), ""); // 12817 - 30: WTSUtility.SelectDdlItem(ddlPrimaryBusResource, wi.PrimaryBusinessResourceID.ToString(), ""); WTSUtility.SelectDdlItem(ddlSecondaryResource, wi.SecondaryResourceID.ToString(), ""); WTSUtility.SelectDdlItem(ddlSecondaryBusResource, wi.SecondaryBusinessResourceID.ToString(), ""); WTSUtility.SelectDdlItem(ddlPriority, wi.PriorityID.ToString(), ""); //WTSUtility.SelectDdlItem(ddlHours_Planned, wi.EstimatedEffortID.ToString(), ""); WTSUtility.SelectDdlItem(ddlProductVersion, wi.ProductVersionID.ToString(), ""); this.lblProductVersion.Text = ddlProductVersion.SelectedItem.Text; this.SystemID = wi.WTS_SystemID; IsNew = true; this.txtWorkloadNumber.Text = this.WorkItemID.ToString() + " - NA"; DataTable parentTaskData = WorkloadItem.WorkItem_Get(workItemID: WorkItemID); txtParentTitle.Text = HttpUtility.HtmlDecode(Uri.UnescapeDataString(parentTaskData.Rows[0]["TITLE"].ToString().Replace(" ", "").Trim())); txtResourceGroup.Text = HttpUtility.HtmlDecode(Uri.UnescapeDataString(parentTaskData.Rows[0]["WorkType"].ToString().Replace(" ", "").Trim())); txtResourceGroup.Attributes.Add("ResourceGroupID", HttpUtility.HtmlDecode(Uri.UnescapeDataString(parentTaskData.Rows[0]["WorkTypeID"].ToString()))); txtFunctionality.Text = HttpUtility.HtmlDecode(Uri.UnescapeDataString(parentTaskData.Rows[0]["WorkloadGroup"].ToString().Replace(" ", "").Trim())); txtProductionStatus.Text = HttpUtility.HtmlDecode(Uri.UnescapeDataString(parentTaskData.Rows[0]["ProductionStatus"].ToString().Replace(" ", "").Trim())); txtSystemTask.Text = HttpUtility.HtmlDecode(Uri.UnescapeDataString(parentTaskData.Rows[0]["WTS_SYSTEM"].ToString().Replace(" ", "").Trim())); txtContract.Text = HttpUtility.HtmlDecode(Uri.UnescapeDataString(parentTaskData.Rows[0]["CONTRACT"].ToString().Replace(" ", "").Trim())); txtWorkloadAllocation.Text = HttpUtility.HtmlDecode(Uri.UnescapeDataString(parentTaskData.Rows[0]["WorkloadAllocation"].ToString().Replace(" ", "").Trim())); int workAreaID = 0, systemID = 0; int.TryParse(parentTaskData.Rows[0]["WorkAreaID"].ToString(), out workAreaID); int.TryParse(parentTaskData.Rows[0]["WTS_SYSTEMID"].ToString(), out systemID); WTSUtility.SelectDdlItem(ddlWorkItemType, parentTaskData.Rows[0]["WorkItemTypeID"].ToString(), parentTaskData.Rows[0]["WorkItemType"].ToString()); //dynamic filters = "{ 'System(Task)':{ 'value':'" + parentTaskData.Rows[0]["WTS_SYSTEMID"].ToString() + "','text':'" + parentTaskData.Rows[0]["WTS_SYSTEM"].ToString() + "'},'Work Area':{ 'value':'" + parentTaskData.Rows[0]["WorkAreaID"].ToString() + "','text':'" + parentTaskData.Rows[0]["WorkArea"].ToString() + "'}}"; //dynamic fields = JsonConvert.DeserializeObject<Dictionary<string, object>>(filters); //bool saved = Filtering.SaveWorkFilters(module: "RQMT", filterModule: "RQMT", filters: fields, myData: false, xml: ""); DataTable dtWorkArea = MasterData.WorkArea_SystemList_Get(workAreaID: workAreaID); string workAreaText = string.Empty; if (dtWorkArea != null && dtWorkArea.Rows.Count > 1) { workAreaText = dtWorkArea.Rows[1]["ApprovedPriority"].ToString() + " - " + dtWorkArea.Rows[1]["WorkArea"].ToString(); } txtWorkArea.Text = HttpUtility.HtmlDecode(workAreaText.Replace(" ", "").Trim()); DataTable dtAORs = AOR.AORTaskAORList_Get(TaskID: WorkItemID); if (dtAORs != null && dtAORs.Rows.Count > 0) { foreach (DataRow dr in dtAORs.Rows) { if (dr["AORWorkTypeID"].ToString() == "1") { txtWorkloadAOR.Text = dr["AORID"].ToString() + " (" + dr["Abbreviation"].ToString() + ") - " + dr["AORName"].ToString(); txtWorkloadAOR.ToolTip = txtWorkloadAOR.Text; } if (dr["AORWorkTypeID"].ToString() == "2") { txtReleaseAOR.Text = dr["AORID"].ToString() + " (" + dr["Abbreviation"].ToString() + ") - " + dr["AORName"].ToString(); txtReleaseAOR.ToolTip = txtReleaseAOR.Text; ParentRelAORReleaseID = dr["AORReleaseID"].ToString(); } } } ListItem item = ddlStatus.Items.FindByText("New"); if (item != null) { item.Selected = true; } filterStatuses(true); if (wi != null) { int maxSort = 0, maxBusRank = 0; DataTable dt = WorkloadItem.WorkItem_GetTaskList(wi.WorkItemID, 1); if (dt != null && dt.Rows.Count > 0) { int sort = 0; foreach (DataRow row in dt.Rows) { int.TryParse(row["SORT_ORDER"].ToString(), out sort); if (sort > maxSort) { maxSort = sort; } int.TryParse(row["BusinessRank"].ToString(), out sort); if (sort > maxBusRank) { maxBusRank = sort; } } } txtSortOrder.Text = (maxSort + 1).ToString(); txtBusinessRank.Text = (maxBusRank + 1).ToString(); } item = ddlAssignedToRank.Items.FindByText("5 - Unprioritized Workload"); if (item != null) { item.Selected = true; } txtBusinessRank.Text = "99"; } LoadAORs(); }