示例#1
0
        protected string CreateAndSendInvitation()
        {
            //Grab parameters, create new invitation id
            String invitationId           = Guid.NewGuid().ToString();
            String learningIdVal          = learningId.Value;
            String emailsVal              = emails.Value;
            String emailSenderNameVal     = emailSenderName.Value;
            String emailSenderAddressVal  = emailSenderAddress.Value;
            String emailMessageVal        = emailMessage.Value;
            String learningTitleVal       = learningTitle.Value;
            String learningDescriptionVal = learningDescription.Value;



            //Persist this invitation to our local data store
            DataStore.AddInvitation(invitationId, learningIdVal, emailSenderAddressVal, emailSenderNameVal);

            Emailer emailer = new Emailer(emailSenderAddressVal, emailSenderNameVal, invitationId,
                                          learningTitleVal, learningDescriptionVal, emailMessageVal);

            //Send admin email first
            emailer.SendAdminEmail();


            //Create registration and send email for everyone in email list
            String[] emailList = Utils.SplitAndTrim(emailsVal, ',');
            foreach (String email in emailList)
            {
                String regId = Guid.NewGuid().ToString();

                //Create registration in hosted, if it fails, skip this learner
                try {
                    ScormCloud.RegistrationService.CreateRegistration(regId, learningIdVal, email, email, email);
                }
                catch { continue; }

                DataStore.AddRegistration(learningIdVal, regId, email);
                emailer.SendLearnerEmail(regId, email);
            }


            return(invitationId);
        }
        protected string CreateAndSendInvitation()
        {
            //Grab parameters, create new invitation id
            String invitationId = Guid.NewGuid().ToString();
            String learningIdVal = learningId.Value;
            String emailsVal = emails.Value;
            String emailSenderNameVal = emailSenderName.Value;
            String emailSenderAddressVal = emailSenderAddress.Value;
            String emailMessageVal = emailMessage.Value;
            String learningTitleVal = learningTitle.Value;
            String learningDescriptionVal = learningDescription.Value;

            //Persist this invitation to our local data store
            DataStore.AddInvitation(invitationId, learningIdVal, emailSenderAddressVal, emailSenderNameVal);

            Emailer emailer = new Emailer(emailSenderAddressVal, emailSenderNameVal, invitationId,
                                          learningTitleVal, learningDescriptionVal, emailMessageVal);

            //Send admin email first
            emailer.SendAdminEmail();

            //Create registration and send email for everyone in email list
            String[] emailList = Utils.SplitAndTrim(emailsVal, ',');
            foreach (String email in emailList) {
                String regId = Guid.NewGuid().ToString();

                //Create registration in hosted, if it fails, skip this learner
                try {
                    ScormCloud.RegistrationService.CreateRegistration(regId, learningIdVal, email, email, email);
                }
                catch { continue; }

                DataStore.AddRegistration(learningIdVal, regId, email);
                emailer.SendLearnerEmail(regId, email);
            }

            return invitationId;
        }