Example #1
0
 public string GetContributorNamesByRolePretty(ContributorRole role)
 {
     return(string.Join(", ", Contributors
                        .Where(c => c.Role == role)
                        .Select(c => c.Contributor.GetFullName()))
            .TrimEnd(new char[] { ',', ' ' }));
 }
Example #2
0
        public ActionResult UpdatePerson(Contributors contributor)
        {
            DataBase db = new DataBase(Settings.Default.ConStr);

            db.UpdateContributor(contributor);
            return(Redirect("/"));
        }
Example #3
0
        private int ScoreRB(
            Round round,
            Player starter,
            Player backup)
        {
            var starterPts = RushingStats(
                starter,
                round,
                "RB");
            int pts;

            if (starterPts > 0)
            {
                pts            = starterPts;
                starter.Points = pts;
                Contributors.Add(starter);
            }
            else
            {
                pts = RushingStats(
                    backup,
                    round,
                    "RB");
                backup.Points = pts;
                Contributors.Add(backup);
            }
            return(pts);
        }
        private void OnLoaded()
        {
            var mainAssembly         = Assembly.GetEntryAssembly();
            var attributes           = mainAssembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false);
            var fileVersionAttribute = attributes.Length > 0 ? attributes[0] as AssemblyFileVersionAttribute : null;

            VersionText.Text = fileVersionAttribute?.Version;
            Contributors.Sort((kv1, kv2) => string.CompareOrdinal(kv1.Key, kv2.Key));
            foreach (var contributor in Contributors)
            {
                if (!string.IsNullOrEmpty(contributor.Value))
                {
                    var hyperlink = new Hyperlink();
                    hyperlink.Inlines.Add(contributor.Key);
                    hyperlink.CommandParameter = contributor.Value;
                    ContributorsBlock.Inlines.Add(hyperlink);
                }
                else
                {
                    var run = new Run();
                    run.Text = contributor.Key;
                    ContributorsBlock.Inlines.Add(run);
                }
                ContributorsBlock.Inlines.Add(", ");
            }
        }
Example #5
0
        /// <summary>
        /// Reads the JSON representation of the object.
        /// </summary>
        /// <param name="reader">The <see cref="Newtonsoft.Json.JsonReader"/> to read from.</param>
        /// <param name="objectType">The <see cref="System.Type"/> of the object.</param>
        /// <param name="existingValue">The existing value of object being read.</param>
        /// <param name="serializer">The calling serializer.</param>
        /// <returns>The object value.</returns>
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            switch(reader.TokenType)
            {
                case JsonToken.Integer:
                    return new Contributors { Id = (long)reader.Value };
                case JsonToken.StartObject:
                    reader.Read();
                    var value = new Contributors();
                    while(reader.TokenType != JsonToken.EndObject)
                    {
                        if(reader.TokenType != JsonToken.PropertyName)
                            throw new FormatException("The format of this object is wrong");

                        switch((string)reader.Value)
                        {
                            case "id":
                                value.Id = (long)reader.ReadAsDecimal();
                                break;
                            case "screen_name":
                                value.ScreenName = reader.ReadAsString();
                                break;
                            default:
                                reader.Read();
                                break;
                        }
                        reader.Read();
                    }
                    return value;
            }

            throw new InvalidOperationException("This object is not a Contributors");
        }
Example #6
0
        private int ScoreRec(
            Round round,
            Player starter,
            Player backup)
        {
            var starterPts = ReceivingStats(
                starter,
                round,
                string.Empty);
            int pts;

            if (starterPts > 0)
            {
                pts            = starterPts;
                starter.Points = pts;
                Contributors.Add(starter);
            }
            else
            {
                pts = ReceivingStats(
                    backup,
                    round,
                    string.Empty);
                backup.Points = pts;
                Contributors.Add(backup);
            }
            return(pts);
        }
        /// <summary>
        /// Reads the JSON representation of the object.
        /// </summary>
        /// <param name="reader">The <see cref="Newtonsoft.Json.JsonReader"/> to read from.</param>
        /// <param name="objectType">The <see cref="System.Type"/> of the object.</param>
        /// <param name="existingValue">The existing value of object being read.</param>
        /// <param name="serializer">The calling serializer.</param>
        /// <returns>The object value.</returns>
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            switch(reader.TokenType)
            {
                case JsonToken.Integer:
                    return new Contributors { Id = (long)reader.Value };
                case JsonToken.StartObject:
                    reader.Read();
                    var value = new Contributors();
                    while(reader.TokenType != JsonToken.EndObject)
                    {
                        if(reader.TokenType != JsonToken.PropertyName)
                            throw new FormatException("The format of this object is wrong");

                        switch((string)reader.Value)
                        {
                            case "id":
                                value.Id = (long)reader.ReadAsDecimal();
                                break;
                            case "screen_name":
                                value.ScreenName = reader.ReadAsString();
                                break;
                            default:
                                reader.Read();
                                break;
                        }
                        reader.Read();
                    }
                    return value;
            }

            throw new InvalidOperationException("This object is not a Contributors");
        }
Example #8
0
        /// <summary>
        ///   This is only ever required after pulling values out of the AtomFeed XML, and is done automatically.
        /// </summary>
        private void SyncToModel()
        {
            // Model.ProductCode = Id;
            Model.PackageDetails.SummaryDescription = Summary.Text;
            Model.PackageDetails.PublishDate        = PublishDate.DateTime;

            var pub = Authors.FirstOrDefault();

            if (pub != null)
            {
                Model.PackageDetails.Publisher = new Identity {
                    Name                             = pub.Name,
                    Location                         = pub.Uri != null?pub.Uri.ToUri() : null,
                                               Email = pub.Email
                };
            }

            Model.PackageDetails.Contributors = Contributors.Select(each => new Identity {
                Name     = each.Name,
                Location = each.Uri.ToUri(),
                Email    = each.Email,
            }).ToXList();

            Model.PackageDetails.Tags       = Categories.Where(each => each.Scheme == "/Tags").Select(each => each.Name).ToXList();
            Model.PackageDetails.Categories = Categories.Where(each => each.Scheme == "/Categories").Select(each => each.Name).ToXList();

            var content = (Content as TextSyndicationContent);

            Model.PackageDetails.Description = content == null ? string.Empty : content.Text;

            Model.PackageDetails.CopyrightStatement = Copyright == null ? string.Empty : Copyright.Text;

            Model.Locations = Links.Select(each => each.Uri.AbsoluteUri.ToUri()).Distinct().ToXList();
        }
Example #9
0
 public bool AddPerson(IPerson person)
 {
     if (person is IContributor contributor)
     {
         Contributors.Add(contributor);
     }
     return(true);
 }
Example #10
0
 public bool RemovePerson(IPerson person)
 {
     if (person is IContributor contributor)
     {
         Contributors.Remove(contributor);
     }
     return(true);
 }
Example #11
0
        public override object Get()
        {
            var values = Contributors.Select(binding => binding.Get());
            var ctor   = setCtor.Value;
            var set    = ctor.Invoke(new object[] { values });

            return(set);
        }
        public ActionResult Join(int?id)
        {
            var status = false;

            if (id == null)
            {
                return(RedirectToAction("Login", "User"));
            }
            else
            {
                string userRole = GetUserRole();
                var    date     = DateTime.Now;
                int    userID   = GetUserID();
                var    user     = db.User.Where(u => u.recordID == userID).FirstOrDefault();
                var    ticket   = db.Ticket.Where(t => t.recordID == id).FirstOrDefault();

                //Preparing viewmodel
                var viewModel = new ViewModelBase
                {
                    user = user
                };

                //Check if he already exists as a contributor
                var cont = db.Contributors.Where(c => c.User.recordID == user.recordID).FirstOrDefault();
                if (cont != null)
                {
                    ViewBag.Status  = false;
                    ViewBag.Message = "It seems that you've already sent a request for this ticket. Please be patient.";
                    return(View(viewModel));
                }

                //Add a new contributor
                var contributor = new Contributors
                {
                    status = "Pending",
                    Role   = userRole,
                    User   = user,
                    Ticket = ticket
                };
                db.Contributors.Add(contributor);

                //Add a comment in the ticket about the contributor being added
                var commnets = new Comments
                {
                    Ticket      = ticket,
                    CommentDate = date,
                    Content     = user.firstName + " " + user.lastName + " wants to join the ticket. Go to the members of the ticket to take further action."
                };
                db.Comments.Add(commnets);
                db.SaveChanges();
                status          = true;
                ViewBag.Status  = status;
                ViewBag.Message = "Your request has been sent. You will be notified once any action is taken.";

                return(View(viewModel));
            }
        }
Example #13
0
 /// <summary>
 /// This constructor gets called by the public constructor and the XmlSerializer on deserialization
 /// </summary>
 private ComparisonData()
 {
     // initialize some of our member properties
     NumeratorProfiles   = new Contributors();
     DenominatorProfiles = new Contributors();
     ComparisonAlleles   = new Dictionary <int, Dictionary <string, string> >();
     KnownsAlleles       = new Dictionary <int, Dictionary <string, string> >();
     EvidenceAlleles     = new Dictionary <string, Dictionary <int, string> >();
 }
Example #14
0
 protected async Task RunPipeline(Type callGraphGeneratorType)
 {
     var pipeline = CreatePipeline(callGraphGeneratorType, Contributors.Concat(new[]
     {
         typeof(RequestResponseDisposer),
         typeof(PostExecuteMarkerContributor)
     }).ToArray(), opt => opt.OpenRasta.Pipeline.Validate = false);
     await pipeline.RunAsync(Context);
 }
Example #15
0
 public void Add_ProjectContributor(ProjectContributor model)
 {
     if (!Contributors.Any(c => c.UserId == model.UserId))
     {
         Contributors.Add(model);
         AddDomainEvent(new ProjectJoinedDomainEvent {
             ProjectContributor = model, Avatar = this.Avatar, Name = this.Avatar
         });
     }
 }
Example #16
0
 public void AddContributor(ProjectContributor contributor)
 {
     if (!Contributors.Any(v => v.UserId == UserId))
     {
         Contributors.Add(contributor);
         AddDomainEvent(new ProjectJoinedEvent {
             Contributor = contributor
         });
     }
 }
Example #17
0
 private void SpoolSuccessMessage()
 {
     if (Contributors.Count == 1)
     {
         TwitchClientManager.SpoolMessage($"@{Contributors.Single()} Nice {Border} jimbox! peepoClap");
     }
     else
     {
         TwitchClientManager.SpoolMessage($"@{String.Join(", @", Contributors)} Nice {Border} jimbox! Hooray teamwork! peepoClap");
     }
 }
Example #18
0
        public void AddContributor(ProjectContributor contributor)
        {
            if (!Contributors.Any(v => v.UserId == contributor.UserId))
            {
                Contributors.Add(contributor);

                AddDomainEvent(new ProjectJoinedEvent {
                    Contributor = contributor, Avatar = Avatar, Company = Company, Introduction = Introduction
                });
            }
        }
Example #19
0
        public void AddContributor(ProjectContributors contributors)
        {
            if (Contributors.All(v => v.UserId != UserId))
            {
                Contributors.Add(contributors);

                AddDomainEvent(new ProjectJoinedEvent()
                {
                    Contributors = contributors
                });
            }
        }
Example #20
0
 public void AddContributor(ProjectContributor contributor)
 {
     if (!Contributors.Any(v => v.UserId == UserId))
     {
         Contributors.Add(contributor);
         AddDomainEvent(new ProjectJoinedEvent {
             Company      = this.Company,
             Introduction = this.Introduction,
             contributor  = contributor
         });
     }
 }
Example #21
0
 public void AddContributor(ProjectContributor contributor)
 {
     if (!Contributors.Any(v => v.Id == contributor.Id))
     {
         this.AddDomainEvent(new ProjectJoinedEvent {
             Contributor    = contributor
             , Company      = this.Company
             , Introduction = this.Introduction
             , Avatar       = this.Avatar
         });
         Contributors.Add(contributor);
     }
 }
Example #22
0
        public void TwitchClient_OnMessageReceived(Object sender, OnMessageReceivedArgs e)
        {
            String cleanMessage = e.ChatMessage.Message.Trim(' ', Data.InvisibleCharacter);

            String[] tokens = cleanMessage.Split(' ');

            if (tokens.Length < 4)
            {
                CurrentStage = JimboxStage.None;
                return;
            }

            if (IsTop(tokens))
            {
                // Differentiate between top and bottom.
                if (CurrentStage == JimboxStage.Mouth)
                {
                    // We are at the bottom and have completed the jimbox.
                    CurrentStage = JimboxStage.Bottom;
                    Contributors.Add(e.ChatMessage.DisplayName);
                    SpoolSuccessMessage();
                    Border = null;
                    Contributors.Clear();
                }
                else
                {
                    // We just started a new jimbox.
                    CurrentStage = JimboxStage.Top;
                    Border       = tokens[0];
                    Contributors.Clear();
                    Contributors.Add(e.ChatMessage.DisplayName);
                }
            }
            else if (CurrentStage == JimboxStage.Top && IsEyes(tokens))
            {
                CurrentStage = JimboxStage.Eyes;
                Contributors.Add(e.ChatMessage.DisplayName);
            }
            else if (CurrentStage == JimboxStage.Eyes && IsMouth(tokens))
            {
                CurrentStage = JimboxStage.Mouth;
                Contributors.Add(e.ChatMessage.DisplayName);
            }
            else
            {
                CurrentStage = JimboxStage.None;
                Border       = null;
                Contributors.Clear();
            }
        }
Example #23
0
 public void AddContributor(ProjectContributor contributor)
 {
     if (Contributors.Any(v => v.UserId == contributor.UserId))
     {
         Contributors.Add(contributor);
         AddDomainEvent(new ProjectJoninedEvnet
         {
             Avatar       = this.Avatar,
             Company      = this.Company,
             Introduction = this.Introduction,
             Contributor  = contributor
         });
     }
 }
Example #24
0
        public ActionResult AddContributor(Contributors contributor, Deposits deposit)
        {
            DataBase db = new DataBase(Settings.Default.ConStr);

            db.AddContributor(contributor);
            Deposits d = new Deposits
            {
                ContributorsId = contributor.Id,
                Amount         = deposit.Amount,
                Date           = contributor.Date
            };

            db.Deposit(d);
            return(Redirect("/"));
        }
Example #25
0
        /// <summary>
        /// 添加项目贡献者
        /// </summary>
        /// <param name="projectContributor"></param>
        public void AddContributor(ProjectContributor projectContributor)
        {
            //如果不在查看列表中,需添加
            if (!Contributors.Any(b => b.UserId == projectContributor.UserId))
            {
                Contributors.Add(projectContributor);

                //添加 参与项目事件
                AddDomainEvent(new ProjectJoinEvent {
                    Company            = this.Company,
                    Introduction       = this.Introduction,
                    Avatar             = this.Avatar,
                    ProjectContributor = projectContributor
                });
            }
        }
Example #26
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            ContributorModel tachiProfile = new ContributorModel()
            {
                Name          = "Tachibana Yui",
                ProfilePicure = "https://avatars3.githubusercontent.com/u/33594017",
                Role          = "Project Owner",
                Description   = "Hello, my name is Tachibana Yui and thank you for choosing Fschool Auto Feedback Windows 10 Edition. I am a hobbyist programmer for some reason also love Japanese cultures. I came to the programming world after watching an anime series called \"Sword Art Online\" after that, I always want to create my dream game. I have 3.5 years of experience working with .NET and C# technology. In recent years, I have created a few programs, automated tools to improve overall watching anime experience. It comprises of 3 projects, but unfortunately, 2 of them are discontinued due to lack of maintainability. If you are interested in this application, please check out \"Universal Anime Downloader\" in my Github Page. In the past few months, I also curious about Minecraft mod development, so I also have a quick dive into Java programming language and created a program called \"MineCLIA\" or Minecraft Command Line Automation. It lets you send commands to Minecraft client via command line or socket. Check it out on my GitHub page.",
                Link          = "https://github.com/quangaming2929",
            };

            Contributors.Add(tachiProfile);

            FeatureModel fbWoHassle = new FeatureModel()
            {
                Glyph  = "\uE899",
                Title  = "Quickly feedback without hassle",
                Detail = "Fschool auto feedback windows 10 edition help you feedback without the need to painstakingly go through each teacher. You can feedback all teacher with a few simple click"
            };

            FeatureModel fbSpeed = new FeatureModel()
            {
                Glyph  = "\uEC4A",
                Title  = "Blazing fast speed",
                Detail = "With batch feedback, you can feedback all teacher significantly faster when you feedback on the offical website. Fschool auto feedback windows 10 edition can feedback 10 teachers per second after you hit send (actual speed may vary)"
            };

            FeatureModel fbLogin = new FeatureModel()
            {
                Glyph  = "\uE779",
                Title  = "Login with ease",
                Detail = "Unlike fschool.fpt.edu.vn where you need to login each time you visit the site. This program only requires you to login once, all the authorization is done automatically until you sign out or revoke the program access"
            };

            FeatureModel fbUsability = new FeatureModel()
            {
                Glyph  = "\uE8CB",
                Title  = "Advanced filtering",
                Detail = "Fschool Autofeedback windows 10 edition is highly customizable. You can search teacher like in offical website but you also can filter, exclude who will be feedback. Save a draft to feedback later,...  "
            };

            Features.Add(fbWoHassle);
            Features.Add(fbSpeed);
            Features.Add(fbLogin);
            Features.Add(fbUsability);
        }
Example #27
0
        public ProjectRegistration(Project project)
        {
            Name        = project.Name;
            OldName     = project.Name;
            Description = project.Description;
            Owner       = project.Owner;

            foreach (var item in project.UserProjects)
            {
                Contributors.Add(item.User);
            }

            foreach (var item in project.ProjectCategories)
            {
                Categories.Add(item.Category);
            }
        }
        /////////////////////////////////////////////////////////////////////////////

        #endregion

        //////////////////////////////////////////////////////////////////////

        /// <summary>given a stream, parses it to construct the Feed object out of it</summary>
        /// <param name="stream"> a stream representing hopefully valid XML</param>
        /// <param name="format"> indicates if the stream is Atom or Rss</param>
        //////////////////////////////////////////////////////////////////////
        public void Parse(Stream stream, AlternativeFormat format)
        {
            Tracing.TraceCall("parsing stream -> Start:" + format.ToString());
            BaseFeedParser feedParser = null;

            // make sure we reset our collections
            Authors.Clear();
            Contributors.Clear();
            Links.Clear();
            Categories.Clear();

            feedParser = new AtomFeedParser(this);

            // create a new delegate for the parser
            feedParser.NewAtomEntry        += new FeedParserEventHandler(OnParsedNewEntry);
            feedParser.NewExtensionElement += new ExtensionElementEventHandler(OnNewExtensionElement);
            feedParser.Parse(stream, this);

            Tracing.TraceInfo("Parsing stream -> Done");
            // done parsing
        }
Example #29
0
        async void OnLogin(PlayerPostLoginEventArgs e)
        {
            try
            {
                Contributor con = await Contributors.GetAsync(e.Player.User.ID);

                if (con != null)
                {
                    // Start listening to events
                    con.Listen(this, e.Player);

                    // Store the contributor object
                    e.Player.SetData(Contributor.DataKey, con);

                    await con.UpdateNotifications();
                }
            }
            catch
            {
                // Catch any exception that is thrown here to prevent pointless error messages
            }
        }
Example #30
0
        public ActionResult Create(ProposalIdeaFieldViewModel proposalIdeaFieldViewModel)
        {
            try
            {
                // TODO: Add insert logic here
                using (TicketingApp db = new TicketingApp())
                {
                    proposalIdeaFieldViewModel.AllFields     = db.Fields.ToList();
                    proposalIdeaFieldViewModel.AllSupervisor = db.Supervisor.ToList();

                    int userID = GetUserID();
                    var user   = db.User.Where(u => u.recordID == userID).FirstOrDefault();
                    var idea   = new Idea
                    {
                        title       = proposalIdeaFieldViewModel.proposal.nameOfProject,
                        description = proposalIdeaFieldViewModel.proposal.abstrac,
                        type        = proposalIdeaFieldViewModel.idea.type,
                        field       = proposalIdeaFieldViewModel.idea.field,
                        User        = user
                    };
                    db.Idea.Add(idea);
                    db.SaveChanges();
                    int ideaRecordId = idea.recordID;
                    var ideaCreated  = db.Idea.Where(i => i.recordID == ideaRecordId).FirstOrDefault();
                    proposalIdeaFieldViewModel.proposal.User = user;
                    proposalIdeaFieldViewModel.proposal.Idea = ideaCreated;
                    db.Proposal.Add(proposalIdeaFieldViewModel.proposal);

                    var ticket = new Ticket
                    {
                        title         = proposalIdeaFieldViewModel.proposal.nameOfProject,
                        status        = "Pending",
                        timesRejected = 0,
                        User          = user,
                        Idea          = ideaCreated
                    };
                    db.Ticket.Add(ticket);
                    db.SaveChanges();
                    int ticketRecordId = ticket.recordID;
                    var ticketCreated  = db.Ticket.Where(t => t.recordID == ticketRecordId).FirstOrDefault();

                    string userRole    = GetUserRole();
                    var    contributor = new Contributors
                    {
                        status = "Pending",
                        role   = userRole,
                        User   = user,
                        Ticket = ticketCreated
                    };
                    db.Contributor.Add(contributor);
                    db.SaveChanges();
                    var surperUser = db.User.Where(u => u.recordID == proposalIdeaFieldViewModel.supervisor).FirstOrDefault();



                    var identifier     = surperUser.email;
                    var surperUserRole = db.RoleIdentifier
                                         .Join(db.RoleIdentifierDetails,
                                               roleIdentifier => roleIdentifier.recordID,
                                               roleIdentifierDetails => roleIdentifierDetails.RoleIdentifier.recordID,
                                               (roleIdentifier, roleIdentifierDetails) => new { RoleIdentifier = roleIdentifier, RoleIdentifierDetails = roleIdentifierDetails })
                                         .Where(roleAndDetails => identifier.Contains(roleAndDetails.RoleIdentifierDetails.identifier)).FirstOrDefault();

                    contributor.User = surperUser;
                    contributor.role = surperUserRole.RoleIdentifier.role;
                    db.Contributor.Add(contributor);
                    db.SaveChanges();
                }
                return(RedirectToAction("Index"));
            }
            catch
            {
                var fields      = db.Fields.ToList();
                var supervisors = db.Supervisor.ToList();
                var viewModel   = new ProposalIdeaFieldViewModel
                {
                    AllFields     = fields,
                    AllSupervisor = supervisors
                };
                return(View(viewModel));
            }
        }
Example #31
0
 public ActionResult Update(Contributors contributors)
 {
     DB.Update(contributors);
     return(Redirect("/home/Contributors"));
 }