Ejemplo n.º 1
0
    private void loadAttachments()
    {
        WorkItem_Task task = new WorkItem_Task(taskID: this.taskID);

        if (task == null || !task.Load())
        {
            return;
        }

        txtWorkloadNumber.Text = string.Format("{0} - {1}", task.WorkItemID.ToString(), task.Task_Number.ToString());
        txtTitle.Text          = HttpUtility.HtmlDecode(Uri.UnescapeDataString(task.Title.Replace(" ", "").Trim()));

        DataTable dt = WorkItem_Task.WorkItem_Task_GetAttachmentList(WorkItemTaskID: this.taskID);

        if (dt != null && dt.Rows.Count > 0)
        {
            Attachment_Count = dt.Rows.Count;
        }
        if (dt != null)
        {
            dc = dt.Columns;

            if (dt.Rows.Count > 0)
            {
                gridAttachments.DataSource = dt;
                gridAttachments.DataBind();
            }
        }
    }
Ejemplo n.º 2
0
    private void loadComments()
    {
        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());
        txtTitle.Text          = HttpUtility.HtmlDecode(Uri.UnescapeDataString(task.Title.Replace(" ", "").Trim()));

        DataTable dt = task.GetComments();

        if (dt != null && dt.Rows.Count > 0)
        {
            Comment_Count = dt.Rows.Count;
        }

        Page.ClientScript.RegisterArrayDeclaration("arrComments", JsonConvert.SerializeObject(dt, Newtonsoft.Json.Formatting.None));
    }
Ejemplo n.º 3
0
    public static string SaveTask(int taskID, int workItemID, int priorityID
                                  , string title, string description, int assignedToID, int primaryResourceID, int secondaryResourceID
                                  , int primaryBusResourceID, int secondaryBusResourceID
                                  , string plannedStartDate, string actualStartDate, int estimatedEffortID, int actualEffortID, string actualEndDate
                                  , int completionPercent, int statusID, int workItemTypeID, int businessRank, int sortOrder, string pageOption, string SRNumber, int assignedToRankID, int productVersionID, string dateNeeded, bool businessReview, string aors)
    {
        Dictionary <string, string> result = new Dictionary <string, string>()
        {
            { "saved", "" }
            , { "id", "0" }
            , { "error", "" }
            , { "pageOption", pageOption }
        };
        bool   saved = false, loaded = false, savedAOR = false;
        string errorMsg = string.Empty;

        try
        {
            HttpServerUtility server = HttpContext.Current.Server;
            description = server.UrlDecode(description);

            int submittedByID = 0;
            submittedByID = UserManagement.GetUserId_FromUsername();

            WorkItem_Task task = new WorkItem_Task(taskID);
            if (taskID > 0)
            {
                loaded = task.Load();
            }

            task.WorkItemID             = workItemID;
            task.PriorityID             = priorityID;
            task.Title                  = title;
            task.Description            = description;
            task.AssignedResourceID     = assignedToID;
            task.PrimaryResourceID      = primaryResourceID;
            task.SecondaryResourceID    = secondaryResourceID;
            task.PrimaryBusResourceID   = primaryBusResourceID;
            task.SecondaryBusResourceID = secondaryBusResourceID;
            task.EstimatedStartDate     = plannedStartDate;
            task.ActualStartDate        = actualStartDate;
            task.EstimatedEffortID      = estimatedEffortID;
            task.ActualEffortID         = actualEffortID;
            task.ActualEndDate          = actualEndDate;
            task.CompletionPercent      = completionPercent;
            task.StatusID               = statusID;
            task.WorkItemTypeID         = workItemTypeID;
            task.BusinessRank           = businessRank;
            task.Sort_Order             = sortOrder;
            task.SRNumber               = SRNumber;
            task.AssignedToRankID       = assignedToRankID;
            task.ProductVersionID       = productVersionID;
            task.NeedDate               = dateNeeded;
            task.BusinessReview         = businessReview;

            XmlDocument docAORs = (XmlDocument)JsonConvert.DeserializeXmlNode(aors, "aors");

            if (taskID == 0)
            {
                task.SubmittedByID = submittedByID;

                saved = task.Add(newID: out taskID, errorMsg: out errorMsg);

                if (saved)
                {
                    savedAOR = AOR.AORSubTask_Save(TaskID: taskID, AORs: docAORs, Add: 0, CascadeAOR: false);
                    Workload.SendWorkloadEmail("WorkItemTask", true, taskID);
                }
            }
            else
            {
                if (loaded)
                {
                    saved = task.Save(errorMsg: out errorMsg);
                }

                if (saved)
                {
                    savedAOR = AOR.AORSubTask_Save(TaskID: taskID, AORs: docAORs, Add: 0, CascadeAOR: false);
                    Workload.SendWorkloadEmail("WorkItemTask", false, taskID);
                }
            }
        }
        catch (Exception ex)
        {
            saved    = false;
            errorMsg = ex.Message;
            LogUtility.LogException(ex);
        }

        result["saved"] = saved.ToString();
        result["id"]    = taskID.ToString();
        result["error"] = errorMsg;

        return(JsonConvert.SerializeObject(result, Newtonsoft.Json.Formatting.None));
    }
Ejemplo n.º 4
0
    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("&nbsp;", "").Trim()));
        txtTitle.Text       = HttpUtility.HtmlDecode(Uri.UnescapeDataString(task.Title.Replace("&nbsp;", "").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("&nbsp;", "").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("&nbsp;", "").Trim()));
        txtProductionStatus.Text   = HttpUtility.HtmlDecode(Uri.UnescapeDataString(parentTaskData.Rows[0]["ProductionStatus"].ToString().Replace("&nbsp;", "").Trim()));
        txtSystemTask.Text         = HttpUtility.HtmlDecode(Uri.UnescapeDataString(parentTaskData.Rows[0]["WTS_SYSTEM"].ToString().Replace("&nbsp;", "").Trim()));
        txtContract.Text           = HttpUtility.HtmlDecode(Uri.UnescapeDataString(parentTaskData.Rows[0]["CONTRACT"].ToString().Replace("&nbsp;", "").Trim()));
        txtWorkloadAllocation.Text = HttpUtility.HtmlDecode(Uri.UnescapeDataString(parentTaskData.Rows[0]["WorkloadAllocation"].ToString().Replace("&nbsp;", "").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("&nbsp;", "").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();
                }
            }
        }
    }