/// <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();
            }
        }
 /// <summary>
 /// 更新ListChildren的DisplayWeight
 /// </summary>
 private void UpdateListChildrenDisplayWeight()
 {
     try
     {
         ListChild.BeginTransaction();
         for (int i = 0; i < listChildrenDataTable.Rows.Count; i++)
         {
             ListChild listChild = ListChild.GetListChildById(Convert.ToInt32(listChildrenDataTable.Rows[i][ListChild.FIELD_NAME_ID]));
             listChild.DisplayWeight = i;
             ListChild.UpdateListChild(listChild);
         }
         ListChild.CommitTransaction();
     }
     catch (Exception ex)
     {
         App.writeLog.Warn("更新ListChildren的DisplayWeight失败,可能是由于删除列表导致", ex);
     }
 }
Exemple #3
0
        public static void UpdateOverdueChildren()
        {
            DataTable dt = sqlite.GetDataTable(string.Format(("SELECT * FROM {0} WHERE {1} < '{2}'"), ListChild.TABLE_NAME, ListChild.FIELD_NAME_END_TIME, DateTime.Now.ToString(Global.TIME_FORMAT_STRING)));

            if (dt.Rows.Count > 0)
            {
                sqlite.BeginTransaction();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ListChild listChild = ListChild.GetListChildById(Convert.ToInt32(dt.Rows[i][ListChild.FIELD_NAME_ID]));
                    if ((listChild.Mark != MarkType.Overdue) && (listChild.Mark != MarkType.Abandoned))
                    {
                        listChild.Mark = MarkType.Overdue;
                        UpdateListChild(listChild);
                    }
                }
                sqlite.CommitTransaction();
            }
        }