private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                listChild.Title     = tbListChildTitle.Text;
                listChild.Detail    = tbListChildDetail.Text;
                listChild.StartTime = (DateTime)dtpStartTime.Value;
                listChild.EndTime   = (DateTime)dtpEndTime.Value;
                listChild.Mark      = ((MarkItem)cmbMark.SelectedItem).Mark;
                switch (dialogType)
                {
                case DialogType.Add:
                    listChild.FamilyId = selectedListFamilyId;
                    ListChild.AddListChild(listChild);
                    break;

                case DialogType.Edit:
                    ListChild.UpdateListChild(listChild);
                    break;
                }
            }
            catch (Exception ex)
            {
                App.writeLog.Error("保存失败", ex);
                MessageBox.Show("项目保存失败!\n错误日志请查看Error.log文件!", "噢噢,出错了", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            this.DialogResult = true;
        }
Пример #2
0
 /// <summary>
 /// 更新ListChild 的 Mark
 /// </summary>
 /// <param name="markType"></param>
 private void UpdateListChildMark(MarkType markType)
 {
     listChildrenDisplayPart.SelectedListChild.Mark = markType;
     ListChild.UpdateListChild(listChildrenDisplayPart.SelectedListChild);
     ReadListChildren();
     popupMark.IsOpen = false;
 }
Пример #3
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();
            }
        }
Пример #4
0
 /// <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);
     }
 }