/// <summary>
        /// Добавляет контент в результат
        /// </summary>
        /// <param name="contentName">Название контента</param>
        /// <param name="content">Содержимое контента</param>
        internal void AddContent(string contentName, DataTable content)
        {
            if (Contents == null)
            {
                Contents = new Dictionary <string, DataTable>();
            }

            if (!Contents.ContainsKey(contentName))
            {
                Contents.Add(contentName, content);
            }
        }
Beispiel #2
0
 /// <summary>
 /// Adds item to the list of scanned items List. If the item is already in the List, 1 quantity is added; else the item is added with 1 qty.
 /// </summary>
 /// <param name="itm">Item to be added to the contents of this box.</param>
 public void AddItem(Item itm)
 {
     if (Contents.Contains(itm))                //check if item is in the box
     {
         var indexItem = Contents.IndexOf(itm); //find it's index
         Contents[indexItem].Quantity += 1;     //add 1 quantity
     }
     else
     {//else add the new item
         Contents.Add(itm);
     }
 }
        public void Initialize()
        {
            Contents.Add(new WorkUnitRecorderViewModel());
            Contents.Add(new ArchiveManagerViewModel());
            Contents.Add(new ExporterViewModel());
            Contents.Add(new ConfigurationViewModel());

            foreach (var c in Contents)
            {
                NavigationIconButtons.Add(c.NavigationIcon);
            }
        }
 public string StoreData(Data data)
 {
     if (StorageUsed + data.Size > StorageCapacity)
     {
         return("Not enough storage capacity.");
     }
     else
     {
         Contents.Add(data);
         StorageUsed += data.Size;
         return("Data has been added.");
     }
 }
        internal void AddContent(IDockContent content)
        {
            if (content == null)
            {
                throw(new ArgumentNullException());
            }

            if (!Contents.Contains(content))
            {
                Contents.Add(content);
                OnContentAdded(new DockContentEventArgs(content));
            }
        }
Beispiel #6
0
        public void Initialise(BaseCharacterController owner, InventoryContents initialContents, bool dropped = false)
        {
            Contents.Add(initialContents);
            Owner    = owner;
            OnGround = dropped;

            Debug.Assert(Contents != null);

            if (!OnGround)
            {
                Owner.Health.OnDied += OnDie;
            }
        }
Beispiel #7
0
 public DodajSklep(Sklep sklep = null, StaticLine Note = null) : base(Note)
 {
     if (sklep != null)
     {
         this.sklep = sklep;
     }
     Contents.Add(new StaticLine("DODAWANIE SKLEPU"));
     Contents.Add(new ActiveLine("Nazwa: " + this.sklep.nazwa));
     Contents.Add(new ActiveLine("Adres: " + this.sklep.adres));
     Contents.Add(new ActiveLine("Dodaj"));
     Contents.Add(new ActiveLine("Powrót"));
     Contents.Add(this.Note);
 }
Beispiel #8
0
        public void AddContent(string category, ArrayList contents)
        {
            if (!Contents.ContainsKey(category))
            {
                Contents.Add(category, new List <Hashtable>());
            }
            var contentList = Contents[category];

            foreach (var content in contents)
            {
                contentList.Add((Hashtable)content);
            }
        }
Beispiel #9
0
        public void LoadContents(XElement node)
        {
            List <XElement> contents = (from el in node.Elements("contains-item") select el).ToList();

            for (int i = 0; i < contents.Count; i++)
            {
                if (!Contents.ContainsKey(contents[i].Attribute("texture").Value))
                {
                    Contents.Add(contents[i].Attribute("texture").Value, 0);
                }
                Contents[contents[i].Attribute("texture").Value] = (int)contents[i].Attribute("units");
            }
        }
Beispiel #10
0
 /// <summary>
 /// 添加到选择集
 /// </summary>
 /// <param name="entities">实体数组</param>
 public static void AddSelection(IFeature[] entities)
 {
     UnmarkSelection();
     entities.ToList().ForEach(x =>
     {
         if (!Contents.Contains(x))
         {
             Contents.Add(x);
         }
     });
     MarkSelection();
     OnSelectionChanged();
 }
Beispiel #11
0
 public Rejestracja(Sklep sklep, Logowanie logowanie = null, StaticLine Note = null) : base(sklep, Note)
 {
     if (logowanie != null)
     {
         this.logowanie = logowanie;
     }
     Contents.Add(new StaticLine("REJESTRACJA"));
     Contents.Add(new ActiveLine("Login: "******"Hasło: " + this.logowanie.haslo));
     Contents.Add(new ActiveLine("Zarejestruj się"));
     Contents.Add(new ActiveLine("Powrót"));
     Contents.Add(this.Note);
 }
Beispiel #12
0
        private void BuildStepMethodCall(NodeStep step, NodeExamples examples, int exampleIndex)
        {
            // if we have rows and first time thru scenario outline
            if (step.Rows.Count > 0 && exampleIndex == 1) // TODO: remove exampleIndex == 1 if parameterizing table arguments
            {
                _tableNumberInScenario++;

                // TODO: could pass in NodeExamples examples to support parameterizing table arguments
                BuildTestDataTable(step.Rows, Contents);
            }

            Contents.Add(string.Format("\t\t{0};", LanguageConfig.StepMethod(step.Name, BuildParameterString(step.Parameters, step.Rows, examples, exampleIndex))));
        }
Beispiel #13
0
 public Zamawianie(Sklep sklep, Produkt produkt = null, StaticLine note = null) : base(sklep, note)
 {
     if (produkt != null)
     {
         this.produkt = produkt;
     }
     Contents.Add(new StaticLine("ZAMAWIANIE PRODUKTU"));
     Contents.Add(new ActiveLine("Nazwa: " + this.produkt.nazwa));
     Contents.Add(new ActiveLine($"Cena: {this.produkt.cena}zł"));
     Contents.Add(new ActiveLine("Zamów"));
     Contents.Add(new ActiveLine("Powrót"));
     Contents.Add(this.Note);
 }
Beispiel #14
0
 public MessageTemplateModel(NotifyMessageTemplate template)
 {
     if (template == null)
     {
         throw new ArgumentNullException("template");
     }
     Name   = template.Name;
     Remark = template.Remark;
     foreach (string key in template.Contents.Keys)
     {
         Contents.Add(key, template.Contents[key]);
     }
 }
Beispiel #15
0
        /// <summary>
        /// Move an entity into a named container in this
        /// </summary>
        /// <typeparam name="T">the type of the entity to add</typeparam>
        /// <param name="thing">the entity to add</param>
        /// <param name="containerName">the name of the container</param>
        /// <returns>errors</returns>
        public string MoveInto <T>(T thing, string containerName)
        {
            var implimentedTypes = DataUtility.GetAllImplimentingedTypes(typeof(T));

            if (implimentedTypes.Contains(typeof(IInanimate)))
            {
                var obj = (IInanimate)thing;

                if (Contents.Contains(obj, containerName))
                {
                    return("That is already in the container");
                }

                Contents.Add(obj, containerName);
                obj.CurrentLocation = this;
                this.UpsertToLiveWorldCache();
                return(string.Empty);
            }

            if (implimentedTypes.Contains(typeof(IMobile)))
            {
                var obj = (IMobile)thing;

                if (MobilesInside.Contains(obj, containerName))
                {
                    return("That is already in the container");
                }

                MobilesInside.Add(obj, containerName);
                obj.CurrentLocation = this;
                this.UpsertToLiveWorldCache();
                return(string.Empty);
            }

            if (implimentedTypes.Contains(typeof(IPathway)))
            {
                var obj = (IPathway)thing;

                if (Pathways.Contains(obj, containerName))
                {
                    return("That is already in the container");
                }

                Pathways.Add(obj, containerName);
                obj.CurrentLocation = this;
                this.UpsertToLiveWorldCache();
                return(string.Empty);
            }

            return("Invalid type to move to container.");
        }
Beispiel #16
0
 /// <summary>
 /// Move the specified element to this cell.
 /// The element will be removed from any cell it occupies.
 /// TODO: Modify this for multi-cell entities?
 /// </summary>
 /// <param name="element"></param>
 public void PlaceInCell(Element element)
 {
     if (!Contents.Contains(element))
     {
         MapData mD = element.GetData <MapData>(true);
         if (mD.MapCell != null && mD.MapCell.Contents.Contains(element))
         {
             mD.MapCell.RemoveFromCell(element);
         }
         Contents.Add(element);
         mD.MapCell = this;
         NotifyPropertyChanged("Contents"); //TEMP
     }
 }
Beispiel #17
0
        /// <summary>
        /// Add an object to the cache, according to its type.
        /// </summary>
        /// <param name="oSubj"></param>
        /// <returns></returns>
        public virtual bool Add(Object oSubj)
        {
            Type     subjtype = oSubj.GetType();
            TypeList list     = GetTypeList(subjtype);

            if (null == list)
            {
                list          = new TypeList();
                list.TypeName = subjtype.AssemblyQualifiedName;
                Contents.Add(list);
            }
            list.Instances.Add(oSubj);
            return(true);
        }
 public override void OnLoad(ConfigNode node)
 {
     base.OnLoad(node);
     foreach (ConfigNode n in node.GetNodes("PART"))
     {
         Core.Log("Loading part from config:\n" + n);
         Part p = PartLoader.getPartInfoByName(n.GetValue("part"))?.partPrefab;
         p.OnLoad(n);
         Core.Log("Loaded part: " + p?.name + " (" + p?.partInfo?.description + ")");
         Contents.Add(p);
         equippedParts++;
     }
     Core.Log(Contents.Count + " parts loaded.");
 }
Beispiel #19
0
        public void Insert(T item)
        {
            if (InsertInChildNode(item))
            {
                return;
            }

            Contents.Add(item);

            if (!IsPartioned && Contents.Count >= propagationThreshold)
            {
                PartitionNode();
            }
        }
Beispiel #20
0
 public clsZipFileInfo(string ZipFilePath)
 {
     _ZipInformation = new FileInfo(ZipFilePath);
     _Archive        = ZipFile.OpenRead(ZipFilePath);
     _Contents       = new Dictionary <string, clsFileInfo>();
     foreach (ZipArchiveEntry oEntry in Archive.Entries)
     {
         clsFileInfo oFileInfo = new clsFileInfo(oEntry);
         oFileInfo.ExtractedFile = null;
         Contents.Add(oEntry.Name, oFileInfo);
     }
     _IsExtracted         = false;
     _ExtractionDirectory = null;
 }
Beispiel #21
0
 public virtual void Add(ResourceLedger other)
 {
     foreach (var(resource, amount) in other.Contents)
     {
         if (Contents.ContainsKey(resource))
         {
             Contents[resource] += amount;
         }
         else
         {
             Contents.Add(resource, amount);
         }
     }
 }
Beispiel #22
0
        private void Lex()
        {
            int cursor = 0;
            var names  = Enum.GetNames(typeof(TkType)).Intersect(Lexer.GetGroupNames()).ToArray();

            while (cursor != OriginalCode.Length)
            {
                var m = Lexer.Match(OriginalCode, cursor);

                if (!m.Success)
                {
                    Contents.Add(new Token(OriginalCode.Substring(cursor)));
                    return;
                }
                else
                {
                    if (m.Index != cursor)
                    {
                        Contents.Add(new Token(OriginalCode.Substring(cursor, m.Index - cursor)));
                    }

                    cursor = m.Index + m.Length;

                    foreach (var name in names)
                    {
                        var g = m.Groups[name];

                        if (g.Success)
                        {
                            var tokenType = (TkType)Enum.Parse(typeof(TkType), name);

                            if (tokenType == BaseKeywordType)
                            {
                                foreach (var kvp in KeywordTable)
                                {
                                    if (g.Value == kvp.Key)
                                    {
                                        tokenType = kvp.Value;
                                        break;
                                    }
                                }
                            }

                            Contents.Add(new Token(tokenType, g.Value));
                            break;
                        }
                    }
                }
            }
        }
Beispiel #23
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="teamName">Team name</param>
        /// <param name="teamId">Team id</param>
        /// <param name="tagName">Service tag</param>
        public QueryServiceRequest(string teamName, int teamId, string tagName) :
            base("QUERY-SERVICE", teamName, teamId.ToString())
        {
            this.TagName = tagName;

            Contents.Add("SRV");
            Contents.Add(tagName);
            Contents.Add("");
            Contents.Add("");
            Contents.Add("");
            Contents.Add("");
            Contents.Add("");
            Contents.Add(NewRow);
        }
        private void SetPowerUpContents()
        {
            Contents.Clear();

            int powerUpIndex = (int)Random.Generator.Next(_powerUpTextureNames.Count);

            Contents.Add(new Data.SmashBlockItemData()
            {
                TextureName = _powerUpTextureNames[powerUpIndex],
                Count       = 1,
                AffectsItem = Data.SmashBlockItemData.AffectedItem.PowerUp,
                Value       = powerUpIndex
            });
        }
Beispiel #25
0
        private async Task AddStaticDataAsync()
        {
            if (StaticDataAdded)
            {
                return;
            }

            await AddTextEntryAsync("mimetype", "application/epub+zip", CompressionLevel.NoCompression).ConfigureAwait(false);
            await AddTextEntryAsync("META-INF/container.xml", Strings.EpubContainerContent).ConfigureAwait(false);

            Contents.Add(new ItemDescription("nav", "nav.xhtml", "application/xhtml+xml", "nav"));

            StaticDataAdded = true;
        }
Beispiel #26
0
        private void OnShowContents()
        {
            IsContentVisible = !IsContentVisible;

            if (Contents.Any())
            {
                return;
            }

            var dir = Path.Combine(Directory.GetCurrentDirectory(), "downloads");

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            try
            {
                var filePath = Path.Combine(dir, Asset.Name);

                // download
                GitHubUtils.DownloadAssets(App.Settings, Asset.Url, filePath);

                // verify
                if (!File.Exists(filePath))
                {
                    StatusBarManager.StatusLabel.Text = "Could not retrieve contents of the Asset!";
                    return;
                }

                using (var zip = ZipFile.Open(filePath, ZipArchiveMode.Read))
                {
                    foreach (var asset in zip.Entries)
                    {
                        Contents.Add(new AssetViewModel(new AssetObject {
                            Name = asset.Name
                        })
                        {
                            IsContent = true
                        });
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Beispiel #27
0
        public TeamMatchesAdapter(IEnumerable <Team> teams, IEnumerable <Match> matches, IEnumerable <League> leagues, int teamId)
        {
            foreach (var league in leagues)
            {
                ListItems.Add(new ListItem {
                    Index = MainHeaders.Count, Type = 0
                });
                MainHeaders.Add(new HeaderModel {
                    Title = league.Name
                });

                foreach (var match in matches.Where(m => m.LeagueId == league.Id).OrderBy(m => m.Date))
                {
                    ListItems.Add(new ListItem {
                        Index = SubHeaders.Count, Type = 1
                    });
                    SubHeaders.Add(new HeaderModel {
                        Title = match.Round.ToString() + ". forduló"
                    });

                    ListItems.Add(new ListItem {
                        Index = Contents.Count, Type = 2
                    });

                    if (teamId == match.HomeTeamId)
                    {
                        Contents.Add(new MatchResultModel
                        {
                            HomeTeam  = teams.Where(t => t.Id == match.HomeTeamId).First().Name + " ",
                            HomeScore = match.ScoreH.ToString(),
                            AwayTeam  = teams.Where(t => t.Id == match.AwayTeamId).First().Name,
                            AwayScore = match.ScoreA.ToString(),
                            Id        = match.Id
                        });
                    }
                    else
                    {
                        Contents.Add(new MatchResultModel
                        {
                            AwayTeam  = teams.Where(t => t.Id == match.HomeTeamId).First().Name + " ",
                            AwayScore = match.ScoreH.ToString(),
                            HomeTeam  = teams.Where(t => t.Id == match.AwayTeamId).First().Name,
                            HomeScore = match.ScoreA.ToString(),
                            Id        = match.Id
                        });
                    }
                }
            }
        }
 private void CloseNameSpace()
 {
     if (LanguageConfig.UseNamespace)
     {
         if (Contents.Last().Equals(string.Empty))
         {
             Contents.RemoveAt(Contents.Count - 1);
             Contents.Add("}");
         }
         else
         {
             Contents.Add("}");
         }
     }
 }
        internal void AddContent(Content c)
        {
            if (Contents.Contains(c))
            {
                return;
            }

            Contents.Add(c);
            SetDockState();
            if (!c.IsHidden && CountOfVisibleContents == 1)
            {
                ActiveContent = c;
                Refresh();
            }
        }
Beispiel #30
0
        /// <summary>
        /// Draws a card from the draw pile into the hand.
        /// </summary>
        /// <param name="from">Where to draw the card from, top or bottom of the deck.</param>
        /// <returns>This hand (for fluent purposes).</returns>
        public IHand <TElement> Draw(DeckSide side = DeckSide.Top)
        {
            InvalidCheck();
            Contract.Requires(Enum.IsDefined(typeof(DeckSide), side));

            Deck.Events.DrawingInto(this);

            var card = Deck.DrawPileStack.Draw(side);

            Contents.Add(card);

            Deck.Events.DrewInto(this, card);

            return(this);
        }
Beispiel #31
0
        public ActionResult ProfileDetail(string userName)
        {
            ViewBag.VideoHeight = (Request.Browser.IsMobileDevice) ? 100 : 277;
            ViewBag.VideoWidth = (Request.Browser.IsMobileDevice) ? 225 : 400;

            ua = new UserAccount(userName);

            UserAccountDetail uad = new UserAccountDetail();
            uad.GetUserAccountDeailForUser(ua.UserAccountID);

            uad.BandsSeen = ContentLinker.InsertBandLinks(uad.BandsSeen, false);
            uad.BandsToSee = ContentLinker.InsertBandLinks(uad.BandsToSee, false);

            MembershipUser mu = Membership.GetUser();

            ProfileModel model = new ProfileModel();

            if (ua.UserAccountID > 0)
            {
                model.UserAccountID = ua.UserAccountID;
                model.PhotoCount = PhotoItems.GetPhotoItemCountForUser(ua.UserAccountID);
                model.CreateDate = ua.CreateDate;
            }

            if (mu != null)
            {
                ViewBag.IsBlocked = BlockedUser.IsBlockedUser(ua.UserAccountID, Convert.ToInt32(mu.ProviderUserKey));
                ViewBag.IsBlocking = BlockedUser.IsBlockedUser(Convert.ToInt32(mu.ProviderUserKey), ua.UserAccountID);

                if (ua.UserAccountID == Convert.ToInt32(mu.ProviderUserKey))
                {
                    model.IsViewingSelf = true;
                }
                else
                {
                    UserConnection ucon = new UserConnection();

                    ucon.GetUserToUserConnection(Convert.ToInt32(mu.ProviderUserKey), ua.UserAccountID);

                    model.UserConnectionID = ucon.UserConnectionID;

                    if (BlockedUser.IsBlockedUser(Convert.ToInt32(mu.ProviderUserKey), ua.UserAccountID))
                    {
                        return RedirectToAction("index", "home");
                    }

                }
            }
            else
            {

                if (uad.MembersOnlyProfile)
                {
                    return RedirectToAction("Account", "LogOn");
                }

            }

            //
            model.UserName = ua.UserName;
            model.CreateDate = ua.CreateDate;
            model.LastActivityDate = ua.LastActivityDate;
            //
            model.DisplayAge = uad.DisplayAge;
            model.Age = uad.YearsOld;
            model.BandsSeen = uad.BandsSeen;
            model.BandsToSee = uad.BandsToSee;
            model.HardwareAndSoftwareSkills = uad.HardwareSoftware;
            model.MessageToTheWorld = uad.AboutDescription;

            model.YouAreFull = uad.Sex;
            model.InterestedInFull = uad.InterestedFull;
            model.RelationshipStatusFull = uad.RelationshipStatusFull ;
            model.RelationshipStatus = uad.RelationshipStatus;
            model.InterestedIn = uad.InterestedIn;
            model.YouAre = uad.YouAre;

            model.Website = uad.ExternalURL;
            model.CountryCode = uad.Country;
            model.CountryName = uad.CountryName;
            model.IsBirthday = uad.IsBirthdayToday;
            model.ProfilePhotoMain = uad.FullProfilePicURL;
            model.ProfilePhotoMainThumb = uad.FullProfilePicThumbURL;
            model.DefaultLanguage = uad.DefaultLanguage;

            model.EnableProfileLogging = uad.EnableProfileLogging;
            model.Handed = uad.HandedFull;
            model.RoleIcon = uad.SiteBages;

            //
            StatusUpdate su = new StatusUpdate();
            su.GetMostRecentUserStatus(ua.UserAccountID);

            if (su.StatusUpdateID > 0)
            {
                model.LastStatusUpdate = su.CreateDate;
                model.MostRecentStatusUpdate = su.Message;
            }

            model.ProfileVisitorCount = ProfileLog.GetUniqueProfileVisitorCount(ua.UserAccountID);

            PhotoItems ptiems = new PhotoItems();
            ptiems.GetUserPhotos(ua.UserAccountID);

            if (ptiems.Count > 0)
            {
                ptiems.Sort((PhotoItem x, PhotoItem y) => (y.CreateDate.CompareTo(x.CreateDate)));

                PhotoItems ptiemsDisplay = new PhotoItems();

                int maxPhotos = 8;

                foreach (PhotoItem pitm1 in ptiems)
                {
                    pitm1.UseThumb = true;
                    if (ptiemsDisplay.Count < maxPhotos)
                    {
                        ptiemsDisplay.Add(pitm1);
                    }
                    else break;
                }

                ptiemsDisplay.UseThumb = true;
                ptiemsDisplay.ShowTitle = false;

                model.HasMoreThanMaxPhotos = (ptiems.Count > maxPhotos);
                ptiemsDisplay.IsUserPhoto = true;
                model.PhotoItems = ptiemsDisplay.ToUnorderdList;
            }

            Contents conts = new Contents();

            conts.GetContentForUser(ua.UserAccountID);

            model.NewsCount = conts.Count;

            if (conts.Count > 0)
            {
                conts.Sort((Content x, Content y) => (y.ReleaseDate.CompareTo(x.ReleaseDate)));

                Contents displayContents = new Contents();
                int maxCont = 1;
                int currentCount = 0;
                foreach (Content ccn1 in conts)
                {
                    currentCount++;
                    if (maxCont >= currentCount)
                    {
                        displayContents.Add(ccn1);
                    }
                    else break;
                }

                displayContents.IncludeStartAndEndTags = false;

                model.NewsArticles = displayContents.ToUnorderdList;

            }

            model.MetaDescription = ua.UserName + " " + BootBaronLib.Resources.Messages.Profile + " " + FromDate.DateToYYYY_MM_DD(ua.LastActivityDate);

            // playlist
            BootBaronLib.AppSpec.DasKlub.BOL.Playlist plyst = new Playlist();

            plyst.GetUserPlaylist(ua.UserAccountID);

            if (plyst.PlaylistID > 0 && PlaylistVideos.GetCountOfVideosInPlaylist(plyst.PlaylistID) > 0)
            {
                ViewBag.AutoPlay = plyst.AutoPlay;
                ViewBag.AutoPlayNumber = (plyst.AutoPlay) ? 1 : 0;
                ViewBag.UserPlaylistID = plyst.PlaylistID;
            }

            if (uad.UserAccountID > 0)
            {
                model.Birthday = uad.BirthDate;

                if (uad.ShowOnMapLegal)
                {

                    byte[] myarray2 = Encoding.Unicode.GetBytes(string.Empty);

                    // because of the foreign cultures, numbers need to stay in the English version unless a javascript encoding could be added
                    string currentLang = Utilities.GetCurrentLanguageCode();

                    Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(SiteEnums.SiteLanguages.EN.ToString());
                    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(SiteEnums.SiteLanguages.EN.ToString());

                    Encoding iso = Encoding.GetEncoding("ISO-8859-1");
                    Encoding utf8 = Encoding.UTF8;

                    model.DisplayOnMap = uad.ShowOnMapLegal;

                    Random rnd = new Random();
                    int offset = rnd.Next(10, 100);

                    SiteStructs.LatLong latlong = GeoData.GetLatLongForCountryPostal(uad.Country, uad.PostalCode);

                    if (latlong.latitude != 0 && latlong.longitude != 0)
                    {
                        model.Latitude = Convert.ToDecimal(latlong.latitude + Convert.ToDouble("0.00" + offset)).ToString();
                        model.Longitude = Convert.ToDecimal(latlong.longitude + Convert.ToDouble("0.00" + offset)).ToString();
                    }
                    else
                    {
                        model.DisplayOnMap = false;
                    }

                    Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(currentLang);
                    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(currentLang);
                }

                ViewBag.ThumbIcon = uad.FullProfilePicThumbURL;

                LoadCurrentImagesViewBag(uad.UserAccountID);
            }

            ViewBag.UserAccountDetail = uad;
            ViewBag.UserAccount = ua;

            UserConnections ucons = new UserConnections();
            ucons.GetUserConnections(ua.UserAccountID);
            ucons.Shuffle();

            UserAccounts irlContacts = new UserAccounts();
            UserAccounts CyberAssociates = new UserAccounts();
            UserAccount userCon = null;

            foreach (UserConnection uc1 in ucons)
            {
                if (!uc1.IsConfirmed) continue;

                switch (uc1.StatusType)
                {
                    case 'C':
                        if (CyberAssociates.Count >= maxcountusers) continue;

                        if (uc1.ToUserAccountID != ua.UserAccountID)
                        {
                            userCon = new UserAccount(uc1.ToUserAccountID);
                        }
                        else
                        {
                            userCon = new UserAccount(uc1.FromUserAccountID);
                        }
                        CyberAssociates.Add(userCon);
                        break;
                    case 'R':
                        if (irlContacts.Count >= maxcountusers) continue;

                        if (uc1.ToUserAccountID != ua.UserAccountID)
                        {
                            userCon = new UserAccount(uc1.ToUserAccountID);
                        }
                        else
                        {
                            userCon = new UserAccount(uc1.FromUserAccountID);
                        }
                        irlContacts.Add(userCon);
                        break;
                    default:
                        break;
                }
            }

            if (irlContacts.Count > 0)
            {
                model.IRLFriendCount = irlContacts.Count;
            }

            if (CyberAssociates.Count > 0)
            {
                // ViewBag.CyberAssociatesCount = Convert.ToString( CyberAssociates.Count );
                model.CyberFriendCount = CyberAssociates.Count;
            }

            mu = Membership.GetUser();
            UserAccountDetail uadLooker = null;

            if (mu != null)
            {
                uadLooker = new UserAccountDetail();
                uadLooker.GetUserAccountDeailForUser(Convert.ToInt32(mu.ProviderUserKey));
            }

            if (mu != null && ua.UserAccountID > 0 &&
                uadLooker.EnableProfileLogging && uad.EnableProfileLogging)
            {
                ProfileLog pl = new ProfileLog();

                pl.LookedAtUserAccountID = ua.UserAccountID;
                pl.LookingUserAccountID = Convert.ToInt32(mu.ProviderUserKey);

                if (pl.LookingUserAccountID != pl.LookedAtUserAccountID) pl.Create();

                ArrayList al = ProfileLog.GetRecentProfileViews(ua.UserAccountID);

                if (al != null && al.Count > 0)
                {
                    UserAccounts uas = new UserAccounts();

                    UserAccount viewwer = null;

                    foreach (int ID in al)
                    {
                        viewwer = new UserAccount(ID);
                        if (!viewwer.IsLockedOut && viewwer.IsApproved)
                        {
                            if (uas.Count >= maxcountusers) break;

                            uas.Add(viewwer);
                        }
                    }

                   // model.ViewingUsers = uas.ToUnorderdList;
                }
            }

            UserAccountVideos uavs = null;

            if (ua.UserAccountID > 0)
            {
                uavs = new UserAccountVideos();

                uavs.GetRecentUserAccountVideos(ua.UserAccountID, 'F');

                if (uavs.Count > 0)
                {
                    Videos favvids = new Videos();
                    Video f1 = new Video();

                    foreach (UserAccountVideo uav1 in uavs)
                    {
                        f1 = new Video(uav1.VideoID);
                        if (f1.IsEnabled) favvids.Add(f1);
                    }

                    SongRecord sng1 = null;
                    SongRecords sngrcds2 = new SongRecords();

                    foreach (Video v1 in favvids)
                    {
                        sng1 = new SongRecord(v1);
                        sngrcds2.Add(sng1);
                    }

                    sngrcds2.IsUserSelected = true;

                    ViewBag.UserFavorites = sngrcds2.VideosList();//.ListOfVideos();
                }
            }

            // this is either a youtube user or this is a band
            Artist art = new Artist(  );
            art.GetArtistByAltname(userName);

            if (art.ArtistID > 0)
            {
                // try this way for dashers
                model.UserName = art.Name;
            }

            Videos vids = new Videos();
            SongRecords sngrs = new SongRecords();

            if (art.ArtistID == 0)
            {
                vids.GetAllVideosByUser(userName);

                uavs = new UserAccountVideos();
                uavs.GetRecentUserAccountVideos(ua.UserAccountID, 'U');

                Video f2 = null;

                foreach (UserAccountVideo uav1 in uavs)
                {
                    f2 = new Video(uav1.VideoID);

                    if (!vids.Contains(f2)) vids.Add(f2);
                }

                vids.Sort((Video x, Video y) => (y.PublishDate.CompareTo(x.PublishDate)));

                model.UserName = userName;

            }
            else
            {
                // photo
                ArtistProperty aprop = new ArtistProperty();
                aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.PH.ToString());

                if (!string.IsNullOrEmpty(aprop.PropertyContent))
                {
                    ViewBag.ArtistPhoto = System.Web.VirtualPathUtility.ToAbsolute(aprop.PropertyContent);
                    ViewBag.ThumbIcon = System.Web.VirtualPathUtility.ToAbsolute(aprop.PropertyContent);
                }

                // meta descriptione
                aprop = new ArtistProperty();
                aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.MD.ToString());
                if (!string.IsNullOrEmpty(aprop.PropertyContent)) ViewBag.MetaDescription = aprop.PropertyContent;

                // description
                aprop = new ArtistProperty();
                aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.LD.ToString());
                if (!string.IsNullOrEmpty(aprop.PropertyContent)) ViewBag.ArtistDescription = ContentLinker.InsertBandLinks(aprop.PropertyContent, false);

                #region rss
                ///// rss
                //RssResources rssrs = new RssResources();

                //rssrs.GetArtistRssResource(art.ArtistID);

                //if (rssrs.Count > 0)
                //{
                //    RssItems ritems = new RssItems();
                //    RssItems ritemsOUT = new RssItems();

                //    foreach (RssResource rssre in rssrs)
                //    {
                //        ritems.GetTopRssItemsForResource(rssre.RssResourceID);
                //        //ritm = new RssItem(rssre..ArtistID);
                //    }

                //    ritems.Sort((RssItem x, RssItem y) => (y.PubDate.CompareTo(x.PubDate)));

                //    foreach (RssItem ritm in ritems)
                //    {
                //        if (ritemsOUT.Count < 10)
                //        {
                //            ritemsOUT.Add(ritm);
                //        }
                //    }

                //    ViewBag.ArtistNews = ritemsOUT.ToUnorderdList;
                //}
                //else
                //{
                //    ViewBag.ArtistNews = null;
                //}

                //ViewBag.DisplayName = art.DisplayName;
                #endregion

                Songs sngss = new Songs();

                sngss.GetSongsForArtist(art.ArtistID);

                SongRecord snrcd = new SongRecord();

                foreach (Song sn1 in sngss)
                {
                    vids.GetVideosForSong(sn1.SongID);
                }
            }

            vids.Sort(delegate(Video p1, Video p2)
            {
                return p2.PublishDate.CompareTo(p1.PublishDate);
            });

            foreach (BootBaronLib.AppSpec.DasKlub.BOL.Video v1 in vids)
            {
                sngrs.Add(new SongRecord(v1));
            }

            if (mu != null && ua.UserAccountID != Convert.ToInt32(mu.ProviderUserKey))
            {
                UserConnection uc1 = new UserConnection();

                uc1.GetUserToUserConnection(ua.UserAccountID, Convert.ToInt32(mu.ProviderUserKey));

                if (uc1.UserConnectionID > 0)
                {

                    switch (uc1.StatusType)
                    {
                        case 'C':
                            if (uc1.IsConfirmed)
                            {
                                model.IsCyberFriend = true;
                            }
                            else
                            {
                                model.IsWatingToBeCyberFriend = true;
                            }
                            break;
                        case 'R':
                            if (uc1.IsConfirmed)
                            {
                                model.IsRealFriend = true;
                            }
                            else
                            {
                                model.IsWatingToBeRealFriend = true;
                            }
                            break;
                        default:
                            model.IsDeniedCyberFriend = true;
                            model.IsDeniedRealFriend = true;
                            break;
                    }
                }
            }

            if (sngrs == null || sngrs.Count == 0 && art.ArtistID == 0 && ua.UserAccountID == 0)
            {
                // no longer exists
                Response.RedirectPermanent("/");
                return new EmptyResult();
            }

            //sngrs.Sort((SongRecord x, SongRecord y) => (y.cre.CompareTo(x.CreateDate)));

            SongRecords sngDisplay = new SongRecords();

            Video vidToShow = null;

            foreach (SongRecord sr1 in sngrs)
            {
                vidToShow = new Video(sr1.VideoID);

                if (vidToShow.IsEnabled)
                {
                    sngDisplay.Add(sr1);
                }
            }

            model.SongRecords = sngDisplay.VideosList();

            return View(model);
        }
Beispiel #32
0
        private void GetUserNews(ProfileModel model)
        {
            var conts = new Contents();

            conts.GetContentForUser(_ua.UserAccountID);

            var userNews = new List<Content>();

            foreach(var newsItem in conts)
            {
                if (newsItem.IsLive) userNews.Add(newsItem);
            }

            model.NewsCount = userNews.Count;

            if (userNews.Count > 0)
            {
                userNews.Sort((x, y) => (y.ReleaseDate.CompareTo(x.ReleaseDate)));

                var displayContents = new Contents();
                const int maxCont = 1;
                int currentCount = 0;

                foreach (Content ccn1 in userNews)
                {
                    if (maxCont > currentCount)
                    {
                        if (ccn1.ReleaseDate >= DateTime.UtcNow) continue;

                        currentCount++;
                        displayContents.Add(ccn1);
                    }
                    else break;
                }

                displayContents.IncludeStartAndEndTags = false;

                model.NewsArticles = displayContents.ToUnorderdList;
            }
        }