Beispiel #1
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                listFamily.Title  = tbListFamilyTitle.Text;
                listFamily.Detail = tbListFamilyDetail.Text;
                switch (dialogType)
                {
                case DialogType.Add:
                    listFamily.DisplayWeight = displayWeight;
                    ListFamily.AddListFamily(listFamily);
                    break;

                case DialogType.Edit:
                    ListFamily.UpdateListFamily(listFamily);
                    break;
                }
            }
            catch (Exception ex)
            {
                App.writeLog.Error("保存失败", ex);
                MessageBox.Show("项目保存失败!\n错误日志请查看Error.log文件!", "噢噢,出错了", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            this.DialogResult = true;
        }
        public SettingsDialog(ListFamily listFamily)
        {
            InitializeComponent();
            this.listFamily = listFamily;
            chkShowFinishedItem.IsChecked  = listFamily.ShowFinishedItem;
            chkShowOverdueItem.IsChecked   = listFamily.ShowOverdueItem;
            chkShowAbandonedItem.IsChecked = listFamily.ShowAbandonedItem;
            switch (listFamily.SortType)
            {
            case SortType.Default:
            case SortType.Mark:
                radMark.IsChecked = true;
                break;

            case SortType.StartTime:
                radStartTime.IsChecked = true;
                break;

            case SortType.EndTime:
                radEndTime.IsChecked = true;
                break;

            case SortType.Title:
                radTitle.IsChecked = true;
                break;

            case SortType.Manual:
                radManual.IsChecked = true;
                break;
            }

            radApplyToCurrentList.IsChecked = true;
        }
Beispiel #3
0
        /// <summary>
        /// 更新ListFamily
        /// </summary>
        /// <param name="listFamily"></param>
        public static void UpdateListFamily(ListFamily listFamily)
        {
            List <string> columnsList = new List <string>
            {
                FIELD_NAME_TITLE,
                FIELD_NAME_DETAIL,
                FIELD_NAME_MARK,
                FIELD_NAME_DISPLAY_WEIGHT,
                FIELD_NAME_SHOW_FINISHED_ITEM,
                FIELD_NAME_SHOW_OVERDUE_ITEM,
                FIELD_NAME_SHOW_ABANDONED_ITEM,
                FIELD_NAME_SORT_TYPE
            };

            List <string> valuesList = new List <string>
            {
                listFamily.Title,
                listFamily.Detail,
                listFamily.Mark.ToString("d"),
                listFamily.DisplayWeight.ToString(),
                Convert.ToInt16(listFamily.ShowFinishedItem).ToString(),
                Convert.ToInt16(listFamily.ShowOverdueItem).ToString(),
                Convert.ToInt16(listFamily.ShowAbandonedItem).ToString(),
                Convert.ToInt16(listFamily.SortType).ToString()
            };

            sqlite.Update(TABLE_NAME, columnsList, valuesList, string.Format("{0} = '{1}'", FIELD_NAME_ID, listFamily.Id));
        }
Beispiel #4
0
        /// <summary>
        /// 读取 ListFamilies
        /// </summary>
        private void ReadListFamiles()
        {
            try
            {
                listFamiliesDataTable       = ListFamily.GetListFamiliesTable();
                lstListFamilies.DataContext = listFamiliesDataTable;

                if (lstListFamiliesSelectedIndex == lstListFamilies.Items.Count)
                {
                    lstListFamilies.SelectedIndex = lstListFamiliesSelectedIndex - 1;
                }
                else if (lstListFamiliesSelectedIndex >= 0)
                {
                    lstListFamilies.SelectedIndex = lstListFamiliesSelectedIndex;
                }
                else
                {
                    lstListFamilies.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                App.writeLog.Warn("未能从数据库中读取到ListFamilies", ex);
            }
        }
Beispiel #5
0
        /// <summary>
        /// 移动ListChild
        /// </summary>
        /// <param name="moveDirection"></param>
        private void MoveListChild(MoveDirection moveDirection)
        {
            int flag = Convert.ToInt16(moveDirection);

            if ((listChildrenDisplayPart.SelectionIndex - flag > -1) && (listChildrenDisplayPart.SelectionIndex - flag < listChildrenDataTable.Rows.Count))
            {
                if (selectedListFamily.SortType != SortType.Manual)
                {
                    UpdateListChildrenDisplayWeight();
                    ReadListChildren();
                    selectedListFamily.SortType = SortType.Manual;
                    ListFamily.UpdateListFamily(selectedListFamily);
                }

                listChildrenDisplayPart.SelectedListChild.DisplayWeight -= flag;
                ListChild listChild = ListChild.GetListChildById(Convert.ToInt32(listChildrenDataTable.Rows[listChildrenDisplayPart.SelectionIndex - flag][ListChild.FIELD_NAME_ID]));
                listChild.DisplayWeight += flag;

                ListChild.UpdateListChild(listChildrenDisplayPart.SelectedListChild);
                ListChild.UpdateListChild(listChild);

                listChildrenDisplayPart.SelectionIndex -= flag;

                ReadListChildren();
            }
        }
        public SettingsDialog(ListFamily listFamily)
        {
            InitializeComponent();
            this.listFamily = listFamily;
            chkShowFinishedItem.IsChecked = listFamily.ShowFinishedItem;
            chkShowOverdueItem.IsChecked = listFamily.ShowOverdueItem;
            chkShowAbandonedItem.IsChecked = listFamily.ShowAbandonedItem;
            switch (listFamily.SortType)
            {
                case SortType.Default:
                case SortType.Mark:
                    radMark.IsChecked = true;
                    break;
                case SortType.StartTime:
                    radStartTime.IsChecked = true;
                    break;
                case SortType.EndTime:
                    radEndTime.IsChecked = true;
                    break;
                case SortType.Title:
                    radTitle.IsChecked = true;
                    break;
                case SortType.Manual:
                    radManual.IsChecked = true;
                    break;
            }

            radApplyToCurrentList.IsChecked = true;
        }
Beispiel #7
0
        /// <summary>
        /// 插入帮助列表
        /// </summary>
        private void InsertHelpLists()
        {
            ListFamily whatsNewListFamily = new ListFamily
            {
                Title         = "最新更新 ",
                Detail        = ProjectVersion.GetLocalVersion().AssemblyVersion,
                DisplayWeight = listFamiliesDataTable.Rows.Count
            };

            ListFamily.AddListFamily(whatsNewListFamily);

            ListChild.AddListChild(new ListChild
            {
                Title         = "修复bug",
                Detail        = "",
                DisplayWeight = 0,
                Mark          = MarkType.Finished,
                StartTime     = new DateTime(2013, 1, 6, 11, 52, 00),
                EndTime       = DateTime.MaxValue,
                FamilyId      = ListFamily.GetListFamilyByWeight(whatsNewListFamily.DisplayWeight).Id
            });

            ListChild.AddListChild(new ListChild
            {
                Title         = "细节调整",
                Detail        = "将设置按钮名称改为属性",
                DisplayWeight = 1,
                Mark          = MarkType.Finished,
                StartTime     = new DateTime(2013, 1, 8, 9, 26, 00),
                EndTime       = DateTime.MaxValue,
                FamilyId      = ListFamily.GetListFamilyByWeight(whatsNewListFamily.DisplayWeight).Id
            });
            ListChild.AddListChild(new ListChild
            {
                Title         = "细节调整",
                Detail        = "在下方按钮中添加了上移和下移,方便移动",
                DisplayWeight = 1,
                Mark          = MarkType.Finished,
                StartTime     = new DateTime(2013, 1, 8, 9, 30, 00),
                EndTime       = DateTime.MaxValue,
                FamilyId      = ListFamily.GetListFamilyByWeight(whatsNewListFamily.DisplayWeight).Id
            });

            ListChild.AddListChild(new ListChild
            {
                Title         = "功能增加",
                Detail        = "现在可以调整窗口大小了",
                DisplayWeight = 2,
                Mark          = MarkType.Finished,
                StartTime     = new DateTime(2013, 1, 8, 14, 50, 00),
                EndTime       = DateTime.MaxValue,
                FamilyId      = ListFamily.GetListFamilyByWeight(whatsNewListFamily.DisplayWeight).Id
            });

            ReadListFamiles();
            lstListFamilies.SelectedIndex = whatsNewListFamily.DisplayWeight;

            GenerateLocalXml();
        }
Beispiel #8
0
 public ListFamilyInfoDialog(ListFamily listFamily)
 {
     InitializeComponent();
     dialogType                   = DialogType.Edit;
     this.listFamily              = listFamily;
     this.tbListFamilyTitle.Text  = listFamily.Title;
     this.tbListFamilyDetail.Text = listFamily.Detail;
 }
 public ListFamilyInfoDialog(ListFamily listFamily)
 {
     InitializeComponent();
     dialogType = DialogType.Edit;
     this.listFamily = listFamily;
     this.tbListFamilyTitle.Text = listFamily.Title;
     this.tbListFamilyDetail.Text = listFamily.Detail;
 }
Beispiel #10
0
 /// <summary>
 /// 删除 ListFamily
 /// </summary>
 private void DeleteListFamily()
 {
     if (MessageBox.Show(string.Format("确定要删除这个列表吗?它里面的项目都会被删除哟~\n列表标题:{0}", selectedListFamily.Title), "三思而后行", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation) == MessageBoxResult.OK)
     {
         ListFamily.DeleteListFamily(selectedListFamily);
         ReadListFamiles();
         ReadListChildren();
     }
 }
Beispiel #11
0
 private void btnDeleteListFamily_Click(object sender, RoutedEventArgs e)
 {
     switch (MessageBox.Show(string.Format("确定要删除这个列表吗?它里面的项目都会被删除哟~\n列表标题:{0}", selectedListFamily.Title), "三思而后行", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation))
     {
     case MessageBoxResult.OK:
         ListFamily.DeleteListFamily(selectedListFamily);
         ReadListFamiles();
         ReadListChildren();
         break;
     }
 }
Beispiel #12
0
 /// <summary>
 /// 更新ListFamilies的DisplayWeight
 /// </summary>
 private void UpdateListFamiliesDisplayWeight()
 {
     ListFamily.BeginTransaction();
     for (int i = 0; i < lstListFamilies.Items.Count; i++)
     {
         DataRowView fd         = lstListFamilies.Items[i] as DataRowView;
         ListFamily  listFamily = ListFamily.GetListFamilyById(fd[ListFamily.FIELD_NAME_ID].ToString());
         listFamily.DisplayWeight = i;
         ListFamily.UpdateListFamily(listFamily);
     }
     ListFamily.CommitTransaction();
 }
Beispiel #13
0
        /// <summary>
        /// 获取ListChildren列表
        /// </summary>
        /// <param name="familyId"></param>
        /// <returns></returns>
        public static DataTable GetListChildrenTable(ListFamily listFamily)
        {
            UpdateOverdueChildren();

            string sortString = null;

            switch (listFamily.SortType)
            {
            case SortType.Default:
                sortString = ListChild.FIELD_NAME_MARK + " " + listFamily.SortSequence.ToString();
                break;

            case SortType.Mark:
                sortString = ListChild.FIELD_NAME_MARK + " " + listFamily.SortSequence.ToString();
                break;

            case SortType.StartTime:
                sortString = ListChild.FIELD_NAME_START_TIME + " " + listFamily.SortSequence.ToString();
                break;

            case SortType.EndTime:
                sortString = ListChild.FIELD_NAME_END_TIME + " " + listFamily.SortSequence.ToString();
                break;

            case SortType.Title:
                sortString = ListChild.FIELD_NAME_TITLE + " COLLATE PinYin" + " " + listFamily.SortSequence.ToString();
                break;

            case SortType.Manual:
                sortString = ListChild.FIELD_NAME_DISPLAY_WEIGHT + " " + listFamily.SortSequence.ToString();
                break;
            }

            StringBuilder condition = new StringBuilder();

            if (!listFamily.ShowFinishedItem)
            {
                condition.Append(string.Format(" AND {0} <> '{1}'", ListChild.FIELD_NAME_MARK, Convert.ToInt16(MarkType.Finished)));
            }
            if (!listFamily.ShowOverdueItem)
            {
                condition.Append(string.Format(" AND {0} <> '{1}'", ListChild.FIELD_NAME_MARK, Convert.ToInt16(MarkType.Overdue)));
            }
            if (!listFamily.ShowAbandonedItem)
            {
                condition.Append(string.Format(" AND {0} <> '{1}'", ListChild.FIELD_NAME_MARK, Convert.ToInt16(MarkType.Abandoned)));
            }

            DataTable dt = sqlite.GetDataTable(string.Format("SELECT * FROM {0} WHERE {1} = '{2}' {3} ORDER BY {4}", ListChild.TABLE_NAME, ListChild.FIELD_NAME_FAMILY_ID, listFamily.Id, condition.ToString(), sortString));

            return(dt);
        }
Beispiel #14
0
        /// <summary>
        /// 移动ListFamily
        /// </summary>
        /// <param name="moveDirection"></param>
        private void MoveListFamily(MoveDirection moveDirection)
        {
            int flag = Convert.ToInt16(moveDirection);

            if ((lstListFamiliesSelectedIndex - flag > -1) && (lstListFamiliesSelectedIndex - flag < listFamiliesDataTable.Rows.Count))
            {
                selectedListFamily.DisplayWeight -= flag;
                ListFamily listFamily = ListFamily.GetListFamilyById(listFamiliesDataTable.Rows[lstListFamiliesSelectedIndex - flag][ListFamily.FIELD_NAME_ID].ToString());
                listFamily.DisplayWeight += flag;

                ListFamily.UpdateListFamily(selectedListFamily);
                ListFamily.UpdateListFamily(listFamily);

                lstListFamiliesSelectedIndex -= flag;
                ReadListFamiles();
            }
        }
Beispiel #15
0
        /// <summary>
        /// lstListFamilies 的 SelectionChanged 事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lstListFamilies_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            if (lstListFamilies.SelectedIndex != -1)
            {
                if (selectedListFamily.SortType == SortType.Manual)
                {
                    UpdateListChildrenDisplayWeight();
                }

                DataRowView fd = lstListFamilies.SelectedItem as DataRowView;
                selectedListFamily                     = ListFamily.GetListFamilyById(fd[ListFamily.FIELD_NAME_ID].ToString());
                lstListFamiliesSelectedIndex           = lstListFamilies.SelectedIndex;
                listChildrenDisplayPart.SelectionIndex = 0;
                tbListFamilyName.Text                  = string.Format("{0}:", selectedListFamily.Title);

                ReadListChildren();
            }
        }
Beispiel #16
0
        public static ListFamily GetListFamilyByWeight(int displayWeight)
        {
            DataRow dr = sqlite.GetDataRow(string.Format("SELECT * FROM {0} WHERE {1} = '{2}'", TABLE_NAME, FIELD_NAME_DISPLAY_WEIGHT, displayWeight));

            ListFamily listFamily = new ListFamily
            {
                Id                = int.Parse(dr[FIELD_NAME_ID].ToString()),
                Title             = dr[FIELD_NAME_TITLE].ToString(),
                Detail            = dr[FIELD_NAME_DETAIL].ToString(),
                Mark              = (MarkType)Enum.Parse(typeof(MarkType), dr[FIELD_NAME_MARK].ToString(), true),
                DisplayWeight     = int.Parse(dr[FIELD_NAME_DISPLAY_WEIGHT].ToString()),
                ShowFinishedItem  = Convert.ToBoolean(dr[FIELD_NAME_SHOW_FINISHED_ITEM]),
                ShowOverdueItem   = Convert.ToBoolean(dr[FIELD_NAME_SHOW_OVERDUE_ITEM]),
                ShowAbandonedItem = Convert.ToBoolean(dr[FIELD_NAME_SHOW_ABANDONED_ITEM]),
                SortType          = (SortType)Enum.Parse(typeof(SortType), dr[FIELD_NAME_SORT_TYPE].ToString(), true)
            };

            return(listFamily);
        }
Beispiel #17
0
        /// <summary>
        /// 添加ListFamily
        /// </summary>
        /// <param name="listFamily"></param>
        public static void AddListFamily(ListFamily listFamily)
        {
            sqlite.CreateTableIfNotExists(
                TABLE_NAME,                    //表名
                FIELD_NAME_ID,                 //主键名
                true,                          //自增
                FIELD_NAME_TITLE,
                FIELD_NAME_DETAIL,
                FIELD_NAME_MARK,
                FIELD_NAME_DISPLAY_WEIGHT,
                FIELD_NAME_SHOW_FINISHED_ITEM,
                FIELD_NAME_SHOW_OVERDUE_ITEM,
                FIELD_NAME_SHOW_ABANDONED_ITEM,
                FIELD_NAME_SORT_TYPE);

            List <string> columnsList = new List <string>
            {
                FIELD_NAME_TITLE,
                FIELD_NAME_DETAIL,
                FIELD_NAME_MARK,
                FIELD_NAME_DISPLAY_WEIGHT,
                FIELD_NAME_SHOW_FINISHED_ITEM,
                FIELD_NAME_SHOW_OVERDUE_ITEM,
                FIELD_NAME_SHOW_ABANDONED_ITEM,
                FIELD_NAME_SORT_TYPE
            };
            List <string> valuesList = new List <string>
            {
                listFamily.Title,
                listFamily.Detail,
                listFamily.Mark.ToString("d"),
                listFamily.DisplayWeight.ToString(),
                Convert.ToInt16(listFamily.ShowFinishedItem).ToString(),
                Convert.ToInt16(listFamily.ShowOverdueItem).ToString(),
                Convert.ToInt16(listFamily.ShowAbandonedItem).ToString(),
                Convert.ToInt16(listFamily.SortType).ToString()
            };

            sqlite.Insert(TABLE_NAME, columnsList, valuesList);
        }
Beispiel #18
0
        /// <summary>
        /// 获取ListChildren列表
        /// </summary>
        /// <param name="familyId"></param>
        /// <returns></returns>
        public static DataTable GetListChildrenTable(ListFamily listFamily)
        {
            UpdateOverdueChildren();

            string sortString = null;
            switch (listFamily.SortType)
            {
                case SortType.Default:
                    sortString = ListChild.FIELD_NAME_MARK + " " + listFamily.SortSequence.ToString();
                    break;
                case SortType.Mark:
                    sortString = ListChild.FIELD_NAME_MARK + " " + listFamily.SortSequence.ToString();
                    break;
                case SortType.StartTime:
                    sortString = ListChild.FIELD_NAME_START_TIME + " " + listFamily.SortSequence.ToString();
                    break;
                case SortType.EndTime:
                    sortString = ListChild.FIELD_NAME_END_TIME + " " + listFamily.SortSequence.ToString();
                    break;
                case SortType.Title:
                    sortString = ListChild.FIELD_NAME_TITLE + " COLLATE PinYin" + " " + listFamily.SortSequence.ToString();
                    break;
                case SortType.Manual:
                    sortString = ListChild.FIELD_NAME_DISPLAY_WEIGHT + " " + listFamily.SortSequence.ToString();
                    break;
            }

            StringBuilder condition = new StringBuilder();
            if (!listFamily.ShowFinishedItem)
            {
                condition.Append(string.Format(" AND {0} <> '{1}'", ListChild.FIELD_NAME_MARK, Convert.ToInt16(MarkType.Finished)));
            }
            if (!listFamily.ShowOverdueItem)
            {
                condition.Append(string.Format(" AND {0} <> '{1}'", ListChild.FIELD_NAME_MARK, Convert.ToInt16(MarkType.Overdue)));
            }
            if (!listFamily.ShowAbandonedItem)
            {
                condition.Append(string.Format(" AND {0} <> '{1}'", ListChild.FIELD_NAME_MARK, Convert.ToInt16(MarkType.Abandoned)));
            }

            DataTable dt = sqlite.GetDataTable(string.Format("SELECT * FROM {0} WHERE {1} = '{2}' {3} ORDER BY {4}", ListChild.TABLE_NAME, ListChild.FIELD_NAME_FAMILY_ID, listFamily.Id, condition.ToString(), sortString));
            return dt;
        }
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            //下面一段保存“显示内容”
            listFamily.ShowFinishedItem  = chkShowFinishedItem.IsChecked.Value;
            listFamily.ShowOverdueItem   = chkShowOverdueItem.IsChecked.Value;
            listFamily.ShowAbandonedItem = chkShowAbandonedItem.IsChecked.Value;

            //下面一段保存“列表排序”
            if (radMark.IsChecked.Value)
            {
                listFamily.SortType = SortType.Mark;
            }
            else if (radStartTime.IsChecked.Value)
            {
                listFamily.SortType = SortType.StartTime;
            }
            else if (radEndTime.IsChecked.Value)
            {
                listFamily.SortType = SortType.EndTime;
            }
            else if (radTitle.IsChecked.Value)
            {
                listFamily.SortType = SortType.Title;
            }
            else if (radManual.IsChecked.Value)
            {
                listFamily.SortType = SortType.Manual;
            }
            else
            {
                listFamily.SortType = SortType.Default;
            }

            if (radApplyToCurrentList.IsChecked.Value)
            {
                //下面更新数据库
                try
                {
                    ListFamily.UpdateListFamily(listFamily);
                }
                catch (Exception ex)
                {
                    App.writeLog.Error("保存失败", ex);
                    MessageBox.Show("项目设置保存失败!\n错误日志请查看Error.log文件!", "噢噢,出错了", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }

            else if (radApplyToAllLists.IsChecked.Value)
            {
                List <string> columnsList = new List <string>
                {
                    ListFamily.FIELD_NAME_SHOW_FINISHED_ITEM,
                    ListFamily.FIELD_NAME_SHOW_OVERDUE_ITEM,
                    ListFamily.FIELD_NAME_SHOW_ABANDONED_ITEM,
                    ListFamily.FIELD_NAME_SORT_TYPE
                };

                List <string> valuesList = new List <string>
                {
                    Convert.ToInt16(listFamily.ShowFinishedItem).ToString(),
                    Convert.ToInt16(listFamily.ShowOverdueItem).ToString(),
                    Convert.ToInt16(listFamily.ShowAbandonedItem).ToString(),
                    Convert.ToInt16(listFamily.SortType).ToString()
                };

                try
                {
                    ListFamily.UpdateAllListFamilies(columnsList, valuesList);
                }
                catch (Exception ex)
                {
                    App.writeLog.Error("保存失败", ex);
                    MessageBox.Show("项目设置保存失败!\n错误日志请查看Error.log文件!", "噢噢,出错了", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            this.DialogResult = true;
        }
Beispiel #20
0
        /// <summary>
        /// lstListFamilies 的 SelectionChanged 事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lstListFamilies_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            if (lstListFamilies.SelectedIndex != -1)
            {
                if (selectedListFamily.SortType == SortType.Manual)
                {
                    UpdateListChildrenDisplayWeight();
                }

                DataRowView fd = lstListFamilies.SelectedItem as DataRowView;
                selectedListFamily = ListFamily.GetListFamilyById(fd[ListFamily.FIELD_NAME_ID].ToString());
                lstListFamiliesSelectedIndex = lstListFamilies.SelectedIndex;
                listChildrenDisplayPart.SelectionIndex = 0;
                tbListFamilyName.Text = string.Format("{0}:", selectedListFamily.Title);

                ReadListChildren();
            }
        }
Beispiel #21
0
        /// <summary>
        /// 插入帮助列表
        /// </summary>
        private void InsertHelpLists()
        {
            ListFamily whatsNewListFamily = new ListFamily
                {
                    Title = "最新更新 ",
                    Detail = ProjectVersion.GetLocalVersion().AssemblyVersion,
                    DisplayWeight = listFamiliesDataTable.Rows.Count
                };
            ListFamily.AddListFamily(whatsNewListFamily);

            ListChild.AddListChild(new ListChild
                 {
                     Title = "修复bug",
                     Detail = "",
                     DisplayWeight = 0,
                     Mark = MarkType.Finished,
                     StartTime = new DateTime(2013, 1, 6, 11, 52, 00),
                     EndTime = DateTime.MaxValue,
                     FamilyId = ListFamily.GetListFamilyByWeight(whatsNewListFamily.DisplayWeight).Id
                 });

            ListChild.AddListChild(new ListChild
                {
                    Title = "细节调整",
                    Detail = "将设置按钮名称改为属性",
                    DisplayWeight = 1,
                    Mark = MarkType.Finished,
                    StartTime = new DateTime(2013, 1, 8, 9, 26, 00),
                    EndTime = DateTime.MaxValue,
                    FamilyId = ListFamily.GetListFamilyByWeight(whatsNewListFamily.DisplayWeight).Id
                });
            ListChild.AddListChild(new ListChild
                {
                    Title = "细节调整",
                    Detail = "在下方按钮中添加了上移和下移,方便移动",
                    DisplayWeight = 1,
                    Mark = MarkType.Finished,
                    StartTime = new DateTime(2013, 1, 8, 9, 30, 00),
                    EndTime = DateTime.MaxValue,
                    FamilyId = ListFamily.GetListFamilyByWeight(whatsNewListFamily.DisplayWeight).Id
                });

            ListChild.AddListChild(new ListChild
                {
                    Title = "功能增加",
                    Detail = "现在可以调整窗口大小了",
                    DisplayWeight = 2,
                    Mark = MarkType.Finished,
                    StartTime = new DateTime(2013, 1, 8, 14, 50, 00),
                    EndTime = DateTime.MaxValue,
                    FamilyId = ListFamily.GetListFamilyByWeight(whatsNewListFamily.DisplayWeight).Id
                });

            ReadListFamiles();
            lstListFamilies.SelectedIndex = whatsNewListFamily.DisplayWeight;

            GenerateLocalXml();
        }
Beispiel #22
0
 /// <summary>
 /// 删除ListFamily以及其所有ListChildren
 /// </summary>
 /// <param name="listFamily"></param>
 public static void DeleteListFamily(ListFamily listFamily)
 {
     sqlite.Delete(TABLE_NAME, string.Format("{0} = '{1}'", FIELD_NAME_ID, listFamily.Id));
     sqlite.Delete(ListChild.TABLE_NAME, string.Format("{0} = '{1}'", ListChild.FIELD_NAME_FAMILY_ID, listFamily.Id));
 }
Beispiel #23
0
        /// <summary>
        /// 添加ListFamily
        /// </summary>
        /// <param name="listFamily"></param>
        public static void AddListFamily(ListFamily listFamily)
        {
            sqlite.CreateTableIfNotExists(
                TABLE_NAME,                    //表名
                FIELD_NAME_ID,                 //主键名
                true,                          //自增
                FIELD_NAME_TITLE,
                FIELD_NAME_DETAIL,
                FIELD_NAME_MARK,
                FIELD_NAME_DISPLAY_WEIGHT,
                FIELD_NAME_SHOW_FINISHED_ITEM,
                FIELD_NAME_SHOW_OVERDUE_ITEM,
                FIELD_NAME_SHOW_ABANDONED_ITEM,
                FIELD_NAME_SORT_TYPE);

            List<string> columnsList = new List<string>
            {
                FIELD_NAME_TITLE,
                FIELD_NAME_DETAIL,
                FIELD_NAME_MARK,
                FIELD_NAME_DISPLAY_WEIGHT,
                FIELD_NAME_SHOW_FINISHED_ITEM,
                FIELD_NAME_SHOW_OVERDUE_ITEM,
                FIELD_NAME_SHOW_ABANDONED_ITEM,
                FIELD_NAME_SORT_TYPE
            };
            List<string> valuesList = new List<string>
            {
                listFamily.Title,
                listFamily.Detail,
                listFamily.Mark.ToString("d"),
                listFamily.DisplayWeight.ToString(),
                Convert.ToInt16(listFamily.ShowFinishedItem).ToString(),
                Convert.ToInt16(listFamily.ShowOverdueItem).ToString(),
                Convert.ToInt16(listFamily.ShowAbandonedItem).ToString(),
                Convert.ToInt16(listFamily.SortType).ToString()
            };
            sqlite.Insert(TABLE_NAME, columnsList, valuesList);
        }
Beispiel #24
0
        /// <summary>
        /// 更新ListFamily
        /// </summary>
        /// <param name="listFamily"></param>
        public static void UpdateListFamily(ListFamily listFamily)
        {
            List<string> columnsList = new List<string>
            {
                FIELD_NAME_TITLE,
                FIELD_NAME_DETAIL,
                FIELD_NAME_MARK,
                FIELD_NAME_DISPLAY_WEIGHT,
                FIELD_NAME_SHOW_FINISHED_ITEM,
                FIELD_NAME_SHOW_OVERDUE_ITEM,
                FIELD_NAME_SHOW_ABANDONED_ITEM,
                FIELD_NAME_SORT_TYPE
            };

            List<string> valuesList = new List<string>
            {
                listFamily.Title,
                listFamily.Detail,
                listFamily.Mark.ToString("d"),
                listFamily.DisplayWeight.ToString(),
                Convert.ToInt16(listFamily.ShowFinishedItem).ToString(),
                Convert.ToInt16(listFamily.ShowOverdueItem).ToString(),
                Convert.ToInt16(listFamily.ShowAbandonedItem).ToString(),
                Convert.ToInt16(listFamily.SortType).ToString()
            };

            sqlite.Update(TABLE_NAME, columnsList, valuesList, string.Format("{0} = '{1}'", FIELD_NAME_ID, listFamily.Id));
        }
Beispiel #25
0
        public static ListFamily GetListFamilyByWeight(int displayWeight)
        {
            DataRow dr = sqlite.GetDataRow(string.Format("SELECT * FROM {0} WHERE {1} = '{2}'", TABLE_NAME, FIELD_NAME_DISPLAY_WEIGHT, displayWeight));

            ListFamily listFamily = new ListFamily
                {
                    Id = int.Parse(dr[FIELD_NAME_ID].ToString()),
                    Title = dr[FIELD_NAME_TITLE].ToString(),
                    Detail = dr[FIELD_NAME_DETAIL].ToString(),
                    Mark = (MarkType) Enum.Parse(typeof (MarkType), dr[FIELD_NAME_MARK].ToString(), true),
                    DisplayWeight = int.Parse(dr[FIELD_NAME_DISPLAY_WEIGHT].ToString()),
                    ShowFinishedItem = Convert.ToBoolean(dr[FIELD_NAME_SHOW_FINISHED_ITEM]),
                    ShowOverdueItem = Convert.ToBoolean(dr[FIELD_NAME_SHOW_OVERDUE_ITEM]),
                    ShowAbandonedItem = Convert.ToBoolean(dr[FIELD_NAME_SHOW_ABANDONED_ITEM]),
                    SortType = (SortType) Enum.Parse(typeof (SortType), dr[FIELD_NAME_SORT_TYPE].ToString(), true)
                };

            return listFamily;
        }
Beispiel #26
0
 /// <summary>
 /// 删除ListFamily以及其所有ListChildren
 /// </summary>
 /// <param name="listFamily"></param>
 public static void DeleteListFamily(ListFamily listFamily)
 {
     sqlite.Delete(TABLE_NAME, string.Format("{0} = '{1}'", FIELD_NAME_ID, listFamily.Id));
     sqlite.Delete(ListChild.TABLE_NAME, string.Format("{0} = '{1}'", ListChild.FIELD_NAME_FAMILY_ID, listFamily.Id));
 }