Пример #1
0
        public MySqlContext(DbContextOptions options) : base(options)
        {
            //Database.EnsureDeleted();
            Database.EnsureCreated();

            if (Articles.Count() == 0)
            {
                PutData data = new PutData();

                Articles.AddRange(data.articles);
                Comments.AddRange(data.comments);

                SuperUsers.Add(data.super);
                TeacherUsers.AddRange(data.teacher);
                StudentUsers.AddRange(data.studentUser);
                TestStudents.AddRange(data.testStudents);
                QuestionAnswers.AddRange(data.questionAnswers);
                Tests.AddRange(data.tests);

                Themes.AddRange(data.themes);
                TestThemes.AddRange(data.TestThemas);
                Questions.AddRange(data.questions1);
                Questions.AddRange(data.questions2);
                Questions.AddRange(data.questions3);
                Marks.AddRange(data.Marks1);
                Marks.AddRange(data.Marks2);

                EventProfileUsers.AddRange(data.EventProfileUsers);
                Meetups.AddRange(data.Meetups);
                Speakers.AddRange(data.Speakers);

                SaveChanges();
            }
        }
        public string Create(int userOrganizer, string title, DateTime date, int guests)
        {
            Console.WriteLine("MeetupModel.Create : START");
            try
            {
                var context = new SantanderChalengeContext();

                var permissions = context.Users.SingleOrDefault(x => x.Id == userOrganizer).Admin;
                if (permissions == 1)
                {
                    var met = new Meetups();
                    met.UserOrganizer = userOrganizer;
                    met.Date          = date;
                    met.Title         = title;
                    met.Canceled      = -1;
                    met.Guests        = guests;
                    context.Meetups.Add(met);
                    context.SaveChanges();
                    Console.WriteLine("MeetupModel.Create : END");
                    return("");
                }
                else
                {
                    return("Permisos insuficientes para realizar esta accion.");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("MeetupModel.Create : ERROR : " + ex.Message);
                return(ex.Message);
            }
        }
Пример #3
0
        public async Task GetMeetups(string id = null)
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;
            Meetups.Clear();

            var    Uri  = new Uri("https://server-cy3lzdr3na-uc.a.run.app/meetup/");
            string data = await RestService.Read(Uri);

            var meetups = JsonConvert.DeserializeObject <List <Meetup> >(data);

            if (id == null)
            {
                id = await SecureStorage.GetAsync("ID");
            }
            meetups.RemoveAll(m => m.User1 != id && m.User2 != id);

            foreach (var meetup in meetups)
            {
                Meetups.Add(meetup);
            }

            IsBusy = false;
        }
Пример #4
0
        private void initObjectModels()
        {
            // initializing footer objects
            terms         = new Terms(browser);
            privacy       = new Privacy(browser);
            security      = new Security(browser);
            status        = new Status(browser);
            help          = new Help(browser);
            footerLogo    = new pageObjectModels.footer.Logo(browser);
            contactGitHub = new ContactGitHub(browser);
            api           = new API(browser);
            training      = new Training(browser);
            shop          = new Shop(browser);
            footerBlog    = new pageObjectModels.footer.Blog(browser);
            about         = new About(browser);

            // initializing explore objects
            integrations = new Integrations(browser);
            showcases    = new Showcases(browser);
            trending     = new Trending(browser);

            // initializing header objects
            headerLogo = new pageObjectModels.header.Logo(browser);
            personal   = new Personal(browser);
            openSource = new OpenSource(browser);
            business   = new Business(browser);
            explore    = new Explore(browser);
            pricing    = new Pricing(browser);
            headerBlog = new pageObjectModels.header.Blog(browser);
            support    = new Support(browser);
            searchBar  = new pageObjectModels.header.SearchBar(browser);
            signIn     = new SignIn(browser);
            signUp     = new SignUp(browser);

            // initializing main objects
            signUpUsername  = new SignUpUsername(browser);
            signUpEmail     = new SignUpEmail(browser);
            signUpPassword  = new SignUpPassword(browser);
            signUpSubmit    = new SignUpSubmit(browser);
            signUpForGitHub = new SignUpForGitHubButton(browser);

            // initializing pricing objects
            joinGitHubForFree    = new JoinGitHubForFree(browser);
            upgradeAccount       = new UpgradeAccount(browser);
            createOrganization   = new CreateOrganization(browser);
            startEnterpriseTrial = new StartEnterpriseTrial(browser);

            // initializing blog objects
            featured      = new Featured(browser);
            allPosts      = new AllPosts(browser);
            newFeatures   = new NewFeatures(browser);
            engineering   = new Engineering(browser);
            enterprise    = new Enterprise(browser);
            conferences   = new Conferences(browser);
            meetups       = new Meetups(browser);
            newHires      = new NewHires(browser);
            watercooler   = new Watercooler(browser);
            blogSearchBar = new pageObjectModels.blog.SearchBar(browser);
        }
Пример #5
0
 public AuditXmlUpdate Merge(AuditXmlUpdate other)
 {
     return(new AuditXmlUpdate
     {
         Communities = Communities.Concat(other.Communities).DistinctBy(x => x.Name),
         Friends = Friends.Concat(other.Friends).DistinctBy(x => x.Id),
         Meetups = Meetups.Concat(other.Meetups).DistinctBy(x => x.Id),
         Speakers = Speakers.Concat(other.Speakers).DistinctBy(x => x.Id),
         Talks = Talks.Concat(other.Talks).DistinctBy(x => x.Id),
         Venues = Venues.Concat(other.Venues).DistinctBy(x => x.Id)
     });
 }
Пример #6
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // Overflow is fine, just wrap
            unchecked
            {
                var hashCode = 41;

                // Suitable nullity checks etc, of course :)
#pragma warning disable CA1307 // Specify StringComparison

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Id != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Id.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Description != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Description.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (SlidesUrl != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + SlidesUrl.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (VideoUrl != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + VideoUrl.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Meetups != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Meetups.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Speakers != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Speakers.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Friends != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Friends.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Venues != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Venues.GetHashCode();
                }
#pragma warning restore CA1307 // Specify StringComparison
                return(hashCode);
            }
        }
Пример #7
0
        /// <inheritdoc />
        /// <summary>
        /// Returns true if TalkDraft instances are equal
        /// </summary>
        /// <param name="other">Instance of TalkDraft to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(TalkDraft other)
        {
#pragma warning disable IDE0041 // Use 'is null' check
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

#pragma warning disable CA1309                  // Use ordinal stringcomparison
#pragma warning disable CA1307                  // Specify StringComparison
#pragma warning disable SA1515                  // Single-line comment must be preceded by blank line
#pragma warning disable SA1009                  // Closing parenthesis must be spaced correctly
            return
                (#pragma warning disable SA1119 // Statement must not use unnecessary parenthesis
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(Id, other.Id) ||
                     (Id != null && Id.Equals(other.Id))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(Description, other.Description) ||
                     (Description != null && Description.Equals(other.Description))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(SlidesUrl, other.SlidesUrl) ||
                     (SlidesUrl != null && SlidesUrl.Equals(other.SlidesUrl))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(VideoUrl, other.VideoUrl) ||
                     (VideoUrl != null && VideoUrl.Equals(other.VideoUrl))
                 ) &&
                 (
                     Meetups == other.Meetups ||
                     (Meetups != null && Meetups.SequenceEqual(other.Meetups))
                 ) &&
                 (
                     Speakers == other.Speakers ||
                     (Speakers != null && Speakers.SequenceEqual(other.Speakers))
                 ) &&
                 (
                     Friends == other.Friends ||
                     (Friends != null && Friends.SequenceEqual(other.Friends))
                 ) &&
                 (
                     Venues == other.Venues ||
                     (Venues != null && Venues.SequenceEqual(other.Venues))
                 ));

#pragma warning restore SA1119 // Statement must not use unnecessary parenthesis
#pragma warning restore SA1009 // Closing parenthesis must be spaced correctly
#pragma warning restore SA1515 // Single-line comment must be preceded by blank line
#pragma warning restore CA1307 // Specify StringComparison
#pragma warning restore CA1309 // Use ordinal stringcomparison
        }
Пример #8
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // Overflow is fine, just wrap
            unchecked
            {
                var hashCode = 41;

                // Suitable nullity checks etc, of course :)
#pragma warning disable CA1307 // Specify StringComparison

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Id != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Id.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (FirstName != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + FirstName.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (LastName != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + LastName.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (CompanyName != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + CompanyName.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (CompanyUrl != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + CompanyUrl.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Description != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Description.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (BlogsUrl != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + BlogsUrl.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (ContactsUrl != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + ContactsUrl.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (TwitterUrl != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + TwitterUrl.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (HabrUrl != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + HabrUrl.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (GitHubUrl != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + GitHubUrl.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Meetups != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Meetups.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Venues != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Venues.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Talks != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Talks.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Friends != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Friends.GetHashCode();
                }
#pragma warning restore CA1307 // Specify StringComparison
                return(hashCode);
            }
        }
Пример #9
0
        /// <inheritdoc />
        /// <summary>
        /// Returns true if SpeakerDraft instances are equal
        /// </summary>
        /// <param name="other">Instance of SpeakerDraft to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(SpeakerDraft other)
        {
#pragma warning disable IDE0041 // Use 'is null' check
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

#pragma warning disable CA1309                  // Use ordinal stringcomparison
#pragma warning disable CA1307                  // Specify StringComparison
#pragma warning disable SA1515                  // Single-line comment must be preceded by blank line
#pragma warning disable SA1009                  // Closing parenthesis must be spaced correctly
            return
                (#pragma warning disable SA1119 // Statement must not use unnecessary parenthesis
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(Id, other.Id) ||
                     (Id != null && Id.Equals(other.Id))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(FirstName, other.FirstName) ||
                     (FirstName != null && FirstName.Equals(other.FirstName))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(LastName, other.LastName) ||
                     (LastName != null && LastName.Equals(other.LastName))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(CompanyName, other.CompanyName) ||
                     (CompanyName != null && CompanyName.Equals(other.CompanyName))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(CompanyUrl, other.CompanyUrl) ||
                     (CompanyUrl != null && CompanyUrl.Equals(other.CompanyUrl))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(Description, other.Description) ||
                     (Description != null && Description.Equals(other.Description))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(BlogsUrl, other.BlogsUrl) ||
                     (BlogsUrl != null && BlogsUrl.Equals(other.BlogsUrl))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(ContactsUrl, other.ContactsUrl) ||
                     (ContactsUrl != null && ContactsUrl.Equals(other.ContactsUrl))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(TwitterUrl, other.TwitterUrl) ||
                     (TwitterUrl != null && TwitterUrl.Equals(other.TwitterUrl))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(HabrUrl, other.HabrUrl) ||
                     (HabrUrl != null && HabrUrl.Equals(other.HabrUrl))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(GitHubUrl, other.GitHubUrl) ||
                     (GitHubUrl != null && GitHubUrl.Equals(other.GitHubUrl))
                 ) &&
                 (
                     Meetups == other.Meetups ||
                     (Meetups != null && Meetups.SequenceEqual(other.Meetups))
                 ) &&
                 (
                     Venues == other.Venues ||
                     (Venues != null && Venues.SequenceEqual(other.Venues))
                 ) &&
                 (
                     Talks == other.Talks ||
                     (Talks != null && Talks.SequenceEqual(other.Talks))
                 ) &&
                 (
                     Friends == other.Friends ||
                     (Friends != null && Friends.SequenceEqual(other.Friends))
                 ));

#pragma warning restore SA1119 // Statement must not use unnecessary parenthesis
#pragma warning restore SA1009 // Closing parenthesis must be spaced correctly
#pragma warning restore SA1515 // Single-line comment must be preceded by blank line
#pragma warning restore CA1307 // Specify StringComparison
#pragma warning restore CA1309 // Use ordinal stringcomparison
        }
Пример #10
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // Overflow is fine, just wrap
            unchecked
            {
                var hashCode = 41;

                // Suitable nullity checks etc, of course :)
#pragma warning disable CA1307 // Specify StringComparison

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Id != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Id.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Name != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Name.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Address != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Address.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (MapUrl != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + MapUrl.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Meetups != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Meetups.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Speakers != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Speakers.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Talks != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Talks.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Friends != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Friends.GetHashCode();
                }
#pragma warning restore CA1307 // Specify StringComparison
                return(hashCode);
            }
        }