Example #1
0
        public int CreateExternalActivity(int organizationId, int geographyId, DateTime dateTime,
                                          ExternalActivityType type, string description, int createdByPersonId)
        {
            if (description.Length > 256)
            {
                description = description.Substring(0, 250) + "...";
            }

            using (DbConnection connection = GetMySqlDbConnection())
            {
                connection.Open();

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

                AddParameterWithName(command, "organizationId", organizationId);
                AddParameterWithName(command, "geographyId", geographyId);
                AddParameterWithName(command, "dateTime", dateTime);
                AddParameterWithName(command, "externalActivityType", type.ToString());
                AddParameterWithName(command, "description", description);
                AddParameterWithName(command, "createdByPersonId", createdByPersonId);
                AddParameterWithName(command, "createdDateTime", DateTime.Now);

                return(Convert.ToInt32(command.ExecuteScalar()));
            }
        }
Example #2
0
 public static ExternalActivity Create (Organization organization, Geography geograpy, ExternalActivityType type, DateTime date, string description, Person createdByPerson)
 {
     return
         FromIdentity(SwarmDb.GetDatabaseForWriting().CreateExternalActivity(organization.Identity, geograpy.Identity,
                                                                    date, type, description,
                                                                    createdByPerson.Identity));
 }
Example #3
0
    protected void ButtonLogActivity_Click(object sender, EventArgs e)
    {
        // First, if there's an upload that the user hasn't processed, process it first.

        if (this.Upload.UploadedFiles.Count > 0)
        {
            ProcessUpload();
        }

        // If args were invalid, abort

        if (!Page.IsValid)
        {
            return;
        }


        // Read the form data

        int temporaryId = Int32.Parse(this.TemporaryDocumentIdentity.Text);

        int       organizationId = Int32.Parse(this.DropOrganizations.SelectedValue);
        Geography geography      = this.DropGeographies.SelectedGeography;

        DateTime             created      = DateTime.Now;
        DateTime             activityDate = (DateTime)this.DatePicker.SelectedDate;
        string               description  = this.TextDescription.Text;
        ExternalActivityType type         =
            (ExternalActivityType)Enum.Parse(typeof(ExternalActivityType), this.DropActivityType.SelectedValue);

        // Create the activism record

        ExternalActivity activity = ExternalActivity.Create(Organization.FromIdentity(organizationId), geography, type,
                                                            activityDate, description, _currentUser);

        // Move documents to the new activism

        Documents.ForObject(new TemporaryIdentity(temporaryId)).SetForeignObjectForAll(activity);

        // Create the event for PirateBot-Mono to send off mails

        Activizr.Logic.Support.PWEvents.CreateEvent(EventSource.PirateWeb, EventType.ActivismLogged,
                                                    _currentUser.Identity, organizationId, geography.Identity, _currentUser.Identity,
                                                    activity.Identity, string.Empty);

        Page.ClientScript.RegisterStartupScript(typeof(Page), "OkMessage", @"alert ('The activism has been logged.');", true);

        // Clear the text fields

        this.TextDescription.Text           = string.Empty;
        this.TemporaryDocumentIdentity.Text = "0";
    }
 public BasicExternalActivity (int externalActivityId, int organizationId, int geographyId, ExternalActivityType type, DateTime dateTime, string description, int createdByPersonId, DateTime createdDateTime,
     int dupeOfActivityId)
 {
     this.ExternalActivityId = externalActivityId;
     this.OrganizationId = organizationId;
     this.GeographyId = geographyId;
     this.Type = type;
     this.DateTime = dateTime;
     this.Description = description;
     this.CreatedByPersonId = createdByPersonId;
     this.CreatedDateTime = createdDateTime;
     this.DupeOfActivityId = dupeOfActivityId;
 }
Example #5
0
        private static BasicExternalActivity ReadExternalActivityFromDataReader(IDataRecord reader)
        {
            int                  externalActivityId = reader.GetInt32(0);
            int                  organizationId     = reader.GetInt32(1);
            int                  geographyId        = reader.GetInt32(2);
            DateTime             dateTime           = reader.GetDateTime(3);
            ExternalActivityType type              = (ExternalActivityType)Enum.Parse(typeof(ExternalActivityType), reader.GetString(4));
            string               description       = reader.GetString(5);
            DateTime             createdDateTime   = reader.GetDateTime(6);
            int                  createdByPersonId = reader.GetInt32(7);
            int                  dupeOfActivityId  = reader.GetInt32(8);

            return(new BasicExternalActivity(externalActivityId, organizationId, geographyId, type, dateTime, description, createdByPersonId, createdDateTime, dupeOfActivityId));
        }
Example #6
0
 public BasicExternalActivity(int externalActivityId, int organizationId, int geographyId,
                              ExternalActivityType type, DateTime dateTime, string description, int createdByPersonId,
                              DateTime createdDateTime,
                              int dupeOfActivityId)
 {
     ExternalActivityId = externalActivityId;
     OrganizationId     = organizationId;
     GeographyId        = geographyId;
     Type              = type;
     DateTime          = dateTime;
     Description       = description;
     CreatedByPersonId = createdByPersonId;
     CreatedDateTime   = createdDateTime;
     DupeOfActivityId  = dupeOfActivityId;
 }
        public int CreateExternalActivity (int organizationId, int geographyId, DateTime dateTime, ExternalActivityType type, string description, int createdByPersonId)
        {
            if (description.Length > 256)
            {
                description = description.Substring(0, 250) + "...";
            }

            using (DbConnection connection = GetMySqlDbConnection())
            {
                connection.Open();

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

                AddParameterWithName(command, "organizationId", organizationId);
                AddParameterWithName(command, "geographyId", geographyId);
                AddParameterWithName(command, "dateTime", dateTime);
                AddParameterWithName(command, "externalActivityType", type.ToString());
                AddParameterWithName(command, "description", description);
                AddParameterWithName(command, "createdByPersonId", createdByPersonId);
                AddParameterWithName(command, "createdDateTime", DateTime.Now);

                return Convert.ToInt32(command.ExecuteScalar());
            }
        }
Example #8
0
 public static ExternalActivity Create(Organization organization, Geography geograpy, ExternalActivityType type, DateTime date, string description, Person createdByPerson)
 {
     return
         (FromIdentity(SwarmDb.GetDatabaseForWriting().CreateExternalActivity(organization.Identity, geograpy.Identity,
                                                                              date, type, description,
                                                                              createdByPerson.Identity)));
 }