Пример #1
0
        public static Email BuildTemplateVMReady(TemplateVM templateVm)
        {
            string template = GetTemplate("TemplateVMReady");

            var emailMessage = new EmailMessage()
            {
                Body = Engine.Razor.RunCompile(
                    template, "vmReadyTemplate", null,
                    new
                    {
                        User = templateVm.Identity.FirstName,
                        UserName = string.Format(@"{0}\{1}", templateVm.VMName, templateVm.VMAdminUser),
                        Password = templateVm.VMAdminPass,
                        LabName = templateVm.VMLabel,
                        RDPHost = templateVm.VMName + ":" + templateVm.VmRdpPort

                    }),
                To = templateVm.Identity.Email,
                Subject = string.Format("Template Image VM for \"{0}\" is ready", templateVm.VMLabel),
                Attachement = BuildRdpAttachement(templateVm.VMName, templateVm.VmRdpPort),
                AttachementName = "trainingMachine.rdp"
            };

            var email = new Email(new List<EmailMessage> { emailMessage });

            return email;
        }
Пример #2
0
        public static Email BuildTemplateVMCaptured(TemplateVM templateVm, bool labCreated = false)
        {
            //TODO: finish!
            string fileName;
            string subject;

            if (labCreated)
            {
                fileName = "LabCreatedWithImage";
                subject = string.Format("Your Lab \"{0}\" has been created", templateVm.VMLabel);
            }
            else
            {
                fileName = "TemplateImageUpdated";
                subject = string.Format("Your Template Image \"{0}\" has been updated", templateVm.VMLabel);
            }

            string template = GetTemplate(fileName);

            var emailMessage = new EmailMessage()
            {
                Body = Engine.Razor.RunCompile(
                    template, "vmCapturedTemplate", null,
                    new
                    {
                        User = templateVm.Identity.FirstName,
                        LabName = templateVm.VMLabel

                    }),
                To = templateVm.Identity.Email,
                Subject = subject,
            };

            var email = new Email(new List<EmailMessage> { emailMessage });

            return email;
        }