示例#1
0
        private void InitUIList()
        {
            needAddList    = new ObservableCollection <EmployeeInfo>();
            needUpdateList = new ObservableCollection <EmployeeInfo>();
            //添加职务、部门及在职状态选择列表
            AlgorithmClass.InitEmployeeSelectionList(dataManager.AllEmployeeList, dataManager.AllPostList, dataManager.AllDepartmentList, AlgorithmClass.GetWorkStatusList());
            AllEmployeeList = AlgorithmClass.DeepClone <ObservableCollection <EmployeeInfo> >(dataManager.AllEmployeeList);
            lcv             = new ListCollectionView(AllEmployeeList);
            lcv.Filter      = Fitter_TextChanged;
            lcv.Refresh();

            SaveBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });
            RestoreBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });
            PrintBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });

            EmployeeDataGrid.ItemsSource = lcv;
        }
        private void BsTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (BsTypeComboBox.SelectedItem == null)
            {
                return;
            }

            //             if (BsTypeComboBox.IsDropDownOpen == false)
            //                 return;

            BsTypeInfo bsTypeInfo = BsTypeComboBox.SelectedItem as BsTypeInfo;

            BSTypeTextBlock.Text          = bsTypeInfo.TypeName;
            CurSelectionProcedureInfoList = AlgorithmClass.GetSelectionProcedureInfoList(bsTypeInfo.ProcedurePrice);

            switch ((OperationType)(((DictionaryEntry)(OperationTypeList.SelectedValue)).Key))
            {
            case OperationType.Edit:
                procedureInfoListForEdit.Clear();
                AddRowBtn.IsEnabled = true;
                break;

            case OperationType.New:
                procedureInfoListForNew.Clear();
                AddRowBtn.IsEnabled = true;
                break;
            }
        }
        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            if (lcv.CanAddNewItem)
            {
                foreach (EmployeeInfo info in dataManager.AllEmployeeList)
                {
                    //离职的不允许添加
                    if (info.StatusID == 0)
                    {
                        continue;
                    }

                    appLog.Info("Add Employee,ID = " + info.ID);
                    lcv.AddNewItem(new SalaryInfo
                    {
                        Year       = (int)(YearComboBox.SelectedItem),
                        Month      = (int)(MonthComboBox.SelectedItem),
                        EmployeeID = info.ID,
                        SelectionEmployeeInfoList   = dataManager.AllEmployeeList.ToList(),
                        SelectionDepartmentInfoList = dataManager.AllDepartmentList.ToList(),
                        SelectionWorkStatusInfoList = AlgorithmClass.GetWorkStatusList()
                    });

                    lcv.CommitNew();
                }
            }
        }
示例#4
0
        private void RangeDatePicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
        {
            if (EndDatePicker == null || StartDatePicker == null)
            {
                return;
            }

            if (StartDatePicker.SelectedDate != null && EndDatePicker.SelectedDate != null)
            {
                if (StartDatePicker.SelectedDate > EndDatePicker.SelectedDate)
                {
                    DatePicker dataPicker = sender as DatePicker;
                    switch (dataPicker.Name)
                    {
                    case "StartDatePicker":
                        StartDatePicker.SelectedDate = EndDatePicker.SelectedDate;
                        //MessageBox.Show("请选择合法的日期范围值!");
                        break;

                    case "EndDatePicker":
                        EndDatePicker.SelectedDate = StartDatePicker.SelectedDate;
                        //MessageBox.Show("请选择合法的日期范围值!");
                        break;
                    }
                }
            }

            AlgorithmClass.CollectionViewSource_Refresh(this, "ViewSource");
            CountCurViewPrice();
        }
        private bool CheckedIsNeedSave()
        {
            appLog.Info("Check If Need Save...");
            if (AllSalaryList == null)
            {
                appLog.Info("AllSalaryList==null,return.");
                return(false);
            }
            //检查添加项
            if (AllSalaryList.Count != dataManager.AllSalaryList.Count)
            {
                appLog.InfoFormat("Check New Item,AllSalaryList.Count={0},dataManager.AllSalaryList.Count={1}", AllSalaryList.Count, dataManager.AllSalaryList.Count);
                needAddList = new ObservableCollection <SalaryInfo>(AllSalaryList.Where(s => s.ID == 0));
                return(true);
            }
            else
            {
                //检查并获取编辑项
                appLog.Info("Check and Get edited Items.");
                var tempList = new ObservableCollection <SalaryInfo>(AllSalaryList.Where(s => s.Year == (int)YearComboBox.SelectedItem && s.Month == (int)MonthComboBox.SelectedItem));
                needUpdateList = AlgorithmClass.CompareCollectionIsChanged <SalaryInfo>(dataManager.AllSalaryList, tempList, "ID");
                if (needUpdateList.Count != 0)
                {
                    return(true);
                }
            }

            return(false);
        }
        private void OperationTypeList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (OperationTypeList.SelectedItem == null)
            {
                return;
            }

            switch ((OperationType)(((DictionaryEntry)(OperationTypeList.SelectedValue)).Key))
            {
            case OperationType.Scan:
                if (SheetDataGrid.SelectedValue != null)
                {
                    SheetDetailGrid.SetBinding(Grid.DataContextProperty, new Binding("SelectedValue")
                    {
                        Source = SheetDataGrid
                    });
                }
                UpdateProcefureInfo();
                break;

            case OperationType.Edit:
                sheetInfoForEdit            = AlgorithmClass.DeepClone <SheetInfo>(SheetDataGrid.SelectedItem as SheetInfo);
                SheetDetailGrid.DataContext = sheetInfoForEdit;

                procedureInfoListForEdit      = AlgorithmClass.DeepClone <ObservableCollection <ProcedureInfo> >(CurProcedureInfoList);
                ProcedureDataGrid.ItemsSource = procedureInfoListForEdit;

                bopInfoListForEdit      = AlgorithmClass.DeepClone <ObservableCollection <SheetBOPInfo> >(CurBOPInfoList);
                BOPDataGrid.ItemsSource = bopInfoListForEdit;

                if (procedureInfoListForEdit.Count == CurSelectionProcedureInfoList.Count)
                {
                    AddRowBtn.IsEnabled = false;
                }
                else
                {
                    AddRowBtn.IsEnabled = true;
                }
                break;

            case OperationType.New:
                BSTypeTextBlock.Text        = "";
                sheetInfoForNew             = new SheetInfo();
                SheetDetailGrid.DataContext = sheetInfoForNew;

                procedureInfoListForNew       = new ObservableCollection <ProcedureInfo>();
                ProcedureDataGrid.ItemsSource = procedureInfoListForNew;
                AddRowBtn.IsEnabled           = true;

                bopInfoListForNew       = new ObservableCollection <SheetBOPInfo>();
                BOPDataGrid.ItemsSource = bopInfoListForNew;
                break;
            }
        }
示例#7
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            AlgorithmClass.InitBOPSelectionList(dataManager.AllBOPList, dataManager.AllDepartmentList, dataManager.AllEmployeeList);
            BalanceBOPList = AlgorithmClass.GetBOPListByBOPType(dataManager.AllBOPList, BOPType.B);
            PaymentBOPList = AlgorithmClass.GetBOPListByBOPType(dataManager.AllBOPList, BOPType.P);

            BalanceBOPList.CollectionChanged += BalanceBOPList_CollectionChanged;
            PaymentBOPList.CollectionChanged += PaymentBOPList_CollectionChanged;

            InitBOPUIList(BalanceBOPList, BOPType.B);
        }
示例#8
0
 public Experiment()
 {
     this.StartTime         = "0";
     this.StopTime          = "1";
     this.NumberOfIntervals = "500";
     this.Interval          = "0";
     this.IntervalMethod    = "NumberOfIntervals";
     this.Tolerance         = "1e-04";
     this.Algorithm         = new AlgorithmClass();
     this.ToolSelection     = "Dymola__latest_";
 }
        public SalaryManagerControl()
        {
            InitializeComponent();

            dataManager   = DataManager.dataManager;
            AllSalaryList = new ObservableCollection <SalaryInfo>();

            (FindResource("YearViewSource") as CollectionViewSource).Source  = AlgorithmClass.GetYearList();
            (FindResource("MonthViewSource") as CollectionViewSource).Source = AlgorithmClass.GetMonthList();

            YearComboBox.SelectedItem  = DateTime.Now.Year;
            MonthComboBox.SelectedItem = DateTime.Now.Month;
        }
        private bool DoSave()
        {
            bool isSaved = false;

            if (needAddList.Count != 0)
            {
                appLog.Info("Insert New Item.needAddList.Count = " + needAddList.Count);
                //执行插入
                foreach (SalaryInfo info in needAddList)
                {
                    int insertID = 0;
                    if (SalaryDeal.InsertSalaryInfo(info, ref insertID))
                    {
                        info.ID = insertID;
                    }
                    else
                    {
                        return(false);
                    }
                }

                needAddList.Clear();
                isSaved = true;
            }

            if (needUpdateList.Count != 0)
            {
                //执行更新
                appLog.Info("Update New Item.needAddList.Count = " + needUpdateList.Count);
                foreach (SalaryInfo info in needUpdateList)
                {
                    if (!SalaryDeal.UpdateSalaryInfo(info))
                    {
                        return(false);
                    }
                }

                needUpdateList.Clear();
                isSaved = true;
            }

            if (isSaved)
            {
                dataManager.AllSalaryList = AlgorithmClass.DeepClone <ObservableCollection <SalaryInfo> >(AllSalaryList);
            }

            return(isSaved);
        }
        private void InitUIList()
        {
            appLog.Info("InitUIList...");

            needAddList    = new ObservableCollection <SalaryInfo>();
            needUpdateList = new ObservableCollection <SalaryInfo>();
            //添加雇员选择列表
            appLog.Info("Add EmployeeList...");
            AlgorithmClass.InitSalarySelectionList(dataManager.AllSalaryList, dataManager.AllEmployeeList, dataManager.AllDepartmentList, AlgorithmClass.GetWorkStatusList());
            AllSalaryList = AlgorithmClass.DeepClone <ObservableCollection <SalaryInfo> >(dataManager.AllSalaryList);
            lcv           = new ListCollectionView(AllSalaryList);
            lcv.GroupDescriptions.Add(new PropertyGroupDescription("DepartmentName"));
            lcv.Filter = Fitter_TextChanged;
            lcv.Refresh();
            //刷新当前页面上的所有收支
            // FlushCurrentViewAllCommission();
            AddBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv
            });
            ClearBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });
            SaveBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });
            RestoreBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });
            ViewBSBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });
            PrintBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });
            FlushAllBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });

            SalaryDataGrid.ItemsSource = lcv;
        }
示例#12
0
        private void RestoreBtn_Click(object sender, RoutedEventArgs e)
        {
            switch ((BOPType)(((DictionaryEntry)(BOPTypeList.SelectedValue)).Key))
            {
            case BOPType.P:
                PaymentBOPList = AlgorithmClass.GetBOPListByBOPType(dataManager.AllBOPList, BOPType.P);
                PaymentBOPList.CollectionChanged += PaymentBOPList_CollectionChanged;
                InitBOPUIList(PaymentBOPList, BOPType.P);
                break;

            case BOPType.B:
                BalanceBOPList = AlgorithmClass.GetBOPListByBOPType(dataManager.AllBOPList, BOPType.B);
                BalanceBOPList.CollectionChanged += BalanceBOPList_CollectionChanged;
                InitBOPUIList(BalanceBOPList, BOPType.B);
                break;
            }
        }
示例#13
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);
        }
示例#14
0
        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            if (lcv.CanAddNewItem)
            {
                lcv.AddNewItem(new EmployeeInfo
                {
                    EmployeeSex                 = EmployeeSexType.boy,
                    StatusID                    = 1,
                    DepartmentID                = (DepartmentComboBox.SelectedItem as DepartmentInfo).ID,
                    PostID                      = 1,
                    SelectionPostInfoList       = dataManager.AllPostList.ToList(),
                    SelectionDepartmentInfoList = dataManager.AllDepartmentList.ToList(),
                    SelectionWorkStatusInfoList = AlgorithmClass.GetWorkStatusList()
                });

                lcv.CommitNew();
            }
        }
        private SalaryInfo Do_GetSalaryProcedureInfo(SalaryInfo salaryInfo, ref SalaryProcedureInfoWrap salaryProcedureInfoWrap)
        {
            if (salaryInfo == null)
            {
                return(null);
            }

            bool isUpdateTotalPrice = false;

            salaryProcedureInfoWrap = GetSalaryProcedureInfo(salaryInfo, ref isUpdateTotalPrice);
            if (isUpdateTotalPrice)
            {
                SalaryDeal.UpdateSalaryInfo(salaryInfo);
                dataManager.AllSalaryList = AlgorithmClass.DeepClone <ObservableCollection <SalaryInfo> >(AllSalaryList);
            }

            return(salaryInfo);
        }
示例#16
0
        private bool CheckedIsNeedSave()
        {
            if (AllEmployeeList == null || lcv == null)
            {
                return(false);
            }

            DepartmentInfo curDepartmentInfo = DepartmentComboBox.SelectedItem as DepartmentInfo;

            //检查添加项
            if (AllEmployeeList.Count != dataManager.AllEmployeeList.Count)
            {
                foreach (EmployeeInfo info in lcv)
                {
                    if (info.ID == 0)
                    {
                        needAddList.Add(info);
                    }
                }
                return(true);
            }
            else
            {
                //检查并获取编辑项
                var tempList = new ObservableCollection <EmployeeInfo>();
                foreach (EmployeeInfo info in lcv)
                {
                    if (info.ID != 0)
                    {
                        tempList.Add(info);
                    }
                }
                needUpdateList = AlgorithmClass.CompareCollectionIsChanged <EmployeeInfo>(dataManager.AllEmployeeList, tempList, "ID");
                if (needUpdateList.Count != 0)
                {
                    return(true);
                }
            }

            return(false);
        }
        private void SheetDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (SheetDataGrid.SelectedItem == null || IsSavingEdit == true)
            {
                return;
            }

            switch ((OperationType)(((DictionaryEntry)(OperationTypeList.SelectedValue)).Key))
            {
            case OperationType.Scan:
                UpdateProcefureInfo();
                break;

            case OperationType.Edit:
                UpdateProcefureInfo();
                sheetInfoForEdit            = AlgorithmClass.DeepClone <SheetInfo>(SheetDataGrid.SelectedItem as SheetInfo);
                SheetDetailGrid.DataContext = sheetInfoForEdit;

                procedureInfoListForEdit = CurProcedureInfoList.Count == 0 ? new ObservableCollection <ProcedureInfo>()
                        : AlgorithmClass.DeepClone <ObservableCollection <ProcedureInfo> >(CurProcedureInfoList);
                ProcedureDataGrid.ItemsSource = procedureInfoListForEdit;

                bopInfoListForEdit = CurBOPInfoList.Count == 0 ? new ObservableCollection <SheetBOPInfo>()
                        : AlgorithmClass.DeepClone <ObservableCollection <SheetBOPInfo> >(CurBOPInfoList);
                BOPDataGrid.ItemsSource = bopInfoListForEdit;

                if (procedureInfoListForEdit.Count == CurSelectionProcedureInfoList.Count)
                {
                    AddRowBtn.IsEnabled = false;
                }
                else
                {
                    AddRowBtn.IsEnabled = true;
                }
                break;
            }
        }
        private void UpdateProcefureInfo()
        {
            if (SheetDataGrid.SelectedItem == null)
            {
                return;
            }

            SheetInfo sheetInfo = SheetDataGrid.SelectedItem as SheetInfo;

            //获取该单所对应的流程信息
            CurProcedureInfoList = SheetDeal.GetAllProcedureInfo(sheetInfo.ID);
            //获取跟单员
            sheetInfo.Follower = AlgorithmClass.GetFollowers(CurProcedureInfoList);

            BsTypeInfo bsTypeInfo = dataManager.AllBsTypeList.Where(type => type.TypeName == sheetInfo.BSType).FirstOrDefault();

            //获取该单中业务类型的全部流程信息 供选择更改
            CurSelectionProcedureInfoList = AlgorithmClass.GetSelectionProcedureInfoList(bsTypeInfo.ProcedurePrice);
            CurProcedureInfoList.ToList().ForEach(info => info.SelectionProcedureInfoList = CurSelectionProcedureInfoList);

            CurBOPInfoList      = SheetDeal.GetAllSheetBOPInfo(sheetInfo.ID);
            TotalTextBlock.Text = AlgorithmClass.GetBOPTotal(CurBOPInfoList).ToString();

            //绑定
            ProcedureDataGrid.ItemsSource = CurProcedureInfoList;
            BOPDataGrid.ItemsSource       = CurBOPInfoList;

            if (CurProcedureInfoList.Count == CurSelectionProcedureInfoList.Count)
            {
                AddRowBtn.IsEnabled = false;
            }
            else
            {
                AddRowBtn.IsEnabled = true;
            }
        }
        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            switch ((OperationType)(((DictionaryEntry)(OperationTypeList.SelectedValue)).Key))
            {
            case OperationType.Edit:

                if (!CheckSheetIsValid(SheetDataGrid.SelectedItem as SheetInfo))
                {
                    MessageBox.Show("请检查该单必填信息是否完整。", "信息不完整", MessageBoxButton.OK, MessageBoxImage.Warning);
                    return;
                }

                bool IsChanged = AlgorithmClass.CheckIsChanged <SheetInfo>(SheetDataGrid.SelectedItem as SheetInfo, sheetInfoForEdit);

                //单信息
                if (IsChanged == true)
                {
                    IsSavingEdit = true;
                    if (SheetDeal.UpdateSheetInfo(sheetInfoForEdit) == true)
                    {
                        //获得所有跟单员
                        sheetInfoForEdit.Follower = AlgorithmClass.GetFollowers(procedureInfoListForEdit);
                        int index = dataManager.AllSheetList.ToList().FindIndex(sheet => sheet.ID == sheetInfoForEdit.ID);
                        dataManager.AllSheetList.RemoveAt(index);
                        dataManager.AllSheetList.Insert(index, AlgorithmClass.DeepClone <SheetInfo>(sheetInfoForEdit));
                        SheetDataGrid.SelectedIndex = index;
                    }
                    else
                    {
                        MessageBox.Show("单保存失败,请重试!", "操作失败", MessageBoxButton.OK, MessageBoxImage.Error);
                        IsSavingEdit = false;
                        return;
                    }
                }

                //流程信息
                string procedureMap = AlgorithmClass.GetProcedureMap(procedureInfoListForEdit);
                if (procedureMap != AlgorithmClass.GetProcedureMap(CurProcedureInfoList))
                {
                    IsSavingEdit = true;
                    if (SheetDeal.UpdateProcedureMap(sheetInfoForEdit.ID, procedureMap) == false)
                    {
                        MessageBox.Show("流程信息保存失败,请重试!", "操作失败", MessageBoxButton.OK, MessageBoxImage.Error);
                        IsSavingEdit = false;
                        return;
                    }
                }

                //收支信息
                string bopMap = AlgorithmClass.GetBOPMap(bopInfoListForEdit);
                if (bopMap != AlgorithmClass.GetBOPMap(CurBOPInfoList))
                {
                    IsSavingEdit = true;
                    if (SheetDeal.UpdateSheetBOPMap(sheetInfoForEdit.ID, bopMap) == false)
                    {
                        MessageBox.Show("收支信息保存失败,请重试!");
                        IsSavingEdit = false;
                        return;
                    }
                }

                if (IsSavingEdit == true)
                {
                    MessageBox.Show("数据更新成功!");
                    IsSavingEdit = false;
                }

                break;

            case OperationType.New:

                if (!CheckSheetIsValid(sheetInfoForNew))
                {
                    MessageBox.Show("请检查该单必填信息是否完整。", "信息不完整", MessageBoxButton.OK, MessageBoxImage.Warning);
                    return;
                }

                int insertID = 0;
                IsSavingEdit = true;
                //单信息
                if (SheetDeal.InsertSheetInfo(sheetInfoForNew, ref insertID) == true)
                {
                    sheetInfoForNew.ID       = insertID;
                    sheetInfoForNew.Follower = AlgorithmClass.GetFollowers(procedureInfoListForNew);
                    dataManager.AllSheetList.Add(AlgorithmClass.DeepClone <SheetInfo>(sheetInfoForNew));
                }
                else
                {
                    MessageBox.Show("新单创建失败,请重试!");
                    IsSavingEdit = false;
                    return;
                }

                IsSavingEdit = false;

                //流程信息
                if (SheetDeal.InsertProcedureMap(sheetInfoForNew.ID, AlgorithmClass.GetProcedureMap(procedureInfoListForNew)) == false)
                {
                    MessageBox.Show("流程信息创建失败,请重试!", "操作失败", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                //收支信息
                if (SheetDeal.InsertSheetBOPMap(sheetInfoForNew.ID, AlgorithmClass.GetBOPMap(bopInfoListForNew)) == false)
                {
                    MessageBox.Show("收支信息创建失败,请重试!", "操作失败", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                sheetInfoForNew             = new SheetInfo();
                SheetDetailGrid.DataContext = sheetInfoForNew;
                procedureInfoListForNew.Clear();
                bopInfoListForNew.Clear();

                MessageBox.Show("新单创建成功!");

                break;
            }
        }
示例#20
0
 private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     AlgorithmClass.CollectionViewSource_Refresh(this, "ViewSource");
     CountCurViewPrice();
 }
示例#21
0
        private bool DoSave(ref string msg)
        {
            bool isSaved = false;

            if (needAddList.Count != 0)
            {
                //执行插入
                foreach (EmployeeInfo info in needAddList)
                {
                    if (!CheckEmployeeInfoIsValid(info))
                    {
                        msg = "新增项或被编辑项的信息不完整,保存失败。";
                        return(false);
                    }

                    int insertID = 0;
                    if (EmployeeDeal.InsertEmployeeInfo(info, ref insertID))
                    {
                        info.ID = insertID;
                    }
                    else
                    {
                        msg = "数据创建失败,请重试!";
                        return(false);
                    }
                }

                needAddList.Clear();
                isSaved = true;
            }

            if (needUpdateList.Count != 0)
            {
                //执行更新
                foreach (EmployeeInfo info in needUpdateList)
                {
                    if (!CheckEmployeeInfoIsValid(info))
                    {
                        msg = "新增项或被编辑项的信息不完整,保存失败。";
                        return(false);
                    }

                    if (!EmployeeDeal.UpdateEmployeeInfo(info))
                    {
                        msg = "数据更新失败,请重试!";
                        return(false);
                    }
                }

                needUpdateList.Clear();
                isSaved = true;
            }

            if (isSaved)
            {
                dataManager.AllEmployeeList = AlgorithmClass.DeepClone <ObservableCollection <EmployeeInfo> >(AllEmployeeList);
            }

            if (isSaved)
            {
                msg = "数据保存完成!";
            }
            else
            {
                msg = "不存在需要保存项!";
            }

            return(true);
        }
示例#22
0
 public Experiment()
 {
     this.StartTime = "0";
     this.StopTime = "1";
     this.NumberOfIntervals = "500";
     this.Interval= "0";
     this.IntervalMethod = "NumberOfIntervals";
     this.Tolerance = "1e-04";
     this.Algorithm = new AlgorithmClass();
     this.ToolSelection = "Dymola__latest_";
 }
示例#23
0
        private bool Do_Save(ref string msg)
        {
            ObservableCollection <BOPInfo> needUpdateList = null;
            BOPInfo tempInfo     = null;
            bool    isNeedUpdate = CheckedIsNeedSave(ref tempInfo, ref needUpdateList, (BOPType)(((DictionaryEntry)(BOPTypeList.SelectedValue)).Key));

            if (tempInfo != null)
            {
                if (!CheckBOPInfoIsValid(tempInfo))
                {
                    msg = "新增项或被编辑项的信息不完整,保存失败。";
                    return(false);
                }

                //插入操作
                int newID = 0;
                if (BOPDeal.InsertBOPInfo(tempInfo, ref newID))
                {
                    tempInfo.ID = newID;
                    dataManager.AllBOPList.Add(tempInfo);
                }
                else
                {
                    msg = "数据创建失败,请重试!";
                    return(false);
                }
            }

            if (needUpdateList.Count != 0)
            {
                //更新操作
                foreach (BOPInfo info in needUpdateList)
                {
                    if (!CheckBOPInfoIsValid(tempInfo))
                    {
                        msg = "新增项或被编辑项的信息不完整,保存失败。";
                        return(false);
                    }

                    if (BOPDeal.UpdateBOPInfo(info))
                    {
                        int index = dataManager.AllBOPList.ToList().FindIndex(bop => bop.ID == info.ID);
                        if (index > -1)
                        {
                            dataManager.AllBOPList.RemoveAt(index);
                            dataManager.AllBOPList.Insert(index, AlgorithmClass.DeepClone <BOPInfo>(info));
                        }
                    }
                    else
                    {
                        msg = "数据更新失败,请重试!";
                        return(false);
                    }
                }
            }

            if (isNeedUpdate)
            {
                msg = "数据保存完成!";
            }
            else
            {
                msg = "不存在需要保存项!";
            }

            return(true);
        }