Ejemplo n.º 1
0
        public ActionResult Register(Users user, HttpPostedFileBase UploadResume)
        {
            Users objUser = new Users();

            user.UserType = "R";

            if (UploadResume != null)
            {
                string uploadedPath = Server.MapPath("~/UploadedFiles/ReviewerResume");

                bool exists = Directory.Exists(uploadedPath);
                if (!exists)
                {
                    Directory.CreateDirectory(uploadedPath);
                }

                string sFileName       = Path.GetFileName(UploadResume.FileName);
                string sUploadFileName = string.Format("{0}-{1}{2}", Path.GetFileNameWithoutExtension(sFileName), Guid.NewGuid().ToString("N"), Path.GetExtension(sFileName));

                string filePath = Path.Combine(uploadedPath, sUploadFileName);

                user.ResumeFileName = sUploadFileName;

                UploadResume.SaveAs(Path.Combine(uploadedPath, user.ResumeFileName));
            }

            objUser = _review.Register(user);

            if (objUser.ResultMessage.ToUpper().Equals("SUCCESS"))
            {
                TempData["ReviewerRegisterHeading"] = "Registration Completed!";
                TempData["ReviewerRegisterMessage"] = "Thank you for registering with us. Your Registration is successfull and you can check your email for your login credentials.";

                return(View("CompleteRegister"));
            }
            else
            {
                CommonCode commonCode = new CommonCode();
                List <Tuple <int, string> > lstSpecialization = _review.GetSpecialization(commonCode);
                List <SelectListItem>       lstSpec           = new List <SelectListItem>();
                foreach (var specialization in lstSpecialization)
                {
                    lstSpec.Add(new SelectListItem {
                        Value = specialization.Item1.ToString(), Text = specialization.Item2
                    });
                }
                ViewBag.Specialization = new SelectList(lstSpec, "Value", "Text");

                TempData["ReviewerUserExists"] = "Reviewer Email Address already registered with us. Please try with another Email Address...";
                return(View());
            }
        }