Beispiel #1
0
 public void GetParameters(bool KeepCurrentRecord, GeneralDataProvider Provider)
 {
     try
     {
         CreateEmptyParameters(Provider);
         if (KeepCurrentRecord)
         {
             if (ViewState["OldParameters"] != null && ((Hashtable)ViewState["OldParameters"]).Count > 0)
             {
                 OldParameters = (Hashtable)ViewState["OldParameters"];
                 foreach (string ParamKey in Provider.Parameters.Keys)
                 {
                     Provider.Parameters[ParamKey].Parameter.SetValue(OldParameters[ParamKey].ToString());
                 }
             }
         }
         if (Provider.TableName == this.TableName)
         {
             Provider.FiltroAtual = sWhere;
         }
         Provider.InitialFilter = Provider.StartFilter;
     }
     catch (Exception e)
     {
         PageErrors.Add("Parameters", "Form parameters: " + e.Message);
     }
 }
    public static int GetRepaterPageNumber(GeneralDataProvider Provider, string FilterPosition, int PageSize, out DataRow Row)
    {
        int ret   = 0;
        int Count = Provider.PageCount;

        System.Data.DataTable Data = Provider.SelectItems(0, 0, out Count);
        if (Data.Rows.Count > 0)
        {
            System.Data.DataRow[] drs = Data.Select(FilterPosition.Replace("N'", "'"));
            if (drs.Length > 0)
            {
                ret = Data.Rows.IndexOf(drs[0]) / PageSize;
                Row = drs[0];
            }
            else
            {
                Row = null;
            }
        }
        else
        {
            Row = null;
        }
        return(ret);
    }
Beispiel #3
0
 public void SetParametersValues(GeneralDataProvider Provider)
 {
     if (CurrentItem != null)
     {
         DataProvider.Parameters["Login"].Parameter.SetValue(CurrentItem.Fields["Login"].Value);
     }
 }
        private async Task <List <Suggestion> > GetSuggestions(string userInput)
        {
            var gdp        = new GeneralDataProvider();
            var suggestion = await gdp.GetData <SuggestionRoot>(userInput, "suggestion");

            return(suggestion.Suggestions);
        }
Beispiel #5
0
 public virtual GeneralDataProviderItem GetDataProviderItem(GeneralDataProvider Provider)
 {
     if (DataProvider != null && DataProvider.PageProvider != null)
     {
         return(DataProvider.PageProvider.GetDataProviderItem(Provider));
     }
     return(null);
 }
Beispiel #6
0
 // cria lista de par??metros vazia
 public void CreateEmptyParameters(GeneralDataProvider Provider)
 {
     if (Provider == DataProvider)
     {
         Provider.Parameters.Clear();
         Provider.CreateParameters();
     }
 }
        private async Task GetWeatherHourly(string userInput, string typeOfData)
        {
            var gdp           = new GeneralDataProvider();
            var weatherHourly = await gdp.GetData <WeatherRoot>(userInput, "weather-hourly");

            if (weatherHourly != null)
            {
                HourlyForecastWeatherComponent.AddHourlyForecastWeatherDataToUI(weatherHourly, typeOfData);
                HourByHourTextBlock.Visibility = 0;
            }

            return;
        }
Beispiel #8
0
        public static void FillListItems(ListBox List, int MaxRecords, GeneralDataProvider TableProvider, GeneralDataProviderItem TableItem, string ValueFieldName, string TextFieldName, string StartFilter)
        {
            TableProvider.FiltroAtual = StartFilter;
            DataTable ItemData = TableProvider.SelectAllItems(TableItem).Tables[0];

            List.Items.Clear();
            ListItem Item;

            foreach (DataRow vgRow in ItemData.Rows)
            {
                Item = new ListItem(vgRow[TextFieldName].ToString(), vgRow[ValueFieldName].ToString());
                List.Items.Add(Item);
            }
        }
Beispiel #9
0
        public static string PTabGetFilter(GeneralDataProvider TableProvider, params string[] FieldAndValues)
        {
            string PTabFilter = "";

            for (int i = 0; i < FieldAndValues.Length; i += 2)
            {
                if (i + 1 < FieldAndValues.Length)
                {
                    PTabFilter += TableProvider.Dao.PoeColAspas(FieldAndValues[i]) + " = " + FieldAndValues[i + 1];
                    PTabFilter += " and ";
                }
            }
            return(PTabFilter.Substring(0, PTabFilter.Length - 5));
        }
        private async Task GetWeatherDaily(string userInput)
        {
            var gdp          = new GeneralDataProvider();
            var weatherDaily = await gdp.GetData <WeatherRoot>(userInput, "weather-daily");

            if (weatherDaily != null)
            {
                CurrentWeatherComponent.AddCurrentWeatherDataToUI(weatherDaily);
                DailyForecastWeatherComponent.AddDailyForecastWeatherDataToUI(weatherDaily.WeatherData);

                progressRing.IsActive = false;
                errorMessage.Text     = " ";
                return;
            }

            errorMessage.Text = "Invalid city name";
        }
Beispiel #11
0
 public void OnSelectedItem(GeneralDataProvider Provider, GeneralDataProviderItem Item, bool UpdateFromUI)
 {
     if (Provider == DataProvider)
     {
         if (UpdateFromUI)
         {
             UpdateItemFromControl(Item);
         }
         InitializeAlias(Item);
         FillAuxiliarTables();
         if (UpdateFromUI)
         {
             if (PageState == FormStateEnum.Insert)
             {
                 ShowInitialValues();
             }
             ShowFormulas();
         }
     }
 }
Beispiel #12
0
        //const string fileName = "whazzup.txt";

        public static void Main(string[] args)
        {
            string           path        = GetPath();
            IGZipCompression compression = new GZipCompression();

            IIVAOWhazzupDataSource nonCachedWebDataSource        = new WebIVAOWhazzupDataSource("http://api.ivao.aero/getdata/whazzup/whazzup.txt");
            IIVAOWhazzupDataSource nonCachedWebGZippedDataSource = new WebGZippedIVAOWhazzupDataSource("http://api.ivao.aero/getdata/whazzup/whazzup.txt.gz", compression);

            IIVAOWhazzupDataSource nonCachedLocalDataSource        = new LocalIVAOWhazzupDataSource(path);
            IIVAOWhazzupDataSource nonCachedLocalGZippedDataSource = new LocalGZippedIVAOWhazzupDataSource(path, compression);

            ICachedIVAOWhazzupDataSource dataSource = new CachedIVAOWhazzupDataSource(nonCachedLocalGZippedDataSource);

            IParserFactory    parserFactory    = new ParserFactory();
            IGeneralSelector  generalSelector  = new GeneralSelector();
            IClientsSelector  clientsSelector  = new ClientsSelector();
            IServersSelector  serverSelector   = new ServersSelector();
            IAirportsSelector airportsSelector = new AirportsSelector();

            IGeneralDataProvider generalDataProvider  = new GeneralDataProvider(dataSource, parserFactory, generalSelector);
            IClientsProvider     clientsDataProvider  = new ClientsDataProvider(dataSource, parserFactory, clientsSelector);
            IServersProvider     serversDataProvider  = new ServersDataProvider(dataSource, parserFactory, serverSelector);
            IAirportsProvider    airportsDataProvider = new AirportsDataProvider(dataSource, parserFactory, airportsSelector);

            IClientsProvider atcClientsDataProvider      = new AirTrafficControllersDataProvider(dataSource, parserFactory, clientsSelector);
            IClientsProvider pilotClientsDataProvider    = new PilotsDataProvider(dataSource, parserFactory, clientsSelector);
            IClientsProvider followMeClientsDataProvider = new FollowMesDataProvider(dataSource, parserFactory, clientsSelector);

            List <GeneralData> generalDataModels  = generalDataProvider.GetData().ToList();
            List <Client>      clientDataModels   = clientsDataProvider.GetData().ToList();
            List <Server>      serversDataModels  = serversDataProvider.GetData().ToList();
            List <Airport>     airportsDataModels = airportsDataProvider.GetData().ToList();

            List <Client> atcDataModels      = atcClientsDataProvider.GetData().ToList();
            List <Client> pilotDataModels    = pilotClientsDataProvider.GetData().ToList();
            List <Client> followMeDataModels = followMeClientsDataProvider.GetData().ToList();

            Client item = pilotDataModels.First();

            TrySerialize(item);
        }
Beispiel #13
0
 public void OnSelectedItem(GeneralDataProvider Provider, GeneralDataProviderItem Item, bool UpdateFromUI)
 {
 }
    public static System.Data.DataTable ControlPagesButtons(Panel Panel, int ButtonsCount, int PageSize, ref int CurrentPage, bool HasLastFirst, bool HasNextPreviews, GeneralDataProvider Provider)
    {
        int Count = Provider.PageCount;

        System.Data.DataTable Data = Provider.SelectItems(CurrentPage, PageSize, out Count);
        Count = (int)Math.Ceiling((decimal)Count / (decimal)PageSize);
        if (CurrentPage == -1)
        {
            CurrentPage = Count - 1;
        }
        else if (CurrentPage >= Count && Count > 0)
        {
            CurrentPage = Count - 1;
            Data        = Provider.SelectItems(CurrentPage, PageSize, out Count);
            Count       = (int)Math.Ceiling((decimal)Count / (decimal)PageSize);
        }

        if (Panel != null)
        {
            if (Count == 1)
            {
                Panel.Visible = false;
                return(Data);
            }
            else if (Count >= 2)
            {
                Panel.Visible = true;
            }

            int startNum      = 0;
            int startBtn      = 1;
            int BtnPosCounter = 1;
            if ((int)((ButtonsCount + 1) / 2) < CurrentPage + 1)
            {
                if ((ButtonsCount & 1) == 1)
                {
                    startNum = (CurrentPage) - ((ButtonsCount) / 2);
                }
                else
                {
                    startNum = (CurrentPage + 1) - ((ButtonsCount) / 2);
                }
            }
            if (startNum > 0 && startNum + ButtonsCount > Count)
            {
                startNum = Count - ButtonsCount;
            }

            if (ButtonsCount >= Count)
            {
                startNum = 0;
            }

            if (Count < ButtonsCount)
            {
                startBtn = ButtonsCount - Count + startBtn;
            }
            BtnPosCounter = startBtn;
            int VisCount = BtnPosCounter;

            if (HasLastFirst)
            {
                ((Button)Panel.FindControl("__" + Panel.ID + "__Button" + BtnPosCounter.ToString())).Text            = "<<";
                ((Button)Panel.FindControl("__" + Panel.ID + "__Button" + BtnPosCounter.ToString())).CommandArgument = "F";
                ((Button)Panel.FindControl("__" + Panel.ID + "__Button" + BtnPosCounter.ToString())).Visible         = true;
                BtnPosCounter++;
            }
            if (HasNextPreviews)
            {
                ((Button)Panel.FindControl("__" + Panel.ID + "__Button" + BtnPosCounter.ToString())).Text            = "<";
                ((Button)Panel.FindControl("__" + Panel.ID + "__Button" + BtnPosCounter.ToString())).CommandArgument = "P";
                ((Button)Panel.FindControl("__" + Panel.ID + "__Button" + BtnPosCounter.ToString())).Visible         = true;
                BtnPosCounter++;
            }

            if (Count >= ButtonsCount)
            {
                for (int i = 0; i < ButtonsCount; i++)
                {
                    ((Button)Panel.FindControl("__" + Panel.ID + "__Button" + BtnPosCounter.ToString())).Text            = (startNum + 1).ToString();
                    ((Button)Panel.FindControl("__" + Panel.ID + "__Button" + BtnPosCounter.ToString())).CommandArgument = startNum.ToString();
                    ((Button)Panel.FindControl("__" + Panel.ID + "__Button" + BtnPosCounter.ToString())).Visible         = true;
                    BtnPosCounter++;
                    startNum++;
                }
            }
            else
            {
                for (int i = 0; i < Count; i++)
                {
                    ((Button)Panel.FindControl("__" + Panel.ID + "__Button" + BtnPosCounter.ToString())).Text            = (startNum + 1).ToString();
                    ((Button)Panel.FindControl("__" + Panel.ID + "__Button" + BtnPosCounter.ToString())).CommandArgument = startNum.ToString();
                    ((Button)Panel.FindControl("__" + Panel.ID + "__Button" + BtnPosCounter.ToString())).Visible         = true;
                    BtnPosCounter++;
                    startNum++;
                }
            }

            if (HasNextPreviews)
            {
                ((Button)Panel.FindControl("__" + Panel.ID + "__Button" + BtnPosCounter.ToString())).Text            = ">";
                ((Button)Panel.FindControl("__" + Panel.ID + "__Button" + BtnPosCounter.ToString())).CommandArgument = "N";
                ((Button)Panel.FindControl("__" + Panel.ID + "__Button" + BtnPosCounter.ToString())).Visible         = true;
                BtnPosCounter++;
            }
            if (HasLastFirst)
            {
                ((Button)Panel.FindControl("__" + Panel.ID + "__Button" + BtnPosCounter.ToString())).Text            = ">>";
                ((Button)Panel.FindControl("__" + Panel.ID + "__Button" + BtnPosCounter.ToString())).CommandArgument = "L";
                ((Button)Panel.FindControl("__" + Panel.ID + "__Button" + BtnPosCounter.ToString())).Visible         = true;
            }

            for (int BtnN = VisCount - 1; BtnN >= 1; BtnN--)
            {
                ((Button)Panel.FindControl("__" + Panel.ID + "__Button" + BtnN.ToString())).Visible = false;
            }
        }
        return(Data);
    }
Beispiel #15
0
 public void SetParametersValues(GeneralDataProvider Provider)
 {
     DataProvider.Parameters["Group"].Parameter.SetValue(CurrentItem.Fields["Group"].Value);
     DataProvider.Parameters["Project"].Parameter.SetValue(CurrentItem.Fields["Project"].Value);
     DataProvider.Parameters["Object"].Parameter.SetValue(CurrentItem.Fields["Object"].Value);
 }
Beispiel #16
0
 public virtual void SetParametersValues(GeneralDataProvider Provider)
 {
 }
Beispiel #17
0
 public void SetParametersValues(GeneralDataProvider Provider)
 {
     DataProvider.Parameters["Id"].Parameter.SetValue(CurrentItem.Fields["Id"].Value);
 }
Beispiel #18
0
 public void GetParameters(bool KeepCurrentRecord, GeneralDataProvider Provider)
 {
     CreateEmptyParameters(Provider);
     SetParametersValues(Provider);
 }
Beispiel #19
0
 public static bool PTab(GeneralDataProvider TableProvider, params string[] FieldAndValues)
 {
     return(TableProvider.PTab(PTabGetFilter(TableProvider, FieldAndValues)));
 }
Beispiel #20
0
 public GeneralDataProviderItem GetDataProviderItem(GeneralDataProvider Provider)
 {
     return(new LoginUserItem());
 }