public static Common.Models.Forms.FormFieldMatter Edit(
     Transaction t,
     Common.Models.Forms.FormFieldMatter model,
     Common.Models.Account.Users modifier)
 {
     return(Edit(model, modifier, t.Connection, false));
 }
Example #2
0
 public static Common.Models.Assets.File Edit(
     Transaction t,
     Common.Models.Assets.File model,
     Common.Models.Account.Users modifier)
 {
     return(Edit(model, modifier, t.Connection, false));
 }
Example #3
0
 public static Common.Models.Assets.File Create(
     Transaction t,
     Common.Models.Assets.File model,
     Common.Models.Account.Users creator)
 {
     return(Create(model, creator, t.Connection, false));
 }
 public static Common.Models.Opportunities.OpportunityStage Create(
     Transaction t,
     Common.Models.Opportunities.OpportunityStage model,
     Common.Models.Account.Users creator)
 {
     return(Create(model, creator, t.Connection, false));
 }
Example #5
0
        public static Common.Models.Events.EventTag Create(Common.Models.Events.EventTag model,
                                                           Common.Models.Account.Users creator)
        {
            if (!model.Id.HasValue)
            {
                model.Id = Guid.NewGuid();
            }
            model.CreatedBy = model.ModifiedBy = creator;
            model.Created   = model.Modified = DateTime.UtcNow;

            Common.Models.Tagging.TagCategory existingTagCat = Tagging.TagCategory.Get(model.TagCategory.Name);

            if (existingTagCat == null)
            {
                existingTagCat = Tagging.TagCategory.Create(model.TagCategory, creator);
            }

            model.TagCategory = existingTagCat;
            DBOs.Events.EventTag dbo = Mapper.Map <DBOs.Events.EventTag>(model);

            using (IDbConnection conn = Database.Instance.GetConnection())
            {
                conn.Execute("INSERT INTO \"event_tag\" (\"id\", \"event_id\", \"tag_category_id\", \"tag\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                             "VALUES (@Id, @EventId, @TagCategoryId, @Tag, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                             dbo);
            }

            return(model);
        }
 public static Common.Models.Matters.CourtType Disable(
     Transaction t,
     Common.Models.Matters.CourtType model,
     Common.Models.Account.Users disabler)
 {
     return(Disable(model, disabler, t.Connection, false));
 }
 public static Common.Models.Opportunities.OpportunityStage Edit(
     Transaction t,
     Common.Models.Opportunities.OpportunityStage model,
     Common.Models.Account.Users modifier)
 {
     return(Edit(model, modifier, t.Connection, false));
 }
        public static Common.Models.Billing.ExpenseMatter Create(
            Common.Models.Billing.ExpenseMatter model,
            Common.Models.Account.Users creator,
            IDbConnection conn   = null,
            bool closeConnection = true)
        {
            model.Created   = model.Modified = DateTime.UtcNow;
            model.CreatedBy = model.ModifiedBy = creator;
            DBOs.Billing.ExpenseMatter dbo = Mapper.Map <DBOs.Billing.ExpenseMatter>(model);

            conn = DataHelper.OpenIfNeeded(conn);

            Common.Models.Billing.ExpenseMatter currentModel = Get(model.Matter.Id.Value, model.Expense.Id.Value, conn, false);

            if (currentModel != null)
            { // Update
                conn.Execute("UPDATE \"expense_matter\" SET \"utc_modified\"=@UtcModified, \"modified_by_user_pid\"=@ModifiedByUserPId " +
                             "\"utc_disabled\"=null, \"disabled_by_user_pid\"=null WHERE \"id\"=@Id", dbo);
                model.Created   = currentModel.Created;
                model.CreatedBy = currentModel.CreatedBy;
            }
            else
            { // Create
                if (conn.Execute("INSERT INTO \"expense_matter\" (\"id\", \"expense_id\", \"matter_id\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                                 "VALUES (@Id, @ExpenseId, @MatterId, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                                 dbo) > 0)
                {
                    model.Id = conn.Query <DBOs.Billing.ExpenseMatter>("SELECT currval(pg_get_serial_sequence('expense_matter', 'id')) AS \"id\"").Single().Id;
                }
            }

            DataHelper.Close(conn, closeConnection);

            return(model);
        }
Example #9
0
        public static Common.Models.Events.EventTag Create(Common.Models.Events.EventTag model,
                                                           Common.Models.Account.Users creator,
                                                           IDbConnection conn = null, bool closeConnection = true)
        {
            if (!model.Id.HasValue)
            {
                model.Id = Guid.NewGuid();
            }
            model.CreatedBy = model.ModifiedBy = creator;
            model.Created   = model.Modified = DateTime.UtcNow;

            Common.Models.Tagging.TagCategory existingTagCat =
                Tagging.TagCategory.Get(model.TagCategory.Name, conn, false);

            if (existingTagCat == null)
            {
                existingTagCat = Tagging.TagCategory.Create(model.TagCategory, creator, conn, false);
            }

            model.TagCategory = existingTagCat;
            DBOs.Events.EventTag dbo = Mapper.Map <DBOs.Events.EventTag>(model);

            conn = DataHelper.OpenIfNeeded(conn);

            conn.Execute("INSERT INTO \"event_tag\" (\"id\", \"event_id\", \"tag_category_id\", \"tag\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                         "VALUES (@Id, @EventId, @TagCategoryId, @Tag, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                         dbo);

            DataHelper.Close(conn, closeConnection);

            return(model);
        }
 public static Common.Models.Opportunities.Opportunity Close(
     Transaction t,
     Common.Models.Opportunities.Opportunity model,
     Common.Models.Account.Users modifier)
 {
     return(Close(model, modifier, t.Connection, false));
 }
Example #11
0
        public static Common.Models.Billing.InvoiceTime Create(Common.Models.Billing.InvoiceTime model,
                                                               Common.Models.Account.Users creator,
                                                               IDbConnection conn = null, bool closeConnection = true)
        {
            if (!model.Id.HasValue)
            {
                model.Id = Guid.NewGuid();
            }
            model.Created   = model.Modified = DateTime.UtcNow;
            model.CreatedBy = model.ModifiedBy = creator;
            DBOs.Billing.InvoiceTime dbo = Mapper.Map <DBOs.Billing.InvoiceTime>(model);

            conn = OpenIfNeeded(conn);

            Common.Models.Billing.InvoiceTime currentModel = Get(model.Invoice.Id.Value, model.Time.Id.Value);

            if (currentModel != null)
            { // Update
                conn.Execute("UPDATE \"invoice_time\" SET \"utc_modified\"=@UtcModified, \"modified_by_user_pid\"=@ModifiedByUserPId " +
                             "\"utc_disabled\"=null, \"disabled_by_user_pid\"=null WHERE \"id\"=@Id", dbo);
                model.Created   = currentModel.Created;
                model.CreatedBy = currentModel.CreatedBy;
            }
            else
            { // Create
                conn.Execute("INSERT INTO \"invoice_time\" (\"id\", \"time_id\", \"invoice_id\", \"duration\", \"details\", \"price_per_hour\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                             "VALUES (@Id, @TimeId, @InvoiceId, @Duration, @Details, @PricePerHour, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                             dbo);
            }

            Close(conn, closeConnection);

            return(model);
        }
 public static void Delete(
     Transaction t,
     Common.Models.Billing.InvoiceFee model,
     Common.Models.Account.Users deleter)
 {
     Delete(model, deleter, t.Connection, false);
 }
 public static Common.Models.Billing.InvoiceFee Edit(
     Transaction t,
     Common.Models.Billing.InvoiceFee model,
     Common.Models.Account.Users modifier)
 {
     return(Edit(model, modifier, t.Connection, false));
 }
 public static Common.Models.Billing.InvoiceFee Create(
     Transaction t,
     Common.Models.Billing.InvoiceFee model,
     Common.Models.Account.Users creator)
 {
     return(Create(model, creator, t.Connection, false));
 }
 public static Common.Models.Tasks.TaskMatter Create(
     Transaction t,
     Common.Models.Tasks.TaskMatter model,
     Common.Models.Account.Users creator)
 {
     return(Create(model, creator, t.Connection, false));
 }
 public static Common.Models.Activities.ActivityTask Edit(
     Transaction t,
     Common.Models.Activities.ActivityTask model,
     Common.Models.Account.Users modifier)
 {
     return(Edit(model, modifier, t.Connection, false));
 }
 public static Common.Models.Matters.CourtType Edit(
     Transaction t,
     Common.Models.Matters.CourtType model,
     Common.Models.Account.Users modifier)
 {
     return(Edit(model, modifier, t.Connection, false));
 }
        public static Common.Models.Activities.ActivityTask Create(
            Common.Models.Activities.ActivityTask model,
            Common.Models.Account.Users creator,
            IDbConnection conn   = null,
            bool closeConnection = true)
        {
            model.CreatedBy = model.ModifiedBy = creator;
            model.Created   = model.Modified = DateTime.UtcNow;
            DBOs.Activities.ActivityTask dbo = Mapper.Map <DBOs.Activities.ActivityTask>(model);

            conn = DataHelper.OpenIfNeeded(conn);

            if (conn.Execute("INSERT INTO \"activity_task\" (\"type\", \"is_campaign_response\", \"subject\", \"body\", \"owner\", \"priority\", \"due\", \"state\", \"status_reason\", " +
                             "\"duration\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                             "VALUES (@Type, @IsCampaignResponse, @Subject, @Body, @Owner, @Priority, @Due, @State, @StatusReason, @Duration, " +
                             "@UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                             dbo) > 0)
            {
                model.Id = conn.Query <DBOs.Activities.ActivityTask>("SELECT currval(pg_get_serial_sequence('activity_base', 'id')) AS \"id\"").Single().Id;
            }

            DataHelper.Close(conn, closeConnection);

            return(model);
        }
 public static Common.Models.Matters.CourtType Create(
     Transaction t,
     Common.Models.Matters.CourtType model,
     Common.Models.Account.Users creator)
 {
     return(Create(model, creator, t.Connection, false));
 }
 public static Common.Models.Activities.ActivityTask Create(
     Transaction t,
     Common.Models.Activities.ActivityTask model,
     Common.Models.Account.Users creator)
 {
     return(Create(model, creator, t.Connection, false));
 }
 public static Common.Models.Opportunities.OpportunityStage Disable(
     Transaction t,
     Common.Models.Opportunities.OpportunityStage model,
     Common.Models.Account.Users disabler)
 {
     return(Disable(model, disabler, t.Connection, false));
 }
Example #22
0
 public static Common.Models.Leads.Lead Close(
     Transaction t,
     Common.Models.Leads.Lead model,
     Common.Models.Account.Users modifier)
 {
     return(Close(model, modifier, t.Connection, false));
 }
        public static Common.Models.Documents.DocumentMatter Create(Common.Models.Documents.DocumentMatter model,
                                                                    Common.Models.Account.Users creator)
        {
            model.Created   = model.Modified = DateTime.UtcNow;
            model.CreatedBy = model.ModifiedBy = creator;
            DBOs.Documents.DocumentMatter dbo = Mapper.Map <DBOs.Documents.DocumentMatter>(model);

            using (IDbConnection conn = Database.Instance.GetConnection())
            {
                Common.Models.Documents.DocumentMatter currentModel = Get(model.Matter.Id.Value, model.Document.Id.Value);

                if (currentModel != null)
                { // Update
                    conn.Execute("UPDATE \"document_matter\" SET \"utc_modified\"=@UtcModified, \"modified_by_user_pid\"=@ModifiedByUserPId " +
                                 "\"utc_disabled\"=null, \"disabled_by_user_pid\"=null WHERE \"id\"=@Id", dbo);
                    model.Created   = currentModel.Created;
                    model.CreatedBy = currentModel.CreatedBy;
                }
                else
                { // Create
                    conn.Execute("INSERT INTO \"document_matter\" (\"id\", \"document_id\", \"matter_id\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                                 "VALUES (@Id, @DocumentId, @MatterId, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                                 dbo);
                }
            }

            return(model);
        }
 public static Common.Models.Settings.TagFilter EditTagFilter(
     Transaction t,
     Common.Models.Settings.TagFilter model,
     Common.Models.Account.Users modifier)
 {
     return(EditTagFilter(model, modifier, t.Connection, false));
 }
Example #25
0
        public static Common.Models.Notes.NoteNotification Create(Common.Models.Notes.NoteNotification model,
                                                                  Common.Models.Account.Users creator)
        {
            if (!model.Id.HasValue)
            {
                model.Id = Guid.NewGuid();
            }
            model.Created   = model.Modified = DateTime.UtcNow;
            model.CreatedBy = model.ModifiedBy = creator;
            DBOs.Notes.NoteNotification dbo = Mapper.Map <DBOs.Notes.NoteNotification>(model);

            using (IDbConnection conn = Database.Instance.GetConnection())
            {
                Common.Models.Notes.NoteNotification currentModel = Get(model.Note.Id.Value, model.Contact.Id.Value);

                if (currentModel != null)
                { // Update
                    dbo = Mapper.Map <DBOs.Notes.NoteNotification>(currentModel);
                    conn.Execute("UPDATE \"note_notification\" SET \"utc_modified\"=@UtcModified, \"modified_by_user_pid\"=@ModifiedByUserPId, " +
                                 "\"utc_disabled\"=null, \"disabled_by_user_pid\"=null, \"cleared\"=null WHERE \"id\"=@Id", dbo);
                    model.Created   = currentModel.Created;
                    model.CreatedBy = currentModel.CreatedBy;
                }
                else
                { // Create
                    conn.Execute("INSERT INTO \"note_notification\" (\"id\", \"note_id\", \"contact_id\", \"cleared\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                                 "VALUES (@Id, @NoteId, @ContactId, @Cleared, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                                 dbo);
                }
            }

            return(model);
        }
 public static void DeleteTagFilter(
     Transaction t,
     Common.Models.Settings.TagFilter model,
     Common.Models.Account.Users deleter)
 {
     DeleteTagFilter(model, deleter, t.Connection, false);
 }
Example #27
0
        public static Common.Models.Assets.File Create(
            Common.Models.Assets.File model,
            Common.Models.Account.Users creator,
            IDbConnection conn   = null,
            bool closeConnection = true)
        {
            if (!model.Id.HasValue)
            {
                model.Id = Guid.NewGuid();
            }
            model.CreatedBy = model.ModifiedBy = creator;
            model.Created   = model.Modified = DateTime.UtcNow;
            DBOs.Assets.File dbo = Mapper.Map <DBOs.Assets.File>(model);

            conn = DataHelper.OpenIfNeeded(conn);

            conn.Execute("INSERT INTO \"file\" (\"id\", \"version_id\", \"is_source\", " +
                         "\"content_length\", \"content_type\", \"extension\", " +
                         "\"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                         "VALUES (@Id, @VersionId, @IsSource, @ContentLength, @ContentType, @Extension, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                         dbo);

            DataHelper.Close(conn, closeConnection);

            return(model);
        }
 public static Common.Models.Settings.TagFilter CreateTagFilter(
     Transaction t,
     Common.Models.Settings.TagFilter model,
     Common.Models.Account.Users creator)
 {
     return(CreateTagFilter(model, creator, t.Connection, false));
 }
Example #29
0
        public static Common.Models.Assets.Tag Create(
            Common.Models.Assets.Tag model,
            Common.Models.Account.Users creator,
            IDbConnection conn   = null,
            bool closeConnection = true)
        {
            model.CreatedBy = model.ModifiedBy = creator;
            model.Created   = model.Modified = DateTime.UtcNow;
            DBOs.Assets.Tag dbo = Mapper.Map <DBOs.Assets.Tag>(model);

            conn = DataHelper.OpenIfNeeded(conn);

            Common.Models.Assets.Tag existing = Get(model.Name, conn, false);

            if (existing == null)
            {
                if (conn.Execute("INSERT INTO \"asset_tag\" (\"name\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                                 "VALUES (@Name, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                                 dbo) > 0)
                {
                    model.Id = conn.Query <DBOs.Assets.Tag>("SELECT currval(pg_get_serial_sequence('asset_tag', 'id')) AS \"id\"").Single().Id;
                }
            }
            else
            {
                model = existing;
            }

            DataHelper.Close(conn, closeConnection);

            return(model);
        }
Example #30
0
        public static Common.Models.Matters.Matter Edit(
            Common.Models.Matters.Matter model,
            Common.Models.Account.Users modifier,
            IDbConnection conn   = null,
            bool closeConnection = true)
        {
            model.ModifiedBy = modifier;
            model.Modified   = DateTime.UtcNow;
            DBOs.Matters.Matter dbo = Mapper.Map <DBOs.Matters.Matter>(model);

            conn = DataHelper.OpenIfNeeded(conn);

            conn.Execute("UPDATE \"matter\" SET \"matter_type_id\"=@MatterTypeId, " +
                         "\"title\"=@Title, \"active\"=@Active, \"parent_id\"=@ParentId, \"synopsis\"=@Synopsis, \"utc_modified\"=@UtcModified, " +
                         "\"minimum_charge\"=@MinimumCharge, \"estimated_charge\"=@EstimatedCharge, \"maximum_charge\"=@MaximumCharge, " +
                         "\"default_billing_rate_id\"=@DefaultBillingRateId, \"billing_group_id\"=@BillingGroupId, \"override_matter_rate_with_employee_rate\"=@OverrideMatterRateWithEmployeeRate, " +
                         "\"attorney_for_party_title\"=@AttorneyForPartyTitle, \"court_type_id\"=@CourtTypeId, \"court_geographical_jurisdiction_id\"=@CourtGeographicalJurisdictionId, " +
                         "\"court_sitting_in_city_id\"=@CourtSittingInCityId, \"caption_plaintiff_or_subject_short\"=@CaptionPlaintiffOrSubjectShort, " +
                         "\"caption_plaintiff_or_subject_regular\"=@CaptionPlaintiffOrSubjectRegular, \"caption_plaintiff_or_subject_long\"=@CaptionPlaintiffOrSubjectLong, " +
                         "\"caption_other_party_short\"=@CaptionOtherPartyShort, " +
                         "\"caption_other_party_regular\"=@CaptionOtherPartyRegular, \"caption_other_party_long\"=@CaptionOtherPartyLong, " +
                         "\"modified_by_user_pid\"=@ModifiedByUserPId, \"case_number\"=@CaseNumber, \"bill_to_contact_id\"=@BillToContactId " +
                         "WHERE \"id\"=@Id", dbo);

            return(model);
        }