Esempio n. 1
0
    private void ViewTasks()
    {
        string actiontype = "both";
        string callBackPage = ""; //unknown
        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "TITLE";
        colBound.HeaderText = m_refMsg.GetMessage("generic Title");
        TaskDataGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "ID";
        colBound.HeaderText = m_refMsg.GetMessage("generic ID");
        TaskDataGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "STATE";
        colBound.HeaderText = m_refMsg.GetMessage("lbl state");
        TaskDataGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "PRIORITY";
        colBound.HeaderText = m_refMsg.GetMessage("lbl priority");
        TaskDataGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "DUEDATE";
        colBound.HeaderText = m_refMsg.GetMessage("lbl Due Date");
        TaskDataGrid.Columns.Add(colBound);

        if ((actiontype == "by") || (actiontype == "all") || (actiontype == "both"))
        {
            colBound = new System.Web.UI.WebControls.BoundColumn();
            colBound.DataField = "ASSIGNEDTO";
            colBound.HeaderText = m_refMsg.GetMessage("lbl Assigned to");
            TaskDataGrid.Columns.Add(colBound);
        }
        if ((actiontype == "to") || (actiontype == "all") || (actiontype == "both"))
        {
            colBound = new System.Web.UI.WebControls.BoundColumn();
            colBound.DataField = "ASSIGNEDBY";
            colBound.HeaderText = m_refMsg.GetMessage("lbl Assigned By");
            TaskDataGrid.Columns.Add(colBound);
        }

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "COMMENT";
        colBound.HeaderText = m_refMsg.GetMessage("lbl Last Added comments");
        TaskDataGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "DATECREATED";
        colBound.HeaderText = m_refMsg.GetMessage("lbl Create Date");
        TaskDataGrid.Columns.Add(colBound);

        TaskDataGrid.BorderColor = System.Drawing.Color.White;

        DataTable dt = new DataTable();
        DataRow dr;

        dt.Columns.Add(new DataColumn("TITLE", typeof(string)));
        dt.Columns.Add(new DataColumn("ID", typeof(string)));
        dt.Columns.Add(new DataColumn("STATE", typeof(string)));
        dt.Columns.Add(new DataColumn("PRIORITY", typeof(string)));
        dt.Columns.Add(new DataColumn("DUEDATE", typeof(string)));
        dt.Columns.Add(new DataColumn("ASSIGNEDTO", typeof(string)));
        dt.Columns.Add(new DataColumn("ASSIGNEDBY", typeof(string)));
        dt.Columns.Add(new DataColumn("COMMENT", typeof(string)));
        dt.Columns.Add(new DataColumn("DATECREATED", typeof(string)));

        if (TaskExists == true)
        {
            int TaskItemType = 1;
            m_refTask = m_refContentApi.EkTaskRef;

            Ektron.Cms.PageRequestData null_EktronCmsPageRequestData = null;
            cTasks = m_refTask.GetTasks(m_intId, -1, -1, TaskItemType, Request.QueryString["orderby"], ContentLanguage, ref null_EktronCmsPageRequestData, "");
        }

        int i = 0;
        EkTask cTask;

        if (cTasks != null)
        {
            EmailHelper m_refMail = new EmailHelper();
            while (i < cTasks.Count)
            {
                i++;
                cTask = cTasks.get_Item(i);
                if (!(cTask.TaskTypeID == (long)Ektron.Cms.Common.EkEnumeration.TaskType.BlogPostComment))
                {
                    Array.Resize(ref arrTaskTypeID, i - 1 + 1);
                    arrTaskTypeID[i - 1] = (string)("shown_task_" + i + "_" + (cTask.TaskTypeID <= 0 ? "NotS" : (cTask.TaskTypeID.ToString())));

                    dr = dt.NewRow();

                    dr["TITLE"] = "<a href=\"tasks.aspx?action=ViewTask&tid=" + cTask.TaskID + "&folderid=" + cTask.FolderId  +  "&contentid=" + cTask.ContentID +  "&fromViewContent=1&ty=both&LangType=" + cTask.ContentLanguage + callBackPage + "\">" + cTask.TaskTitle + "</a>";
                    dr["TITLE"] += "	<script language=\"JavaScript\">" + "\r\n";
                    dr["TITLE"] += "					AddShownTaskID(\'" + arrTaskTypeID[i - 1] + "\');" + "\r\n";
                    dr["TITLE"] += "				</script>	" + "\r\n";

                    dr["ID"] = cTask.TaskID;
                    int iState = System.Convert.ToInt32(cTask.State);
                    switch (iState)
                    {
                        case 1:
                            dr["STATE"] = "Not Started";
                            break;
                        case 2:
                            dr["STATE"] = "Active";
                            break;
                        case 3:
                            dr["STATE"] = "Awaiting Data";
                            break;
                        case 4:
                            dr["STATE"] = "On Hold";
                            break;
                        case 5:
                            dr["STATE"] = "Pending";
                            break;
                        case 6:
                            dr["STATE"] = "ReOpened";
                            break;
                        case 7:
                            dr["STATE"] = "Completed";
                            break;
                        case 8:
                            dr["STATE"] = "Archived";
                            break;
                        case 9:
                            dr["STATE"] = "Deleted";
                            break;
                    }
                    int iPrio = System.Convert.ToInt32(cTask.Priority);
                    switch (iPrio)
                    {
                        case 1:
                            dr["PRIORITY"] = "Low";
                            break;
                        case 2:
                            dr["PRIORITY"] = "Normal";
                            break;
                        case 3:
                            dr["PRIORITY"] = "High";
                            break;
                    }

                    if (cTask.DueDate != "")
                    {
                        if (System.Convert.ToDateTime(cTask.DueDate) < DateTime.Today) //Verify:Udai 11/22/04 Replaced Now.ToOADate - 1 with DateTime.Today
                        {
                            dr["DUEDATE"] = cTask.DueDate; //Response.Write("<td class=""important"">" & AppUI.GetInternationalDateOnly(cTask.DueDate) & "</td>")
                        }
                        else
                        {
                            dr["DUEDATE"] = cTask.DueDate; //Response.Write("<td>" & AppUI.GetInternationalDateOnly(cTask.DueDate) & "</td>")
                        }
                    }
                    else
                    {
                        dr["DUEDATE"] = "[Not Specified]";
                    }
                    EkTask tempcTask = cTask;
                    if ((actiontype == "by") || (actiontype == "all") || (actiontype == "both"))
                    {
                        if (cTask.AssignToUserGroupID == 0)
                        {
                            dr["ASSIGNEDTO"] = "All Authors of (" + cTask.ContentID.ToString() + ")";
                        }
                        else if (cTask.AssignedToUser != "")
                        {
                            dr["ASSIGNEDTO"] = "<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/user.png\" align=\"absbottom\">" + m_refMail.MakeUserTaskEmailLink(tempcTask, false);
                        }
                        else if (cTask.AssignedToUserGroup != "")
                        {
                            dr["ASSIGNEDTO"] = "<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/users.png\" align=\"absbottom\">";
                            if (cTask.AssignToUserGroupID != -1)
                            {
                                dr[5] += m_refMail.MakeUserGroupTaskEmailLink(tempcTask);
                            }
                            else
                            {
                                dr[5] += cTask.AssignedToUserGroup;
                            }
                        }
                    }
                    if ((actiontype == "to") || (actiontype == "all") || (actiontype == "both"))
                    {
                        dr["ASSIGNEDBY"] = m_refMail.MakeByUserTaskEmailLink(tempcTask, false);

                    }

                    if (cTask.LastComment == "")
                    {
                        dr["COMMENT"] = "[Not Specified]";
                    }
                    else
                    {
                        dr["COMMENT"] = "<div class=\"comment-block\">" + cTask.LastComment + "</div>";
                    }
                    dr["DATECREATED"] = cTask.DateCreated; //GetInternationalDateOnly

                    dt.Rows.Add(dr);
                }
            }
        }
        DataView dv = new DataView(dt);
        TaskDataGrid.DataSource = dv;
        TaskDataGrid.DataBind();
    }