Esempio n. 1
0
        private async void SlHistory_Tapped(object sender, EventArgs e)
        {
            HistoryPage historyPage = null;

            try
            {
                if (DeviceInternet.InternetConnected())
                {
                    StklauoutactivityIndicator.IsVisible = true;
                    await Task.Run(() =>
                    {
                        historyPage = new HistoryPage();
                    });

                    await Navigation.PushAsync(historyPage);

                    StklauoutactivityIndicator.IsVisible = false;
                }
                else
                {
                    await DisplayAlert("Alert", "Please check your Internet connection", "Ok");
                }
            }
            catch (Exception ex) { }
        }
Esempio n. 2
0
        private async void ButtonReportPrint_Clicked(object sender, EventArgs e)
        {
            try
            {
                if (objlot != null)
                {
                    if (DeviceInternet.InternetConnected())
                    {
                        ReportPrint(objlot);
                    }
                    else
                    {
                        await DisplayAlert("Alert", "Please check your Internet connection", "Ok");

                        ShowLoading(false);
                    }
                }
                else
                {
                    await DisplayAlert("Alert", "Please generate report.", "Ok");

                    ShowLoading(false);
                }
            }
            catch (Exception ex)
            {
                dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "ReportPage.xaml.cs", "", "ButtonReportPrint_Clicked");
            }
        }
Esempio n. 3
0
        private async void BtnNewPass_Clicked(object sender, EventArgs e)
        {
            try
            {
                if (DeviceInternet.InternetConnected())
                {
                    NewPassPage newPassPage = null;
                    ShowLoading(true);
                    await Task.Run(() =>
                    {
                        newPassPage = new NewPassPage("New Pass");
                    });

                    await Navigation.PushAsync(newPassPage);

                    ShowLoading(false);
                }
                else
                {
                    await DisplayAlert("Alert", "Please check your Internet connection", "Ok");
                }
            }
            catch (Exception ex)
            {
                ShowLoading(false);
            }
        }
Esempio n. 4
0
        private async void SlLogout_Tapped(object sender, EventArgs e)
        {
            try
            {
                if (DeviceInternet.InternetConnected())
                {
                    bool answer = await DisplayAlert("Exit", "Do you want to logout the app", "Yes", "No");

                    if (answer)
                    {
                        await GetCurrentLocation();

                        //MasterDetailHomePage masterDetailHomePage = new MasterDetailHomePage();
                        //masterDetailHomePage.StopNFCListening();
                        var lstchekIns = await App.SQLiteDb.GetAllVehicleAsync();

                        if (lstchekIns != null && lstchekIns.Count > 0)
                        {
                            await DisplayAlert("Alert", "Please check offline vehicles sync", "Ok");
                        }
                        else
                        {
                            if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                            {
                                User objloginuser = (User)App.Current.Properties["LoginUser"];
                                objloginuser.LogoutTime = DateTime.Now;
                                objloginuser.LocationParkingLotID.Lattitude = Latitude;
                                objloginuser.LocationParkingLotID.Longitude = Longitude;
                                string resultmsg = dal_Menubar.UpdateUserDailyLogOut(Convert.ToString(App.Current.Properties["apitoken"]), objloginuser);
                                SecureStorage.RemoveAll();
                                if (App.Current.Properties.ContainsKey("apitoken"))
                                {
                                    App.Current.Properties.Remove("apitoken");
                                }
                                if (App.Current.Properties.ContainsKey("LoginUser"))
                                {
                                    App.Current.Properties.Remove("LoginUser");
                                }
                                if (App.Current.Properties.ContainsKey("ReNewPassCustomerVehicle"))
                                {
                                    App.Current.Properties.Remove("ReNewPassCustomerVehicle");
                                }

                                await Navigation.PushAsync(new LoginPage());
                            }
                        }
                    }
                }
                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, "HistoryPage.xaml.cs", "", "ListVehicles");
            }
        }
Esempio n. 5
0
        private async void LoadLoginUserLocationLots()
        {
            try
            {
                if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                {
                    DALHome dal_Home     = new DALHome();
                    User    objLoginUser = (User)App.Current.Properties["LoginUser"];

                    if (DeviceInternet.InternetConnected())
                    {
                        lstlots = dal_Home.GetUserAllocatedLocationAndLots(Convert.ToString(App.Current.Properties["apitoken"]), objLoginUser);
                    }
                    else
                    {
                        lstlots = dal_Home.GetUserAllocatedLocationAndLotsOffline(objLoginUser);
                    }
                    if (lstlots.Count > 0)
                    {
                        pickerLocationLot.ItemsSource = lstlots;
                        for (int x = 0; x < lstlots.Count; x++)
                        {
                            if (objLoginUser.LocationParkingLotID.LocationParkingLotID == null || objLoginUser.LocationParkingLotID.LocationParkingLotID == 0)
                            {
                                if (lstlots[x].LocationID == objLoginUser.LocationParkingLotID.LocationID.LocationID)
                                {
                                    IsTodayHoliday    = lstlots[x].IsActive;
                                    todayLotOpenTime  = lstlots[x].LotOpenTime;
                                    todayLotCloseTime = lstlots[x].LotCloseTime;
                                    pickerLocationLot.SelectedIndex = x;
                                }
                            }
                            else
                            {
                                if (lstlots[x].LocationParkingLotID == objLoginUser.LocationParkingLotID.LocationParkingLotID)
                                {
                                    IsTodayHoliday    = lstlots[x].IsActive;
                                    todayLotOpenTime  = lstlots[x].LotOpenTime;
                                    todayLotCloseTime = lstlots[x].LotCloseTime;
                                    pickerLocationLot.SelectedIndex = x;
                                }
                            }
                        }
                    }
                }
                else
                {
                    await DisplayAlert("Alert", "Lost API Token,Please login agin", "Ok");
                }
            }
            catch (Exception ex)
            {
                dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "MasterDetailHomePage.xaml.cs", "", "LoadLoginUserLocationLots");
            }
        }
Esempio n. 6
0
        private async void BtnGenerateNFCCard_Clicked(object sender, EventArgs e)
        {
            try
            {
                if (DeviceInternet.InternetConnected())
                {
                    ShowLoading(true);
                    btnGenerateNFCCard.IsVisible = false;
                    CustomerVehiclePass        resultPass             = null;
                    NFCCardPaymentReceiptPagae PassPaymentReceiptPage = null;

                    if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                    {
                        await Task.Run(() =>
                        {
                            resultPass = dal_CustomerPass.SaveCustomerVehiclePassNewNFCCard(Convert.ToString(App.Current.Properties["apitoken"]), objCustomerPassNewNFC);
                            if (resultPass != null && resultPass.CustomerVehiclePassID != 0)
                            {
                                PassPaymentReceiptPage = new NFCCardPaymentReceiptPagae(resultPass);
                            }
                        });

                        if (resultPass != null && resultPass.CustomerVehiclePassID != 0)
                        {
                            await DisplayAlert("Alert", "Vehicle Tag created successfully", "Ok");

                            await Navigation.PushAsync(PassPaymentReceiptPage);

                            ShowLoading(false);
                            btnGenerateNFCCard.IsVisible = true;
                        }
                        else
                        {
                            ShowLoading(false);
                            btnGenerateNFCCard.IsVisible = true;
                            await DisplayAlert("Alert", "Tag creation failed,Please contact Admin", "Ok");
                        }
                    }

                    else
                    {
                        ShowLoading(false);
                        btnGenerateNFCCard.IsVisible = true;
                        await DisplayAlert("Alert", "Please check your Internet connection", "Ok");
                    }
                }
            }
            catch (Exception ex)
            {
                ShowLoading(false);
                btnGenerateNFCCard.IsVisible = true;
                dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "NFCCardCashPaymentPage.xaml.cs", "", "BtnGenerateNFCCard_Clicked");
            }
        }
Esempio n. 7
0
        private async void BtnGeneratePassReceipt_Clicked(object sender, EventArgs e)
        {
            try
            {
                btnGeneratePassReceipt.IsVisible = false;
                CustomerVehiclePass    resultPass             = null;
                PassPaymentReceiptPage PassPaymentReceiptPage = null;
                ShowLoading(true);
                if (DeviceInternet.InternetConnected())
                {
                    if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                    {
                        decimal passAmount = (objCustomerweeklyPass.TotalAmount == null || objCustomerweeklyPass.TotalAmount == 0) ? (objCustomerweeklyPass.Amount + objCustomerweeklyPass.DueAmount) : (objCustomerweeklyPass.TotalAmount + objCustomerweeklyPass.DueAmount);
                        if (Convert.ToDecimal(entryCashReceived.Text) >= passAmount)
                        {
                            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
                        {
                            btnGeneratePassReceipt.IsVisible = true;
                            await DisplayAlert("Alert", "Please enter valid pass amount.", "Ok");
                        }
                        ShowLoading(false);
                    }
                }
                else
                {
                    ShowLoading(false);
                    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");
            }
        }
        private async void LvCheckInChkOutReport_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            try
            {
                if (DeviceInternet.InternetConnected())
                {
                    ShowLoading(true);

                    if (e.SelectedItem == null)
                    {
                        return;
                    }
                    RecentCheckOutDetailsPage objrecentChekcOutPage = null;
                    VMRecentCheckOuts         objVMRecentCheckOuts  = (VMRecentCheckOuts)e.SelectedItem;
                    if (objVMRecentCheckOuts.CustomerParkingSlotID != 0)
                    {
                        await Task.Run(() =>
                        {
                            objrecentChekcOutPage = new RecentCheckOutDetailsPage(objVMRecentCheckOuts.CustomerParkingSlotID);
                        });

                        await Navigation.PushAsync(objrecentChekcOutPage);
                    }
                    else
                    {
                        await DisplayAlert("Alert", "Vehicle details unvailable,Please contact Admin", "Ok");
                    }
                    try
                    {
                        if (((ListView)lvCheckInChkOutReport).SelectedItem != null)
                        {
                            ((ListView)lvCheckInChkOutReport).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, "RecentCheckOuts.xaml.cs", "", "LvCheckInChkOutReport_ItemSelected");
            }
            ShowLoading(false);
        }
        private async void BtnCheckOut_Clicked(object sender, EventArgs e)
        {
            try
            {
                ShowLoading(true);
                btnCheckOut.IsVisible = false;
                if (DeviceInternet.InternetConnected())
                {
                    ShowLoading(true);
                    slYESNO.IsVisible = false;
                    DALVehicleCheckOut dal_CheckOut = new DALVehicleCheckOut();
                    if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                    {
                        CustomerParkingSlot VehicleCheckOut = null;
                        User objCheckoutBy = (User)App.Current.Properties["LoginUser"];
                        objviolationVehicleChekOut.CreatedBy = objCheckoutBy.UserID;
                        await Task.Run(() =>
                        {
                            VehicleCheckOut = dal_CheckOut.VehicleCheckOut(Convert.ToString(App.Current.Properties["apitoken"]), objviolationVehicleChekOut);
                        });

                        if (VehicleCheckOut != null)
                        {
                            if (VehicleCheckOut.PaymentTypeID != null)  // IF Payment Type NULL
                            {
                                VehicleCheckOut.PaymentTypeID.PaymentTypeName = objviolationVehicleChekOut.PaymentTypeID.PaymentTypeName;
                            }
                            await Navigation.PushAsync(new CheckOutReceiptPage(PageCalledBy, VehicleCheckOut));
                        }
                        else
                        {
                            await DisplayAlert("Alert", "Check-Out Failed,Please contact Admin.", "Ok");
                        }
                    }
                }
                else
                {
                    await DisplayAlert("Alert", "Please check your Internet connection", "Ok");
                }
                ShowLoading(false);
                btnCheckOut.IsVisible = true;
            }
            catch (Exception ex)
            {
                dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "CheckOutPaymentConfirmationPage.xaml.cs", "", "BtnCheckOut_Clicked");
                ShowLoading(false);
                btnCheckOut.IsVisible = true;
            }
        }
Esempio n. 10
0
 private async void SlTimeSheet_Tapped(object sender, EventArgs e)
 {
     try
     {
         if (DeviceInternet.InternetConnected())
         {
             await Navigation.PushAsync(new TimeSheet());
         }
         else
         {
             await DisplayAlert("Alert", "Please check your Internet connection", "Ok");
         }
     }
     catch (Exception ex) { }
 }
Esempio n. 11
0
        public void LoadParkedVehicle(ParkedVehiclesFilter objinput)
        {
            try
            {
                LstVWParkingVehicle.ItemsSource = null;
                if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                {
                    DALHome dal_Home = new DALHome();

                    if (objinput == null)
                    {
                        User objLoginUser = (User)App.Current.Properties["LoginUser"];
                        objinput = new ParkedVehiclesFilter();
                        VMLocationLots objVMLocations = (VMLocationLots)pickerLocationLot.SelectedItem;
                        objinput.LocationID           = objLoginUser.LocationParkingLotID.LocationID.LocationID;
                        objinput.LocationParkingLotID = objLoginUser.LocationParkingLotID.LocationParkingLotID;
                        if (objLoginUser.LocationParkingLotID.LocationParkingLotID == null || objLoginUser.LocationParkingLotID.LocationParkingLotID == 0)
                        {
                            if (objVMLocations != null)
                            {
                                objinput.LocationParkingLotID = objVMLocations.LocationParkingLotID;
                            }
                        }
                    }
                    VMLocationLotParkedVehicles vmVehicles = null;

                    if (DeviceInternet.InternetConnected())
                    {
                        vmVehicles = dal_Home.GetAllParkedVehicles(Convert.ToString(App.Current.Properties["apitoken"]), objinput);
                    }
                    else
                    {
                        vmVehicles = dal_Home.GetAllParkedVehiclesOffline();
                    }

                    lstdayvehicles = vmVehicles.CustomerParkingSlotID;
                    LstVWParkingVehicle.ItemsSource = vmVehicles.CustomerParkingSlotID;
                    labelTotalTwoWheeler.Text       = Convert.ToString(vmVehicles.TotalTwoWheeler) + "(" + Convert.ToString(vmVehicles.TotalOutTwoWheeler) + ")";
                    labelTotalFourWheeler.Text      = Convert.ToString(vmVehicles.TotalFourWheeler) + "(" + Convert.ToString(vmVehicles.TotalOutFourWheeler) + ")";
                    labelTotalHVWheeler.Text        = Convert.ToString(vmVehicles.TotalHVWheeler) + "(" + Convert.ToString(vmVehicles.TotalOutHVWheeler) + ")";
                    labelTotalThreeWheeler.Text     = Convert.ToString(vmVehicles.TotalThreeWheeler) + "(" + Convert.ToString(vmVehicles.TotalOutThreeWheeler) + ")";
                }
            }
            catch (Exception ex)
            {
                dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "MasterDetailHomePage.xaml.cs", "", "LoadParkedVehicle");
            }
        }
Esempio n. 12
0
        private async void PickerLocationLot_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                {
                    if (pickerLocationLot.SelectedItem != null)
                    {
                        User           objLoginUser   = (User)App.Current.Properties["LoginUser"];
                        VMLocationLots objVMLocations = (VMLocationLots)pickerLocationLot.SelectedItem;
                        if (objVMLocations != null)
                        {
                            string lotName = objVMLocations.LocationParkingLotName;
                            ParkedVehiclesFilter objloclot = new ParkedVehiclesFilter();
                            objloclot.LocationParkingLotID = objVMLocations.LocationParkingLotID;
                            objloclot.LocationID           = objVMLocations.LocationID;
                            objLoginUser.LocationParkingLotID.LocationParkingLotID       = objVMLocations.LocationParkingLotID;
                            objLoginUser.LocationParkingLotID.LocationParkingLotName     = objVMLocations.LotName;
                            objLoginUser.LocationParkingLotID.LocationID.LocationID      = objVMLocations.LocationID;
                            objLoginUser.LocationParkingLotID.LocationID.LocationName    = objVMLocations.LocationName;
                            objLoginUser.LocationParkingLotID.LotOpenTime                = objVMLocations.LotOpenTime;
                            objLoginUser.LocationParkingLotID.LotCloseTime               = objVMLocations.LotCloseTime;
                            objLoginUser.LocationParkingLotID.LotVehicleAvailabilityName = objVMLocations.LotVehicleAvailabilityName;

                            IsTodayHoliday    = objVMLocations.IsActive;
                            todayLotOpenTime  = objVMLocations.LotOpenTime;
                            todayLotCloseTime = objVMLocations.LotCloseTime;
                            LoadParkedVehicle(objloclot);
                            if (DeviceInternet.InternetConnected())
                            {
                                await App.SQLiteDb.SaveVehiclesParkingFeesDetailOnLogin(Convert.ToString(App.Current.Properties["apitoken"]), objVMLocations.LocationParkingLotID);

                                await App.SQLiteDb.SaveAllVehicleTypesInSQLLite(Convert.ToString(App.Current.Properties["apitoken"]), objVMLocations.LocationID);
                            }
                        }
                    }
                }
                else
                {
                    await DisplayAlert("Alert", "Token details  unavailable", "Ok");
                }
            }
            catch (Exception ex)
            {
                dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "MasterDetailHomePage.xaml.cs", "", "LoadLoginUserLocationLots");
            }
        }
Esempio n. 13
0
 private async void SlReports_Tapped(object sender, EventArgs e)
 {
     try
     {
         if (DeviceInternet.InternetConnected())
         {
             var repPage = new ReportPage();
             await Navigation.PushAsync(repPage);
         }
         else
         {
             await DisplayAlert("Alert", "Please check your Internet connection", "Ok");
         }
     }
     catch (Exception ex)
     {
     }
 }
Esempio n. 14
0
        private async void BtnViolation_Clicked(object sender, EventArgs e)
        {
            try
            {
                ShowLoading(true);
                if (DeviceInternet.InternetConnected())
                {
                    BtnViolation.IsVisible = false;
                    if (!IsTodayHoliday)
                    {
                        var opentime = Convert.ToDateTime(todayLotOpenTime);

                        bool doesPageExists = Navigation.NavigationStack.Any(p => p is ViolationPage);
                        if (!doesPageExists)
                        {
                            ViolationPage violationPage = null;
                            await Task.Run(() =>
                            {
                                StopNFCListening();
                                violationPage = new ViolationPage();
                            });

                            await Navigation.PushAsync(violationPage);
                        }
                    }
                    else
                    {
                        await DisplayAlert("Alert", "Please check Lot closed today.", "Ok");
                    }
                    BtnViolation.IsVisible = true;
                }
                else
                {
                    await DisplayAlert("Alert", "Please check your Internet connection", "Ok");
                }
                ShowLoading(false);
            }
            catch (Exception ex)
            {
                BtnViolation.IsVisible = true;
                ShowLoading(false);
                dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "MasterDetailHomePage.xaml.cs", "", "BtnViolation_Clicked");
            }
        }
Esempio n. 15
0
 private void lvLotOccupancyReport_Refreshing(object sender, EventArgs e)
 {
     try
     {
         if (DeviceInternet.InternetConnected())
         {
             if (objReportUser != null)
             {
                 GetLotOccupancy(objReportUser);
                 lvLotOccupancyReport.IsRefreshing = false;
             }
         }
         else
         {
         }
     }
     catch (Exception ex)
     {
     }
 }
Esempio n. 16
0
 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");
     }
 }
Esempio n. 17
0
        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");
     }
 }
Esempio n. 19
0
        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) { }
        }
 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)
     {
     }
 }
 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");
     }
 }
Esempio n. 22
0
        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");
            }
        }
Esempio n. 23
0
        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");
            }
        }
        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());
        }
        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 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");
            }
        }
Esempio n. 27
0
        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");
            }
        }
Esempio n. 28
0
        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);
        }
Esempio n. 29
0
        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");
            }
        }
Esempio n. 30
0
        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;
        }