Esempio n. 1
0
 public int  SaveParkingStatus(CheckInOut Check)
 {
     lock (locker) {
         if (Check.IsCheckout != false)
         {
             connection.Update(Check);
             return(Check.ID);
         }
         else
         {
             connection.Insert(Check);
             return(Check.ID);
         }
     }
 }
Esempio n. 2
0
        public void OnCheckOut(object sender, EventArgs e)
        {
            CheckInOut Object = new CheckInOut();

            Object.ID         = Id;
            Object.IsCheckout = true;
            var result = Database.SaveParkingStatus(Object);

            Intent myIntent = new Intent(this, typeof(CheckIn));

            myIntent.PutExtra("ID", result);
            SetResult(Result.Ok, myIntent);
            //StartActivity(typeof(CheckIn));
            // StartActivity(new Intent(Application.Context, typeof(CheckIn)));
            Toast.MakeText(this, "Check Out at:" + DateTime.Now, ToastLength.Long).Show();
            this.Finish();
        }
Esempio n. 3
0
        private void sendEmail()
        {
            try
            {
                var datatime = DateTime.Now;

                MailMessage mail       = new MailMessage();
                SmtpClient  SmtpServer = new SmtpClient("smtp.gmail.com");
                mail.From = new MailAddress("*****@*****.**");
                mail.To.Add("*****@*****.**");
                mail.Subject           = "TEST";
                mail.Body              = $"Check In " + datatime.ToString();
                SmtpServer.Port        = 587;
                SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "50204243.002");
                SmtpServer.EnableSsl   = true;
                ServicePointManager.ServerCertificateValidationCallback = delegate(object s, System.Security.Cryptography.X509Certificates.X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); };
                SmtpServer.Send(mail);

                CheckInOut Object = new CheckInOut();
                Object.ID         = 0;
                Object.IsCheckout = false;
                Id = Database.SaveParkingStatus(Object);

                // Store ID in Shered Storage
                ISharedPreferencesEditor editor = prefs.Edit();
                editor.PutInt("CheckinID", Id);
                editor.Apply();

                //Navigate to Checkout Activity
                var CheckouActivity = new Intent(this, typeof(CheckOut));
                CheckouActivity.PutExtra("CheckInID", Id);
                StartActivityForResult(CheckouActivity, 100);
            }
            catch (Exception A)
            {
                Console.WriteLine("Ouch!" + A.ToString());
            }
        }