コード例 #1
0
        private void Datagrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var item = datagrid.SelectedItem as AuxiliaryObj;

            if (item != null)
            {
                SelectedEvent?.Invoke(item);
            }
            else
            {
                FinanceMessageBox.Info("请选中一个项目");
            }
        }
コード例 #2
0
ファイル: VoucherGrid.xaml.cs プロジェクト: ruo2012/finance
 FrameworkElement CheckRow(int rowIndex)
 {
     try
     {
         if (rowIndex < 0)
         {
             return(null);
         }
         if (IsEmptyRow(rowIndex) && (rowIndex == m_DataSource.Count - 1) && (rowIndex - 1 >= 0))
         {
             var ele = CheckRow(rowIndex - 1);
             return(ele);
         }
         if (rowIndex >= m_DataSource.Count)
         {
             return(null);
         }
         var row = m_DataSource[rowIndex];
         if (row.AccountSubjectId == 0L && !isReadOnly)
         {
             MessageEvent?.Invoke(MessageLevel.ERR, "科目不能为空!");
             var ele1 = grid.FindName("txtAccountSubject_" + rowIndex) as FrameworkElement;
             return(ele1);
         }
         else if (row.CreditAmount == 0M && row.DebitsAmount == 0M && !isReadOnly)
         {
             MessageEvent?.Invoke(MessageLevel.ERR, "金额不能为零!");
             var ele1 = grid.FindName("aInputDebits_" + rowIndex) as FrameworkElement;
             return(ele1);
         }
         var dTotalCredit = totalCredit.Value;
         var dTotalDebits = totalDebits.Value;
         if (dTotalCredit != dTotalDebits)
         {
             MessageEvent?.Invoke(MessageLevel.WARN, "借贷不平衡!");
             return(null);
         }
         MessageEvent?.Invoke(MessageLevel.INFO, "");
     }
     catch (Exception ex)
     {
         FinanceMessageBox.Error(ex.Message);
     }
     return(null);
 }