Example #1
0
        void SetUnboundCellData(object sender, TreeListUnboundColumnDataEventArgs e)
        {
            TaskObject task      = e.Node.Content as TaskObject;
            string     FieldName = e.Column.FieldName;

            if (task != null)
            {
                switch (FieldName)
                {
                case StartDateFieldName:
                    task.StartDate = (DateTime)(e.Value ?? DateTime.MinValue);
                    break;

                case EndDateFieldName:
                    task.EndDate = (DateTime)(e.Value ?? DateTime.MinValue);
                    break;

                case StateFieldName:
                    task.State = (State)e.Value;
                    break;

                default:
                    break;
                }
            }
        }
Example #2
0
        void GetUnboundState(TreeListUnboundColumnDataEventArgs e, TreeListNode treeListNode)
        {
            TaskObject task = treeListNode.Content as TaskObject;

            if (task != null)
            {
                e.Value = task.State;
                return;
            }
            List <State> statesList = new List <State>();

            CollectBoundStates(e.Node, statesList);
            if (statesList.Contains(States.DataSource[1]) ||
                (statesList.Contains(States.DataSource[0]) && statesList.Contains(States.DataSource[2])))
            {
                e.Value = States.DataSource[1];
            }
            else if (statesList.Contains(States.DataSource[0]))
            {
                e.Value = States.DataSource[0];
            }
            else if (statesList.Contains(States.DataSource[2]))
            {
                e.Value = States.DataSource[2];
            }
        }
Example #3
0
        void CollectBoundStates(TreeListNode treeListNode, List <State> states)
        {
            TreeListNodeIterator iterator = new TreeListNodeIterator(treeListNode);

            foreach (TreeListNode node in iterator)
            {
                TaskObject task = node.Content as TaskObject;
                if (task != null)
                {
                    states.Add(task.State);
                }
            }
        }
Example #4
0
        DateTime GetUnboundEndDate(TreeListUnboundColumnDataEventArgs e, TreeListNode treeListNode)
        {
            TaskObject task  = treeListNode.Content as TaskObject;
            DateTime   value = DateTime.Now;
            DateTime   tempValue;

            if (task != null)
            {
                value = task.EndDate;
            }
            else
            {
                value = DateTime.MinValue;
                foreach (TreeListNode item in treeListNode.Nodes)
                {
                    tempValue = GetUnboundEndDate(e, item);
                    if (tempValue > value)
                    {
                        value = tempValue;
                    }
                }
            }
            return(value);
        }