Beispiel #1
0
        public static string GetPersonUrl <T>(this IBasicEmail mail, T model) where T : OrganizationPersonOutput, new()
        {
            var token = FlowExtensions.GetRole(typeof(T));
            var path  = FlowExtensions.GetPath(typeof(T));

            return($"{mail.FlowUrl}{model.TargetOrganizationId}/{token.GetDescription()}/people/{model.PersonId}/peopledetails");
        }
        public static IHtmlContent ProposalRejected <T>(this IBasicEmail email,
                                                        T proposal) where T : FixedPriceProposalOutput, new()
        {
            var role = FlowExtensions.GetRole(typeof(T));

            var message = "";

            switch (role)
            {
            case FlowRoleToken.Customer:
                message = $"You have rejected the proposal from {proposal.ProjectManagerOrganizationName}";
                break;

            case FlowRoleToken.AccountManager:
            case FlowRoleToken.ProjectManager:
            case FlowRoleToken.AgencyOwner:
                message = "A proposal has been rejected";
                break;
            }

            var link    = email.GetProposalUrl(proposal);
            var details = proposal.ProposalDetails();

            return(TemplateHelpers.ThreeParagraph(message, link, details));
        }
Beispiel #3
0
        public static IHtmlContent CandidateRejected <T>(this IBasicEmail email, T model) where T : CandidateOutput, new()
        {
            var role = FlowExtensions.GetRole(typeof(T));

            var message = "";

            switch (role)
            {
            case FlowRoleToken.Recruiter:
                message = "Your candidate was rejected";
                break;

            case FlowRoleToken.RecruitingAgencyOwner:
                message = "Your candidate was rejected";
                break;

            case FlowRoleToken.AgencyOwner:
                message = "Your candidate was rejected";
                break;

            case FlowRoleToken.AccountManager:
                message = "Your candidate was rejected";
                break;
            }

            var link = email.GetCandidateUrl(model);

            return(TemplateHelpers.TwoParagraph(message, link));
        }
Beispiel #4
0
        public static string GetInvoiceUrl <T>(this IBasicEmail mail, T model) where T : ProjectInvoiceOutput, new()
        {
            var token = FlowExtensions.GetRole(typeof(T));
            var path  = FlowExtensions.GetPath(typeof(T));

            return($"{mail.FlowUrl}{model.TargetOrganizationId}/{token.GetDescription()}/{path}/{model.Id}/invoicedetails");
        }
Beispiel #5
0
        public static IHtmlContent TimeEntryRejected(this IBasicEmail email, SectionType sectionType,
                                                     TimeEntryOutput entry)
        {
            var message = "";

            switch (sectionType)
            {
            case SectionType.AgencyOwner:
            case SectionType.AccountManager:
            case SectionType.ProjectManager:
                message = "A time entry was rejected";
                break;


            case SectionType.Contractor:
                message = $"Your time entry was rejected for the following reason: { entry.RejectionReason }";
                break;
            }

            var root = new TagBuilder("div");

            root.InnerHtml.Append(message);

            return(root);
        }
Beispiel #6
0
        public static IHtmlContent InvoiceDispersedOrganization <T>(this IBasicEmail email, T model)
            where T : OrganizationTransferEmail, new()
        {
            var message = $"Your organization : " + model.OrganizationName + " just got paid! Project : " + model.ProjectName +
                          " with Invoice No : " + model.Number + " & Transfer Amount : $" + model.Amount.ToString("N2");

            return(TemplateHelpers.SingleParagraph(message));
        }
Beispiel #7
0
        public static IHtmlContent Introduction(this IBasicEmail email)
        {
            var span = new TagBuilder("p");

            span.InnerHtml.Append($"Hello {email.RecipientName},");

            return(span);
        }
Beispiel #8
0
        public static IHtmlContent PersonAdded <T>(this IBasicEmail email, T person)
            where T : OrganizationPersonOutput, new()
        {
            var link    = email.GetPersonUrl(person);
            var details = person.PersonDetails();

            return(TemplateHelpers.ThreeParagraph("A new person was added to your organization", link, details));
        }
Beispiel #9
0
        public static IHtmlContent LeadQualified <T>(this IBasicEmail email, T model) where T : LeadOutput, new()
        {
            var role = FlowExtensions.GetRole(typeof(T));

            var message    = "";
            var streamName = "";
            var stream     = 0m;
            var bonus      = 0m;
            var bonusName  = "";

            switch (role)
            {
            case FlowRoleToken.Marketer:
                bonus      = model.MarketerBonus;
                stream     = model.MarketerStream;
                streamName = "MA Stream";
                bonusName  = "MA Bonus";
                message    = "Your lead was qualified";
                break;

            case FlowRoleToken.MarketingAgencyOwner:
                bonus      = model.MarketingAgencyBonus;
                stream     = model.MarketingAgencyStream;
                streamName = "MAO Stream";
                bonusName  = "MAO Bonus";
                message    = "Your marketer's lead was qualified";
                break;

            case FlowRoleToken.AgencyOwner:
                bonus      = model.MarketingBonus;
                stream     = model.MarketingStream;
                streamName = "Marketing Stream";
                bonusName  = "Marketing Bonus";
                message    = "Your lead was successfully assigned";
                break;

            case FlowRoleToken.AccountManager:
                bonus      = model.MarketingBonus;
                stream     = model.MarketingStream;
                streamName = "Marketing Stream";
                bonusName  = "Marketing Bonus";
                message    = "A new Opportunity was assigned to you.";
                break;

            case FlowRoleToken.None:
                break;
            }

            var link = email.GetLeadUrl(model);

            var contractDetails = model.LeadDetails(stream, streamName, bonus, bonusName);

            return(TemplateHelpers.ThreeParagraph(message, link, contractDetails));
        }
Beispiel #10
0
        public static IHtmlContent CandidateQualified <T>(this IBasicEmail email, T model) where  T : CandidateOutput, new()
        {
            var role = FlowExtensions.GetRole(typeof(T));

            var message    = "";
            var streamName = "";
            var stream     = 0m;
            var bonus      = 0m;
            var bonusName  = "";

            switch (role)
            {
            case FlowRoleToken.Recruiter:
                bonus      = model.RecruiterBonus;
                stream     = model.RecruiterStream;
                streamName = "RE Stream";
                bonusName  = "RE Bonus";
                message    = "Your candidate was qualified";
                break;

            case FlowRoleToken.RecruitingAgencyOwner:
                bonus      = model.RecruitingAgencyBonus;
                stream     = model.RecruitingAgencyStream;
                streamName = "RAO Stream";
                bonusName  = "RAO Bonus";
                message    = "Your candidate was qualified";
                break;

            case FlowRoleToken.AgencyOwner:
                bonus      = model.RecruitingBonus;
                stream     = model.RecruitingStream;
                streamName = "Recruiting Stream";
                bonusName  = "Recruiting Bonus";
                message    = "Your candidate was successfully assigned";
                break;

            case FlowRoleToken.ProjectManager:
                bonus      = 0;
                stream     = 0;
                streamName = "Recruiting Stream";
                bonusName  = "Recruiting Bonus";
                message    = "A new Candidate was assigned to you for screening.";
                break;
            }

            var link = email.GetCandidateUrl(model);

            var contractDetails = model.CandidateDetails(stream, streamName, bonus, bonusName);

            return(TemplateHelpers.ThreeParagraph(message, link, contractDetails));
        }
Beispiel #11
0
        public static IHtmlContent InvoiceCreated <T>(this IBasicEmail email, T model)
            where T : ProjectInvoiceOutput, new()
        {
            var role    = FlowExtensions.GetRole(typeof(T));
            var message = "";

            switch (role)
            {
            case FlowRoleToken.AccountManager:
            case FlowRoleToken.AgencyOwner:
                message = $"A new invoice was created";
                break;
            }

            var link = email.GetInvoiceUrl(model);

            return(TemplateHelpers.TwoParagraph(message, link));
        }
Beispiel #12
0
        public static IHtmlContent ProjectCreated <T>(this IBasicEmail email, T project) where T : ProjectOutput, new()
        {
            var role = FlowExtensions.GetRole(typeof(T));

            var message = "";

            switch (role)
            {
            default:
                message = "A new project was created";
                break;
            }

            var link    = email.GetProjectUrl(project);
            var details = project.ProjectDetails();

            return(TemplateHelpers.ThreeParagraph(message, link, details));
        }
Beispiel #13
0
        public static IHtmlContent CandidateCreated <T>(this IBasicEmail email, T model)
            where T : CandidateOutput, new()
        {
            var role = FlowExtensions.GetRole(typeof(T));


            var message    = "";
            var streamName = "";
            var stream     = 0m;
            var bonus      = 0m;
            var bonusName  = "";

            switch (role)
            {
            case FlowRoleToken.Recruiter:
                bonus      = model.RecruiterBonus;
                stream     = model.RecruiterStream;
                streamName = "RE Stream";
                bonusName  = "RE Bonus";
                message    = "A new candidate was created";
                break;

            case FlowRoleToken.RecruitingAgencyOwner:
                bonus      = model.RecruitingAgencyBonus;
                stream     = model.RecruitingAgencyStream;
                streamName = "RAO Stream";
                bonusName  = "RAO Bonus";
                message    = "A new candidate was created by one of your organization's recruiters";
                break;

            case FlowRoleToken.AgencyOwner:
                bonus      = model.RecruitingBonus;
                stream     = model.RecruitingStream;
                streamName = "Recruiting Stream";
                bonusName  = "Recruiting Bonus";
                message    = "You have a new candidate ready to be qualified";
                break;
            }
            var link = email.GetCandidateUrl(model);

            var contractDetails = model.CandidateDetails(stream, streamName, bonus, bonusName);

            return(TemplateHelpers.ThreeParagraph(message, link, contractDetails));
        }
Beispiel #14
0
        public static IHtmlContent Footer(this IBasicEmail email, SectionType sectionType, [NotNull] string organization)
        {
            var paragraph = new TagBuilder("div");
            var hr        = new TagBuilder("hr");

            var p1 = new TagBuilder("p");
            var p2 = new TagBuilder("p");

            p2.MergeAttribute("style", "padding: 10px; display:block; border: 1px solid #ccc; background-color: #efefef; margin: 20px; font-weight:bold");

            paragraph.InnerHtml.AppendHtml(hr);
            paragraph.InnerHtml.AppendHtml(p1);
            paragraph.InnerHtml.AppendHtml(p2);

            p1.InnerHtml.Append(GetGenericFooterMessage(sectionType, organization));
            p2.InnerHtml.Append(GetCommonMessage());

            return(paragraph);
        }
Beispiel #15
0
        public static IHtmlContent LeadCreated <T>(this IBasicEmail email, T model) where T : LeadOutput, new()
        {
            var role = FlowExtensions.GetRole(typeof(T));

            var message    = "";
            var streamName = "";
            var stream     = 0m;
            var bonus      = 0m;
            var bonusName  = "";

            switch (role)
            {
            case FlowRoleToken.Marketer:
                bonus      = model.MarketerBonus;
                stream     = model.MarketerStream;
                streamName = "MA Stream";
                bonusName  = "MA Bonus";
                message    = "A new lead was created";
                break;

            case FlowRoleToken.MarketingAgencyOwner:
                bonus      = model.MarketingAgencyBonus;
                stream     = model.MarketingAgencyStream;
                streamName = "MAO Stream";
                bonusName  = "MAO Bonus";
                message    = "A new lead was created";
                break;

            case FlowRoleToken.AgencyOwner:
                bonus      = model.MarketingBonus;
                stream     = model.MarketingStream;
                streamName = "Marketing Stream";
                bonusName  = "Marketing Bonus";
                message    = "You have a new lead";
                break;
            }

            var link = email.GetLeadUrl(model);

            var contractDetails = model.LeadDetails(stream, streamName, bonus, bonusName);

            return(TemplateHelpers.ThreeParagraph(message, link, contractDetails));
        }
Beispiel #16
0
        public static IHtmlContent WorkOrderRejected <T>(this IBasicEmail email,
                                                         T entry) where T : WorkOrderOutput, new()
        {
            var role = FlowExtensions.GetRole(typeof(T));

            var message = "";

            switch (role)
            {
            default:
                message = $"Your work order was rejected";
                break;
            }

            var link = email.GetWorkOrderUrl(entry);

            var workEntryDetails = entry.WorkOrderDetails();

            return(TemplateHelpers.ThreeParagraph(message, link, workEntryDetails));
        }
Beispiel #17
0
        public static IHtmlContent StoryCompleted <T>(this IBasicEmail email,
                                                      T story) where T : StoryOutput, new()
        {
            var role    = FlowExtensions.GetRole(typeof(T));
            var message = "";

            switch (role)
            {
            case FlowRoleToken.AccountManager:
            case FlowRoleToken.ProjectManager:
            case FlowRoleToken.AgencyOwner:
                message = "A story has been completed";
                break;
            }
            var link = email.GetStoryUrl(story);

            var contractDetails = story.StoryDetails();

            return(TemplateHelpers.ThreeParagraph(message, link, contractDetails));
        }
Beispiel #18
0
        public static IHtmlContent ContractRestarted <T>(this IBasicEmail email, T model) where T : ContractOutput, new()
        {
            var role = FlowExtensions.GetRole(typeof(T));

            var message = "";

            switch (role)
            {
            case FlowRoleToken.Contractor:
                message = $"Your contact was restarted";
                break;

            default:
                message = "A contract was ended";
                break;
            }

            var link = email.GetContractUrl(model);

            return(TemplateHelpers.TwoParagraph(message, link));
        }
Beispiel #19
0
        public static IHtmlContent StoryCreated <T>(this IBasicEmail email, T story) where T : StoryOutput, new()
        {
            var role = FlowExtensions.GetRole(typeof(T));

            var message = "";

            switch (role)
            {
            case FlowRoleToken.AgencyOwner:
                message = "A story was created in your organization";
                break;

            default:
                message = "A new story was created";
                break;
            }
            var link = email.GetStoryUrl(story);

            var contractDetails = story.StoryDetails();

            return(TemplateHelpers.ThreeParagraph(message, link, contractDetails));
        }
Beispiel #20
0
        public static IHtmlContent InvoiceFinalized <T>(this IBasicEmail email, T model)
            where T : ProjectInvoiceOutput, new()
        {
            var role = FlowExtensions.GetRole(typeof(T));

            var message = "";

            switch (role)
            {
            case FlowRoleToken.Customer:
                message = $"You have a new invoice from {model.ProviderOrganizationName}";
                break;

            case FlowRoleToken.AccountManager:
            case FlowRoleToken.AgencyOwner:
                message = $"Invoice: {model.Number} was sent to {model.CustomerOrganizationName}";
                break;
            }

            var link = email.GetInvoiceUrl(model);

            return(TemplateHelpers.TwoParagraph(message, link));
        }
Beispiel #21
0
        public static IHtmlContent ProposalSent <T>(this IBasicEmail email,
                                                    T proposal) where T : FixedPriceProposalOutput, new()
        {
            var role = FlowExtensions.GetRole(typeof(T));

            var message = "";

            switch (role)
            {
            case FlowRoleToken.Customer:
                message = "You have a new proposal";
                break;

            case FlowRoleToken.AccountManager:
            case FlowRoleToken.ProjectManager:
                message = "The proposal was sent";
                break;


            case FlowRoleToken.AgencyOwner:
                message = "A proposal has sent to your customer";
                break;
            }
            var link = string.Empty;

            if (role == FlowRoleToken.Customer)
            {
                link = email.GetPublicProposalUrl(proposal);
            }
            else
            {
                link = email.GetProposalUrl(proposal);
            }
            var details = proposal.ProposalDetails();

            return(TemplateHelpers.ThreeParagraph(message, link, details));
        }
Beispiel #22
0
        public static IHtmlContent WorkOrderCreated <T>(this IBasicEmail email,
                                                        T entry) where T : WorkOrderOutput, new()
        {
            var role    = FlowExtensions.GetRole(typeof(T));
            var message = "";

            switch (role)
            {
            case FlowRoleToken.Customer:
                message = $"You submitted a work order to {entry.AccountManagerOrganizationName}";
                break;

            default:
                message = "A new Work Order was created";
                break;
            }


            var link = email.GetWorkOrderUrl(entry);

            var workEntryDetails = entry.WorkOrderDetails();

            return(TemplateHelpers.ThreeParagraph(message, link, workEntryDetails));
        }
Beispiel #23
0
 public static string GetPublicProposalUrl <T>(this IBasicEmail mail, T model) where T : FixedPriceProposalOutput, new()
 {
     return($"{mail.FlowUrl}/Proposal/Detail/{model.Id}");
 }
Beispiel #24
0
 public static void Initialize(this IBasicEmail email, AppSettings settings)
 {
     email.FlowUrl = settings.Urls.Flow;
 }
Beispiel #25
0
        public static IHtmlContent ContractCreated <T>(this IBasicEmail email,
                                                       T model) where T : ContractOutput, new()
        {
            var role = FlowExtensions.GetRole(typeof(T));

            var     message    = $"A new contract was added, see the terms below";
            decimal rate       = 0;
            string  streamName = "CO";

            switch (role)
            {
            case FlowRoleToken.Contractor:
                rate       = model.ContractorStream;
                streamName = "Hourly Rate (CO Stream)";
                message    = $@"You have been added to a project. The terms of the contract below:";
                break;

            case FlowRoleToken.AgencyOwner:
                rate       = model.AgencyStream;
                streamName = "PAO Stream";
                break;

            case FlowRoleToken.AccountManager:
                rate       = model.AccountManagerStream;
                streamName = "AM Stream";
                break;

            case FlowRoleToken.ProjectManager:
                rate       = model.ProjectManagerStream;
                streamName = "PM Stream";
                break;

            case FlowRoleToken.Customer:
                rate       = model.CustomerRate;
                streamName = "Hourly Rate";
                break;

            case FlowRoleToken.Recruiter:
                rate       = model.ContractorStream;
                streamName = "RE Stream";
                break;

            case FlowRoleToken.Marketer:
                rate       = model.ContractorStream;
                message    = $"Your contractor, {model.ContractorName}, been added to a project";
                streamName = "MA Stream";
                break;

            case FlowRoleToken.MarketingAgencyOwner:
                rate       = model.ContractorStream;
                streamName = "MAO Stream";
                break;

            case FlowRoleToken.RecruitingAgencyOwner:
                rate       = model.ContractorStream;
                streamName = "RAO Stream";
                break;
            }


            var link = email.GetContractUrl(model);

            var contractDetails = model.ContractDetails(rate, streamName);

            return(TemplateHelpers.ThreeParagraph(message, link, contractDetails));
        }
Beispiel #26
0
        public static IHtmlContent TimeEntryApproved <T>(this IBasicEmail email,
                                                         T entry) where T : TimeEntryOutput, new()
        {
            var role = FlowExtensions.GetRole(typeof(T));

            var message    = "";
            var streamName = "";
            var stream     = 0m;

            switch (role)
            {
            case FlowRoleToken.Contractor:
                stream     = entry.TotalContractorStream;
                streamName = "CO Stream";
                message    = $"Your time entry was approved";
                break;

            case FlowRoleToken.AccountManager:
                stream     = entry.TotalAccountManagerStream;
                streamName = "AM Stream";
                message    = $"A time entry of {entry.TotalHours.ToString("N2")} Hours was approved";
                break;

            case FlowRoleToken.ProjectManager:
                stream     = entry.TotalProjectManagerStream;
                streamName = "PM Stream";
                message    = $"A time entry of {entry.TotalHours.ToString("N2")} Hours was approved";
                break;

            case FlowRoleToken.AgencyOwner:
                stream     = entry.TotalAgencyStream;
                streamName = "AO Stream";
                message    = $"A time entry of {entry.TotalHours.ToString("N2")} Hours was approved";
                break;

            case FlowRoleToken.Customer:
                stream     = entry.TotalCustomerAmount;
                streamName = "Amount";
                message    = $"A time entry of {entry.TotalHours.ToString("N2")} Hours was approved";
                break;

            case FlowRoleToken.Recruiter:
                stream     = entry.TotalRecruiterStream;
                streamName = "RE Stream";
                message    = $"A time entry of {entry.TotalHours.ToString("N2")} Hours was approved";
                break;

            case FlowRoleToken.Marketer:
                stream     = entry.TotalMarketerStream;
                streamName = "MA Stream";
                message    = $"A time entry of {entry.TotalHours.ToString("N2")} Hours was approved";
                break;

            case FlowRoleToken.MarketingAgencyOwner:
                stream     = entry.TotalMarketingAgencyStream;
                streamName = "MAO Stream";
                message    = $"A time entry of {entry.TotalHours.ToString("N2")} Hours was approved";
                break;

            case FlowRoleToken.RecruitingAgencyOwner:
                stream     = entry.TotalRecruitingAgencyStream;
                streamName = "RAO Stream";
                message    = $"A time entry of {entry.TotalHours.ToString("N2")} Hours was approved";
                break;
            }

            var link        = email.GetTimeEntryUrl(entry);
            var timeDetails = entry.TimeEntryDetails(stream, streamName);

            return(TemplateHelpers.ThreeParagraph(message, link, timeDetails));
        }