예제 #1
0
        private void ShowMsgForNOSave(BOPType bopType)
        {
            ObservableCollection <BOPInfo> needUpdateList = null;
            BOPInfo tempInfo = null;

            if (CheckedIsNeedSave(ref tempInfo, ref needUpdateList, bopType))
            {
                MessageBoxResult mr = MessageBox.Show("当前列表中存在未保存项,是否保存?", "", MessageBoxButton.OKCancel, MessageBoxImage.Question);
                if (mr == MessageBoxResult.OK)
                {
                    string msg = "";
                    if (Do_Save(ref msg))
                    {
                        if (!string.IsNullOrEmpty(msg))
                        {
                            MessageBox.Show(msg);
                        }
                    }
                    else
                    {
                        RestoreBtn_Click(null, new RoutedEventArgs());
                        if (!string.IsNullOrEmpty(msg))
                        {
                            MessageBox.Show(msg);
                        }
                    }
                }
                else
                {
                    RestoreBtn_Click(null, new RoutedEventArgs());
                }
            }
        }
예제 #2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            BOPType type = (BOPType)value;

            if (type == BOPType.P)
            {
                return((Visibility)parameter);
            }
            else
            {
                return((Visibility)parameter == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible);
            }
        }
예제 #3
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            BOPType type = (BOPType)value;

            if (type == BOPType.P)
            {
                return("支出");
            }
            else
            {
                return("收入");
            }
        }
예제 #4
0
        private void InitBOPUIList(ObservableCollection <BOPInfo> bopList, BOPType type)
        {
            pageManager = new PageManager(bopList.Count);
            (FindResource("ViewSource") as CollectionViewSource).Source = pageManager.ReFreshCurPageCollection(bopList);
            PageManagerGrid.DataContext = pageManager;
            pageManager.RefreshEvent   += pageManager_RefreshEvent;

            balanceColumn.Visibility = type == BOPType.B ? Visibility.Visible : Visibility.Collapsed;
            bkColumn.Visibility      = type == BOPType.B ? Visibility.Visible : Visibility.Collapsed;

            paymentColumn.Visibility    = type == BOPType.P ? Visibility.Visible : Visibility.Collapsed;
            departmentColumn.Visibility = type == BOPType.P ? Visibility.Visible : Visibility.Collapsed;
            payeeColumn.Visibility      = type == BOPType.P ? Visibility.Visible : Visibility.Collapsed;
            CountCurViewPrice();
        }
 public static ObservableCollection <BOPInfo> GetBOPListByBOPType(ObservableCollection <BOPInfo> allBOPList, BOPType type)
 {
     return(AlgorithmClass.DeepClone <ObservableCollection <BOPInfo> >(new ObservableCollection <BOPInfo>(allBOPList.Where(info => info.BOP_Type == type))));
 }
예제 #6
0
        private bool CheckedIsNeedSave(ref BOPInfo tempInfo, ref ObservableCollection <BOPInfo> needUpdateList, BOPType bopType)
        {
            if (dataManager == null)
            {
                tempInfo       = new BOPInfo();
                needUpdateList = new ObservableCollection <BOPInfo>();
                return(false);
            }

            ObservableCollection <BOPInfo> tempInfoList = null;
            bool isNeedUpdate = false;

            //检查新建项
            switch (bopType)
            {
            case BOPType.P:
                tempInfo = PaymentBOPList.Where(bop => bop.ID == 0).FirstOrDefault();

                tempInfoList = pageManager.ReFreshCurPageCollection(
                    AlgorithmClass.GetBOPListByBOPType(dataManager.AllBOPList, BOPType.P));

                break;

            case BOPType.B:
                tempInfo = BalanceBOPList.Where(bop => bop.ID == 0).FirstOrDefault();

                tempInfoList = pageManager.ReFreshCurPageCollection(
                    AlgorithmClass.GetBOPListByBOPType(dataManager.AllBOPList, BOPType.B));

                break;
            }

            if (tempInfo != null)
            {
                isNeedUpdate = true;
            }

            //检查并获取编辑项
            needUpdateList = AlgorithmClass.CompareCollectionIsChanged <BOPInfo>(tempInfoList, (FindResource("ViewSource") as CollectionViewSource).Source as ObservableCollection <BOPInfo>, "ID");
            if (needUpdateList.Count != 0)
            {
                isNeedUpdate = true;
            }

            return(isNeedUpdate);
        }