Exemplo n.º 1
0
        public string BecomeARockstarTextBuilder(InvolvedModel model)
        {
            string result = "";

            result = "<b>First Name<b>: " + model.FirstName + "<br/><br/><b>Last Name<b>: " + model.LastName + "<br/><br/><b>Email Address<b>: " + model.EmailAddress + "<br/><br/><b>Phone Number<b>: " + model.PhoneNumber +
                "<br/><br/><b/>Company/Project Name<b>: " + model.CompanyProjName + "<br/><br/><b>Company/Project Description<b>: " + model.CompanyProjDescription + "<br/><br/><b>Quanitifiable Metrics<b>: " + model.QuantifiableMetrics;

            return result;
        }
Exemplo n.º 2
0
        public ActionResult BecomeARockstar(InvolvedModel model)
        {
            UserService svc = new UserService();
            EmailService eSvc = new EmailService();
            List<HttpPostedFileBase> fileList = new List<HttpPostedFileBase>();
            string toAddress = ToAddress;
            string subject = "A new user has registered!";

            if (this.IsCaptchaValid("Captcha is valid"))
            {
                if (ModelState.IsValid)
                {
                    fileList.Add(model.FirstFile);
                    fileList.Add(model.SecondFile);
                    fileList.Add(model.ThirdFile);
                    try
                    {
                        svc.CreateUser(model);
                        ModelState.Clear();
                        TempData["RegisterSuccess"] = "true";
                        string body = eSvc.BecomeARockstarTextBuilder(model);
                        eSvc.SendMail(toAddress, subject, body, fileList);
                    }
                    catch (Exception)
                    {
                        ModelState.Clear();
                        TempData["RegisterSuccess"] = "false";
                    }
                }
                else
                {
                    TempData["MissingFields"] = "true";
                }
            }
            else
            {
                TempData["InvalidCaptcha"] = "true";
            }

            return View();
        }
Exemplo n.º 3
0
        public void CreateUser(InvolvedModel model)
        {
            dbContext = new RockstarDBModelDataContext();

            RegisteredUser userTbl = new RegisteredUser();
            UserFile fileTbl = new UserFile();

            userTbl.FirstName = model.FirstName;
            userTbl.LastName = model.LastName;
            userTbl.EmailAddress = model.EmailAddress;
            userTbl.PhoneNumber = model.PhoneNumber;
            userTbl.Facebook = model.Facebook;
            userTbl.Twitter = model.Twitter;
            userTbl.LinkedIn = model.LinkedIn;
            userTbl.Instagram = model.Instagram;
            userTbl.Skype = model.Skype;


            userTbl.CompanyProjName = model.CompanyProjName;
            userTbl.CompanyProjDescription = model.CompanyProjDescription;
            userTbl.QuantifiableMetrics = model.QuantifiableMetrics;

            userTbl.ImpactQuestion = model.ImpactQuestion;
            userTbl.ExampleQuestion = model.ExampleQuestion;
            userTbl.LearnQuestion = model.LearnQuestion;
            userTbl.AdditionalInfo = model.AdditionalInfo;

            userTbl.CreatedOn = DateTime.Now;

            dbContext.RegisteredUsers.InsertOnSubmit(userTbl);
            dbContext.SubmitChanges();

            if (model.FirstFile != null)
            {
                byte[] firstUploadFile = new byte[model.FirstFile.InputStream.Length];
                model.FirstFile.InputStream.Read(firstUploadFile, 0, firstUploadFile.Length);
                fileTbl.FileName = model.FirstFile.FileName;
                fileTbl.FileData = firstUploadFile;
                fileTbl.UserID = userTbl.Id;

                dbContext.UserFiles.InsertOnSubmit(fileTbl);
                dbContext.SubmitChanges(); ;
            }


            if (model.SecondFile != null)
            {
                byte[] secondUploadFile = new byte[model.SecondFile.InputStream.Length];
                model.SecondFile.InputStream.Read(secondUploadFile, 0, secondUploadFile.Length);
                fileTbl.FileName = model.FirstFile.FileName;
                fileTbl.UserID = userTbl.Id;
                fileTbl.FileData = secondUploadFile;
            }


            if (model.ThirdFile != null)
            {
                byte[] secondUploadFile = new byte[model.SecondFile.InputStream.Length];
                model.SecondFile.InputStream.Read(secondUploadFile, 0, secondUploadFile.Length);
                fileTbl.FileName = model.FirstFile.FileName;
                fileTbl.UserID = userTbl.Id;
                fileTbl.FileData = secondUploadFile;
            }
        }