Example #1
0
        /// <summary>
        /// Add
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static bool Add(TaskType taskType)
        {
            lock (BusinessEntity.m_sDS)
            {
                bool success   = false;
                var  attribute = taskType.Attribute();

                if (attribute != null)
                {
                    var dataRow = BusinessEntity.m_sDS.Tasks.AddTasksRow(attribute.Description);

                    try
                    {
                        success = m_sTA.Update(dataRow) == 1;
                    }
                    catch { }

                    if (!success)
                    {
                        BusinessEntity.m_sDS.Tasks.RemoveTasksRow(dataRow);
                    }
                    else
                    {
                        m_sTasks.Add(new Task(dataRow));
                    }
                }

                return(success);
            }
        }
Example #2
0
        /// <summary>
        /// Find
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static Task Find(TaskType taskType)
        {
            Task task      = null;
            var  attribute = taskType.Attribute();

            if (attribute != null)
            {
                task = Find(attribute.Description);
            }

            return(task);
        }