public async void ListViewBase_OnItemClick(object sender, ItemClickEventArgs e)
        {
            _clickedItem = (TemplateTable)e.ClickedItem;
            if (string.IsNullOrEmpty(_clickedItem.Name))
            {
                return;
            }
            TemplateConfigModel configModel = new TemplateConfigModel();

            try
            {
                _template = await configModel.GetConfiguration(_clickedItem.Name);

                Template = _template;
            }
            catch (Exception exception)
            {
                Debug.Assert(true, exception.Message);
            }

            this.NavigationService.Navigate(typeof(TemplateConfigPage), this.Template);
        }
        public async void SaveTemplate()
        {
            CommonConfigurationModel configuration = new CommonConfigurationModel();
            CommonConfig             common        = configuration.GetConfiguration();
            Database            database           = new Database(common.DatabaseHost, common.DatabaseUser, common.DatabasePassword, common.DatabaseName, (uint)common.DatabasePort);
            TemplateConfigModel configModel        = new TemplateConfigModel();

            if (string.IsNullOrEmpty(_template.CommonInfo.WebsiteName) ||
                string.IsNullOrEmpty(_template.CommonInfo.WebsiteUrl))
            {
                return;
            }
            await configModel.SetConfiguration(_template);

            try
            {
                database.InsertTemplatesToDatabase(Template.CommonInfo.WebsiteName, "/Templates/",
                                                   Template.CommonInfo.WebsiteName + ".xml");
            }
            catch (Exception exception)
            {
                Debug.Assert(true, exception.Message);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// In this method we receive data that was defined in B2B_app application and required for websites and web service investigation
        /// </summary>
        public void GetDataFromUser()
        {
            string        data     = RemoteSave.GetContentFromFtp("conf", RemoteSave.State.INTERMEDIATE);
            var           strArr   = data.Split(Environment.NewLine.ToCharArray());
            List <string> condData = strArr.Where(s => !String.IsNullOrEmpty(s)).ToList();
            var           temp     = condData[0];
            var           temp2    = temp.Split(';');

            foreach (string s in temp2.Where(s => !String.IsNullOrEmpty(s)))
            {
                SiteNames.Add(s);
            }
            temp  = condData[1];
            temp2 = temp.Split(';');
            bool flag;

            foreach (string s in temp2)
            {
                if (!String.IsNullOrEmpty(s))
                {
                    var   temp3 = s.Split('-');
                    Route route = new Route();
                    flag = true;
                    foreach (string s1 in temp3.Where(s1 => !String.IsNullOrEmpty(s1)))
                    {
                        if (flag)
                        {
                            route.Departure = s1;
                            flag            = false;
                        }
                        else
                        {
                            if (s1 != '-'.ToString())
                            {
                                route.Arrival = s1;
                            }
                        }
                    }
                    FlightLegs.Add(route);
                }
            }
            temp  = condData[2];
            temp2 = temp.Split(';');
            flag  = true;
            foreach (string s in temp2)
            {
                if (!String.IsNullOrEmpty(s))
                {
                    if (flag)
                    {
                        // 2016-07-20T15:00:00Z
                        DepartureDate = s;
                        flag          = false;
                    }
                    else
                    {
                        if (s != ';'.ToString())
                        {
                            ArrivalDate = s;
                        }
                    }
                }
            }
            temp           = condData[3];
            temp2          = temp.Split(';');
            ConfigFilePath = temp2[0];
            Config         = new CommonConfig();
            Config         = _configuration.GetConfiguration(ConfigFilePath);
            foreach (string siteName in SiteNames)
            {
                WebsiteDomList.Add(RemoteSave.GetContentFromFtp(siteName, RemoteSave.State.TEMPLATE));
            }
            TemplateConfigModel template = new TemplateConfigModel();

            foreach (string s in SiteNames)
            {
                WebsiteTemplates.Add(template.GetConfiguration(s));
            }
        }