Ejemplo n.º 1
0
        private void LoadLocationLotActiveOperators(VMLocationLots objVMLocationLot, int UserID)
        {
            try
            {
                if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                {
                    DALHome dal_Home = new DALHome();

                    objReportUser.UserID = UserID;
                    objReportUser.LocationParkingLotID.LocationID.LocationID = objVMLocationLot.LocationID;
                    objReportUser.LocationParkingLotID.LocationParkingLotID  = objVMLocationLot.LocationParkingLotID;
                    lstOperators = dal_Home.GetLocationLotActiveOperators(Convert.ToString(App.Current.Properties["apitoken"]), objReportUser);
                    var loginuser = (User)App.Current.Properties["LoginUser"];
                    if ((loginuser.UserTypeID.UserTypeName).ToUpper() == "OPERATOR".ToUpper())
                    {
                        lstOperators.RemoveAll(item => item.UserID != loginuser.UserID);
                    }
                    if (lstOperators.Count > 0)
                    {
                        pickerOperator.ItemsSource   = lstOperators;
                        pickerOperator.SelectedIndex = 1;
                        GetLotOccupancy(objReportUser);
                    }
                }
            }
            catch (Exception ex)
            {
                dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "LotOccupancy.xaml.cs", "", "LoadLocationLotActiveOperators");
            }
        }
Ejemplo n.º 2
0
        private void LoadLocationLotActiveOperators(VMLocationLots objVMLocationLot, int UserID)
        {
            try
            {
                if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                {
                    DALHome dal_Home = new DALHome();
                    User    objselectedlocationlot = new User();

                    objselectedlocationlot.UserID = UserID;
                    objselectedlocationlot.LocationParkingLotID.LocationID.LocationID = objVMLocationLot.LocationID;
                    objselectedlocationlot.LocationParkingLotID.LocationParkingLotID  = objVMLocationLot.LocationParkingLotID;
                    lstOperators = dal_Home.GetLocationLotActiveOperators(Convert.ToString(App.Current.Properties["apitoken"]), objselectedlocationlot);
                    if (lstOperators.Count > 0)
                    {
                        pickerOperator.ItemsSource   = lstOperators;
                        pickerOperator.SelectedIndex = 1;
                    }
                }
            }
            catch (Exception ex)
            {
                dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "ReportPage.xaml.cs", "", "LoadLocationLotActiveOperators");
            }
        }
Ejemplo n.º 3
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)
             {
                 var            objLoginUser   = (User)App.Current.Properties["LoginUser"];
                 VMLocationLots objVMLocations = (VMLocationLots)pickerLocationLot.SelectedItem;
                 objReportUser.UserID = objLoginUser.UserID;
                 objReportUser.LocationParkingLotID.LocationID.LocationID = objVMLocations.LocationID;
                 objReportUser.LocationParkingLotID.LocationParkingLotID  = objVMLocations.LocationParkingLotID;
                 GetLotOccupancy(objReportUser);
             }
         }
         else
         {
             await DisplayAlert("Alert", "Token details  unavailable", "Ok");
         }
     }
     catch (Exception ex)
     {
         dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "LotOccupancy.xaml.cs", "", "PickerLocationLot_SelectedIndexChanged");
     }
 }
Ejemplo n.º 4
0
        public List <VMLocationLots> GetUserAllocatedLocationAndLots(string accessToken, User objUser)
        {
            List <LocationParkingLot> lstParkingLots    = new List <LocationParkingLot>();
            List <VMLocationLots>     lstVMLocationLots = new List <VMLocationLots>();

            try
            {
                string baseUrl = Convert.ToString(App.Current.Properties["BaseURL"]);
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(baseUrl);
                    client.DefaultRequestHeaders.Accept.Clear();
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    // Add the Authorization header with the AccessToken.
                    client.DefaultRequestHeaders.Add("Authorization", "bearer  " + accessToken);
                    // create the URL string.
                    string url = "api/InstaOperator/postOPAPPLoginUserAllocatedLocationAndLots";
                    // make the request

                    var json    = JsonConvert.SerializeObject(objUser);
                    var content = new StringContent(json, Encoding.UTF8, "application/json");
                    HttpResponseMessage response = client.PostAsync(url, content).Result;
                    if (response.IsSuccessStatusCode)
                    {
                        string jsonString = response.Content.ReadAsStringAsync().Result;
                        if (jsonString != null)
                        {
                            APIResponse apiResult = JsonConvert.DeserializeObject <APIResponse>(jsonString);

                            if (apiResult.Result)
                            {
                                lstParkingLots = JsonConvert.DeserializeObject <List <LocationParkingLot> >(Convert.ToString(apiResult.Object));
                                if (lstParkingLots.Count > 0)
                                {
                                    for (var i = 0; i < lstParkingLots.Count; i++)
                                    {
                                        VMLocationLots objlot = new VMLocationLots();
                                        objlot.LocationParkingLotID = lstParkingLots[i].LocationParkingLotID;
                                        objlot.LotName = lstParkingLots[i].LocationParkingLotName;
                                        objlot.LocationParkingLotName = lstParkingLots[i].LocationID.LocationName + "-" + lstParkingLots[i].LocationParkingLotName;
                                        objlot.LocationID             = lstParkingLots[i].LocationID.LocationID;
                                        objlot.LocationName           = lstParkingLots[i].LocationID.LocationName;
                                        objlot.IsActive     = lstParkingLots[i].IsActive;
                                        objlot.LotOpenTime  = lstParkingLots[i].LotOpenTime;
                                        objlot.LotCloseTime = lstParkingLots[i].LotCloseTime;
                                        objlot.LotVehicleAvailabilityName = lstParkingLots[i].LotVehicleAvailabilityName;
                                        lstVMLocationLots.Add(objlot);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(lstVMLocationLots);
        }
Ejemplo n.º 5
0
        private void LoadLoginUserLocationLots()
        {
            try
            {
                if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                {
                    DALHome dal_Home     = new DALHome();
                    var     objLoginUser = (User)App.Current.Properties["LoginUser"];
                    lstlots = dal_Home.GetUserAllocatedLocationAndLots(Convert.ToString(App.Current.Properties["apitoken"]), objLoginUser);
                    // Include ALL
                    VMLocationLots objlotAll = new VMLocationLots();
                    objlotAll.LocationParkingLotID = 0;
                    objlotAll.LotName = "ALL";
                    objlotAll.LocationParkingLotName = "ALL";
                    objlotAll.LocationID             = 0;
                    objlotAll.LocationName           = "ALL";
                    objlotAll.IsActive = true;
                    lstlots.Insert(0, objlotAll);

                    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 != null && lstlots[x].LocationID != 0)
                                {
                                    if (lstlots[x].LocationID == objLoginUser.LocationParkingLotID.LocationID.LocationID)
                                    {
                                        pickerLocationLot.SelectedIndex = x;
                                    }
                                }
                            }
                            else
                            {
                                if (lstlots[x].LocationParkingLotID == objLoginUser.LocationParkingLotID.LocationParkingLotID)
                                {
                                    pickerLocationLot.SelectedIndex = x;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "ReportPage.xaml.cs", "", "LoadLoginUserLocationLots");
            }
        }
Ejemplo n.º 6
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");
            }
        }
Ejemplo n.º 7
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");
            }
        }
Ejemplo n.º 8
0
        public List <VMLocationLots> GetUserAllocatedLocationAndLotsOffline(User objUser)
        {
            List <LocationParkingLot> lstParkingLots    = new List <LocationParkingLot>();
            List <VMLocationLots>     lstVMLocationLots = new List <VMLocationLots>();

            try
            {
                VMLocationLots objlot = new VMLocationLots();
                objlot.LocationParkingLotID = objUser.LocationParkingLotID.LocationParkingLotID;
                objlot.LotName = objUser.LocationParkingLotID.LocationParkingLotName;
                objlot.LocationParkingLotName = objUser.LocationParkingLotID.LocationID.LocationName + "-" + objUser.LocationParkingLotID.LocationParkingLotName;
                objlot.LocationID             = objUser.LocationParkingLotID.LocationID.LocationID;
                objlot.LocationName           = objUser.LocationParkingLotID.LocationID.LocationName;
                objlot.IsActive     = objUser.LocationParkingLotID.IsActive;
                objlot.LotOpenTime  = objUser.LocationParkingLotID.LotOpenTime;
                objlot.LotCloseTime = objUser.LocationParkingLotID.LotCloseTime;
                lstVMLocationLots.Add(objlot);
            }
            catch (Exception ex)
            {
            }
            return(lstVMLocationLots);
        }
Ejemplo n.º 9
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");
            }
        }