Example #1
0
 /// <summary>
 /// Add each station to our plain xml list
 /// </summary>
 /// <param name="data"></param>
 /// <param name="i"></param>
 /// <returns></returns>
 public override SiteData eachSite(SiteData data, int i)
 {
     SiteData thisTab = new SiteData();
     thisTab.Title = data.Title;
     nullTabs.Add(thisTab);
     return data;
 }
Example #2
0
        public override global::System.Data.DataSet Clone()
        {
            SiteData cln = ((SiteData)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
        public void WhenIEditSiteAndSaveInSiteDetailsPage(Table table)
        {
            SiteData siteData = table.CreateInstance <SiteData>();

            if (!BP_SiteCreationUtilities.EnterSiteData(siteData))
            {
                ScenarioContext.Current["ActResult"] = "Failed";
            }
        }
Example #4
0
        public void ThenISeeSiteDataInSitesTabOfLabInLabPage(Table siteInfo)
        {
            SiteData siteData = siteInfo.CreateInstance <SiteData>();

            if (!BP_LabCreationUtilities.IsSiteExistInSitesTableOfLab(siteData))
            {
                ScenarioContext.Current["ActResult"] = "Failed";
            }
        }
Example #5
0
        protected virtual void LoadChildren(HtmlTextWriter output, Guid rootContentID, string sItemCSS, int iParent, int iLevel)
        {
            List <SiteNav> lstNav = GetChildren(rootContentID);
            int            indent = output.Indent;

            output.Indent = indent + 1;

            string sThis2CSS = sItemCSS;

            if (lstNav != null && lstNav.Any())
            {
                output.WriteLine();
                output.WriteLine("<ul id=\"listitem" + iParent.ToString() + "-childlist\" class=\"childlist childlevel" + iLevel + " " + this.CSSULClassLower + "\">");
                int indent2 = output.Indent + 1;
                foreach (SiteNav c2 in lstNav)
                {
                    output.Indent = indent2;
                    List <SiteNav> cc = GetChildren(c2.Root_ContentID);

                    if (this.MultiLevel)
                    {
                        string sChild = " ";
                        if (cc != null && cc.Any())
                        {
                            sChild = " level" + iLevel + "-haschildren " + this.CSSHasChildren + " ";
                        }
                        sThis2CSS = " level" + iLevel + " " + sItemCSS + sChild;
                    }
                    else
                    {
                        sThis2CSS = sItemCSS;
                    }

                    if (SiteData.IsFilenameCurrentPage(c2.FileName) || AreFilenamesSame(c2.FileName, this.ParentFileName))
                    {
                        sThis2CSS = sThis2CSS + " " + this.CSSSelected;
                    }
                    sThis2CSS = (sThis2CSS + " child-nav").Replace("   ", " ").Replace("  ", " ").Trim();

                    iItemNumber++;
                    output.WriteLine("<li id=\"listitem" + iItemNumber.ToString() + "\" class=\"" + sThis2CSS + "\"><a href=\"" + c2.FileName + "\">" + c2.NavMenuText + "</a>");
                    int indent3 = output.Indent;
                    if (cc != null && cc.Any())
                    {
                        LoadChildren(output, c2.Root_ContentID, sItemCSS, iItemNumber, iLevel + 1);
                    }
                    output.Indent = indent3;
                    output.Write("</li>");

                    output.WriteLine();
                }
                output.Indent--;
                output.WriteLine("</ul> ");
            }

            output.Indent = indent;
        }
        private static void CalculateSpectra(SiteData data, int window, Action <double> progress)
        {
            var cmps = data.GetAllData();

            for (int i = 0; i < cmps.Count; i++)
            {
                var sp = PowerSpectraCalculation.Run(cmps[i].Ts, window, p => progress((i * 100.0 + p) / cmps.Count));
                Application.Current.Dispatcher.Invoke(() => cmps[i].Spectra = sp);
            }
        }
Example #7
0
        private static void Transform(Stops stops)
        {
            var site        = SiteData.GetSites();
            var api         = CreateApi(site);
            var transformer = new UploadModelTransformer(site, stops);
            var uploadModel = transformer.Transform();
            var integration = api.Organisations.Current.Routes.Integration(site.SiteId);

            SubmitRecord(integration, uploadModel);
        }
        public SiteDataGridWrapper(SiteData siteData)
        {
            if (siteData == null)
            {
                throw new ArgumentNullException("Cannot pass in a null SiteData object");
            }

            SiteData = siteData;
            updateBriefDescription();
        }
Example #9
0
 protected SiteNav GetHomePage(SiteData site)
 {
     if (_navHome == null)
     {
         using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) {
             _navHome = navHelper.FindHome(site.SiteID, false);
         }
     }
     return(_navHome);
 }
Example #10
0
        public ActionResult DefaultView()
        {
            LoadPage();

            if (_page != null && _page.ThePage.Root_ContentID != Guid.Empty)
            {
                DateTime dtModified = _page.TheSite.ConvertSiteTimeToLocalServer(_page.ThePage.EditDate);
                string   strModifed = dtModified.ToString("r");
                Response.AppendHeader("Last-Modified", strModifed);
                Response.Cache.SetLastModified(dtModified);

                DateTime dtExpire = DateTime.Now.AddSeconds(15);

                if (User.Identity.IsAuthenticated)
                {
                    Response.Cache.SetNoServerCaching();
                    Response.Cache.SetCacheability(HttpCacheability.NoCache);
                    dtExpire = DateTime.Now.AddMinutes(-10);
                    Response.Cache.SetExpires(dtExpire);
                }
                else
                {
                    Response.Cache.SetExpires(dtExpire);
                }

                SiteData.WriteDebugException("cmscontentcontroller_defaultview _page != null", new Exception(String.Format("Loading: {0} {1} {2}", _page.ThePage.FileName, _page.ThePage.TemplateFile, this.DisplayTemplateFile)));

                return(View(this.DisplayTemplateFile));
            }
            else
            {
                string sFileRequested = Request.Path;

                SiteData.WriteDebugException("cmscontentcontroller_defaultview _page == null", new Exception(String.Format("Requesting: {0} {1}", sFileRequested, this.DisplayTemplateFile)));

                DateTime dtModified = DateTime.Now.Date;
                string   strModifed = dtModified.ToString("r");
                Response.AppendHeader("Last-Modified", strModifed);
                Response.Cache.SetLastModified(dtModified);
                Response.Cache.SetExpires(DateTime.Now.AddSeconds(30));

                if (SiteData.IsLikelyHomePage(sFileRequested))
                {
                    SiteData.WriteDebugException("cmscontentcontroller_defaultview", new Exception("Empty _page"));
                    return(View("_EmptyHome"));
                }
                else
                {
                    Response.StatusCode = 404;
                    Response.AppendHeader("Status", "HTTP/1.1 404 Object Not Found");
                    SiteData.WriteDebugException("cmscontentcontroller_httpnotfound", new Exception("HttpNotFound"));
                    return(HttpNotFound());
                }
            }
        }
        protected virtual StringBuilder LoadChildren(StringBuilder output, Guid rootContentID, string sItemCSS, int iParent, int iLevel)
        {
            List <SiteNav> lstNav = GetChildren(rootContentID);

            string sThis2CSS = sItemCSS;

            if (lstNav != null && lstNav.Any())
            {
                output.AppendLine();
                output.AppendLine("<ul id=\"listitem" + iParent.ToString() + "-childlist\" class=\"childlist childlevel" + iLevel + " " + this.CssULClassLower + "\">");

                foreach (SiteNav c2 in lstNav)
                {
                    List <SiteNav> cc = GetChildren(c2.Root_ContentID);

                    if (this.MultiLevel)
                    {
                        string sChild = " ";
                        if (cc != null && cc.Any())
                        {
                            sChild = " level" + iLevel + "-haschildren " + this.CssHasChildren + " ";
                        }
                        sThis2CSS = " level" + iLevel + " " + sItemCSS + sChild;
                    }
                    else
                    {
                        sThis2CSS = sItemCSS;
                    }

                    if (SiteData.IsFilenameCurrentPage(c2.FileName) ||
                        ControlUtilities.AreFilenamesSame(c2.FileName, this.ParentFileName))
                    {
                        sThis2CSS = sThis2CSS + " " + this.CssSelected;
                    }
                    sThis2CSS = (sThis2CSS + " child-nav").Replace("   ", " ").Replace("  ", " ").Trim();

                    iItemNumber++;
                    output.AppendLine("<li id=\"listitem" + iItemNumber.ToString() + "\" class=\"" + sThis2CSS + "\"><a href=\"" + c2.FileName + "\">" + c2.NavMenuText + "</a>");

                    if (cc != null && cc.Any())
                    {
                        LoadChildren(output, c2.Root_ContentID, sItemCSS, iItemNumber, iLevel + 1);
                    }

                    output.Append("</li>");

                    output.AppendLine();
                }

                output.AppendLine("</ul> ");
            }

            return(output);
        }
Example #12
0
 public Site(SiteData data)
 {
     Id       = data.Id;
     FolderId = data.FolderId;
     Name     = data.Name != null ? new CipherString(data.Name) : null;
     Uri      = data.Uri != null ? new CipherString(data.Uri) : null;
     Username = data.Username != null ? new CipherString(data.Username) : null;
     Password = data.Password != null ? new CipherString(data.Password) : null;
     Notes    = data.Notes != null ? new CipherString(data.Notes) : null;
     Favorite = data.Favorite;
 }
        // POST: SiteDatas/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.

        public async Task <IActionResult> Create(SiteData siteData)
        {
            if (ModelState.IsValid)
            {
                _context.Add(siteData);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(Ok());
        }
Example #14
0
        public override string GetHtml()
        {
            if (this.ContentPage == null)
            {
                this.ContentPage = SiteData.GetCurrentPage();
            }

            this.ImgSrc = this.ContentPage.Thumbnail;
            this.Title  = this.ContentPage.NavMenuText;

            if (String.IsNullOrEmpty(this.ImgSrc))
            {
                // if page itself has no image, see if the image had been specified directly
                this.ImgSrc = this.ImageUrl;
            }

            if (!String.IsNullOrEmpty(this.ImgSrc))
            {
                if (this.PerformURLResize)
                {
                    ImageSizer imgSzr = new ImageSizer();
                    imgSzr.ImageUrl   = this.ImgSrc;
                    imgSzr.ThumbSize  = this.ThumbSize;
                    imgSzr.ScaleImage = this.ScaleImage;

                    this.ImgSrc = imgSzr.ImageThumbUrl;
                }
            }
            else
            {
                this.ImgSrc = String.Empty;
            }

            if (!String.IsNullOrEmpty(this.ImgSrc))
            {
                var imgBuilder = new TagBuilder("img");
                imgBuilder.MergeAttribute("src", this.ImgSrc);

                if (!String.IsNullOrEmpty(this.Title))
                {
                    imgBuilder.MergeAttribute("alt", this.Title);
                    imgBuilder.MergeAttribute("title", this.Title);
                }

                var imgAttribs = (IDictionary <string, object>)HtmlHelper.AnonymousObjectToHtmlAttributes(imageAttributes);
                imgBuilder.MergeAttributes(imgAttribs);

                return(imgBuilder.ToString(TagRenderMode.SelfClosing));
            }
            else
            {
                return(String.Empty);
            }
        }
    void Awake()
    {
        camControllerRef = FindObjectOfType <CameraController>();
        siteManagerRef   = FindObjectOfType <SiteManager>();
        siteDataRef      = transform.parent.GetComponent <SiteData>();

        dropDownText = dropDown.transform.GetComponentInChildren <Text>();
        if (dropDownText)
        {
            dropDownText.text = baseValue.ToString();
        }
    }
        protected override void OnAppearing()
        {
            Data = Preferences.Get("Site", "tomorrowio") switch
            {
                "openweathermap" => new SiteData(typeof(OpenWeatherMap)),
                "stormglassio" => new SiteData(typeof(StormGlassIO)),
                _ => new SiteData(typeof(TomorrowIO))
            };

            BindingContext = Data;
            base.OnAppearing();
        }
Example #17
0
        public ActionResult PageNotFound()
        {
            //SiteData.Perform404Redirect(Request.Path);

            Response.StatusCode = 404;
            Response.AppendHeader("Status", "HTTP/1.1 404 Object Not Found");
            SiteData.WriteDebugException("cmscontentcontroller_pagenotfound", new Exception(String.Format("HttpNotFound: {0}", Request.Path)));

            throw new HttpException(404, "HTTP/1.1 404 Object Not Found");

            return(HttpNotFound());
        }
Example #18
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            SiteData ds = new SiteData();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
Example #19
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            try {
                if (context.Request.Files != null && context.Request.Files.Count > 0)
                {
                    FileDataHelper helpFile = new FileDataHelper();

                    for (int i = 0; i < context.Request.Files.Count; i++)
                    {
                        HttpPostedFile file = context.Request.Files[i];

                        string dir              = context.Request["FileDirectory"].ToString() ?? @"/";
                        bool   esc              = Convert.ToBoolean(context.Request["EscapeSpaces"].ToString() ?? "false");
                        string path             = context.Server.MapPath(dir).Replace(@"\", @"/");
                        string uploadedFileName = file.FileName.Replace(@"\", @"/").Replace(@"//", @"/");

                        if (uploadedFileName.IndexOf("/") > 0)
                        {
                            uploadedFileName = uploadedFileName.Substring(uploadedFileName.LastIndexOf("/"));
                        }

                        if ((from b in helpFile.BlockedTypes
                             where uploadedFileName.ToLower().EndsWith(String.Format(".{0}", b).ToLower())
                             select b).Count() < 1)
                        {
                            if (esc)
                            {
                                uploadedFileName = uploadedFileName.Replace(" ", "-");
                                uploadedFileName = uploadedFileName.Replace("_", "-");
                                uploadedFileName = uploadedFileName.Replace("+", "-");
                                uploadedFileName = uploadedFileName.Replace("%20", "-");
                            }

                            string filename = (path + "/" + uploadedFileName).Replace(@"//", @"/");
                            file.SaveAs(filename);
                        }
                        else
                        {
                            throw new Exception("Blocked File Type");
                        }

                        var serial = new System.Web.Script.Serialization.JavaScriptSerializer();
                        var res    = new { name = file.FileName };
                        context.Response.Write(serial.Serialize(res));
                    }
                }
            } catch (Exception ex) {
                SiteData.WriteDebugException("fileupload", ex);
                throw;
            }
        }
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////
    ///
    /// SETUP
    ///
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////

    void Awake()
    {
        cityIO = GameObject.Find("cityIO").GetComponent <cityIO> ();
        if (GameObject.Find("SiteData"))
        {
            siteData = GameObject.Find("SiteData").GetComponent <SiteData> ();
        }

        setup = false;

        EventManager.StartListening("updateData", OnUpdateData);
        EventManager.StartListening("siteInitialized", OnSiteInitialized);
    }
        public MainWindow()
        {
            InitializeComponent();
            Data = Settings.Default["Site"].ToString() switch
            {
                "openweathermap" => new SiteData(typeof(OpenWeatherMap)),
                "stormglassio" => new SiteData(typeof(StormGlassIO)),
                _ => new SiteData(typeof(TomorrowIO))
            };

            DrawTemperature();
            DataContext = Data;
        }
Example #22
0
        private string GenSiteRealtimeAqiJson(int siteId)
        {
            Dictionary <int, SiteData> allData = _cacheManager.Get <Dictionary <int, SiteData> >(CACHE_KEY_ALLSITE_CURRENT_AQI, () => { return(BuildAllSiteRealTimeAqi()); });

            if (null == allData || !allData.ContainsKey(siteId))
            {
                return(null);
            }
            SiteData theData = allData[siteId];
            string   json    = JsonConvert.SerializeObject(theData);

            return(json);
        }
Example #23
0
        private bool IsSiteForeignIdExist(SiteData data)
        {
            WaitForElementToBeVisible(By.XPath($"//strong[text()=\"{data.Name}\"]"));
            var actualForeignIdValue = FindElementByXPath($"//strong[text()=\"{data.Name}\"]/ancestor::tr//a[contains(@id, 'lnkEditForeignId')]").Text;
            var isForeignIdExist     = false;

            if (!string.IsNullOrEmpty(actualForeignIdValue))
            {
                isForeignIdExist = true;
            }

            return(isForeignIdExist);
        }
Example #24
0
        public override string ToHtmlString()
        {
            LoadData();
            TweakData();

            string sItemCss = String.Empty;

            StringBuilder output = new StringBuilder();

            if (!String.IsNullOrEmpty(this.CssClass))
            {
                output.AppendLine("<ul id=\"" + this.ElementId + "\" class=\"" + this.CssClass + "\">");
            }
            else
            {
                output.AppendLine("<ul id=\"" + this.ElementId + "\" >");
            }

            if (this.NavigationData != null && this.NavigationData.Any())
            {
                foreach (var n in this.NavigationData)
                {
                    if (SiteData.IsFilenameCurrentPage(n.FileName) ||
                        (n.NavOrder == 0 && SiteData.IsCurrentLikelyHomePage) ||
                        ControlUtilities.AreFilenamesSame(n.FileName, this.CmsPage.ThePage.FileName))
                    {
                        sItemCss = String.Format(" {0} {1} ", this.CssItem, this.CssSelected).Trim();
                    }
                    else
                    {
                        sItemCss = String.Format(" {0} ", this.CssItem).Trim();
                    }

                    if (!String.IsNullOrEmpty(sItemCss))
                    {
                        output.Append("<li class=\"" + sItemCss + "\">");
                    }
                    else
                    {
                        output.Append("<li>");
                    }

                    output.Append(" <a href=\"" + n.FileName + "\">" + n.NavMenuText + "</a> </li>" + Environment.NewLine);
                }
            }

            output.AppendLine("</ul>");

            return(output.ToString());
        }
Example #25
0
        public void LoadData()
        {
            theSite      = SiteData.CurrentSite;
            pageContents = null;
            pageWidgets  = new List <Widget>();

            pageContents = SiteData.GetCurrentPage();

            if (pageContents != null)
            {
                guidContentID = pageContents.Root_ContentID;
                pageWidgets   = SiteData.GetCurrentPageWidgets(guidContentID);
            }
        }
Example #26
0
        public void EditSite(SiteData siteData)
        {
            EnsureMandatoryValuesAreProvided(siteData);

            ClearInputAndTypeValue(_txtSiteName, siteData.SiteName);
            ClearInputAndTypeValueIfRequired(_txtSecondaryLanguageName, siteData.SecondaryLanguageName);
            ClearInputAndTypeValue(_txtUrl, siteData.Url);
            ClearInputAndTypeValueIfRequired(_txtLanguage, siteData.Language);
            SelectWebformDropdownValueIfRequired(_ddlPrimaryCategory, siteData.PrimaryCategory);
            SelectWebformDropdownValueIfRequired(_ddlSecondaryCategory, siteData.SecondaryCategory);
            SetWebformCheckBoxState(_chkProprietaryMediaSite, siteData.IsProprietaryMediaSite);
            ClearInputAndTypeValueIfRequired(_txtDescription, siteData.Description);
            ClickElement(_btnSave);
        }
        public static void ViewEachTransformedActionLineItem(SiteData site, ActionItem action)
        {
            var ActionRef      = action.GetActionReference();
            var custRef        = action.GetCustomerReference();
            var custName       = action.GetCustomerName();
            var internalRef    = action.GetInternalReference();
            var actionTypeName = action.GetActionTypeName();
            var actionTypeId   = AsId(site.Id, action.GetActionTypeName());
            var direction      = action.DetermineDirection();
            var instructions   = action.GetInstructions();

            var sellToId   = AsEntityId(site.Id, action.GetSellToReference());
            var sellToName = action.GetSellToName();
            var sellToRef  = action.GetSellToReference();

            var measure = action.DetermineMeasure();

            var restriction = action.GetRestrictions();

            //if (actionId == "a" ) { throw new ArgumentNullException("customer"); }
            var shipToId   = AsEntityId(site.Id, action.GetShipToReference());
            var shipToName = action.GetShipToName();
            var shipToRef  = action.GetShipToReference();

            var mst = action.GetMaxStopTime();

            var decoId     = AsId(site.Id, action.GetShipToReference());
            var decoToName = action.GetShipToName();
            var decoToRef  = action.GetShipToReference();
            var Latitude   = action.GetShipToLatitude();
            var Longitude  = action.GetShipToLongitude();

            var UnitNo            = action.GetUnitNo();
            var BuildingName      = action.GetBuildingName();
            var StreetNo          = action.GetStreetNo();
            var SubDivisionNumber = action.GetSubDivisionNumber();
            var Street            = action.GetStreet();
            var Suburb            = action.GetSuburb();
            var City       = action.GetCity();
            var Province   = action.GetProvince();
            var PostalCode = action.GetPostalCode();
            var MapCode    = action.GetMapCode();

            var Weight         = action.GetWeight();
            var Pieces         = action.GetPieces();
            var Pallets        = action.GetPallets();
            var VolumetricMass = action.GetVolumetricMass();
            var AmountEx       = action.GetAmountEx();
            var AmountIncl     = action.GetAmountIncl();
        }
        protected void BuildInstallList()
        {
            pnlReview.Visible = true;
            SiteData site = SiteData.CurrentSite;

            GalleryHelper gh = new GalleryHelper(SiteID);

            foreach (GridViewRow row in gvPages.Rows)
            {
                Guid gGallery = Guid.Empty;

                CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect");

                if (chkSelect.Checked)
                {
                    HiddenField hdnGalleryID = (HiddenField)row.FindControl("hdnGalleryID");

                    gGallery = new Guid(hdnGalleryID.Value);

                    GalleryGroup grpImp = (from g in lstGalleries.TheGalleries
                                           where g.TheGallery.GalleryID == gGallery
                                           select g.TheGallery).FirstOrDefault();

                    GalleryGroup grpSite = gh.GalleryGroupGetByName(grpImp.GalleryTitle);

                    if (grpSite == null)
                    {
                        grpSite        = grpImp;
                        grpSite.SiteID = site.SiteID;
                    }
                    grpSite.Save();

                    grpImp.GalleryImages.ForEach(q => q.GalleryImageID = Guid.NewGuid());
                    grpImp.GalleryImages.ForEach(q => q.GalleryID      = grpSite.GalleryID);

                    foreach (GalleryImageEntry imgImp in grpImp.GalleryImages)
                    {
                        GalleryImageEntry imgSite = gh.GalleryImageEntryGetByFilename(grpSite.GalleryID, imgImp.GalleryImage);

                        if (imgSite == null)
                        {
                            imgSite           = imgImp;
                            imgSite.GalleryID = grpSite.GalleryID;
                        }
                        imgSite.Save();
                    }
                }
            }
        }
Example #29
0
        private void fillDayToSiteData(SiteData siteData, List <StationOrCityMeasuredData> dayData, RankingData rd)
        {
            foreach (var d in dayData)
            {
                int aqi = parseStringToInt(d.AQI);
                var g   = _aqiGradeService.CalcGrade(aqi);
                siteData.Days.Add(new DayAqi()
                {
                    Aqi = aqi, Level = g.Grade, DayTime = d.DateTime
                });
            }
            var newestData = dayData[dayData.Count - 1];

            fillRankingData(rd, newestData, siteData.Name, parseStringToInt(newestData.AQI));
        }
Example #30
0
        private static void Transform(ConsignmentStops consignmentModel)
        {
            var stops = consignmentModel.Stops;
            var site  = SiteData.GetSites();
            var api   = CreateApi(site);

            foreach (var stop in stops)
            {
                var transformer = new UploadModelTransformer(site, stop);
                var uploadModel = transformer.Transform();
                var integration = api.Organisations.Current.Routes.Integration(site.SiteId);

                SubmitRecord(integration, uploadModel);
            }
        }
Example #31
0
        /// <summary>
        /// Method to get list of site collections under specific web application
        /// </summary>
        /// <returns></returns>
        public List <SiteData> ListSiteCollections()
        {
            List <SiteData> lstSites = new List <SiteData>();
            Guid            siteId   = SPContext.Current.Site.ID;

            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                //Create new elevated instances of the site collection
                using (SPSite elevSite = new SPSite(siteId))
                {
                    foreach (SPSite site in elevSite.WebApplication.Sites)
                    {
                        try
                        {
                            if (site.RootWeb != null)
                            {
                                SiteData siteData = new SiteData()
                                {
                                    Title       = site.RootWeb.Title,
                                    Description = site.RootWeb.Description,
                                    LcId        = site.RootWeb.Language.ToString(),
                                    OwnerLogin  = site.Owner.LoginName,
                                    Url         = site.Url,
                                    WebTemplate = string.Format("{0}#{1}", site.RootWeb.WebTemplate, site.RootWeb.Configuration)
                                };
                                if (site.SecondaryContact != null)
                                {
                                    siteData.SecondaryContactLogin = site.SecondaryContact.LoginName;
                                }
                                lstSites.Add(siteData);
                            }
                        }
                        catch (Exception ex)
                        {
                            //TODO - Log exception and move to next
                        }
                        finally
                        {
                            if (site != null)
                            {
                                site.Dispose();
                            }
                        }
                    }
                }
            });
            return(lstSites);
        }
Example #32
0
 /// <summary>
 /// This method is called on each site iteration. 
 /// </summary>
 /// <param name="data">All of the data for this site, including the rigs contained within it</param>
 /// <param name="i">The index of this site within the List</param>
 /// <returns></returns>
 public virtual SiteData eachSite(SiteData data, int i)
 {
     return data;
 }
		/// <summary>
		/// Recursively process a folder url and all subfolders,
		/// creating new SharePointDocLibFolder objects on the fly
		/// and adding them to the list of subfolders in this class.
		/// This creates a heiarchy of folders we can recurse through
		/// in the gui or for processing.
		/// </summary>
		/// <param name="dws">The SiteData Web Service</param>
		/// <param name="folderUrl">A url to the folder you want to enumerate</param>
		/// <remarks>This is a private method and not currently used
		/// but might want to be refactored to be public.</remarks>
		private void EnumerateFolder(SiteData dws, string folderUrl)
		{
			_sFPUrl[] enArray = null;

			try
			{
				dws.EnumerateFolder(folderUrl, out enArray);
				foreach(_sFPUrl folder in enArray)
				{
					if(folder.IsFolder)
						subFolders.Add(new SharePointDocLibFolder(siteUrl, folder.Url));
				}
			}
			catch (NullReferenceException nullEx)
			{
				// handles empty folders
				Console.WriteLine(nullEx.Message);
			}
			catch (SoapException ex)
			{
				Console.WriteLine(ex.Message);
			}
		}
Example #34
0
 /// <summary>
 /// Get a filter for each site title
 /// </summary>
 /// <param name="data"></param>
 /// <param name="i"></param>
 /// <returns></returns>
 public override SiteData eachSite(SiteData data, int i)
 {
     filterData.Sites.Add(data.Title);
     return data;
 }
Example #35
0
		/// <summary>
		/// News the site data web service.
		/// </summary>
		/// <returns></returns>
		public SiteData NewSiteDataWebService()
		{
			SiteData ws = new SiteData();
			ws.Url = siteUrl + "SiteData.asmx";
			ws.Credentials = Credentials;
			return ws;
		}