private async void BtnPass_Clicked(object sender, EventArgs e) { try { ShowLoading(true); if (DeviceInternet.InternetConnected()) { BtnPass.IsVisible = false; PassPage passPage = null; if (!IsTodayHoliday) { bool doesPageExists = Navigation.NavigationStack.Any(p => p is PassPage); if (!doesPageExists) { await Task.Run(() => { StopNFCListening(); passPage = new PassPage(); }); await Navigation.PushAsync(passPage); } } else { await DisplayAlert("Alert", "Please check Lot closed today.", "Ok"); } BtnPass.IsVisible = true; } else { await DisplayAlert("Alert", "Please check your Internet connection", "Ok"); } ShowLoading(false); } catch (Exception ex) { BtnPass.IsVisible = true; ShowLoading(false); dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "MasterDetailHomePage.xaml.cs", "", "BtnPass_Clicked"); } }
private void lvLotOccupancyReport_Refreshing(object sender, EventArgs e) { try { if (DeviceInternet.InternetConnected()) { if (objReportUser != null) { GetLotOccupancy(objReportUser); lvLotOccupancyReport.IsRefreshing = false; } } else { } } catch (Exception ex) { } }
private async void ToolbarFilter_Clicked(object sender, EventArgs e) { try { if (DeviceInternet.InternetConnected()) { StopNFCListening(); var filtersPage = new FiltersPage(); await Navigation.PushAsync(filtersPage); } else { await DisplayAlert("Alert", "Please check your Internet connection", "Ok"); } } catch (Exception ex) { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "MasterDetailHomePage.xaml.cs", "", "ToolbarFilter_Clicked"); } }
private async void BtnGeneratePassReceipt_Clicked(object sender, EventArgs e) { try { CustomerVehiclePass resultPass = null; PassPaymentReceiptPage PassPaymentReceiptPage = null; if (DeviceInternet.InternetConnected()) { if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken")) { await Task.Run(() => { resultPass = dal_CustomerPass.CreateCustomerPass(Convert.ToString(App.Current.Properties["apitoken"]), objCustomerweeklyPass); if (resultPass != null && resultPass.CustomerVehiclePassID != 0) { PassPaymentReceiptPage = new PassPaymentReceiptPage(resultPass); } }); if (resultPass != null && resultPass.CustomerVehiclePassID != 0) { await DisplayAlert("Alert", "Vehicle Pass created successfully", "Ok"); await Navigation.PushAsync(PassPaymentReceiptPage); } else { await DisplayAlert("Alert", "Payment Failed,Please contact Admin", "Ok"); } } } else { await DisplayAlert("Alert", "Please check your Internet connection", "Ok"); } } catch (Exception ex) { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "WeeklyPassPaymentConfirmationPage.xaml.cs", "", "BtnGeneratePassReceipt_Clicked"); } }
public void SendSMS(string PhoneNumber) { try { string ParkingAmount = string.Empty; StringBuilder sbSMS = new StringBuilder(); if (DeviceInternet.InternetConnected()) { string vehicleType = objResultCustomerParkingSlot.VehicleTypeID.VehicleTypeCode; sbSMS.AppendLine(" HMRL PARKING "); sbSMS.AppendLine(objResultCustomerParkingSlot.LocationParkingLotID.LocationID.LocationName + " - " + objResultCustomerParkingSlot.LocationParkingLotID.LocationParkingLotName); sbSMS.AppendLine(vehicleType + ": " + objResultCustomerParkingSlot.CustomerVehicleID.RegistrationNumber); sbSMS.AppendLine((objResultCustomerParkingSlot.ActualStartTime == null ? "" : Convert.ToDateTime(objResultCustomerParkingSlot.ActualStartTime).ToString("dd MMM yyyy,hh:mm tt")) + " To " + (objResultCustomerParkingSlot.ActualEndTime == null ? "" : Convert.ToDateTime(objResultCustomerParkingSlot.ActualEndTime).ToString("dd MMM yyyy,hh:mm tt"))); ParkingAmount = (objResultCustomerParkingSlot.Amount).ToString("N2"); if (objResultCustomerParkingSlot.PaidDueAmount > 0) { ParkingAmount = ParkingAmount + " (Due Amount: " + (objResultCustomerParkingSlot.PaidDueAmount).ToString("N2") + ")"; } decimal GSTPercentage = 18; decimal GSTAmount = ((objResultCustomerParkingSlot.Amount) * GSTPercentage) / 100; decimal AmountAfterGST = (objResultCustomerParkingSlot.Amount) - GSTAmount; string GSTString = "Rs" + AmountAfterGST.ToString("N2") + "," + " GST " + GSTPercentage + "%" + " Rs" + GSTAmount.ToString("N2"); sbSMS.AppendLine("Paid: Rs" + ParkingAmount + " " + "(" + GSTString + ")"); sbSMS.AppendLine("Bay " + objResultCustomerParkingSlot.LocationParkingLotID.ParkingBayID.ParkingBayRange); sbSMS.AppendLine("ID: " + objResultCustomerParkingSlot.UserCode); sbSMS.AppendLine("Ph: " + objResultCustomerParkingSlot.SuperVisorID.PhoneNumber); sbSMS.AppendLine("Security " + objResultCustomerParkingSlot.LocationParkingLotID.LotOpenTime + "-" + objResultCustomerParkingSlot.LocationParkingLotID.LotCloseTime); sbSMS.AppendLine("GST " + objResultCustomerParkingSlot.GSTNumber + ""); sbSMS.AppendLine("SPRV Technologies (INSPRK)"); string resultmsg = sbSMS.ToString(); dal_DALCheckIn.SendReceiptToMobile(resultmsg, PhoneNumber, "1407161777346458051");//msg ,phonenumber,templateid } } catch (Exception ex) { ShowLoading(false); btnYes.IsVisible = true; dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "ConfirmationPage.xaml.cs", "", "SendSMS"); } }
private void lvCheckInChkOutReport_Refreshing(object sender, EventArgs e) { try { if (DeviceInternet.InternetConnected()) { if (objFilter != null) { objFilter.VehicleTypeCode = ""; btnFourWheeler.Style = (Style)App.Current.Resources["ButtonRegularMercuryStyle"]; btnTwoWheeler.Style = (Style)App.Current.Resources["ButtonRegularMercuryStyle"]; GetRecentCheckOuts(); } lvCheckInChkOutReport.IsRefreshing = false; } else { lvCheckInChkOutReport.IsRefreshing = false; } } catch (Exception ex) { } }
private async void SlRecentCheckOuts_Tapped(object sender, EventArgs e) { try { if (DeviceInternet.InternetConnected()) { RecentCheckOuts pageRecentCheckOuts = null; StklauoutactivityIndicator.IsVisible = true; await Task.Run(() => { pageRecentCheckOuts = new RecentCheckOuts(); }); await Navigation.PushAsync(pageRecentCheckOuts); StklauoutactivityIndicator.IsVisible = false; } else { await DisplayAlert("Alert", "Please check your Internet connection", "Ok"); } } catch (Exception ex) { } }
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"); } }
public async void GenerateAppReport() { try { objlot = null; if (DeviceInternet.InternetConnected()) { objReportUser = new User(); VMLocationLots objselectedlot = (VMLocationLots)pickerLocationLot.SelectedItem; if (objselectedlot != null) { objReportUser.LocationParkingLotID.LocationID.LocationID = objselectedlot.LocationID; objReportUser.LocationParkingLotID.LocationParkingLotID = objselectedlot.LocationParkingLotID; objReportUser.LocationParkingLotID.LocationParkingLotName = objselectedlot.LocationParkingLotName; objReportUser.LocationParkingLotID.LocationID.LocationName = objselectedlot.LocationName; if (pickerOperator.SelectedItem != null) { var objselectedOperator = (User)pickerOperator.SelectedItem; if (objselectedOperator.UserCode.Contains("ALL")) { var userobj = (User)App.Current.Properties["LoginUser"]; objReportUser.UserID = 0; objReportUser.UserCode = userobj.UserCode; } else { objReportUser.UserID = objselectedOperator.UserID; objReportUser.UserCode = objselectedOperator.UserCode; } } else { var userobj = (User)App.Current.Properties["LoginUser"]; objReportUser.UserID = userobj.UserID; objReportUser.UserCode = userobj.UserCode; } if (objselectedlot.LocationID == 0 && objselectedlot.LocationParkingLotID == 0 && objselectedlot.LotName == "ALL") { var userobj = (User)App.Current.Properties["LoginUser"]; objReportUser.UserID = userobj.UserID; objReportUser.UserCode = "ALL"; } } ShowLoading(true); await Task.Run(() => { if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken")) { DateTime fromDate = new DateTime(datePickerFromDate.Date.Year, datePickerFromDate.Date.Month, datePickerFromDate.Date.Day, datePickerFromTime.Time.Hours, datePickerFromTime.Time.Minutes, 0); objReportUser.LoginTime = fromDate; objReportUser.LogoutTime = new DateTime(datePickerToDate.Date.Year, datePickerToDate.Date.Month, datePickerToDate.Date.Day, datePickerToTime.Time.Hours, datePickerToTime.Time.Minutes, 0);; objlot = new LocationLotParkingReport(Convert.ToString(App.Current.Properties["apitoken"]), objReportUser); } }); if (objlot != null) { lvSummaryReports.BindingContext = objlot; lstvwStationPassesReport.BindingContext = objlot.GetLocationLotPassesReport(); lstvwStationViolationReport.BindingContext = objlot.GetLocationLotViolationReport(); StationVehicles objStationVehicles = objlot.GetLocationLotTotalRevenue(); TotalStationVehicleCash.Text = objStationVehicles.StationVehicleCash.ToString("N2"); TotalStationVehicleEpay.Text = objStationVehicles.StationVehicleEPay.ToString("N2"); } 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, "ReportPage.xaml.cs", "", "ButtonGenerateReport_Clicked"); } }
private async void BtnYes_Clicked(object sender, EventArgs e) { try { if (IsbtnClicked) { return; } IsbtnClicked = true; btnYes.IsVisible = false; CheckIn checkInPage = null; try { ShowLoading(true); if (DeviceInternet.InternetConnected()) { if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken") && objNewCheckIn != null) { await Task.Run(() => { objResultCustomerParkingSlot = dal_DALCheckIn.SaveVehicleNewCheckIn(Convert.ToString(App.Current.Properties["apitoken"]), objNewCheckIn); dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", "Save New CheckIn : " + objNewCheckIn.RegistrationNumber + "-At" + DateTime.Now, "ConfirmationPage.xaml.cs", "", "BtnYes_Clicked"); checkInPage = new CheckIn(); }); if (objResultCustomerParkingSlot.CustomerParkingSlotID != 0) { if (string.IsNullOrEmpty(objNewCheckIn.PhoneNumber)) { if (printerName != string.Empty && printerName != "") { PrintReceipt(); await Navigation.PushAsync(checkInPage); } else { await DisplayAlert("Alert", "Unable to find Bluetooth device", "Ok"); await Navigation.PushAsync(checkInPage); ShowLoading(false); btnYes.IsVisible = true; } } else { SendSMS(objNewCheckIn.PhoneNumber); await Navigation.PushAsync(checkInPage); } } else { await DisplayAlert("Alert", "Check-In Failed,Please contact Admin.", "Ok"); await Navigation.PushAsync(checkInPage); ShowLoading(false); btnYes.IsVisible = true; } } } else { await Task.Run(() => { App.SQLiteDb.SaveOfflineCheckInAsync(objNewCheckIn).Wait(); checkInPage = new CheckIn(); }); if (printerName != string.Empty && printerName != "") { PrintReceipt(); await Navigation.PushAsync(checkInPage); } else { await DisplayAlert("Alert", "Unable to find Bluetooth device", "Ok"); await Navigation.PushAsync(checkInPage); ShowLoading(false); btnYes.IsVisible = true; } ShowLoading(false); btnYes.IsVisible = true; } } catch (Exception ex) { ShowLoading(false); btnYes.IsVisible = true; dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "ConfirmationPage.xaml.cs", "", "BtnPrint_Clicked"); } IsbtnClicked = false; } catch (Exception ex) { ShowLoading(false); btnYes.IsVisible = true; dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "ConfirmationPage.xaml.cs", "", "BtnPrint_Clicked"); } }
public async void PrintReceipt() { try { string[] receiptlines = new string[17]; // Receipt Lines string ParkingAmount = string.Empty; await Task.Run(() => { if (receiptlines != null && receiptlines.Length > 0) { if (DeviceInternet.InternetConnected()) { string vehicleType = objResultCustomerParkingSlot.VehicleTypeID.VehicleTypeDisplayName; receiptlines[0] = "\x1B\x21\x08" + " " + "HMRL PARKING" + "\x1B\x21\x00" + "\n"; receiptlines[1] = "\x1B\x21\x01" + " " + objResultCustomerParkingSlot.LocationParkingLotID.LocationID.LocationName + "-" + objResultCustomerParkingSlot.LocationParkingLotID.LocationParkingLotName + "\x1B\x21\x00\n"; receiptlines[2] = "" + "\n"; receiptlines[3] = "\x1B\x21\x08" + vehicleType + ":" + objResultCustomerParkingSlot.CustomerVehicleID.RegistrationNumber + "\x1B\x21\x00\n"; receiptlines[4] = "\x1B\x21\x01" + (objResultCustomerParkingSlot.ActualStartTime == null ? "" : "In:" + Convert.ToDateTime(objResultCustomerParkingSlot.ActualStartTime).ToString("dd MMM yyyy,hh:mm tt")) + "\x1B\x21\x00" + "\n"; ParkingAmount = (objResultCustomerParkingSlot.Amount).ToString("N2"); if (objResultCustomerParkingSlot.PaidDueAmount > 0) { ParkingAmount = ParkingAmount + "(Due Amount:" + (objResultCustomerParkingSlot.PaidDueAmount).ToString("N2") + ")"; } receiptlines[5] = "\x1B\x21\x01" + "Paid: Rs" + ParkingAmount + "(Up to " + objResultCustomerParkingSlot.Duration + " hours)" + "\x1B\x21\x00\n"; receiptlines[6] = "\x1B\x21\x01" + "Valid Till:" + (objResultCustomerParkingSlot.ActualEndTime == null ? "" : Convert.ToDateTime(objResultCustomerParkingSlot.ActualEndTime).ToString("dd MMM yyyy,hh:mm tt")) + "\x1B\x21\x00\n"; receiptlines[7] = "\x1B\x21\x01" + "Parked at: (Bays)" + objResultCustomerParkingSlot.LocationParkingLotID.ParkingBayID.ParkingBayRange + "\x1B\x21\x00\n"; receiptlines[8] = "\x1B\x21\x06" + "OperatorId/SupervisorId :" + objResultCustomerParkingSlot.UserCode + "\x1B\x21\x00\n"; receiptlines[9] = "\x1B\x21\x01" + "(Supervisor Mobile:" + objResultCustomerParkingSlot.SuperVisorID.PhoneNumber + ")" + "\x1B\x21\x00\n"; receiptlines[10] = "\x1B\x21\x06" + "Security available " + objResultCustomerParkingSlot.LocationParkingLotID.LotOpenTime + "-" + objResultCustomerParkingSlot.LocationParkingLotID.LotCloseTime + "\x1B\x21\x00\n"; receiptlines[11] = "\x1B\x21\x01" + "We are not responsible for your valuable items like laptop, wallet,helmet etc." + "\x1B\x21\x00\n"; receiptlines[12] = "\x1B\x21\x06" + "GST Number " + objResultCustomerParkingSlot.GSTNumber + "" + "\x1B\x21\x00\n"; receiptlines[13] = "\x1B\x21\x06" + "Amount includes 18% GST" + "\x1B\x21\x00\n"; receiptlines[14] = "" + "\n"; receiptlines[15] = "" + "\n"; receiptlines[16] = "" + "\n"; } else { var localUser = (User)App.Current.Properties["LoginUser"]; string vehicleType = objNewCheckIn.VehicleTypeDisplayName; receiptlines[0] = "\x1B\x21\x08" + " " + "HMRL PARKING" + "\x1B\x21\x00" + "\n"; receiptlines[1] = "\x1B\x21\x01" + " " + objNewCheckIn.LocationName + "-" + objNewCheckIn.LocationParkingLotName + "\x1B\x21\x00\n"; receiptlines[2] = "" + "\n"; receiptlines[3] = "\x1B\x21\x08" + vehicleType + ":" + objNewCheckIn.RegistrationNumber + "\x1B\x21\x00\n"; receiptlines[4] = "\x1B\x21\x01" + (objNewCheckIn.ParkingStartTime == null ? "" : "In:" + Convert.ToDateTime(objNewCheckIn.ParkingStartTime).ToString("dd MMM yyyy,hh:mm tt")) + "\x1B\x21\x00" + "\n"; receiptlines[5] = "\x1B\x21\x01" + "Paid: Rs" + objNewCheckIn.ParkingFees.ToString("N2") + "(Up to " + objNewCheckIn.ParkingHours + " hours)" + "\x1B\x21\x00\n"; receiptlines[6] = "\x1B\x21\x01" + "Valid Till:" + (objNewCheckIn.ParkingEndTime == null ? "" : Convert.ToDateTime(objNewCheckIn.ParkingEndTime).ToString("dd MMM yyyy,hh:mm tt")) + "\x1B\x21\x00\n"; receiptlines[7] = "\x1B\x21\x01" + "Parked at: (Bays)" + objNewCheckIn.BayRange + "\x1B\x21\x00\n"; receiptlines[8] = "\x1B\x21\x06" + "OperatorId :" + localUser.UserCode + "\x1B\x21\x00\n"; receiptlines[9] = "\x1B\x21\x01" + "(Supervisor Mobile:" + localUser.PhoneNumber + ")" + "\x1B\x21\x00\n"; receiptlines[10] = "\x1B\x21\x06" + "Security available" + localUser.LocationParkingLotID.LotOpenTime + "-" + localUser.LocationParkingLotID.LotCloseTime + "\x1B\x21\x00\n"; receiptlines[11] = "\x1B\x21\x01" + "We are not responsible for your valuable items like laptop, wallet,helmet etc." + "\x1B\x21\x00\n"; receiptlines[12] = "\x1B\x21\x06" + "GST Number 36AACFZ1015E1ZL" + "\x1B\x21\x00\n"; receiptlines[13] = "\x1B\x21\x06" + "Amount includes 18% GST" + "\x1B\x21\x00\n"; receiptlines[14] = "" + "\n"; receiptlines[15] = "" + "\n"; receiptlines[16] = "" + "\n"; } } for (var l = 0; l < receiptlines.Length; l++) { string printtext = receiptlines[l]; if (printtext != "") { ObjblueToothDevicePrinting.PrintCommand(printerName, printtext); } } }); } catch (Exception ex) { ShowLoading(false); btnYes.IsVisible = true; dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "ConfirmationPage.xaml.cs", "", "BtnPrint_Clicked"); } }
private async void BtnCheckOut_Clicked(object sender, EventArgs e) { string resultmsg = string.Empty; MasterDetailHomePage masterPage = null; btnCheckOut.IsVisible = false; try { if (DeviceInternet.InternetConnected()) { ShowLoading(true); if (pickerChckOutReason.SelectedItem != null) { DALVehicleCheckOut dal_CheckOut = new DALVehicleCheckOut(); if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken")) { ViolationReason objselectedreason = (ViolationReason)pickerChckOutReason.SelectedItem; objFOCVehicle.StatusID.StatusName = "FOC"; objFOCVehicle.FOCReasonID.ViolationReasonID = objselectedreason.ViolationReasonID; User objFOCBy = (User)App.Current.Properties["LoginUser"]; objFOCVehicle.CreatedBy = objFOCBy.UserID; await Task.Run(() => { resultmsg = dal_CheckOut.FOCVehicleCheckOut(Convert.ToString(App.Current.Properties["apitoken"]), objFOCVehicle); if (resultmsg != null && resultmsg == "Success") { masterPage = new MasterDetailHomePage(); } }); if (resultmsg != null && resultmsg == "Success") { await Navigation.PushAsync(masterPage); } else { await DisplayAlert("Alert", "FOC Failed,Please contact Admin.", "Ok"); } } else { await DisplayAlert("Alert", "Lost API Token,Please login agin", "Ok"); } } else { await DisplayAlert("Alert", "Please select Reason", "Ok"); } } else { await DisplayAlert("Alert", "Please check your Internet connection", "Ok"); } } catch (Exception ex) { ShowLoading(false); btnCheckOut.IsVisible = true; } ShowLoading(false); btnCheckOut.IsVisible = true; }
public async Task <string> CheckInOfflineSync(string apitoken, User loguser) { int totalCounts = 0; StringBuilder sbUnMoved = new StringBuilder(); DALExceptionManagment dal_Exceptionlog = new DALExceptionManagment(); try { var lstchekIns = await App.SQLiteDb.GetAllVehicleAsync(); if (lstchekIns != null) { if (lstchekIns.Count > 0) { foreach (var items in lstchekIns) { if (DeviceInternet.InternetConnected()) { var objexlog = new OfflineSyncLog(); try { var resultCustomerID = SaveVehicleNewCheckIn(apitoken, items); if (resultCustomerID != null) { try { objexlog.CustomerParkingSlotID = resultCustomerID.CustomerParkingSlotID; objexlog.RegistrationNumber = items.RegistrationNumber; objexlog.LocationParkingLotName = loguser.LocationParkingLotID.LocationParkingLotName; objexlog.LocationParkingLotID = loguser.LocationParkingLotID.LocationParkingLotID; objexlog.CreatedBy = resultCustomerID.CreatedBy; if (resultCustomerID.CustomerParkingSlotID != 0) { objexlog.ExceptionMessage = "Success"; objexlog.IsSync = true; if (!string.IsNullOrEmpty(items.ParkingStartTime) && !string.IsNullOrEmpty(items.ParkingEndTime)) { objexlog.ExpectedStartTime = Convert.ToDateTime(items.ParkingStartTime); objexlog.ExpectedEndTime = Convert.ToDateTime(items.ParkingEndTime); } } else { if (sbUnMoved.Length == 0) { sbUnMoved.AppendLine(items.RegistrationNumber); } else { sbUnMoved.AppendLine(", " + items.RegistrationNumber); } objexlog.ExceptionMessage = "Failed"; objexlog.IsSync = false; DeSyncVehicleCheckIn objdesync = new DeSyncVehicleCheckIn(); objdesync.VehicleTypeCode = items.VehicleTypeCode; objdesync.BayRange = items.BayRange; objdesync.RegistrationNumber = items.RegistrationNumber; objdesync.LocationParkingLotName = items.LocationParkingLotName; await App.SQLiteDb.SaveDeSyncCheckInAsync(objdesync); } } catch (Exception ex) { objexlog.ExceptionMessage = "Failed"; objexlog.IsSync = false; dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message + ",At:" + "Item after Online Sync" + resultCustomerID.CustomerParkingSlotID, "DALCheckIn.cs", items.RegistrationNumber + "," + items.ParkingStartTime + "," + items.ParkingEndTime + "," + "", "CheckInOfflineSync"); } finally { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", "Finally at:" + "Item after Online Sync" + resultCustomerID.CustomerParkingSlotID, "DALCheckIn.cs", items.RegistrationNumber + "," + items.ParkingStartTime + "," + items.ParkingEndTime + "," + "", "CheckInOfflineSync"); dal_Exceptionlog.InsertOfflineSynchException(Convert.ToString(App.Current.Properties["apitoken"]), objexlog); await App.SQLiteDb.DeleteItemAsync(items); } } else { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", "No Records found ", "DALCheckIn.cs", "", "CheckInOfflineSync"); } } catch (Exception ex) { if (sbUnMoved.Length == 0) { sbUnMoved.AppendLine(items.RegistrationNumber); } else { sbUnMoved.AppendLine(", " + items.RegistrationNumber); } await App.SQLiteDb.DeleteItemAsync(items); dal_Exceptionlog.InsertOfflineSynchException(Convert.ToString(App.Current.Properties["apitoken"]), objexlog); dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "DALCheckIn.cs", items.RegistrationNumber + "," + items.ParkingStartTime + "," + items.ParkingEndTime, "CheckInOfflineSync"); } } else { if (sbUnMoved.Length == 0) { sbUnMoved.AppendLine(items.RegistrationNumber); } else { sbUnMoved.AppendLine(", " + items.RegistrationNumber); } } } } else { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", "No Records in VehicleCheckIn", "DALCheckIn.cs", "", "CheckInOfflineSync"); } } else { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", "No Records in VehicleCheckIn", "DALCheckIn.cs", "", "CheckInOfflineSync"); } } catch (Exception ex) { StackTrace st = new StackTrace(ex, true); //Get the first stack frame StackFrame frame = st.GetFrame(0); //Get the file name string fileName = frame.GetFileName(); //Get the method name string methodName = frame.GetMethod().Name; //Get the line number from the stack frame int line = frame.GetFileLineNumber(); string exDetails = fileName + "," + methodName + "," + line; dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "DALCheckIn.cs", exDetails, "CheckInOfflineSync"); } return(sbUnMoved.ToString()); }
public void LoadCustomerPassPaymentDetails(CustomerVehiclePass objReceipt) { try { string vehicleType = string.Empty; string stations = string.Empty; labelParkingReceiptTitle.Text = "InstaParking-" + objReceipt.PassPriceID.PassTypeID.PassTypeName; labelParkingLot.Text = objReceipt.LocationID.LocationName + "-" + objReceipt.PassPriceID.StationAccess; labelValidFrom.Text = Convert.ToDateTime(objReceipt.StartDate).ToString("dd MMM yyyy"); labelValidTo.Text = Convert.ToDateTime(objReceipt.ExpiryDate).ToString("dd MMM yyyy"); if (objReceipt.PassPriceID.PassTypeID.PassTypeCode == "MP") { if (objReceipt.PassPriceID.StationAccess == "Single Station") { labelParkingLot.Text = objReceipt.LocationID.LocationName + "-" + objReceipt.PassPriceID.StationAccess; stations = objReceipt.LocationID.LocationName; } else if (objReceipt.PassPriceID.StationAccess == "Multi Station" || objReceipt.PassPriceID.StationAccess == "Multi Stations") { if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken")) { List <VMMultiLocations> lstpasslocations = dal_home.GetAllPassLocationsByVehicleType(Convert.ToString(App.Current.Properties["apitoken"]), objReceipt.CustomerVehicleID.VehicleTypeID.VehicleTypeCode, objReceipt.CustomerVehiclePassID); if (lstpasslocations.Count > 0) { for (var s = 0; s < lstpasslocations.Count; s++) { stations = stations + lstpasslocations[s].LocationName + ","; } labelParkingLot.Text = "Multi Stations:" + stations + "."; } } } else if (objReceipt.PassPriceID.StationAccess == "All Station" || objReceipt.PassPriceID.StationAccess == "All Stations") { labelParkingLot.Text = "All Metro Stations"; stations = "All Metro Stations"; } labelValidFrom.Text = Convert.ToDateTime(objReceipt.StartDate).ToString("dd MMM yyyy"); labelValidTo.Text = Convert.ToDateTime(objReceipt.ExpiryDate).ToString("dd MMM yyyy"); } imageVehicleImage.Source = objReceipt.CustomerVehicleID.VehicleTypeID.VehicleIcon; labelCustomerName.Text = objReceipt.CustomerVehicleID.CustomerID.Name; labelVehicleDetails.Text = objReceipt.CustomerVehicleID.RegistrationNumber; labelParkingFeesDetails.Text = objReceipt.CardAmount.ToString("N2") + "/-"; labelParkingPaymentType.Text = "Paid - By " + objReceipt.NFCCardPaymentID.PaymentTypeCode; if (objReceipt.CreatedBy.UserName != "") { labelOperatorName.Text = objReceipt.CreatedBy.UserName; labelOperatorID.Text = "- #" + Convert.ToString(objReceipt.CreatedBy.UserCode); labelOrderID.Text = "#" + objReceipt.CustomerVehiclePassID; imageOperatorProfile.IsVisible = true; } else { imageOperatorProfile.IsVisible = false; } labelGSTNumber.Text = objReceipt.GSTNumber; try { if (receiptlines != null && receiptlines.Length > 0) { receiptlines[0] = "\x1B\x21\x08" + " " + "HMRL PARKING" + "\x1B\x21\x00" + "\n"; receiptlines[1] = "\x1B\x21\x01" + " " + objReceipt.CreatedBy.LocationParkingLotID.LocationID.LocationName + "\x1B\x21\x00\n"; receiptlines[3] = "" + "\n"; receiptlines[4] = "\x1B\x21\x08" + vehicleType + " " + objReceipt.CustomerVehicleID.RegistrationNumber + "\x1B\x21\x00\n"; receiptlines[5] = "\x1B\x21\x01" + "Valid From:" + Convert.ToDateTime(objReceipt.StartDate).ToString("dd MMM yyyy") + "\x1B\x21\x00" + "\n"; receiptlines[6] = "\x1B\x21\x01" + "Valid Till:" + Convert.ToDateTime(objReceipt.ExpiryDate).ToString("dd MMM yyyy") + "\x1B\x21\x00" + "\n"; receiptlines[7] = "\x1B\x21\x01" + "(Pass Type :" + objReceipt.PassPriceID.PassTypeID.PassTypeName + ")" + "\x1B\x21\x00\n"; receiptlines[8] = "\x1B\x21\x01" + "Station(s):" + stations + "\x1B\x21\x01" + "\n"; receiptlines[9] = "\x1B\x21\x01" + "Paid: Rs" + objReceipt.PassPriceID.CardPrice.ToString("N2") + "\x1B\x21\x01" + "\n"; receiptlines[10] = "\x1B\x21\x06" + "Operator Id:" + objReceipt.CreatedBy.UserCode + "\x1B\x21\x00\n"; receiptlines[11] = "\x1B\x21\x01" + "(Supervisor Mobile:" + objReceipt.SuperVisorID.PhoneNumber + ")" + "\x1B\x21\x00\n"; receiptlines[12] = "\x1B\x21\x01" + "We are not responsible for your valuable items like laptop, wallet,helmet etc." + "\x1B\x21\x00\n"; receiptlines[13] = "\x1B\x21\x06" + "GST Number 36AACFZ1015E1ZL" + "\x1B\x21\x00\n"; receiptlines[14] = "\x1B\x21\x06" + "Amount includes 18% GST" + "\x1B\x21\x00\n"; receiptlines[15] = "" + "\n"; receiptlines[16] = "" + "\n"; } } catch (Exception ex) { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "NFCCardPaymentReceiptPagae.xaml.cs", "", "receiptlines"); } try { //SMS Sending string ParkingAmount = string.Empty; StringBuilder sbSMS = new StringBuilder(); if (DeviceInternet.InternetConnected()) { sbSMS.AppendLine(" HMRL PARKING "); sbSMS.AppendLine(objReceipt.LocationID.LocationName + "-" + objReceipt.PassPriceID.StationAccess); sbSMS.AppendLine(vehicleType + ": " + objReceipt.CustomerVehicleID.RegistrationNumber); sbSMS.AppendLine("Valid From: " + Convert.ToDateTime(objReceipt.StartDate).ToString("dd MMM yyyy")); sbSMS.AppendLine("Valid Till: " + Convert.ToDateTime(objReceipt.ExpiryDate).ToString("dd MMM yyyy")); sbSMS.AppendLine("Pass Type: " + objReceipt.PassPriceID.PassTypeID.PassTypeName); sbSMS.AppendLine("Station(s): " + stations); ParkingAmount = objReceipt.PassPriceID.CardPrice.ToString("N2"); decimal GSTPercentage = 18; decimal GSTAmount = (Convert.ToDecimal(objReceipt.PassPriceID.CardPrice) * GSTPercentage) / 100; decimal AmountAfterGST = (Convert.ToDecimal(objReceipt.PassPriceID.CardPrice)) - GSTAmount; string GSTString = "Rs" + AmountAfterGST.ToString("N2") + "," + " GST " + GSTPercentage + "%" + " Rs" + GSTAmount.ToString("N2"); sbSMS.AppendLine("Paid: Rs" + ParkingAmount + " " + "(" + GSTString + ")"); sbSMS.AppendLine("ID: " + objReceipt.CreatedBy.UserCode); sbSMS.AppendLine("Ph: " + objReceipt.SuperVisorID.PhoneNumber + ")"); if (App.Current.Properties.ContainsKey("LoginUser")) { User objLoginUser = (User)App.Current.Properties["LoginUser"]; sbSMS.AppendLine("Security " + objLoginUser.LocationParkingLotID.LotOpenTime + "-" + objLoginUser.LocationParkingLotID.LotCloseTime); } sbSMS.AppendLine("GST " + objReceipt.GSTNumber + ""); sbSMS.AppendLine("SPRV Technologies (INSPRK)"); string resultsmsmsg = sbSMS.ToString(); SendSMS(objReceipt.CustomerVehicleID.CustomerID.PhoneNumber, resultsmsmsg); } } catch (Exception ex) { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "NFCCardPaymentReceiptPagae.xaml.cs", "", " SMS Sending Text"); } } catch (Exception ex) { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "NFCCardPaymentReceiptPagae.xaml.cs", "", "LoadCustomerPassPaymentDetails"); } }
private async void LstVWParkingVehicle_ItemSelected(object sender, SelectedItemChangedEventArgs e) { try { if (DeviceInternet.InternetConnected()) { ShowLoading(true); ViolationVehicleInformation violationPageInfo = null; OverstayVehicleInformation overstayPageInfo = null; PassCheckInVehicleInformation chekInPageInfo = null; if (e.SelectedItem == null) { return; } LocationLotParkedVehicles objSelecteditem = (LocationLotParkedVehicles)e.SelectedItem; if (objSelecteditem.StatusCode == "V" || objSelecteditem.StatusCode == "C") { StopNFCListening(); if (objSelecteditem.CustomerParkingSlotID != 0) { await Task.Run(() => { violationPageInfo = new ViolationVehicleInformation(objSelecteditem.CustomerParkingSlotID); }); await Navigation.PushAsync(violationPageInfo); } else { await DisplayAlert("Alert", "Vehicle details unvailable,Please contact Admin", "Ok"); } } else if (objSelecteditem.StatusCode == "O") { StopNFCListening(); if (objSelecteditem.CustomerParkingSlotID != 0) { await Task.Run(() => { overstayPageInfo = new OverstayVehicleInformation(objSelecteditem.CustomerParkingSlotID); }); await Navigation.PushAsync(overstayPageInfo); } else { await DisplayAlert("Alert", "Vehicle details unvailable,Please contact Admin", "Ok"); } } else if (objSelecteditem.StatusCode == "P" || objSelecteditem.StatusCode == "A" || objSelecteditem.StatusCode == "CHKIN" || objSelecteditem.StatusCode == "G") { StopNFCListening(); if (objSelecteditem.CustomerParkingSlotID != 0) { await Task.Run(() => { chekInPageInfo = new PassCheckInVehicleInformation(objSelecteditem.CustomerParkingSlotID); }); await Navigation.PushAsync(chekInPageInfo); } else { await DisplayAlert("Alert", "Vehicle details unvailable,Please contact Admin", "Ok"); } } try { if (((ListView)LstVWParkingVehicle).SelectedItem != null) { ((ListView)LstVWParkingVehicle).SelectedItem = null; } } catch (Exception ex) { } ShowLoading(false); } else { await DisplayAlert("Alert", "Please check your Internet connection", "Ok"); } } catch (Exception ex) { ShowLoading(false); dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "MasterDetailHomePage.xaml.cs", "", "LstVWParkingVehicle"); } ShowLoading(false); }
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; }
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 BtnGeneratePass_Clicked(object sender, EventArgs e) { try { ShowLoading(true); btnGeneratePass.IsVisible = false; string existingnfcCardVehcile = string.Empty; if (DeviceInternet.InternetConnected()) { CustomerVehiclePass resultPass = null; if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken")) { existingnfcCardVehcile = dal_CustomerPass.IsValidNFCCard(Convert.ToString(App.Current.Properties["apitoken"]), labelNFCCard.Text, objInputMonthlyPass.CustomerVehicleID.RegistrationNumber); if (existingnfcCardVehcile == string.Empty) { if (App.Current.Properties.ContainsKey("MultiSelectionLocations")) { List <Model.APIOutPutModel.Location> lstMultiLication = (List <Model.APIOutPutModel.Location>)App.Current.Properties["MultiSelectionLocations"]; await Task.Run(() => { objInputMonthlyPass.CardNumber = labelNFCCard.Text; if (!string.IsNullOrEmpty(labelNFCCard.Text)) { objInputMonthlyPass.CardNumber = labelNFCCard.Text; } else if (!string.IsNullOrEmpty(labelBARCode.Text)) { objInputMonthlyPass.CardNumber = labelBARCode.Text; } objInputMonthlyPass.IsMultiLot = true; VMMultiStationCustomerVehiclePass objvmMultiStations = new VMMultiStationCustomerVehiclePass(); objvmMultiStations.CustomerVehiclePassID = objInputMonthlyPass; objvmMultiStations.LocationID = lstMultiLication; resultPass = dal_CustomerPass.CreateMultiStationCustomerPass(Convert.ToString(App.Current.Properties["apitoken"]), objvmMultiStations); }); if (resultPass != null && resultPass.CustomerVehiclePassID != 0) { StopNFCListening(); await DisplayAlert("Alert", "Vehicle Pass created successfully", "Ok"); var passPaymentReceiptPage = new PassPaymentReceiptPage(resultPass); await Navigation.PushAsync(passPaymentReceiptPage); } else { await DisplayAlert("Alert", "Payment Failed,Please contact Admin", "Ok"); } } else { await Task.Run(() => { objInputMonthlyPass.BarCode = labelBARCode.Text; if (!string.IsNullOrEmpty(labelNFCCard.Text)) { objInputMonthlyPass.CardNumber = labelNFCCard.Text; } else if (!string.IsNullOrEmpty(labelBARCode.Text)) { objInputMonthlyPass.CardNumber = labelBARCode.Text; } resultPass = dal_CustomerPass.CreateCustomerPass(Convert.ToString(App.Current.Properties["apitoken"]), objInputMonthlyPass); }); if (resultPass != null && resultPass.CustomerVehiclePassID != 0) { await DisplayAlert("Alert", "Vehicle Pass created successfully", "Ok"); var passPaymentReceiptPage = new PassPaymentReceiptPage(resultPass); await Navigation.PushAsync(passPaymentReceiptPage); } else { await DisplayAlert("Alert", "Payment Failed,Please contact Admin", "Ok"); } } } else { ShowLoading(false); await DisplayAlert("Alert", "NFC Card already assigned to " + existingnfcCardVehcile + "", "Ok"); } ShowLoading(false); btnGeneratePass.IsVisible = true; } } else { await DisplayAlert("Alert", "Please check your Internet connection", "Ok"); ShowLoading(false); btnGeneratePass.IsVisible = true; } } catch (Exception ex) { btnGeneratePass.IsVisible = true; dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "MonthlyPassCashPaymentPage.xaml.cs", "", "BtnGeneratePassReceipt_Clicked"); } }