Beispiel #1
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");
            }
        }
Beispiel #2
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");
            }
        }