コード例 #1
0
        private void ViewerGrid_RowEditEnding(object sender, System.Windows.Controls.DataGridRowEditEndingEventArgs e)
        {
            // Save changes and tell other viewers about the change
            int currow = 0;

            currow = this.BankGrid.SelectedIndex;
            // Save current row so we can reposition correctly at end of the entire refresh process
            Flags.SqlBankCurrentIndex = currow;
            BankAccountViewModel ss = new BankAccountViewModel();

            ss = this.BankGrid.SelectedItem as BankAccountViewModel;
            // This is the NEW DATA from the current row
            SQLHandlers sqlh = new SQLHandlers();

            sqlh.UpdateDbRowAsync("BANKACCOUNT", ss, this.BankGrid.SelectedIndex);

            this.BankGrid.SelectedIndex = Flags.SqlBankCurrentIndex;
            this.BankGrid.ScrollIntoView(Flags.SqlBankCurrentIndex);
            // Notify EditDb to upgrade its grid
            if (Flags.CurrentEditDbViewer != null)
            {
                Flags.CurrentEditDbViewer.UpdateGrid("BANKACCOUNT");
            }

            // ***********  DEFINITE WIN  **********
            // This DOES trigger a notidfication to SQLDBVIEWER for sure !!!   14/5/21
            EventControl.TriggerViewerDataChanged(2, this.BankGrid.SelectedIndex, "BANKACCOUNT");
        }
コード例 #2
0
        /// <summary>
        /// Handles the SQL updateof any changes made and updates all grids
        /// </summary>
        /// <param name="CurrentDb"></param>
        /// <param name="e"></param>
        public void UpdateOnDataChange(string CurrentDb, DataGridRowEditEndingEventArgs e)
        {
            // Call Handler to update ALL Db's via SQL
            SQLHandlers sqlh = new SQLHandlers();

            sqlh.UpdateAllDb(CurrentDb, e, 2);
            //Gotta reload our data because the update clears it down totally to null
            // Refresh our grids
            RefreshAllGrids( );
            inprogress = false;
        }
コード例 #3
0
        private async Task <bool> SaveButton(object sender = null, RoutedEventArgs e = null)
        {
            //inprogress = true;
            //bindex = this . BankGrid . SelectedIndex;
            //cindex = this . CustomerGrid . SelectedIndex;
            //dindex = this . DetailsGrid . SelectedIndex;

            // Get the current rows data
            IsDirty = false;
            int CurrentSelection = this.BankGrid.SelectedIndex;

            this.BankGrid.SelectedItem = this.BankGrid.SelectedIndex;
            BankAccountViewModel bvm = new BankAccountViewModel();

            bvm = this.BankGrid.SelectedItem as BankAccountViewModel;

            SaveFieldData( );

            // update the current rows data content to send  to Update process
            bvm.BankNo  = Bankno.Text;
            bvm.CustNo  = Custno.Text;
            bvm.AcType  = Convert.ToInt32(acType.Text);
            bvm.Balance = Convert.ToDecimal(balance.Text);
            bvm.ODate   = Convert.ToDateTime(odate.Text);
            bvm.CDate   = Convert.ToDateTime(cdate.Text);
            // Call Handler to update ALL Db's via SQL
            SQLHandlers sqlh = new SQLHandlers();
            await sqlh.UpdateDbRow("BANKACCOUNT", bvm);

            EventControl.TriggerBankDataLoaded(BankViewercollection,
                                               new LoadedEventArgs
            {
                CallerDb   = "BANKACCOUNT",
                DataSource = BankViewercollection,
                RowCount   = this.BankGrid.SelectedIndex
            });

            //Gotta reload our data because the update clears it down totally to null
            this.BankGrid.SelectedIndex = CurrentSelection;
            this.BankGrid.SelectedItem  = CurrentSelection;
            this.BankGrid.Refresh( );

            SaveBttn.IsEnabled = false;
            return(true);
        }
コード例 #4
0
 public List <EmployeeListViewModel> GetEmployeeList(EmployeeViewModelFilter filter)
 {
     try
     {
         List <KeyValuePair <string, object> > Param = new List <KeyValuePair <string, object> >();
         Param.Add(new KeyValuePair <string, object>("@Offset", filter.Offset));
         Param.Add(new KeyValuePair <string, object>("@Limit", filter.Limit));
         Param.Add(new KeyValuePair <string, object>("@DateFrom", filter.DateFrom));
         Param.Add(new KeyValuePair <string, object>("@DateTo", filter.DateTo));
         Param.Add(new KeyValuePair <string, object>("@SearchText", filter.SearchText));
         Param.Add(new KeyValuePair <string, object>("@SalaryRangeFrom", filter.SalaryRangeFrom));
         Param.Add(new KeyValuePair <string, object>("@SalaryRangeTo", filter.SalaryRangeTo));
         Param.Add(new KeyValuePair <string, object>("@Gender", filter.Gender));
         Param.Add(new KeyValuePair <string, object>("@ImportDateFrom", filter.ImportedRangeFrom));
         Param.Add(new KeyValuePair <string, object>("@ImportDateTo", filter.ImportedRangeTo));
         SQLHandlers sqlh = new SQLHandlers();
         return(sqlh.ExecuteAsList <EmployeeListViewModel>("[dbo].[usp_GetEmployeList]", Param));
     }
     catch (Exception ex)
     {
         throw;
     }
 }