ViewModel for the EmailTemplate class
Наследование: NavigationViewModel
Пример #1
0
        private static void SetEmailTemplateViewExtras(EmailTemplate emailtemplate, EmailTemplateViewModel viewModel)
        {
            viewModel.FooterText = StaticValues.EmailAutomatedDisclaimer;
            if (emailtemplate.TemplateType == EmailTemplateType.InitialCall)
            {
                viewModel.FooterText = string.Format("{0}<br />{1}<br />This will be replaced with the link to create a proposal", viewModel.FooterText, StaticValues.EmailCreateProposal);

                viewModel.Tokens.Add(StaticValues.TokenProposalMaximum);
                viewModel.Tokens.Add(StaticValues.TokenCloseDate);
                viewModel.Tokens.Add(StaticValues.TokenCreateProposalLink);
            }
            else if (emailtemplate.TemplateType == EmailTemplateType.ReadyForReview)
            {
                viewModel.FooterText = string.Format("{0}<p>{1}</p><p>{2}</p><p>{3}</p><p>{4}</p><p>{5}</p><p>{6}</p><p>{7}</p><p>{8}</p>"
                                                     , viewModel.FooterText
                                                     , "An account has been created for you."
                                                     , "UserName [email protected]"
                                                     , "Password bdLJ&SftBN>%oe"
                                                     , "You may change your password (recommended) after logging in."
                                                     , "After you have logged in, you may use this link to review submitted proposals for this Grant Request:"
                                                     , "http://*****:*****@test.com"
                                                     , "Password"
                                                     , "bdLJ&SftBN>%oe"
                                                     , "You may change your password (recommended) after logging in.");

                viewModel.FooterText = string.Format("{0}<p>{1}</p><p>{2}</p><p>{3}</p><p>{4}</p>"
                                                     , viewModel.FooterText
                                                     , "After you have logged in, you may use this link to edit your proposal:"
                                                     , "http://localhost:31701/Proposal/Edit/e18348ee-424c-4754-ab48-a23cc7d177a9"
                                                     , "Or you may access a list of your proposal(s) here:"
                                                     , "http://localhost:31701/Proposal/Home");

                viewModel.AlternateFooterText = string.Format("{0}<p>{1}</p>"
                                                              , viewModel.AlternateFooterText
                                                              , "You have an existing account. Use your email as the userName to login");
                viewModel.AlternateFooterText = string.Format("{0}<p>{1}</p><p>{2}</p><p>{3}</p><p>{4}</p>"
                                                              , viewModel.AlternateFooterText
                                                              , "After you have logged in, you may use this link to edit your proposal:"
                                                              , "http://localhost:31701/Proposal/Edit/e18348ee-424c-4754-ab48-a23cc7d177a9"
                                                              , "Or you may access a list of your proposal(s) here:"
                                                              , "http://localhost:31701/Proposal/Home");

                viewModel.Tokens.Add(StaticValues.TokenCloseDate);
            }
            else if(emailtemplate.TemplateType == EmailTemplateType.ProposalApproved)
            {

                viewModel.Tokens.Add(StaticValues.TokenApprovedAmount);
                viewModel.Tokens.Add(StaticValues.TokenProposalLink);
            }
            else if (emailtemplate.TemplateType == EmailTemplateType.ProposalDenied)
            {

                viewModel.Tokens.Add(StaticValues.TokenProposalLink);
            }
            else if(emailtemplate.TemplateType == EmailTemplateType.ReminderCallIsAboutToClose)
            {

                viewModel.Tokens.Add(StaticValues.TokenCloseDate);
                viewModel.Tokens.Add(StaticValues.TokenProposalLink);
            }
            else if (emailtemplate.TemplateType == EmailTemplateType.ProposalUnsubmitted)
            {

                viewModel.Tokens.Add(StaticValues.TokenCloseDate);
                viewModel.Tokens.Add(StaticValues.TokenProposalLink);
            }
        }
Пример #2
0
        public static EmailTemplateViewModel Create(IRepository repository, int? templateId, int? callForProposalId)
        {
            Check.Require(repository != null, "Repository must be supplied");

            var viewModel = new EmailTemplateViewModel { EmailTemplate = new EmailTemplate() };
            if (templateId != null && templateId != 0)
            {
                viewModel.IsTemplate = true;
                viewModel.TemplateId = templateId;
            }
            else if (callForProposalId != null && callForProposalId != 0)
            {
                viewModel.IsCallForProposal = true;
                viewModel.CallForProposalId = callForProposalId;
            }

            viewModel.DescriptionDict = new Dictionary<EmailTemplateType, string>(7);
            viewModel.DescriptionDict.Add(EmailTemplateType.InitialCall, StaticValues.InitialCall);
            viewModel.DescriptionDict.Add(EmailTemplateType.ProposalApproved, StaticValues.ProposalApproved);
            viewModel.DescriptionDict.Add(EmailTemplateType.ProposalConfirmation, StaticValues.ProposalConfirmation);
            viewModel.DescriptionDict.Add(EmailTemplateType.ProposalDenied, StaticValues.ProposalDenied);
            viewModel.DescriptionDict.Add(EmailTemplateType.ReadyForReview, StaticValues.ReadyForReview);
            viewModel.DescriptionDict.Add(EmailTemplateType.ReminderCallIsAboutToClose, StaticValues.ReminderCallIsAboutToClose);
            viewModel.DescriptionDict.Add(EmailTemplateType.ProposalUnsubmitted, StaticValues.ProposalUnsubmitted);

            viewModel.Tokens = new List<string>();

            return viewModel;
        }