private async void BtnApply_Clicked(object sender, EventArgs e) { try { ShowLoading(true); MasterHomePage filerpage = null; if (App.Current.Properties.ContainsKey("LoginUser")) { User objloginuser = (User)App.Current.Properties["LoginUser"]; await Task.Run(() => { objFilter.LocationID = objloginuser.LocationParkingLotID.LocationID.LocationID; objFilter.LocationParkingLotID = objloginuser.LocationParkingLotID.LocationParkingLotID; objFilter.ApplicationTypeCode = objSelectedAppTypes; objFilter.StatusCode = objSelectedStatus; objFilter.VehicleTypeCode = SelectedVehicle; filerpage = new MasterHomePage(objFilter); }); await Navigation.PushAsync(filerpage); } ShowLoading(false); } catch (Exception ex) { ShowLoading(false); } }
private async void BtnPrintReceipt_Clicked(object sender, EventArgs e) { string printerName = string.Empty; try { printerName = ObjblueToothDevicePrinting.GetBlueToothDevices(); labelPrinterName.Text = printerName; if (printerName != string.Empty && printerName != "") { string[] receiptlines = new string[16]; receiptlines[0] = "\x1B\x21\x12" + " " + "HMRL PARKING" + "\x1B\x21\x00" + "\n"; receiptlines[1] = "\x1B\x21\x01" + " " + "Location And Lot" + "\x1B\x21\x00" + "\n"; receiptlines[2] = "\x1B\x21\x08" + "BIKE: TS05FL0960" + "\x1B\x21\x00" + "\n"; receiptlines[3] = "\x1B\x21\x08" + "(In)11/06/20 7:37" + "\x1B\x21\x00" + "\n"; receiptlines[4] = "\x1B\x21\x06" + "Paid: Rs 10.00" + "\x1B\x21\x00" + "\n"; receiptlines[5] = "\x1B\x21\x01" + "Parked at - Bays: (40-50)" + "\x1B\x21\x00" + "\n"; receiptlines[6] = "\x1B\x21\x01" + "Operator Id :2001" + "\x1B\x21\x00" + "\n"; receiptlines[7] = "\x1B\x21\x01" + "We are not responsible for your" + "\x1B\x21\x00" + "\n"; receiptlines[8] = "\x1B\x21\x06" + "GST Number 36AACFZ1015E1ZL" + "\x1B\x21\x00" + "\n"; receiptlines[9] = "\x1B\x21\x01" + "Amount includes 18% GST" + "\x1B\x21\x00" + "\n"; receiptlines[10] = "\x1B\x21\x03" + "We are not responsible " + "\x1B\x21\x00" + "\n"; receiptlines[11] = "\x1B\x21\x05" + "We are not responsible for your" + "\x1B\x21\x00" + "\n"; receiptlines[12] = "\x1B\x21\x09" + "We are not responsible for your" + "\x1B\x21\x00" + "\n"; receiptlines[13] = "" + "\n"; receiptlines[14] = "" + "\n"; receiptlines[15] = "" + "\n"; if (receiptlines.Length > 0) { for (var l = 0; l < receiptlines.Length; l++) { string printtext = receiptlines[l]; if (printtext != "") { ObjblueToothDevicePrinting.PrintCommand(printerName, printtext); } } var masterPage = new MasterHomePage(); await Navigation.PushAsync(masterPage); } } else { await DisplayAlert("Alert", "Unable to find Bluetooth device", "Ok"); } } catch (Exception ex) { } }
private async void BtnPrint_Clicked(object sender, EventArgs e) { try { string printerName = string.Empty; MasterHomePage masterPage = null; ShowLoading(true); try { if (App.Current.Properties.ContainsKey("MultiSelectionLocations")) { App.Current.Properties.Remove("MultiSelectionLocations"); } printerName = ObjblueToothDevicePrinting.GetBlueToothDevices(); if (printerName != string.Empty && printerName != "") { if (receiptlines.Length > 0) { for (var l = 0; l < receiptlines.Length; l++) { string printtext = receiptlines[l]; if (printtext != "") { ObjblueToothDevicePrinting.PrintCommand(printerName, printtext); } } await Task.Run(() => { masterPage = new MasterHomePage(); }); } await Navigation.PushAsync(masterPage); } else { await DisplayAlert("Alert", "Unable to find Bluetooth device", "Ok"); await Navigation.PushAsync(masterPage); } } catch (Exception ex) { } ShowLoading(false); } catch (Exception ex) { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "PassPaymentReceiptPage.xaml.cs", "", "BtnDone_Clicked"); } }
private async void BtnClamp_Clicked(object sender, EventArgs e) { try { ShowLoading(true); BtnClamp.IsEnabled = false; MasterHomePage masterPage = null; string resultmsg = string.Empty; if (pickerViolationReason.SelectedItem != null) { ViolationReason objselectedreason = (ViolationReason)pickerViolationReason.SelectedItem; if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken")) { await Task.Run(() => { User objClampedBy = (User)App.Current.Properties["LoginUser"]; objresult.IsClamp = checkBoxClampVehicle.IsChecked; objresult.IsWarning = chkWarning.IsChecked; objresult.ViolationReasonID.ViolationReasonID = objselectedreason.ViolationReasonID; objresult.CreatedBy = objClampedBy.UserID; resultmsg = dal_ViolationClamp.UpdaetVehicleClampStatus(Convert.ToString(App.Current.Properties["apitoken"]), objresult); if (resultmsg == "Success") { masterPage = new MasterHomePage(); } }); if (resultmsg == "Success") { await Navigation.PushAsync(masterPage); } else { await DisplayAlert("Alert", "Clamp Failed,Please contact Admin", "Ok"); } } } else { await DisplayAlert("Alert", "Please select Reason", "Ok"); } BtnClamp.IsEnabled = true; ShowLoading(false); } catch (Exception ex) { BtnClamp.IsEnabled = true; ShowLoading(false); } }
private async void ImgbtnPrint_Clicked(object sender, EventArgs e) { try { string printerName = string.Empty; MasterHomePage masterPage = null; try { await Task.Run(() => { printerName = ObjblueToothDevicePrinting.GetBlueToothDevices(); if (printerName != string.Empty && printerName != "") { if (receiptlines.Length > 0) { for (var l = 0; l < receiptlines.Length; l++) { string printtext = receiptlines[l]; if (printtext != "") { ObjblueToothDevicePrinting.PrintCommand(printerName, printtext); } } masterPage = new MasterHomePage(); } } else { masterPage = new MasterHomePage(); } }); if (printerName != string.Empty && printerName != "") { await Navigation.PushAsync(masterPage); } else { await DisplayAlert("Alert", "Unable to find Bluetooth device", "Ok"); await Navigation.PushAsync(masterPage); } } catch (Exception ex) { } } catch (Exception ex) { } }
private async void BtnDone_Clicked(object sender, EventArgs e) { try { ShowLoading(true); MasterHomePage masterHomePage = null; await Task.Run(() => { masterHomePage = new MasterHomePage(); }); await Navigation.PushAsync(masterHomePage); ShowLoading(false); } catch (Exception ex) { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "ValidatePassPage.xaml.cs", "", "BtnDone_Clicked"); } }
private async void SlBackbuttonClick_Tapped(object sender, EventArgs e) { try { ShowLoading(true); MasterHomePage masterHomePage = null; await Task.Run(() => { masterHomePage = new MasterHomePage(); }); await Navigation.PushAsync(masterHomePage); ShowLoading(false); } catch (Exception ex) { ShowLoading(false); } }
private async void BtnCheckOut_Clicked(object sender, EventArgs e) { try { CustomerParkingSlot objcheckoutresult = null; MasterHomePage masterpage = null; DALVehicleCheckOut dal_VehicleCheckOut = new DALVehicleCheckOut(); if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken")) { objresult.ActualEndTime = DateTime.Now; await Task.Run(() => { objcheckoutresult = dal_VehicleCheckOut.VehicleCheckOut(Convert.ToString(App.Current.Properties["apitoken"]), objresult); if (objcheckoutresult != null) { masterpage = new MasterHomePage(); } }); if (objcheckoutresult != null) { await Navigation.PushAsync(masterpage); } else { await DisplayAlert("Alert", "Check-Out Failed,Please contact Admin", "Ok"); } } } catch (Exception ex) { await DisplayAlert("Alert", "Check-Out Failed,Please contact Admin", "Ok"); dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "OverstayVehicleInformation.xaml.cs", "", "BtnCheckOut_Clicked"); } }
private async void BtnUpdatePassword_Clicked(object sender, EventArgs e) { try { if (DeviceInternet.InternetConnected()) { ShowLoading(true); dal_Userlogin = new DALUserLogin(); objloginuser.Password = entryNewPassword.Text; string currentPassword = await SecureStorage.GetAsync("Password"); if (currentPassword != null && currentPassword != "") { if ((entryCurrentPassword.Text != null && entryCurrentPassword.Text != "" && entryCurrentPassword.Text.Length >= 8 && entryCurrentPassword.Text == currentPassword)) { if ((entryNewPassword.Text != null && entryNewPassword.Text != "" && entryNewPassword.Text.Length >= 8)) { if ((entryConfirmPassword.Text != null && entryConfirmPassword.Text != "" && entryConfirmPassword.Text.Length >= 8)) { if (entryNewPassword.Text == entryConfirmPassword.Text) { string msg = dal_Userlogin.UpdateUserPassword(Convert.ToString(App.Current.Properties["apitoken"]), objloginuser); if (msg == "Success") { await SecureStorage.SetAsync("Password", entryNewPassword.Text.Trim()); await DisplayAlert("Alert", "Your password updated successfully", "Ok"); var masterPage = new MasterHomePage(); await Navigation.PushAsync(masterPage); } else { await DisplayAlert("Alert", "Unable to update Password,Please contact Admin", "Ok"); var masterPage = new MasterHomePage(); await Navigation.PushAsync(masterPage); } } else { await DisplayAlert("Alert", "Password and Confirm Password do not match", "Cancel"); ShowLoading(false); } } else { await DisplayAlert("Alert", "Please enter valid Confirm Password", "Cancel"); ShowLoading(false); } } else { await DisplayAlert("Alert", "Please enter valid New Password", "Cancel"); ShowLoading(false); } } else { await DisplayAlert("Alert", "Please enter valid Current Password", "Cancel"); ShowLoading(false); } } else { await DisplayAlert("Alert", "Unable to get Password details", "Cancel"); ShowLoading(false); } } else { await DisplayAlert("Alert", "Please check your Internet connection", "Ok"); ShowLoading(false); } } catch (Exception ex) { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "ChangePasswordPage.xaml.cs", "", "BtnUpdatePassword_Clicked"); } }
private async void BtnCheckIn_Clicked(object sender, EventArgs e) { MasterHomePage masterPage = null; string msg = string.Empty; string existingCheckIn = string.Empty; btnCheckIn.IsVisible = false; try { ShowLoading(true); if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken") && objCustomerPass != null) { if (SelectedVehicle != string.Empty) { // Pass holder vehicle Check In ParkingBay objselectedbay = (ParkingBay)pickerBayNumers.SelectedItem; if (objselectedbay != null) { await Task.Run(() => { existingCheckIn = VerifyVehicleCheckInStatus(); if (existingCheckIn == string.Empty) { VehicleCheckIn objPassVehicle = new VehicleCheckIn(); User objloginuser = (User)App.Current.Properties["LoginUser"]; objPassVehicle.UserID = objloginuser.UserID; objPassVehicle.LocationID = objloginuser.LocationParkingLotID.LocationID.LocationID; objPassVehicle.LocationParkingLotID = objloginuser.LocationParkingLotID.LocationParkingLotID; objPassVehicle.VehicleTypeCode = SelectedVehicle; objPassVehicle.BayNumberID = objselectedbay.ParkingBayID; objPassVehicle.RegistrationNumber = entryRegistrationNumber.Text; objPassVehicle.CustomerID = objCustomerPass.CustomerVehicleID.CustomerID.CustomerID; msg = dal_DALCheckIn.SavePassVehicleCheckIn(Convert.ToString(App.Current.Properties["apitoken"]), objPassVehicle); if (msg == "Success") { masterPage = new MasterHomePage(); } } }); if (existingCheckIn == string.Empty) { if (msg == "Success") { await Navigation.PushAsync(masterPage); } else { await DisplayAlert("Alert", "Unable to Check In, Please contact Admin", "Ok"); } } else { await DisplayAlert("Alert", "Vehicle Checked In as Violation at " + existingCheckIn, "Ok"); } } else { await DisplayAlert("Alert", "Please select Bay Number", "Ok"); } } else { await DisplayAlert("Alert", "Please select vehicle type and Registration Number- minimum 6 digits", "Ok"); } } else { await DisplayAlert("Alert", "Unable to Check In, Please contact Admin", "Ok"); } ShowLoading(false); btnCheckIn.IsVisible = true; } catch (Exception ex) { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "ViolationPage.xaml.cs", "", "BtnCheckIn_Clicked"); ShowLoading(false); btnCheckIn.IsVisible = true; } }
private async void BtnViolation_Clicked(object sender, EventArgs e) { string resultmsg = string.Empty; string existingCheckIn = string.Empty; MasterHomePage masterPage = null; BtnViolation.IsVisible = false; ShowLoading(true); try { int number; if (DeviceInternet.InternetConnected()) { if (SelectedVehicle != string.Empty) { if (entryRegistrationNumber.Text != null && (!entryRegistrationNumber.Text.Contains(" ") && (entryRegistrationNumber.Text.Length >= 6 && entryRegistrationNumber.Text.Length <= 10))) { string regNumber = entryRegistrationNumber.Text; string regFormat = regNumber.Substring(regNumber.Length - 4); if (int.TryParse(regFormat, out number)) { if (pickerBayNumers.SelectedItem != null) { if ((checkBoxClampVehicle.IsChecked) || (chkWarning.IsChecked)) { if (pickerVehicleReason.SelectedItem != null) { ParkingBay objselectedbay = (ParkingBay)pickerBayNumers.SelectedItem; ViolationReason objselectedreason = (ViolationReason)pickerVehicleReason.SelectedItem; if (imgCameraByteData != null) { if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken")) { await Task.Run(() => { existingCheckIn = VerifyVehicleCheckInStatus(); if (existingCheckIn == string.Empty) { ViolationAndClamp objViolationAndClamp = new ViolationAndClamp(); User objloginuser = (User)App.Current.Properties["LoginUser"]; objViolationAndClamp.UserID = objloginuser.UserID; objViolationAndClamp.UserTypeID = objloginuser.UserTypeID.UserTypeID; objViolationAndClamp.LocationID = objloginuser.LocationParkingLotID.LocationID.LocationID; objViolationAndClamp.LocationParkingLotID = objloginuser.LocationParkingLotID.LocationParkingLotID; objViolationAndClamp.LocationName = objloginuser.LocationParkingLotID.LocationID.LocationName; objViolationAndClamp.RegistrationNumber = entryRegistrationNumber.Text; objViolationAndClamp.BayNumberID = objselectedbay.ParkingBayID; objViolationAndClamp.BayNumber = objselectedbay.ParkingBayName; objViolationAndClamp.IsClamp = checkBoxClampVehicle.IsChecked; objViolationAndClamp.ReasonID = objselectedreason.ViolationReasonID; objViolationAndClamp.ReasonName = objselectedreason.Reason; objViolationAndClamp.VehicleTypeCode = SelectedVehicle; DateTime openTime = DateTime.Parse(objloginuser.LocationParkingLotID.LotOpenTime); if (DateTime.Now < openTime) { objViolationAndClamp.ViolationStartTime = openTime; objViolationAndClamp.ViolationTime = openTime.ToString("MM/dd/yyyy HH:mm tt"); } else { objViolationAndClamp.ViolationStartTime = violationTime; objViolationAndClamp.ViolationTime = violationTime.ToString("MM/dd/yyyy HH:mm tt"); } objViolationAndClamp.IsWarning = Convert.ToBoolean(chkWarning.IsChecked); objViolationAndClamp.VehicleImageLottitude = Convert.ToDecimal(Latitude); objViolationAndClamp.VehicleImageLongitude = Convert.ToDecimal(Longitude); if (imgCameraByteData != null) { objViolationAndClamp.ViolationImage = ByteArrayCompressionUtility.Compress(imgCameraByteData); } resultmsg = dal_ViolationClamp.SaveViolationAndClamp(Convert.ToString(App.Current.Properties["apitoken"]), objViolationAndClamp); if (resultmsg == "Success") { masterPage = new MasterHomePage(); } } }); if (existingCheckIn == string.Empty) { if (resultmsg == "Success") { await Navigation.PushAsync(masterPage); } else { await DisplayAlert("Alert", "Violation Check In failed,Please contact Admin.", "Ok"); } } else { await DisplayAlert("Alert", "Vehicle Checked In as Violation at " + existingCheckIn, "Ok"); } } else { await DisplayAlert("Alert", "User details and API token unavailable. Login again", "Ok"); } } else { await DisplayAlert("Alert", "Please select Vehicle Image.", "Ok"); } } else { await DisplayAlert("Alert", "Please select Reason.", "Ok"); } } else { await DisplayAlert("Alert", "Please check Clamp or Warning ", "Ok"); } } else { await DisplayAlert("Alert", "Please select Bay Number.", "Ok"); } } else { await DisplayAlert("Alert", "Please enter valid Registration Number", "Ok"); } } else { await DisplayAlert("Alert", "Please enter valid Registration Number.", "Ok"); } } else { await DisplayAlert("Alert", "Please select Vehicle type", "Ok"); } BtnViolation.IsVisible = true; } else { await DisplayAlert("Alert", "Please check your Internet connection", "Ok"); ShowLoading(false); BtnViolation.IsVisible = true; } } catch (Exception ex) { } ShowLoading(false); BtnViolation.IsVisible = true; }
public async void UserLoginVerification() { User resultObj = null; string appversionmsg = string.Empty; ShowLoading(true); IsOnline = VerifyInternet(); try { await Task.Run(() => { appversionmsg = AppVersionServices.GetAndroidStoreAppVersion(); }); if (appversionmsg == string.Empty || appversionmsg == "") { if ((entryUserID.Text != null && entryUserID.Text.Length >= 4) && (entryPassword.Text != null && entryPassword.Text.Length >= 8)) { if (DeviceInternet.InternetConnected()) { await GetAPIToken(); await GetCurrentLocation(); if (App.Current.Properties.ContainsKey("apitoken")) { DALUserLogin objdalLogin = new DALUserLogin(); UserLogin objinputuser = new UserLogin(); objinputuser.UserName = entryUserID.Text.Trim(); objinputuser.Password = entryPassword.Text.Trim(); objinputuser.Latitude = Latitude; objinputuser.Longitude = Longitude; objinputuser.LoginDeviceID = GetDeviceUniqueID(); APIResponse objAPIResponse; objAPIResponse = objdalLogin.LoginVerification(Convert.ToString(App.Current.Properties["apitoken"]), objinputuser); if (objAPIResponse != null) { if (objAPIResponse.Result) { resultObj = JsonConvert.DeserializeObject <User>(Convert.ToString(objAPIResponse.Object)); App.Current.Properties["LoginUser"] = resultObj; resultObj.LoginDeviceID = LoginDeviceID; MasterHomePage masterPage = null; DateTime toDay = DateTime.Parse(resultObj.LocationParkingLotID.LotCloseTime); // Load VehicleTypes in SQLLite await App.SQLiteDb.SaveAllVehicleTypesInSQLLite(Convert.ToString(App.Current.Properties["apitoken"]), resultObj.LocationParkingLotID.LocationID.LocationID); await App.SQLiteDb.SaveVehiclesParkingFeesDetailOnLogin(Convert.ToString(App.Current.Properties["apitoken"]), resultObj.LocationParkingLotID.LocationParkingLotID); await DisplayAlert("Alert", "Your Location and Lot details are:" + resultObj.LocationParkingLotID.LocationID.LocationName + "-" + resultObj.LocationParkingLotID.LocationParkingLotName, "Ok"); if ((resultObj.UserTypeID.UserTypeName.ToUpper()) == ("Operator".ToUpper())) { if (DateTime.Now < toDay) { await Task.Run(() => { if (string.IsNullOrEmpty(cookieUserName) && string.IsNullOrEmpty(cookiePassword)) { SaveUserLogin(Convert.ToString(App.Current.Properties["apitoken"]), resultObj); } SecureStorage.SetAsync("apitoken", Convert.ToString(App.Current.Properties["apitoken"])); SecureStorage.SetAsync("UserName", entryUserID.Text.Trim()); SecureStorage.SetAsync("Password", entryPassword.Text.Trim()); masterPage = new MasterHomePage(); }); await Navigation.PushAsync(masterPage); } else { await DisplayAlert("Alert", "Please contact Admin,lot time (" + toDay + ") closed", "Cancel"); ShowLoading(false); } } else { await Task.Run(() => { if (string.IsNullOrEmpty(cookieUserName) && string.IsNullOrEmpty(cookiePassword)) { SaveUserLogin(Convert.ToString(App.Current.Properties["apitoken"]), resultObj); } SecureStorage.SetAsync("apitoken", Convert.ToString(App.Current.Properties["apitoken"])); SecureStorage.SetAsync("UserName", entryUserID.Text.Trim()); SecureStorage.SetAsync("Password", entryPassword.Text.Trim()); masterPage = new MasterHomePage(); }); await Navigation.PushAsync(masterPage); } } else { await DisplayAlert("Alert", objAPIResponse.Message, "Cancel"); ShowLoading(false); } } else { await DisplayAlert("Alert", "Invalid Credentials", "Cancel"); ShowLoading(false); } } else { await DisplayAlert("Alert", "Unable to connect API.Please contact Admin", "Ok"); ShowLoading(false); } } else { await DisplayAlert("Alert", "Please check your Internet connection", "Ok"); ShowLoading(false); } } else { await DisplayAlert("Alert", "Please enter Valid UserID and Password.", "Ok"); ShowLoading(false); } ShowLoading(false); } else { await DisplayAlert("Alert", appversionmsg, "Ok"); ShowLoading(false); Device.OpenUri(new Uri("https://play.google.com/store/apps/details?id=com.sprvtec.InstaOperator")); DependencyService.Get <ILaunchActivity>().LaunchActivityInAndroid("com.sprvtec.InstaOperator"); } } catch (Exception ex) { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "LoginPage.xaml.cs", "", "BtnSignIn_Clicked"); ShowLoading(false); await DisplayAlert("Alert", "Unable to connect API" + ex.Message, "Ok"); } }