protected void Page_Load(object sender, EventArgs e)
        {
            DataTable tasks = new DataTable();
            tasks.Columns.Add("Id");
            tasks.Columns.Add("Date");
            tasks.Columns.Add("NodeId");
            tasks.Columns.Add("NodeName");
            tasks.Columns.Add("ReferingUser");
            tasks.Columns.Add("Language");

            taskList.Columns[0].HeaderText = ui.Text("nodeName");
            taskList.Columns[1].HeaderText = ui.Text("translation", "taskAssignedBy");
            taskList.Columns[2].HeaderText = ui.Text("date");

            ((System.Web.UI.WebControls.HyperLinkField)taskList.Columns[3]).Text = ui.Text("translation", "details");
            ((System.Web.UI.WebControls.HyperLinkField)taskList.Columns[4]).Text = ui.Text("translation", "downloadTaskAsXml");

            Tasks ts = new Tasks();
            if (Request["mode"] == "owned")
            {
                ts = Task.GetOwnedTasks(base.getUser(), false);
                pane_tasks.Text = ui.Text("translation", "ownedTasks");
                Panel2.Text = ui.Text("translation", "ownedTasks");
            }
            else
            {
                ts = Task.GetTasks(base.getUser(), false);
                pane_tasks.Text = ui.Text("translation", "assignedTasks");
                Panel2.Text = ui.Text("translation", "assignedTasks");
            }

            uploadFile.Text = ui.Text("upload");
            pane_uploadFile.Text = ui.Text("translation", "uploadTranslationXml");

            foreach (Task t in ts)
            {
                if (t.Type.Alias == "toTranslate")
                {
                    DataRow task = tasks.NewRow();
                    task["Id"] = t.Id;
                    task["Date"] = t.Date;
                    task["NodeId"] = t.Node.Id;
                    task["NodeName"] = t.Node.Text;
                    task["ReferingUser"] = t.ParentUser.Name;
                    tasks.Rows.Add(task);
                }
            }

            taskList.DataSource = tasks;
            taskList.DataBind();
            feedback.Style.Add("margin-top", "10px");

        }
Beispiel #2
0
        /// <summary>
        /// Retrieves a collection of open tasks assigned to the user
        /// </summary>
        /// <param name="User">The User who have the tasks assigned</param>
        /// <param name="IncludeClosed">If true both open and closed tasks will be returned</param>
        /// <returns>A collections of tasks</returns>
        public static Tasks GetOwnedTasks(User User, bool IncludeClosed) {
            string sql = "select id, taskTypeId, nodeId, parentUserId, userId, DateTime, comment, closed from cmsTask where parentUserId = @userId";
            if (!IncludeClosed)
                sql += " and closed = 0";
            sql += " order by DateTime desc";

            Tasks tasks = new Tasks();
            using (IRecordsReader dr = SqlHelper.ExecuteReader(
                sql,
                SqlHelper.CreateParameter("@userId", User.Id))) {
                    while (dr.Read())
                    {
                        var t = new Task();
                        t.PopulateTaskFromReader(dr);
                        tasks.Add(t);
                    }   
            }

            return tasks;
        }
Beispiel #3
0
        /// <summary>
        /// Get all tasks assigned to a node
        /// </summary>
        /// <param name="nodeId"></param>
        /// <returns></returns>
        public static Tasks GetTasks(int nodeId)
        {
            var sql = "select id, taskTypeId, nodeId, parentUserId, userId, DateTime, comment, closed from cmsTask where nodeId = @nodeId";
            Tasks tasks = new Tasks();
            using (IRecordsReader dr = SqlHelper.ExecuteReader(sql, SqlHelper.CreateParameter("@nodeId", nodeId)))
            {
                while (dr.Read())
                {
                    var t = new Task();
                    t.PopulateTaskFromReader(dr);
                    tasks.Add(t);
                }                    
            }

            return tasks;
        }