Example #1
0
 public static MeetingElection Create (Person creator, Organization org, Geography geo, string name, InternalPollResultsType resultsType, int maxVoteLength, DateTime runningOpens, DateTime runningCloses, DateTime votingOpens, DateTime votingCloses)
 {
     return
         FromIdentity(SwarmDb.GetDatabaseForWriting().CreateInternalPoll(org.Identity, geo.Identity, name, maxVoteLength,
                                                                resultsType, creator.Identity, runningOpens,
                                                                runningCloses, votingOpens, votingCloses));
 }
        public int CreateInternalPoll(int organizationId, int geographyId, string name, int maxVoteLength,
                                      InternalPollResultsType resultsType, int createdByPersonId,
                                      DateTime runningOpens, DateTime runningCloses, DateTime votingOpens,
                                      DateTime votingCloses)
        {
            using (DbConnection connection = GetMySqlDbConnection())
            {
                connection.Open();

                DbCommand command = GetDbCommand("CreateInternalPoll", connection);
                command.CommandType = CommandType.StoredProcedure;

                AddParameterWithName(command, "organizationId", organizationId);
                AddParameterWithName(command, "geographyId", geographyId);
                AddParameterWithName(command, "name", name);
                AddParameterWithName(command, "maxVoteLength", maxVoteLength);
                AddParameterWithName(command, "resultsTypeId", (int)resultsType);
                AddParameterWithName(command, "createdByPersonId", createdByPersonId);
                AddParameterWithName(command, "runningOpens", runningOpens);
                AddParameterWithName(command, "runningCloses", runningCloses);
                AddParameterWithName(command, "votingOpens", votingOpens);
                AddParameterWithName(command, "votingCloses", votingCloses);

                return(Convert.ToInt32(command.ExecuteScalar()));
            }
        }
Example #3
0
 public static MeetingElection Create(Person creator, Organization org, Geography geo, string name,
                                      InternalPollResultsType resultsType, int maxVoteLength, DateTime runningOpens, DateTime runningCloses,
                                      DateTime votingOpens, DateTime votingCloses)
 {
     return
         (FromIdentity(SwarmDb.GetDatabaseForWriting()
                       .CreateInternalPoll(org.Identity, geo.Identity, name, maxVoteLength,
                                           resultsType, creator.Identity, runningOpens,
                                           runningCloses, votingOpens, votingCloses)));
 }
Example #4
0
 public BasicInternalPoll (int internalPollId, int createdByPersonId, int organizationId, int geographyId, string name, bool runningOpen, bool votingOpen, int maxVoteLength, DateTime runningOpens, DateTime runningCloses, DateTime votingOpens, DateTime votingCloses, InternalPollResultsType resultsType)
 {
     this.InternalPollId = internalPollId;
     this.CreatedByPersonId = createdByPersonId;
     this.OrganizationId = organizationId;
     this.GeographyId = geographyId;
     this.Name = name;
     this.RunningOpen = runningOpen;
     this.VotingOpen = votingOpen;
     this.MaxVoteLength = maxVoteLength;
     this.RunningOpens = runningOpens;
     this.RunningCloses = runningCloses;
     this.VotingOpens = votingOpens;
     this.VotingCloses = votingCloses;
     this.ResultsType = resultsType;
 }
Example #5
0
 public BasicInternalPoll(int internalPollId, int createdByPersonId, int organizationId, int geographyId,
                          string name, bool runningOpen, bool votingOpen, int maxVoteLength, DateTime runningOpens,
                          DateTime runningCloses, DateTime votingOpens, DateTime votingCloses, InternalPollResultsType resultsType)
 {
     InternalPollId    = internalPollId;
     CreatedByPersonId = createdByPersonId;
     OrganizationId    = organizationId;
     GeographyId       = geographyId;
     Name          = name;
     RunningOpen   = runningOpen;
     VotingOpen    = votingOpen;
     MaxVoteLength = maxVoteLength;
     RunningOpens  = runningOpens;
     RunningCloses = runningCloses;
     VotingOpens   = votingOpens;
     VotingCloses  = votingCloses;
     ResultsType   = resultsType;
 }
        private BasicInternalPoll ReadInternalPollFromDataReader(DbDataReader reader)
        {
            int      internalPollId    = reader.GetInt32(0);
            int      organizationId    = reader.GetInt32(1);
            int      geographyId       = reader.GetInt32(2);
            string   name              = reader.GetString(3);
            bool     runningOpen       = reader.GetBoolean(4);
            bool     votingOpen        = reader.GetBoolean(5);
            int      maxVoteLength     = reader.GetInt32(6);
            int      createdByPersonId = reader.GetInt32(7);
            DateTime runningOpens      = reader.GetDateTime(8);
            DateTime runningCloses     = reader.GetDateTime(9);
            DateTime votingOpens       = reader.GetDateTime(10);
            DateTime votingCloses      = reader.GetDateTime(11);
            int      resultsTypeId     = reader.GetInt32(12);

            InternalPollResultsType resultsType = (InternalPollResultsType)resultsTypeId;

            return(new BasicInternalPoll(internalPollId, createdByPersonId, organizationId, geographyId, name, runningOpen, votingOpen, maxVoteLength, runningOpens, runningCloses, votingOpens, votingCloses, resultsType));
        }
        public int CreateInternalPoll(int organizationId, int geographyId, string name, int maxVoteLength,
                                      InternalPollResultsType resultsType, int createdByPersonId, 
                                      DateTime runningOpens, DateTime runningCloses, DateTime votingOpens, 
                                      DateTime votingCloses)
        {
            using (DbConnection connection = GetMySqlDbConnection())
            {
                connection.Open();

                DbCommand command = GetDbCommand("CreateInternalPoll", connection);
                command.CommandType = CommandType.StoredProcedure;

                AddParameterWithName(command, "organizationId", organizationId);
                AddParameterWithName(command, "geographyId", geographyId);
                AddParameterWithName(command, "name", name);
                AddParameterWithName(command, "maxVoteLength", maxVoteLength);
                AddParameterWithName(command, "resultsTypeId", (int) resultsType);
                AddParameterWithName(command, "createdByPersonId", createdByPersonId);
                AddParameterWithName(command, "runningOpens", runningOpens);
                AddParameterWithName(command, "runningCloses", runningCloses);
                AddParameterWithName(command, "votingOpens", votingOpens);
                AddParameterWithName(command, "votingCloses", votingCloses);

                return Convert.ToInt32(command.ExecuteScalar());
            }
        }