Exemplo n.º 1
0
        private void LoadTasks()
        {
            // get the todo list items
            ToDoService.ToDoServiceClient client = new ToDoService.ToDoServiceClient();

            try
            {
                List <ToDoService.ToDoItemContract> toDoItems = client.GetToDoItems("").ToList();
                dlTasks.DataSource = toDoItems;
                dlTasks.DataBind();

                ddlDependentTasks.DataSource     = toDoItems;
                ddlDependentTasks.DataTextField  = "Title";
                ddlDependentTasks.DataValueField = "Id";
                ddlDependentTasks.DataBind();
                ddlDependentTasks.Items.Insert(0, new ListItem("No Dependency", ""));

                client.Close();
            }
            catch (Exception ex)
            {
                // TODO: Log error
                client.Abort();
            }
        }
Exemplo n.º 2
0
        private static void UpdateDependentTasks(ToDoService.ToDoItemContract toDoItemContract)
        {
            ToDoService.ToDoServiceClient client = new ToDoService.ToDoServiceClient();

            try
            {
                // update the task
                client.UpdateDependentTasks(toDoItemContract);
            }
            catch (Exception ex)
            {
                client.Abort();
                // TODO: Client side save error message
                return;
            }
        }
Exemplo n.º 3
0
        private string Save(ToDoService.ToDoItemContract toDoItemContract)
        {
            // get the todo list items
            ToDoService.ToDoServiceClient client = new ToDoService.ToDoServiceClient();

            try
            {
                // save the new task
                return(client.SaveToDoItem(toDoItemContract));
            }
            catch (Exception ex)
            {
                client.Abort();
                // TODO: Client side save error message
                return("");
            }
        }
Exemplo n.º 4
0
        private void LoadTasks()
        {
            // get the todo list items
            ToDoService.ToDoServiceClient client = new ToDoService.ToDoServiceClient();

            try
            {
                List <ToDoService.ToDoItemContract> toDoItems = client.GetToDoItems("").ToList();
                dlTasks.DataSource = toDoItems;
                dlTasks.DataBind();

                client.Close();
            }
            catch (Exception ex)
            {
                // TODO: Log error
                client.Abort();
            }
        }
Exemplo n.º 5
0
        public static string GetAnyDependentTasks(string id)
        {
            string result = "";

            // get the todo list items
            ToDoService.ToDoServiceClient client = new ToDoService.ToDoServiceClient();

            try
            {
                List <ToDoService.ToDoItemContract> toDoItems = client.GetToDoItems("").ToList();

                // get specific record
                ToDoService.ToDoItemContract singleRecord = toDoItems.Where(tdi => tdi.Id == id).FirstOrDefault();

                // get records the have the same parentid as the id passed in and order by orderid asc
                // only those whose orderid < than singleRecord.OrderId
                foreach (var item in toDoItems.Where(tdi => tdi.Complete == false && tdi.Id == singleRecord.ParentId && tdi.OrderId < singleRecord.OrderId).OrderBy(tdi => tdi.OrderId).ToList())
                {
                    result = string.Format("{0}<li>{1}</li>", result, item.Title);
                }

                // if result is not empty, add enclosing ul tag
                if (!string.IsNullOrWhiteSpace(result))
                {
                    result = string.Format("<ul>{0}</ul>", result);
                }

                client.Close();
            }
            catch (Exception ex)
            {
                // TODO: Log error
                client.Abort();
            }

            return(result);
        }
Exemplo n.º 6
0
        public static ToDoService.ToDoItemContract[] GetDependentTaskOptions(string id)
        {
            List <ToDoService.ToDoItemContract> matches = new List <ToDoService.ToDoItemContract>();

            // get the todo list items
            ToDoService.ToDoServiceClient client = new ToDoService.ToDoServiceClient();

            try
            {
                List <ToDoService.ToDoItemContract> toDoItems = client.GetToDoItems("").ToList();
                client.Close();
                // get specific record
                ToDoService.ToDoItemContract singleRecord = toDoItems.Where(tdi => tdi.Id == id).FirstOrDefault();
                // get all dependents with lower order ID not including current task
                matches = toDoItems.Where(tdi => tdi.Id != id && tdi.OrderId < singleRecord.OrderId).ToList();
            }
            catch (Exception ex)
            {
                // TODO: Log error
                client.Abort();
            }

            return(matches.ToArray());
        }