예제 #1
0
        public void primaryprofile(RegisterModel rm)
        {
            //adding data in looking for
            lf.username = rm.UserName;
            lf.looking_for = "visible+Not provided yet";
            lf.aboutme = "visible+Not provided yet";
            db.lookingfors.Add(lf);

            //adding data in basic info
            pbinfo.username = rm.UserName;
            pbinfo.weight = "visible+Not provided yet";
            pbinfo.sex = "Not provided yet";
            pbinfo.religion_cast = "Not provided yet";
            pbinfo.Religion = "Not provided yet";
            pbinfo.Name = "visible+Not provided yet";
            pbinfo.marital_status = "Not provided yet";
            pbinfo.languages = "visible+Not provided yet";
            pbinfo.height = "visible+Not provided yet";
            pbinfo.DOB = rm.DOB;
            pbinfo.age = DateTime.Now.Year - rm.DOB.Year;
            db.basicinfos.Add(pbinfo);

            //adding data in career info
            pcinfo.education = "visible+Not provided yet";
            pcinfo.education_institute = "visible+Not provided yet";
            pcinfo.profession = "visible+Not provided yet";
            pcinfo.salary = "visible+Not provided yet";
            pcinfo.username = rm.UserName;
            pcinfo.work_company = "visible+Not provided yet";
            db.careerinfos.Add(pcinfo);

            //adding data in contactinfo
            pconinfo.contactnumber = "UV,Not provided yet";
            pconinfo.email = "UV+"+rm.email;
            pconinfo.fblink = "visible+Not provided yet";
            pconinfo.orkutlink = "visible+Not provided yet";
            pconinfo.permenant_address = "visible+Not provided yet";
            pconinfo.permenant_address_city = "visible+Not provided yet";
            pconinfo.present_address = "visible+Not provided yet";
            pconinfo.present_address_city = "visible+Not provided yet";
            pconinfo.twitterlink = "visible+Not provided yet";
            pconinfo.username = rm.UserName;
            db.contactinfos.Add(pconinfo);

            //adding data in login info
            plinfo.emailaddress = rm.email;
            plinfo.password = rm.Password;
            plinfo.update_date = DateTime.UtcNow.Date;
            plinfo.user_status = "Normal";
            plinfo.username = rm.UserName;
            db.logininfos.Add(plinfo);

            db.SaveChanges();
        }
예제 #2
0
 public ActionResult Register_error(RegisterModel rm)
 {
     return View(rm);
 }
예제 #3
0
        public ActionResult Register(RegisterModel model, HttpPostedFileBase picture_file1, HttpPostedFileBase picture_file2)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                MembershipCreateStatus createStatus;
                Membership.CreateUser(model.UserName, model.Password, model.email, passwordQuestion: null, passwordAnswer: null, isApproved: true, providerUserKey: null, status: out createStatus);

                if (createStatus == MembershipCreateStatus.Success)
                {
                    primary_registration pr = new primary_registration();

                    //Adding datas to database
                    pr.primaryprofile(model);

                    if (picture_file1 != null && picture_file1.ContentLength > 0)
                    {
                        var filename = Path.GetFileName(picture_file1.FileName);
                        string x1 = model.UserName;
                        string newfilename = x1 + "..1.png";
                        var file_path1 = Path.Combine(Server.MapPath("~/Images/Pictures"), newfilename);
                        picture_file1.SaveAs(file_path1);
                    }

                    if (picture_file2 != null && picture_file2.ContentLength > 0)
                    {
                        var filename = Path.GetFileName(picture_file2.FileName);
                        string x1 = model.UserName;
                        string newfilename = x1 + "..2.png";
                        var file_path2 = Path.Combine(Server.MapPath("~/Images/Pictures"), newfilename);
                        picture_file2.SaveAs(file_path2);
                    }

                    FormsAuthentication.SetAuthCookie(model.UserName, createPersistentCookie: true);

                    //send mail
                    MailMessage message = new MailMessage();
                    message.From = new MailAddress("*****@*****.**");
                    // any address where the email will be sending
                    message.To.Add(model.email);
                    //Password of your gmail address
                    const string fromPassword = "******";
                    // Passing the values and make a email formate to display
                    message.Subject = "Welcome to IndianBibah";
                    message.Body = string.Format("Hello {0}, Welcome to IndianBibah.com. Your IndianBibah.com login informations are:" + "<br />" + "<a style=" + "color:maroon" + ">" +
                    "Username:  "******"</a>" + "{1}" + "<br />" + "<a style=" + "color:maroon" + ">" + "Password:  "******"</a>" + "{2}",
                        model.UserName, model.UserName, model.Password);

                    message.Body += "<br /><br /><br /><br />" + "<p style=" + "color:gray" + ">" +
                        "This is an automatic generated mail. Please do not reply to this mail." + "</p>";
                    message.IsBodyHtml = true;

                    // smtp settings
                    SmtpClient smtp = new SmtpClient
                    {
                        Host = "mail.indianbibah.com",
                        Port = 587,
                        EnableSsl = false,
                        //DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
                        Credentials = new NetworkCredential("*****@*****.**", fromPassword)
                        //  smtp.Timeout = 20000;

                    };

                        smtp.Send(message);
                        Thread.Sleep(1000);
                    return RedirectToAction("Index", "myprofile");

                }
                else
                {
                    ModelState.AddModelError("register_error", ErrorCodeToString(createStatus));
                }
            }

            return RedirectToAction("Index", "myprofile");
        }