Ejemplo n.º 1
0
        private void FnSetUpData()
        {
            mSelectedRunnerId       = Intent.GetIntExtra("selectedRunnerId", 0);
            mTransactionsDataAccess = new TransactionsDataAccess();
            mRunnersDataAccess      = new RunnersDataAccess();
            mSelectedRunner         = mRunnersDataAccess.SelectRecord(mSelectedRunnerId)[0];

            //get startdate and end date based from unpaid records of the selected runner
            var holder = mTransactionsDataAccess.SelectTable()
                         .Where(x => x.CustomerOrRunnerId == mSelectedRunnerId && !x.IsPaid).ToList();

            holder = holder.OrderBy(x => StringDateToDate(x.TransactionDateTime)).ToList();

            if (holder.Count != 0)
            {
                mSelectedStartDate = StringDateToDate(holder[0].TransactionDateTime);
                mSelectedEndDate   = StringDateToDate(holder[holder.Count() - 1].TransactionDateTime);
            }

            selectedStartCalendarYear       = mSelectedStartDate.Year;
            selectedStartCalendarMonth      = mSelectedStartDate.Month - 1;
            selectedStartCalendarDayOfMonth = mSelectedStartDate.Day;

            selectedEndCalendarYear       = mSelectedEndDate.Year;
            selectedEndCalendarMonth      = mSelectedEndDate.Month - 1;
            selectedEndCalendarDayOfMonth = mSelectedEndDate.Day;
        }
 private void FnSetUpData()
 {
     mSelectedRunnerId = Intent.GetIntExtra("selectedRunnerId", 0);
     mRunnersMultipayRecordsDataAccess = new RunnersMultipayRecordsDataAccess();
     mRunnersDataAccess = new RunnersDataAccess();
     mSelectedRunner    = mRunnersDataAccess.SelectRecord(mSelectedRunnerId)[0];
 }
        private RunnersModel RunnerToSave()
        {
            RunnersModel Runner = new RunnersModel
            {
                Id           = mSelectedRunnerRow[0].Id,
                FullName     = mEtRunnerName.Text.Trim(),
                Contact      = mEtMobileNumber.Text.Trim(),
                Address      = mEtRunnerAddress.Text.Trim(),
                DateModified = DateTime.Now.ToString(GlobalVariables.DATABASE_TIME_FORMAT)
            };

            return(Runner);
        }
 public bool InsertIntoTable(RunnersModel runners)
 {
     try
     {
         using (var connection = new SQLiteConnection(connectionString))
         {
             connection.Insert(runners);
             return(true);
         }
     }
     catch (SQLiteException ex)
     {
         Log.Info("SQLiteEx", ex.Message);
         return(false);
     }
 }
 public bool UpdateTable(RunnersModel runnersModel)
 {
     try
     {
         using (var connection = new SQLiteConnection(connectionString))
         {
             connection.Query <RunnersModel>("UPDATE RunnersModel set FullName=?, Contact=?, Address=?, DateModified=? Where Id=?",
                                             runnersModel.FullName, runnersModel.Contact, runnersModel.Address, runnersModel.DateModified, runnersModel.Id);
             return(true);
         }
     }
     catch (SQLiteException ex)
     {
         Log.Info("SQLiteEx", ex.Message);
         return(false);
     }
 }