public JsonResult SaveStudentBasic(Student_Register _obj)
        {
            StudentRepository objRepository = new StudentRepository();
            DataSet           _ds           = objRepository.UpdateStudentRegistration(_obj);
            bool flag = true;

            if (_ds != null)
            {
                if (_ds.Tables[0].Rows.Count > 0)
                {
                    if (_ds.Tables[0].Rows[0]["Counts"].ToString() == "0")
                    {
                        flag = false;
                    }
                    else
                    {
                        Session["ApplyingForCourse"] = _obj.ApplyingForCourse;
                    }
                }
            }
            return(Json(new
            {
                flag = flag
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
Exemple #2
0
 public DataSet Opr_Upload_Student_Image(Student_Register _obj)
 {
     try
     {
         _cn.Open();
         SqlCommand _cmd = new SqlCommand("Opr_Upload_Student_Image", _cn);
         _cmd.Parameters.AddWithValue("@studentid", _obj.studentid);
         _cmd.Parameters.AddWithValue("@Photo", _obj.Photo);
         _cmd.Parameters.AddWithValue("@Signature", _obj.Signature);
         _cmd.Parameters.AddWithValue("@Type", _obj.Type);
         _cmd.CommandType = CommandType.StoredProcedure;
         SqlDataAdapter _adp = new SqlDataAdapter(_cmd);
         DataSet        _ds  = new DataSet();
         _adp.Fill(_ds);
         _adp.Dispose();
         _cmd.Dispose();
         return(_ds);
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         _cn.Close();
     }
 }
 public DataSet update_image_path(Student_Register _obj)
 {
     try
     {
         _cn.Open();
         SqlCommand _cmd = new SqlCommand("update_image_path", _cn);
         _cmd.Parameters.AddWithValue("@studentid", _obj.studentid);
         _cmd.Parameters.AddWithValue("@student_path", _obj.student_path);
         _cmd.CommandType = CommandType.StoredProcedure;
         SqlDataAdapter _adp = new SqlDataAdapter(_cmd);
         DataSet        _ds  = new DataSet();
         _adp.Fill(_ds);
         _adp.Dispose();
         _cmd.Dispose();
         return(_ds);
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         _cn.Close();
     }
 }
        public JsonResult SaveStudent_Basic(Student_Register _obj)
        {
            StudentRepository objRepository = new StudentRepository();

            _obj.gov_scheme_id = Session["Gov_User_id"].ToString();
            _obj.Created_By    = Session["Gov_User_id"].ToString();
            _obj.Created_Ip    = Request.ServerVariables["REMOTE_ADDR"].ToString();
            DataSet _ds  = objRepository.InsertUpdateStudentRegistration_gov(_obj);
            bool    flag = false;

            if (_ds != null)
            {
                if (_ds.Tables[0].Rows.Count > 0)
                {
                    if (_ds.Tables[0].Rows[0]["Exist"].ToString() == "0")
                    {
                        flag = true;
                        TempData["Studentid"] = _ds.Tables[0].Rows[0]["UserName"].ToString();
                        TempData.Keep("Studentid");
                    }
                }
            }
            return(Json(new
            {
                flag = flag
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
 public DataSet InsertUpdatet_tbl_Student_Ch_Choice_Filling_NicheCourse(Student_Register _obj)
 {
     try
     {
         _cn.Open();
         SqlCommand _cmd = new SqlCommand("InsertUpdatet_tbl_Student_Ch_Choice_Filling_NicheCourse", _cn);
         _cmd.Parameters.AddWithValue("@studentid", _obj.studentid);
         _cmd.Parameters.AddWithValue("@InstituteNicheCourse_ID", _obj.NicheCourseID);
         _cmd.Parameters.AddWithValue("@instituteid", _obj.instituteid);
         _cmd.Parameters.AddWithValue("@Mobile", _obj.Mobile);
         _cmd.Parameters.AddWithValue("@Created_Ip", _obj.Created_Ip);
         _cmd.Parameters.AddWithValue("@ParticipatedYear", ConfigurationManager.AppSettings["ParticipatedYear"].ToString());
         _cmd.Parameters.AddWithValue("@Phase", ConfigurationManager.AppSettings["CurrentPhase"].ToString());
         _cmd.CommandType = CommandType.StoredProcedure;
         SqlDataAdapter _adp = new SqlDataAdapter(_cmd);
         DataSet        _ds  = new DataSet();
         _adp.Fill(_ds);
         _adp.Dispose();
         _cmd.Dispose();
         return(_ds);
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         _cn.Close();
     }
 }
 public DataSet StudentForgotPassword(Student_Register _obj)
 {
     try
     {
         _cn.Open();
         SqlCommand _cmd = new SqlCommand("UpdateForgotPassword", _cn);
         _cmd.Parameters.AddWithValue("@random", _obj.Random);
         _cmd.Parameters.AddWithValue("@Email", _obj.Email);
         _cmd.CommandType = CommandType.StoredProcedure;
         SqlDataAdapter _adp = new SqlDataAdapter(_cmd);
         DataSet        _ds  = new DataSet();
         _adp.Fill(_ds);
         _adp.Dispose();
         _cmd.Dispose();
         return(_ds);
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         _cn.Close();
     }
 }
        public JsonResult SaveStudentBackgraound(Student_Register _obj)
        {
            _obj.studentid = TempData.Peek("Studentid").ToString();
            TempData.Keep("Studentid");
            StudentRepository objRepository = new StudentRepository();
            DataSet           _ds           = objRepository.UpdateStudentBackground(_obj);
            bool flag = true;

            if (_ds != null)
            {
                if (_ds.Tables[0].Rows.Count > 0)
                {
                    if (_ds.Tables[0].Rows[0]["Counts"].ToString() == "0")
                    {
                        flag = false;
                    }
                }
            }
            return(Json(new
            {
                flag = flag
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
Exemple #8
0
        public JsonResult uploadstudentimage()
        {
            string           path     = "";
            string           filename = "";
            string           fname    = "";
            Student_Register _obj     = new Student_Register();

            if (Request.Files.Count > 0)
            {
                if (Request.Files[0].ContentLength > 0)
                {
                    //Upload the file...
                    HttpFileCollectionBase files = Request.Files;
                    path     = AppDomain.CurrentDomain.BaseDirectory + "Uploads/studentPhoto/";
                    filename = Path.GetFileName(Request.Files[0].FileName);
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    else
                    {
                        string[] curentfiles = Directory.GetFiles(path);
                    }
                    HttpPostedFileBase file = files[0];
                    filename = Session["studentid"].ToString() + "_Photo_" + DateTime.Now.ToString("yyyyMMddHHmmss") + Path.GetExtension(file.FileName);
                    fname    = Path.Combine(Server.MapPath("~/Uploads/studentPhoto/"), filename);
                    file.SaveAs(fname);
                    _obj.student_path = "/Uploads/studentPhoto/" + filename;
                }
                else
                {
                    _obj.student_path = _obj.student_path;
                }
            }
            else
            {
                _obj.student_path = _obj.student_path;
            }
            _obj.studentid = Session["studentid"].ToString();
            StudentRepository objRepository = new StudentRepository();
            DataSet           ds            = objRepository.update_image_path(_obj);
            bool flag = false;

            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["COUNTS"].ToString() != "0")
                    {
                        flag = true;
                    }
                }
            }
            return(Json(new
            {
                flag = flag
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
        public JsonResult SelectStudentBackgraound()
        {
            Student_Register  _obj   = new Student_Register();
            StudentRepository objRep = new StudentRepository();

            _obj.studentid = Session["studentid"].ToString();
            DataSet ds = objRep.Select_Student_Information(_obj);
            List <Student_Register> _list  = new List <Student_Register>();
            List <Student_Register> _list1 = new List <Student_Register>();

            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        Student_Register objBasic = new Student_Register();
                        objBasic.studentid                   = row["studentid"].ToString();
                        objBasic.IsvalidPassport             = row["IsvalidPassport"].ToString();
                        objBasic.NameasperPassport           = row["NameasperPassport"].ToString();
                        objBasic.PassportNo                  = row["PassportNo"].ToString();
                        objBasic.IssuingAuthority            = row["IssuingAuthority"].ToString();
                        objBasic.PassportExpDate             = row["PassportExpDate"].ToString();
                        objBasic.PassportIssueCountry        = row["PassportIssueCountry"].ToString();
                        objBasic.ApplyForPassport            = row["ApplyForPassport"].ToString();
                        objBasic.AgreeTermsConditions        = row["AgreeTermsConditions"].ToString();
                        objBasic.PassportFileReferenceNumber = row["PassportFileReferenceNumber"].ToString();
                        objBasic.HaveCitizenshipNumber       = row["HaveCitizenshipNumber"].ToString();
                        objBasic.CitizenshipNumber           = row["CitizenshipNumber"].ToString();
                        _list.Add(objBasic);
                    }
                }
                if (ds.Tables[2].Rows.Count > 0)
                {
                    foreach (DataRow row in ds.Tables[2].Rows)
                    {
                        Student_Register objBasic = new Student_Register();
                        objBasic.Name                    = row["Name"].ToString();
                        objBasic.Designation             = row["Designation"].ToString();
                        objBasic.Institute_employer_name = row["Institute_employer_name"].ToString();
                        objBasic.Email                   = row["Email"].ToString();
                        objBasic.ContactNo               = row["ContactNo"].ToString();
                        objBasic.RefAddress              = row["RefAddress"].ToString();
                        objBasic.RefCountry              = row["RefCountry"].ToString();
                        objBasic.RefState                = row["RefState"].ToString();
                        objBasic.RefCity                 = row["RefCity"].ToString();
                        objBasic.RefArea                 = row["RefArea"].ToString();
                        _list1.Add(objBasic);
                    }
                }
            }
            return(Json(new
            {
                List = _list,
                List1 = _list1
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
Exemple #10
0
        public JsonResult SelectStudentBasic()
        {
            Student_Register  _obj   = new Student_Register();
            StudentRepository objRep = new StudentRepository();

            _obj.studentid = Session["studentid"].ToString();
            DataSet ds = objRep.Select_Student_Information(_obj);
            List <Student_Register>       _list        = new List <Student_Register>();
            List <Student_AddressDetails> _listAddress = new List <Student_AddressDetails>();

            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        Student_Register objBasic = new Student_Register();
                        objBasic.studentid     = row["studentid"].ToString();
                        objBasic.FirstName     = row["FirstName"].ToString();
                        objBasic.LastName      = row["LastName"].ToString();
                        objBasic.MiddleName    = row["MiddleName"].ToString();
                        objBasic.DateOfBirth   = row["DateOfBirth"].ToString();
                        objBasic.Gender        = row["Gender"].ToString();
                        objBasic.Email         = row["Email"].ToString();
                        objBasic.Mobile        = row["Mobile"].ToString();
                        objBasic.CountryCode   = row["CountryCode"].ToString();
                        objBasic.Nationality   = row["Nationality"].ToString();
                        objBasic.CountryToStay = row["CountryToStay"].ToString();
                        objBasic.student_path  = row["student_path"].ToString();
                        _list.Add(objBasic);
                    }
                }
                if (ds.Tables[1].Rows.Count > 0)
                {
                    foreach (DataRow row in ds.Tables[1].Rows)
                    {
                        Student_AddressDetails objadd = new Student_AddressDetails();
                        objadd.studentid    = row["studentid"].ToString();
                        objadd.AddressType  = row["AddressType"].ToString();
                        objadd.Addressline1 = row["Addressline1"].ToString();
                        objadd.Country      = row["Country"].ToString();
                        objadd.State        = row["State"].ToString();
                        objadd.City         = row["City"].ToString();
                        objadd.Area         = row["Area"].ToString();
                        _listAddress.Add(objadd);
                    }
                }
            }
            return(Json(new
            {
                List = _list,
                ListAdd = _listAddress
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
        public JsonResult RegistationUserForCourse(Student_Register _obj)
        {
            string flagValidID     = "";
            string flagValidCourse = "";
            string InstituteName   = "";
            string CourseDetails   = "";

            try
            {
                StudentRepository _objRepository = new StudentRepository();
                string            localIP        = "?";
                localIP         = Request.ServerVariables["REMOTE_ADDR"].ToString();
                _obj.Created_Ip = localIP;
                _obj.Created_Ip = Request.ServerVariables["REMOTE_ADDR"].ToString();
                DataSet ds = _objRepository.InsertUpdatet_tbl_Student_Ch_Choice_Filling_NicheCourse(_obj);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["Count"].ToString() == "1")
                    {
                        flagValidID     = "True";
                        flagValidCourse = "True";
                        SendemailForCourse(ds.Tables[1].Rows[0]["Studentid"].ToString(), _obj.NicheCourseID.ToString(), ds.Tables[1].Rows[0]["Email"].ToString(), ds.Tables[1].Rows[0]["FirstName"].ToString() + " " + ds.Tables[1].Rows[0]["LastName"].ToString());
                        InstituteName = ds.Tables[2].Rows[0]["InstituteName"].ToString();
                        CourseDetails = ds.Tables[2].Rows[0]["Natureofcourse"].ToString();
                    }
                    else if (ds.Tables[0].Rows[0]["Count"].ToString() == "0")
                    {
                        flagValidID     = "false";
                        flagValidCourse = "false";
                    }
                    else if (ds.Tables[0].Rows[0]["Count"].ToString() == "-2")
                    {
                        flagValidID     = "True";
                        flagValidCourse = "false";
                    }
                    else
                    {
                        flagValidID     = "false";
                        flagValidCourse = "false";
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(Json(new
            {
                flagValidID = flagValidID,
                flagValidCourse = flagValidCourse,
                Institute = InstituteName,
                CourseType = CourseDetails
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
        public DataSet UpdateStudentRegistration(Student_Register _obj)
        {
            try
            {
                _cn.Open();
                SqlCommand _cmd = new SqlCommand("InsertUpdateStudentRegistration", _cn);
                _cmd.Parameters.AddWithValue("@studentid", _obj.studentid);
                _cmd.Parameters.AddWithValue("@FirstName", _obj.FirstName);
                _cmd.Parameters.AddWithValue("@LastName", _obj.LastName);
                _cmd.Parameters.AddWithValue("@MiddleName", _obj.MiddleName);
                if (_obj.DateOfBirth == null || _obj.DateOfBirth.Equals(""))
                {
                    _cmd.Parameters.AddWithValue("@DateOfBirth", DBNull.Value);
                }
                else
                {
                    _cmd.Parameters.AddWithValue("@DateOfBirth", DateTime.ParseExact(_obj.DateOfBirth.ToString(), "dd-MM-yyyy", null));
                }
                _cmd.Parameters.AddWithValue("@Gender", _obj.Gender);
                _cmd.Parameters.AddWithValue("@Email", _obj.Email);
                _cmd.Parameters.AddWithValue("@Mobile", _obj.Mobile);
                _cmd.Parameters.AddWithValue("@CountryCode", _obj.CountryCode);
                _cmd.Parameters.AddWithValue("@Country", _obj.Country);
                _cmd.Parameters.AddWithValue("@CountryToStay", _obj.CountryToStay);
                _cmd.Parameters.AddWithValue("@Created_By", _obj.Created_By);
                _cmd.Parameters.AddWithValue("@Created_Ip", _obj.Created_Ip);
                _cmd.Parameters.AddWithValue("@StrJson", _obj.StrJson);
                _cmd.Parameters.AddWithValue("@bCopyAddress", _obj.bCopyAddress);

                _cmd.Parameters.AddWithValue("@ApplyingForCourse", _obj.ApplyingForCourse);
                _cmd.CommandType = CommandType.StoredProcedure;
                SqlDataAdapter _adp = new SqlDataAdapter(_cmd);
                DataSet        _ds  = new DataSet();
                _adp.Fill(_ds);
                _adp.Dispose();
                _cmd.Dispose();
                return(_ds);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                _cn.Close();
            }
        }
 public DataSet InsertStudentRegistration_Niche(Student_Register _obj)
 {
     try
     {
         _cn.Open();
         SqlCommand _cmd = new SqlCommand("InsertStudentRegistration_Niche", _cn);
         _cmd.Parameters.AddWithValue("@FirstName", _obj.FirstName);
         _cmd.Parameters.AddWithValue("@LastName", _obj.LastName);
         _cmd.Parameters.AddWithValue("@Email", _obj.Email);
         _cmd.Parameters.AddWithValue("@Country", _obj.Country);
         _cmd.Parameters.AddWithValue("@Mobile", _obj.Mobile);
         _cmd.Parameters.AddWithValue("@Random", _obj.Random);
         _cmd.Parameters.AddWithValue("@Created_Ip", _obj.Created_Ip);
         if (_obj.DateOfBirth == null || _obj.DateOfBirth.Equals(""))
         {
             _cmd.Parameters.AddWithValue("@DateOfBirth", DBNull.Value);
         }
         else
         {
             _cmd.Parameters.AddWithValue("@DateOfBirth", DateTime.ParseExact(_obj.DateOfBirth.ToString(), "dd-MM-yyyy", null));
         }
         _cmd.Parameters.AddWithValue("@bulk_reg", DBNull.Value);
         _cmd.Parameters.AddWithValue("@ApplyingForCourse", _obj.ApplyingForCourse);
         _cmd.Parameters.AddWithValue("@PresentProfession", _obj.PresentProfession);
         _cmd.Parameters.AddWithValue("@NicheCourseID", _obj.NicheCourseID);
         _cmd.Parameters.AddWithValue("@instituteid", _obj.instituteid);
         _cmd.Parameters.AddWithValue("@ParticipatedYear", ConfigurationManager.AppSettings["ParticipatedYear"].ToString());
         _cmd.Parameters.AddWithValue("@Phase", ConfigurationManager.AppSettings["CurrentPhase"].ToString());
         _cmd.Parameters.AddWithValue("@Gender", _obj.Gender);
         _cmd.CommandType = CommandType.StoredProcedure;
         SqlDataAdapter _adp = new SqlDataAdapter(_cmd);
         DataSet        _ds  = new DataSet();
         _adp.Fill(_ds);
         _adp.Dispose();
         _cmd.Dispose();
         return(_ds);
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         _cn.Close();
     }
 }
 public DataSet UpdateStudentBackground(Student_Register _obj)
 {
     try
     {
         _cn.Open();
         SqlCommand _cmd = new SqlCommand("updateStudentBackgroundinformation", _cn);
         _cmd.Parameters.AddWithValue("@studentid", _obj.studentid);
         _cmd.Parameters.AddWithValue("@IsvalidPassport", _obj.IsvalidPassport);
         _cmd.Parameters.AddWithValue("@NameasperPassport", _obj.NameasperPassport);
         _cmd.Parameters.AddWithValue("@PassportNo", _obj.PassportNo);
         _cmd.Parameters.AddWithValue("@IssuingAuthority", _obj.IssuingAuthority);
         if (_obj.PassportExpDate == null || _obj.PassportExpDate.Equals(""))
         {
             _cmd.Parameters.AddWithValue("@PassportExpDate", DBNull.Value);
         }
         else
         {
             _cmd.Parameters.AddWithValue("@PassportExpDate", DateTime.ParseExact(_obj.PassportExpDate.ToString(), "dd-MM-yyyy", null));
         }
         _cmd.Parameters.AddWithValue("@PassportIssueCountry", _obj.PassportIssueCountry);
         _cmd.Parameters.AddWithValue("@ApplyForPassport", _obj.ApplyForPassport);
         _cmd.Parameters.AddWithValue("@PassportFileReferenceNumber", _obj.PassportFileReferenceNumber);
         _cmd.Parameters.AddWithValue("@AgreeTermsConditions", _obj.AgreeTermsConditions);
         _cmd.Parameters.AddWithValue("@strjson", _obj.StrJson);
         _cmd.Parameters.AddWithValue("@gov_scheme_id", _obj.gov_scheme_id);
         _cmd.Parameters.AddWithValue("@HaveCitizenshipNumber", _obj.HaveCitizenshipNumber);
         _cmd.Parameters.AddWithValue("@CitizenshipNumber", _obj.CitizenshipNumber);
         _cmd.CommandType = CommandType.StoredProcedure;
         SqlDataAdapter _adp = new SqlDataAdapter(_cmd);
         DataSet        _ds  = new DataSet();
         _adp.Fill(_ds);
         _adp.Dispose();
         _cmd.Dispose();
         return(_ds);
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         _cn.Close();
     }
 }
 public DataSet InsertStudentRegistration(Student_Register _obj)
 {
     try
     {
         _cn.Open();
         SqlCommand _cmd = new SqlCommand("InsertStudentRegistration", _cn);
         _cmd.Parameters.AddWithValue("@FirstName", _obj.FirstName);
         _cmd.Parameters.AddWithValue("@LastName", _obj.LastName);
         _cmd.Parameters.AddWithValue("@Email", _obj.Email);
         _cmd.Parameters.AddWithValue("@Country", _obj.Country);
         _cmd.Parameters.AddWithValue("@Mobile", _obj.Mobile);
         _cmd.Parameters.AddWithValue("@CountryCode", _obj.CountryCode);
         _cmd.Parameters.AddWithValue("@Random", _obj.Random);
         _cmd.Parameters.AddWithValue("@Created_Ip", _obj.Created_Ip);
         if (_obj.DateOfBirth == null || _obj.DateOfBirth.Equals(""))
         {
             _cmd.Parameters.AddWithValue("@DateOfBirth", DBNull.Value);
         }
         else
         {
             _cmd.Parameters.AddWithValue("@DateOfBirth", DateTime.ParseExact(_obj.DateOfBirth.ToString(), "dd-MM-yyyy", null));
         }
         _cmd.Parameters.AddWithValue("@ActualPassword", _obj.ActualPassword);
         _cmd.Parameters.AddWithValue("@bulk_reg", _obj.bulk_reg);
         _cmd.Parameters.AddWithValue("@ApplyingForCourse", _obj.ApplyingForCourse);
         _cmd.Parameters.AddWithValue("@whatsapp_consent", _obj.whatsapp_consent);
         _cmd.CommandType = CommandType.StoredProcedure;
         SqlDataAdapter _adp = new SqlDataAdapter(_cmd);
         DataSet        _ds  = new DataSet();
         _adp.Fill(_ds);
         _adp.Dispose();
         _cmd.Dispose();
         return(_ds);
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         _cn.Close();
     }
 }
Exemple #16
0
        public int studentdata_submitted(string studentid)
        {
            int flag = 0;
            Student_Register _obj = new Student_Register();

            _obj.studentid = studentid;
            StudentRepository _objRepository = new StudentRepository();
            DataSet           ds             = _objRepository.Login_Student(_obj);

            if (ds != null)
            {
                //Session["IsChangePwd"] = null;
                if (ds.Tables[0].Rows.Count > 0)
                {
                    DataRow dr = ds.Tables[0].Rows[0];
                    if (dr["submitChoiceFill"].ToString().ToLower() == "true")
                    {
                        Session["submitChoiceFill"] = dr["submitChoiceFill"].ToString();
                        flag = 1;
                    }
                }
            }
            return(flag);
        }
        public JsonResult ForgotPassword(Student_Register _obj)
        {
            int flag = 0;
            //bool flagExists = false;
            bool              flagCaptcha    = false;
            string            error          = "";
            mWebhook          _response      = null;
            StudentRepository _objRepository = new StudentRepository();

            try
            {
                if (this.Session["CaptchaImageText"].ToString() == _obj.Captchastr)
                //if (CaptchaValid)
                {
                    flagCaptcha = true;
                    string password = Membership.GeneratePassword(8, 1);
                    _obj.Random = password;
                    DataSet   ds            = _objRepository.StudentForgotPassword(_obj);
                    SendEmail _objseedemail = new SendEmail();
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["COUNTS"].ToString() == "1")
                        {
                            //string strform = System.Configuration.ConfigurationManager.AppSettings["Emailusername"];
                            string strform = "";
                            #region Code to send mails simultaneously in a loop (By Amit: 14-06-2019 11:45 AM)
                            if (System.Web.HttpContext.Current.Application["UserCountForMail"] == null)
                            {
                                System.Web.HttpContext.Current.Application["UserCountForMail"] = 1;
                            }
                            else
                            {
                            }
                            int UserCountForMail = Convert.ToInt32(System.Web.HttpContext.Current.Application["UserCountForMail"]);
                            if (UserCountForMail < 4)
                            {
                                UserCountForMail++;
                            }
                            else
                            {
                                UserCountForMail = 1;
                            }
                            if (System.Web.HttpContext.Current.Application["UserCountForMail"] == null)
                            {
                                System.Web.HttpContext.Current.Application["UserCountForMail"] = 1;
                            }

                            if (UserCountForMail == 1)
                            {
                                strform = System.Configuration.ConfigurationManager.AppSettings["Emailusername1"];
                            }
                            else if (UserCountForMail == 2)
                            {
                                strform = System.Configuration.ConfigurationManager.AppSettings["Emailusername2"];
                            }
                            else if (UserCountForMail == 3)
                            {
                                strform = System.Configuration.ConfigurationManager.AppSettings["Emailusername3"];
                            }
                            else if (UserCountForMail == 4)
                            {
                                strform = System.Configuration.ConfigurationManager.AppSettings["Emailusername4"];
                            }

                            #endregion
                            //string Subject = "Forgot login details of Student";
                            StringBuilder MailBody = new StringBuilder();
                            MailBody.Append("<br/>Dear " + ds.Tables[0].Rows[0]["StudName"].ToString() + ",<br/>");
                            MailBody.Append("<br/>You may now login with below credentials:");
                            MailBody.Append("<br/>Username: "******"StudId"].ToString() + " or " + _obj.Email);
                            MailBody.Append("<br/>Password: "******"<br/><br/><a target='_blank' href='" + FullyQualifiedApplicationPath(ControllerContext.RequestContext.HttpContext.Request) + "admission/login' style='color:blue;'>click here</a> to reset your Student Portal password." + "<br/>");
                            MailBody.Append("<br/>Please note: This is an auto generated email.<br/>");
                            MailBody.Append("<br/>Regards,<br/>");
                            MailBody.Append("Study in India Team<br/>");
                            //string bcc = "";
                            //string cc = "";
                            /// _obj.Email = "*****@*****.**";
                            //_objseedemail.SendEmailInBackgroundThread(strform, _obj.Email, bcc, cc, Subject, MailBody.ToString(), "", true);
                            // _objseedemail.SendEmailForRegistration(strform, _obj.Email, bcc, cc, Subject, MailBody.ToString(), "", true);
                            flag = 1;
                            #region Call PivotRoots Code
                            string     strUrl  = "https://pivotroots.com/clients/studyinindia/webhooks/user_events";
                            WebRequest request = HttpWebRequest.Create(strUrl);
                            request.Headers.Add("Request-Id", DateTime.Now.ToString("yyyyMMddhhmmss"));
                            request.Method      = "POST";
                            request.ContentType = "application/json";
                            request.Headers.Add("Client-Id", "b7a51eff57749dc0e733b74342c8b512");
                            request.Headers.Add("Client-Access-Token", "dfdd5aa8ea4a1e2fb5999dc213476c2a9b68efa7");
                            mWebhookRequestForgot _objJsonRequest = new mWebhookRequestForgot()
                            {
                                timestamp    = DateTime.Now.ToString("yyyyMMddhhmmss"),
                                user_id      = ds.Tables[0].Rows[0]["StudId"].ToString(),
                                userName     = ds.Tables[0].Rows[0]["StudName"].ToString(),
                                emailID      = ds.Tables[0].Rows[0]["Email"].ToString(),
                                new_password = password.ToString(),
                                @event       = "forgot_password"
                            };
                            string data       = JsonConvert.SerializeObject(_objJsonRequest);
                            byte[] dataStream = Encoding.UTF8.GetBytes(data);
                            request.ContentLength = dataStream.Length;
                            Stream r = request.GetRequestStream();
                            r.Write(dataStream, 0, dataStream.Length);
                            r.Close();
                            HttpWebResponse response   = (HttpWebResponse)request.GetResponse();
                            Stream          s          = (Stream)response.GetResponseStream();
                            StreamReader    readStream = new StreamReader(s);
                            string          dataString = readStream.ReadToEnd();
                            _response = JsonConvert.DeserializeObject <mWebhook>(dataString);

                            response.Close();
                            s.Close();
                            readStream.Close();
                            #endregion
                        }
                        else if (ds.Tables[0].Rows[0]["COUNTS"].ToString() == "2")
                        {
                            flag = 2;
                        }
                        else
                        {
                            flag = 0;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                error = ex.Message;
                throw;
            }
            return(Json(new
            {
                flag = flag,
                flagCaptcha = flagCaptcha,
                e = error
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
        public JsonResult RegistationUser(Student_Register _obj, bool CaptchaValid)
        {
            bool flagCaptcha = false;
            bool flagValidID = true;

            try
            {
                //if (this.Session["CaptchaImageText"].ToString() == _obj.Captchastr)
                if (CaptchaValid)
                {
                    flagCaptcha = true;
                    StudentRepository _objRepository = new StudentRepository();
                    // _obj.CREATE_BY = Session["FA_USER_ID"].ToString();
                    string localIP = "?";
                    localIP         = Request.ServerVariables["REMOTE_ADDR"].ToString();
                    _obj.Created_Ip = localIP;
                    string password = Membership.GeneratePassword(8, 1);
                    _obj.Random = password;
                    Random        rn           = new Random();
                    int           month        = rn.Next(1, 6);
                    StringBuilder hashPassword = new StringBuilder();
                    string        new_password = _obj.ActualPassword;
                    switch (month)
                    {
                    case 1:
                        hashPassword.Append(Helper.ComputeHash(new_password, "MD5", null));
                        break;

                    case 2:
                        hashPassword.Append(Helper.ComputeHash(new_password, "SHA1", null));
                        break;

                    case 3:
                        hashPassword.Append(Helper.ComputeHash(new_password, "SHA256", null));
                        break;

                    case 4:
                        hashPassword.Append(Helper.ComputeHash(new_password, "SHA384", null));
                        break;

                    case 5:
                        hashPassword.Append(Helper.ComputeHash(new_password, "SHA512", null));
                        break;
                    }
                    _obj.ActualPassword = hashPassword.ToString();
                    DataSet   ds            = _objRepository.InsertStudentRegistration(_obj);
                    SendEmail _objseedemail = new SendEmail();
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["Exist"].ToString() == "0")
                        {
                            flagValidID = true;
                            if (_obj.Email.ToString() != "")
                            {
                                string        strform  = System.Configuration.ConfigurationManager.AppSettings["Emailusername"];
                                string        Subject  = "Student Login";
                                StringBuilder MailBody = new StringBuilder();
                                MailBody.Append("<br/>Dear Student, " + _obj.FirstName + " " + _obj.LastName + ",<br/>");
                                MailBody.Append("<br/>Thank you for registering at Study in India.");
                                MailBody.Append("<br/>To activate your account <b><a target='_blank' href='" + FullyQualifiedApplicationPath(ControllerContext.RequestContext.HttpContext.Request) + "admission/login?eid=" + Encrypt_Decrypt.EncryptData(_obj.Email, "") + "'>click on the following link </a> </b>");
                                //  MailBody.Append("<br/>Username: "******"UserName"].ToString() + "(You can also use your email id for logging in)");
                                //   MailBody.Append("<br/>Password: "******"<br/>Please note: This is an auto generated email.<br/>");
                                MailBody.Append("<br/><br/><br/>Regards,<br/>");
                                MailBody.Append("Study in India Team<br/>");
                                string bcc = "";
                                string cc  = "";
                                _objseedemail.SendEmailInBackgroundThread(strform, _obj.Email, bcc, cc, Subject, MailBody.ToString(), "", true);
                            }
                        }
                        else
                        {
                            flagValidID = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Json(new
            {
                flagCaptcha = flagCaptcha,
                flagValidID = flagValidID
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
        //   [RecaptchaFilter], bool CaptchaValid
        public JsonResult Check_And_ChangePassword(Student_Register _obj)
        {
            bool flagCheckPassword = false;
            bool flagCaptcha       = false;
            bool flagPwdChanged    = false;

            if (this.Session["CaptchaImageText"].ToString() == _obj.Captchastr)
            //if (CaptchaValid)
            {
                flagCaptcha    = true;
                _obj.studentid = Session["studentid"].ToString();
                StudentRepository _objRepository = new StudentRepository();
                DataSet           ds             = _objRepository.Login_Student(_obj);
                if (ds != null)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        DataRow dr             = ds.Tables[0].Rows[0];
                        string  actualPassword = dr["ActualPassword"].ToString();
                        string  random         = "";
                        if (dr["Random"] != null)
                        {
                            random = dr["Random"].ToString();
                        }
                        if (dr["IsPasswordChanged"].ToString().ToLower() == "true" && dr["ischangedpassword"].ToString().ToLower() == "true")
                        {
                            string password = _obj.Random;
                            string MD5      = Helper.VerifyHash(password, "MD5", actualPassword).ToString();
                            string SHA1     = Helper.VerifyHash(password, "SHA1", actualPassword).ToString();
                            string sha256   = Helper.VerifyHash(password, "SHA256", actualPassword).ToString();
                            string sha384   = Helper.VerifyHash(password, "SHA384", actualPassword).ToString();
                            string sha512   = Helper.VerifyHash(password, "SHA512", actualPassword).ToString();

                            if (MD5 == "True" || SHA1 == "True" || sha256 == "True" || sha384 == "True" || sha512 == "True")
                            {
                                flagCheckPassword = true;
                            }
                        }
                        else
                        {
                            if (random != "")
                            {
                                if (random == _obj.Random)
                                {
                                    flagCheckPassword = true;
                                }
                            }
                        }
                        if (flagCheckPassword)
                        {
                            Random rn = new Random();
#pragma warning disable SCS0005 // Weak random generator
                            int month = rn.Next(1, 6);
#pragma warning restore SCS0005 // Weak random generator
                            StringBuilder hashPassword = new StringBuilder();
                            string        new_password = _obj.ActualPassword;
                            switch (month)
                            {
                            case 1:
                                hashPassword.Append(Helper.ComputeHash(new_password, "MD5", null));
                                break;

                            case 2:
                                hashPassword.Append(Helper.ComputeHash(new_password, "SHA1", null));
                                break;

                            case 3:
                                hashPassword.Append(Helper.ComputeHash(new_password, "SHA256", null));
                                break;

                            case 4:
                                hashPassword.Append(Helper.ComputeHash(new_password, "SHA384", null));
                                break;

                            case 5:
                                hashPassword.Append(Helper.ComputeHash(new_password, "SHA512", null));
                                break;
                            }
                            _obj.ActualPassword = hashPassword.ToString();
                            DataSet _dsChngPwd = _objRepository.student_password_change(_obj);
                            if (_dsChngPwd != null)
                            {
                                if (_dsChngPwd.Tables[0].Rows.Count > 0)
                                {
                                    flagPwdChanged = true;
                                    Session["IsPasswordChanged"] = "true";
                                }
                            }
                        }
                    }
                }
            }
            return(Json(new
            {
                flagCaptcha = flagCaptcha,
                flagPwdChanged = flagPwdChanged
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
Exemple #20
0
        public JsonResult SelectStudentBasic()
        {
            Student_Register  _obj   = new Student_Register();
            StudentRepository objRep = new StudentRepository();

            _obj.studentid = Session["studentid"].ToString();
            DataSet ds = objRep.Select_Student_Information(_obj);
            List <Student_Register>       _list        = new List <Student_Register>();
            List <Student_AddressDetails> _listAddress = new List <Student_AddressDetails>();

            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        Student_Register objBasic = new Student_Register();
                        objBasic.studentid         = row["studentid"].ToString();
                        objBasic.FirstName         = row["FirstName"].ToString();
                        objBasic.LastName          = row["LastName"].ToString();
                        objBasic.MiddleName        = row["MiddleName"].ToString();
                        objBasic.DateOfBirth       = row["DateOfBirth"].ToString();
                        objBasic.Gender            = row["Gender"].ToString();
                        objBasic.Email             = row["Email"].ToString();
                        objBasic.Mobile            = row["Mobile"].ToString();
                        objBasic.CountryCode       = row["CountryCode"].ToString();
                        objBasic.Nationality       = row["Nationality"].ToString();
                        objBasic.Country           = row["CountryID"].ToString();
                        objBasic.CountryToStay     = row["CountryToStay"].ToString();
                        objBasic.student_path      = row["student_path"].ToString();
                        objBasic.bCopyAddress      = row["bCopyAddress"].ToString();
                        objBasic.ApplyingForCourse = row["ApplyingForCourse"].ToString();
                        Session["studentname"]     = row["FirstName"].ToString() + ' ' + row["MiddleName"].ToString() + ' ' + row["LastName"].ToString();
                        _list.Add(objBasic);
                    }
                }
            }
            TestCentreRegitration _obj1 = new TestCentreRegitration
            {
                Type      = "SELECT",
                studentid = Session["studentid"].ToString()
            };
            ChoiceFillingRepository objRep1 = new ChoiceFillingRepository();
            DataSet ds1 = objRep1.Opr_TestCentreRegitration(_obj1);
            List <TestCentreRegitration> _list1 = new List <TestCentreRegitration>();

            if (ds1 != null)
            {
                if (ds1.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow row in ds1.Tables[0].Rows)
                    {
                        _list1.Add(new TestCentreRegitration
                        {
                            FatherName  = row["FatherName"].ToString(),
                            TestCountry = row["TestCountry"].ToString(),
                            TestCity    = row["TestCity"].ToString()
                        });
                    }
                }
            }
            return(Json(new
            {
                List = _list,
                List1 = _list1
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
Exemple #21
0
        // GET: admission/Landing
        public ActionResult Index(string id = "")
        {
            if (id == "")
            {
                return(Redirect("~/"));
            }
            Student_Register _obj = new Student_Register()
            {
                Email     = id,
                studentid = id
            };
            StudentRepository _objRepository = new StudentRepository();
            DataSet           ds             = _objRepository.Login_Student(_obj);

            if (ds != null)
            {
                Session["IsChangePwd"] = null;
                if (ds.Tables[0].Rows.Count > 0)
                {
                    DataRow dr = ds.Tables[0].Rows[0];
                    Session["studentid"] = dr["studentid"].ToString();


                    Session["studentname"]       = dr["studentname"].ToString();
                    Session["Email"]             = dr["Email"].ToString();
                    Session["Mobile"]            = dr["Mobile"].ToString();
                    Session["StudentProfilePic"] = "/assets/img/avatar.png";
                    Session["submitChoiceFill"]  = dr["submitChoiceFill"].ToString();
                    Session["submitchoiceDate"]  = dr["submitchoiceDate"].ToString();
                    Session["EditApplication"]   = dr["EditApplication"].ToString();
                    //Session["submitChoiceFill"] = "false";
                    Session["IsPasswordChanged"]  = dr["IsPasswordChanged"].ToString();
                    Session["ischangedpassword"]  = dr["ischangedpassword"].ToString();
                    Session["IsSeatAlloted"]      = dr["IsSeatAlloted"].ToString();
                    Session["IsAllowEditData"]    = dr["IsAllowEditData"].ToString();
                    Session["AllowChoiceFilling"] = dr["AllowChoiceFilling"].ToString();
                    Session["CountryID"]          = dr["CountryID"].ToString();
                    Session["RegistrationPhase"]  = dr["RegistrationPhase"].ToString();
                    //RegistrationPhase = dr["RegistrationPhase"].ToString();
                    Session["OpenChoiceFilling_"]           = dr["OpenChoiceFilling_"].ToString();
                    Session["IndividualOpenChoiceFilling_"] = dr["IndividualOpenChoiceFilling_"].ToString();
                    Session["ApplyingForCourse"]            = dr["ApplyingForCourse"].ToString();
                    Session["isTestStudent"]       = dr["isTestStudent"].ToString();
                    Session["Photo"]               = dr["Photo"].ToString();
                    Session["Signature"]           = dr["Signature"].ToString();
                    Session["IsTestCentreCountry"] = dr["IsTestCentreCountry"].ToString();
                    Session["IsIndSATStudent"]     = dr["IsIndSATStudent"].ToString();
                    //if (dr["student_path"]!= null)
                    //{
                    //    if (dr["student_path"].ToString() != "")
                    //    {
                    //        Session["StudentProfilePic"] = dr["student_path"].ToString();
                    //    }
                    //}
                    Session["SCH_UG"]  = "No";
                    Session["SCH_PG"]  = "No";
                    Session["SCH_PhD"] = "No";



                    string localIP = "?";
                    localIP            = Request.ServerVariables["REMOTE_ADDR"].ToString();
                    Session["localIP"] = localIP;
                }
                if (ds.Tables[1].Rows.Count > 0)
                {
                    foreach (DataRow _dr in ds.Tables[1].Rows)
                    {
                        if (_dr["AddressType"].ToString() == "Residential")
                        {
                            Session["Addressline1"] = _dr["Addressline1"].ToString();
                            Session["Addressline2"] = _dr["Addressline2"].ToString();
                            Session["State_name"]   = _dr["State_name"].ToString();
                            Session["City_name"]    = _dr["City_name"].ToString();
                            Session["Area"]         = _dr["Area"].ToString();
                            Session["Country_Name"] = _dr["Country_Name"].ToString();
                        }
                    }
                }
                if (ds.Tables[3].Rows.Count > 0)
                {
                    DataRow dr = ds.Tables[3].Rows[0];
                    Session["SCH_UG"]  = dr["UG"].ToString();
                    Session["SCH_PG"]  = dr["PG"].ToString();
                    Session["SCH_PhD"] = dr["PhD"].ToString();
                }
                if (ds.Tables[4].Rows.Count > 0)
                {
                    foreach (DataRow _dr in ds.Tables[4].Rows)
                    {
                        if (_dr["ProgrammeLevel"].ToString() == "UG")
                        {
                            Session["UG_ReEdit_DateTime"] = _dr["ClosingDate"].ToString();
                        }
                        else if (_dr["ProgrammeLevel"].ToString() == "PG")
                        {
                            Session["PG_ReEdit_DateTime"] = _dr["ClosingDate"].ToString();
                        }
                        else if (_dr["ProgrammeLevel"].ToString() == "PhD")
                        {
                            Session["PhD_ReEdit_DateTime"] = _dr["ClosingDate"].ToString();
                        }
                    }
                }
            }
            return(Redirect("~/admission/Dashboard"));
        }
        //[RecaptchaFilter], bool CaptchaValid
        public JsonResult RegistationUser(Student_Register _obj)
        {
            bool flagCaptcha = false;
            bool flagValidID = true;
            bool flagDOB     = true;

            string[] DMonths   = null;
            mWebhook _response = null;

            if (this.Session["CaptchaImageText"].ToString() == _obj.Captchastr)
            //  if (CaptchaValid)
            {
                flagCaptcha = true;
                DMonths     = new[] { "04", "06", "09", "11" };
                if (_obj.Month == "02")
                {
                    if (Convert.ToInt32(_obj.Year) % 4 == 0)
                    {
                        if (Convert.ToInt32(_obj.Date) > 29)
                        {
                            flagDOB = false;
                        }
                    }
                    else
                    {
                        if (Convert.ToInt32(_obj.Date) > 28)
                        {
                            flagDOB = false;
                        }
                    }
                }
                else if (DMonths.Contains(_obj.Month))
                {
                    if (Convert.ToInt32(_obj.Date) > 30)
                    {
                        flagDOB = false;
                    }
                }
                if (flagDOB)
                {
                    _obj.DateOfBirth = _obj.Date + "-" + _obj.Month + "-" + _obj.Year;
                    StudentRepository _objRepository = new StudentRepository();
                    // _obj.CREATE_BY = Session["FA_USER_ID"].ToString();
                    string localIP = "?";
                    localIP         = Request.ServerVariables["REMOTE_ADDR"].ToString();
                    _obj.Created_Ip = localIP;
                    string password = Membership.GeneratePassword(8, 1);
                    _obj.Random = password;
                    Random rn = new Random();
#pragma warning disable SCS0005 // Weak random generator
                    int month = rn.Next(1, 6);
#pragma warning restore SCS0005 // Weak random generator
                    StringBuilder hashPassword = new StringBuilder();
                    string        new_password = _obj.ActualPassword;
                    switch (month)
                    {
                    case 1:
                        hashPassword.Append(Helper.ComputeHash(new_password, "MD5", null));
                        break;

                    case 2:
                        hashPassword.Append(Helper.ComputeHash(new_password, "SHA1", null));
                        break;

                    case 3:
                        hashPassword.Append(Helper.ComputeHash(new_password, "SHA256", null));
                        break;

                    case 4:
                        hashPassword.Append(Helper.ComputeHash(new_password, "SHA384", null));
                        break;

                    case 5:
                        hashPassword.Append(Helper.ComputeHash(new_password, "SHA512", null));
                        break;
                    }
                    _obj.ActualPassword = hashPassword.ToString();
                    _obj.Created_Ip     = Request.ServerVariables["REMOTE_ADDR"].ToString();
                    DataSet   ds            = _objRepository.InsertStudentRegistration(_obj);
                    SendEmail _objseedemail = new SendEmail();
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        _obj.studentid = ds.Tables[0].Rows[0]["UserName"].ToString();
                        if (ds.Tables[0].Rows[0]["Exist"].ToString() == "0")
                        {
                            flagValidID = true;
                            string strform = "";
                            if (_obj.Email.ToString() != "")
                            {
                                #region Mail Sending Code
                                #region Code to send mails simultaneously in a loop (By Amit: 14-06-2019 11:45 AM)
                                //if (System.Web.HttpContext.Current.Application["UserCountForMail"] == null)
                                //{
                                //    System.Web.HttpContext.Current.Application["UserCountForMail"] = 1;
                                //}
                                //else
                                //{

                                //}
                                //int UserCountForMail = Convert.ToInt32(System.Web.HttpContext.Current.Application["UserCountForMail"]);
                                //if (UserCountForMail < 4)
                                //{
                                //    UserCountForMail++;
                                //}
                                //else
                                //{
                                //    UserCountForMail = 1;
                                //}

                                //System.Web.HttpContext.Current.Application["UserCountForMail"] = UserCountForMail;
                                //if (System.Web.HttpContext.Current.Application["UserCountForMail"] == null)
                                //{
                                //    System.Web.HttpContext.Current.Application["UserCountForMail"] = 1;
                                //}

                                //if (UserCountForMail == 1)
                                //{
                                //    strform = System.Configuration.ConfigurationManager.AppSettings["Emailusername1"];
                                //}
                                //else if (UserCountForMail == 2)
                                //{
                                //    strform = System.Configuration.ConfigurationManager.AppSettings["Emailusername2"];
                                //}
                                //else if (UserCountForMail == 3)
                                //{
                                //    strform = System.Configuration.ConfigurationManager.AppSettings["Emailusername3"];
                                //}
                                //else if (UserCountForMail == 4)
                                //{
                                //    strform = System.Configuration.ConfigurationManager.AppSettings["Emailusername4"];
                                //}

                                #endregion

                                string ActivationLink = FullyQualifiedApplicationPath(ControllerContext.RequestContext.HttpContext.Request) + "admission/login?eid=" + Encrypt_Decrypt.EncryptData(_obj.Email, "");

                                //string Subject = "Student Login";
                                //StringBuilder MailBody = new StringBuilder();
                                //MailBody.Append("<br/>Dear " + _obj.FirstName + " " + _obj.LastName + ",<br/>");
                                //MailBody.Append("<br/>Greetings from 'Study In India' Team!");
                                //MailBody.Append("<br/>Thank you for registering at 'Study In India' Portal. Your application will be considered for the Academic Year of 2020-21.");
                                //MailBody.Append("<br/>To activate your account <b><a target='_blank' href='" + ActivationLink + "'>click here </a> </b>");
                                ////  MailBody.Append("<br/>Username: "******"UserName"].ToString() + "(You can also use your email id for logging in)");
                                ////   MailBody.Append("<br/>Password: "******"<br/>Please note: This is an auto generated email.<br/>");
                                //MailBody.Append("<br/><br/><br/>Regards,<br/>");
                                //MailBody.Append("'Study In India' Team<br/>");
                                //MailBody.Append("<br/><strong>NOTE:</strong> This is an auto generated mail. Please do not respond to this mail.<br/>");
                                //string bcc = "";
                                //string cc = "";
                                //_objseedemail.SendEmailInBackgroundThread(strform, _obj.Email, bcc, cc, Subject, MailBody.ToString(), "", true);
                                string MailMessage = "";
                                string MailSent    = "1";
                                try
                                {
                                    //_objseedemail.SendEmailForRegistration(strform, _obj.Email, bcc, cc, Subject, MailBody.ToString(), "", true);
                                    MailMessage = "Mail Sent";
                                    MailSent    = "1";
                                }
                                catch (Exception ex)
                                {
                                    MailMessage = ex.Message.ToString();
                                }
                                #endregion

                                #region Call PivotRoots Code
                                int gotoIndex = 0;
                                goback : { }
                                string     strUrl  = "https://pivotroots.com/clients/studyinindia/webhooks/user_events";
                                WebRequest request = HttpWebRequest.Create(strUrl);
                                request.Headers.Add("Request-Id", DateTime.Now.ToString("yyyyMMddhhmmss"));
                                request.Method      = "POST";
                                request.ContentType = "application/json";
                                request.Headers.Add("Client-Id", "b7a51eff57749dc0e733b74342c8b512");
                                request.Headers.Add("Client-Access-Token", "dfdd5aa8ea4a1e2fb5999dc213476c2a9b68efa7");
                                mWebhookRequestRegistration _objJsonRequest = new mWebhookRequestRegistration()
                                {
                                    timestamp        = DateTime.Now.ToString("yyyyMMddhhmmss"),
                                    user_id          = _obj.studentid,
                                    @event           = "new_registration",
                                    userName         = _obj.FirstName + " " + _obj.LastName,
                                    emailID          = _obj.Email,
                                    activationLink   = ActivationLink,
                                    Country          = ds.Tables[0].Rows[0]["CountryName"].ToString(),
                                    country_code     = ds.Tables[0].Rows[0]["country_code"].ToString(),
                                    mobile           = _obj.Mobile,
                                    whatsapp_consent = _obj.whatsapp_consent
                                };
                                string data       = JsonConvert.SerializeObject(_objJsonRequest);
                                byte[] dataStream = Encoding.UTF8.GetBytes(data);
                                request.ContentLength = dataStream.Length;
                                Stream r = request.GetRequestStream();
                                r.Write(dataStream, 0, dataStream.Length);
                                r.Close();
                                HttpWebResponse response   = (HttpWebResponse)request.GetResponse();
                                Stream          s          = (Stream)response.GetResponseStream();
                                StreamReader    readStream = new StreamReader(s);
                                string          dataString = readStream.ReadToEnd();
                                _response = JsonConvert.DeserializeObject <mWebhook>(dataString);
                                if (_response.reason == "SUCCESS")
                                {
                                    DataSet dsMailSend = _objRepository.Opr_GenerateStudentDtl("ActivationLinkSent", _obj.studentid, ActivationLink, MailSent, MailMessage, strform);
                                    response.Close();
                                    s.Close();
                                    readStream.Close();
                                }
                                else
                                {
                                    response.Close();
                                    s.Close();
                                    readStream.Close();
                                    if ((gotoIndex++) < 3)
                                    {
                                        goto goback;
                                    }
                                }
                                #endregion
                            }
                        }
                        else
                        {
                            flagValidID = false;
                        }
                    }
                }
            }
            return(Json(new
            {
                flagCaptcha = flagCaptcha,
                flagValidID = flagValidID,
                flagDOB = flagDOB
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
        // [ValidateAntiForgeryToken]
        //[RecaptchaFilter], bool CaptchaValid
#pragma warning disable SCS0016 // Controller method is vulnerable to CSRF
        public JsonResult RegistationUser(Student_Register _obj)
#pragma warning restore SCS0016 // Controller method is vulnerable to CSRF
        {
            //_obj.instituteid = TempData["instituteid"].ToString();
            //_obj.NicheCourseID = TempData["NicheCourseId"].ToString();

            bool flagCaptcha = false;
            bool flagValidID = true;
            bool flagDOB     = true;

            string[] DMonths   = null;
            string   Studentid = null;

            try
            {
                if (this.Session["CaptchaImageText"].ToString() == _obj.Captchastr)
                //  if (CaptchaValid)
                {
                    flagCaptcha = true;
                    DMonths     = new[] { "04", "06", "09", "11" };
                    if (_obj.Month == "02")
                    {
                        if (Convert.ToInt32(_obj.Year) % 4 == 0)
                        {
                            if (Convert.ToInt32(_obj.Date) > 29)
                            {
                                flagDOB = false;
                            }
                        }
                        else
                        {
                            if (Convert.ToInt32(_obj.Date) > 28)
                            {
                                flagDOB = false;
                            }
                        }
                    }
                    else if (DMonths.Contains(_obj.Month))
                    {
                        if (Convert.ToInt32(_obj.Date) > 30)
                        {
                            flagDOB = false;
                        }
                    }
                    if (flagDOB)
                    {
                        _obj.DateOfBirth = _obj.Date + "-" + _obj.Month + "-" + _obj.Year;
                        StudentRepository _objRepository = new StudentRepository();
                        // _obj.CREATE_BY = Session["FA_USER_ID"].ToString();
                        string localIP = "?";
                        localIP         = Request.ServerVariables["REMOTE_ADDR"].ToString();
                        _obj.Created_Ip = localIP;
                        string password = Membership.GeneratePassword(8, 1);
                        _obj.Random = password;
                        Random rn = new Random();
#pragma warning disable SCS0005 // Weak random generator
                        int month = rn.Next(1, 6);
#pragma warning restore SCS0005 // Weak random generator
                                //StringBuilder hashPassword = new StringBuilder();
                                //string new_password = _obj.ActualPassword;
                                //switch (month)
                                //{
                                //    case 1:
                                //        hashPassword.Append(Helper.ComputeHash(new_password, "MD5", null));
                                //        break;

                        //    case 2:
                        //        hashPassword.Append(Helper.ComputeHash(new_password, "SHA1", null));
                        //        break;

                        //    case 3:
                        //        hashPassword.Append(Helper.ComputeHash(new_password, "SHA256", null));
                        //        break;

                        //    case 4:
                        //        hashPassword.Append(Helper.ComputeHash(new_password, "SHA384", null));
                        //        break;

                        //    case 5:
                        //        hashPassword.Append(Helper.ComputeHash(new_password, "SHA512", null));
                        //        break;
                        //}
                        //_obj.ActualPassword = hashPassword.ToString();
                        _obj.Created_Ip = Request.ServerVariables["REMOTE_ADDR"].ToString();
                        DataSet   ds            = _objRepository.InsertStudentRegistration_Niche(_obj);
                        SendEmail _objseedemail = new SendEmail();
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            if (ds.Tables[0].Rows[0]["Exist"].ToString() == "0")
                            {
                                flagValidID = true;
                                string strform = "";
                                if (_obj.Email.ToString() != "")
                                {
                                    #region Code to send mails simultaneously in a loop (By Amit: 14-06-2019 11:45 AM)
                                    if (System.Web.HttpContext.Current.Application["UserCountForMail"] == null)
                                    {
                                        System.Web.HttpContext.Current.Application["UserCountForMail"] = 1;
                                    }
                                    else
                                    {
                                    }
                                    int UserCountForMail = Convert.ToInt32(System.Web.HttpContext.Current.Application["UserCountForMail"]);
                                    if (UserCountForMail < 4)
                                    {
                                        UserCountForMail++;
                                    }
                                    else
                                    {
                                        UserCountForMail = 1;
                                    }

                                    System.Web.HttpContext.Current.Application["UserCountForMail"] = UserCountForMail;
                                    if (System.Web.HttpContext.Current.Application["UserCountForMail"] == null)
                                    {
                                        System.Web.HttpContext.Current.Application["UserCountForMail"] = 1;
                                    }

                                    if (UserCountForMail == 1)
                                    {
                                        strform = System.Configuration.ConfigurationManager.AppSettings["Emailusername1"];
                                    }
                                    else if (UserCountForMail == 2)
                                    {
                                        strform = System.Configuration.ConfigurationManager.AppSettings["Emailusername2"];
                                    }
                                    else if (UserCountForMail == 3)
                                    {
                                        strform = System.Configuration.ConfigurationManager.AppSettings["Emailusername3"];
                                    }
                                    else if (UserCountForMail == 4)
                                    {
                                        strform = System.Configuration.ConfigurationManager.AppSettings["Emailusername4"];
                                    }

                                    #endregion

                                    string        Subject  = "Student Login";
                                    StringBuilder MailBody = new StringBuilder();
                                    MailBody.Append("<br/>Dear " + _obj.FirstName + " " + _obj.LastName + ",<br/>");
                                    MailBody.Append("<br/>Thank You for registering at Study in India. The applications for 2019 or 2020 admissions have already begun.");
                                    MailBody.Append("<br/>");
                                    MailBody.Append("<br/>Username: "******"UserName"].ToString());
                                    MailBody.Append("<br/>Mobile: " + ds.Tables[0].Rows[0]["Mobile"].ToString());
                                    MailBody.Append("<br/>Email: " + ds.Tables[0].Rows[0]["Email"].ToString());
                                    MailBody.Append("<br/>");
                                    // MailBody.Append("<br/>To activate your account <b><a target='_blank' href='" + FullyQualifiedApplicationPath(ControllerContext.RequestContext.HttpContext.Request) + "admission/login?eid=" + Encrypt_Decrypt.EncryptData(_obj.Email, "") + "'>click on the following link </a> </b>");
                                    MailBody.Append("<br/>");
                                    MailBody.Append("<br/>Please note: Kindly keep this details for future  usage.<br/>");
                                    MailBody.Append("<br/><br/><br/>Regards,<br/>");
                                    MailBody.Append("Study in India Team<br/>");
                                    string bcc = "";
                                    string cc  = "";
                                    _objseedemail.SendEmailForRegistration(strform, _obj.Email, bcc, cc, Subject, MailBody.ToString(), "", true);
                                    SendemailForCourse(ds.Tables[0].Rows[0]["studentid"].ToString(), ds.Tables[0].Rows[0]["NicheCourseID"].ToString(), ds.Tables[0].Rows[0]["Email"].ToString(), _obj.FirstName + " " + _obj.LastName);
                                    Studentid = ds.Tables[0].Rows[0]["studentid"].ToString();
                                }
                            }
                            else
                            {
                                flagValidID = false;
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(Json(new
            {
                flagCaptcha = flagCaptcha,
                flagValidID = flagValidID,
                flagDOB = flagDOB,
                Studentid = Studentid
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
        public JsonResult RegistationUser(Student_Register _obj, bool CaptchaValid = true)
        {
            bool flagCaptcha = false;
            bool flagValidID = true;

            try
            {
                //if (this.Session["CaptchaImageText"].ToString() == _obj.Captchastr)
                if (CaptchaValid)
                {
                    flagCaptcha = true;
                    StudentRepository _objRepository = new StudentRepository();
                    string            localIP        = "?";
                    localIP         = Request.ServerVariables["REMOTE_ADDR"].ToString();
                    _obj.Created_Ip = localIP;
                    string password = Membership.GeneratePassword(8, 1);
                    _obj.Random   = password;
                    _obj.bulk_reg = "true";
                    DataSet   ds            = _objRepository.InsertStudentRegistration(_obj);
                    SendEmail _objseedemail = new SendEmail();
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["Exist"].ToString() == "0")
                        {
                            flagValidID = true;
                            if (_obj.Email.ToString() != "")
                            {
                                string        strform  = System.Configuration.ConfigurationManager.AppSettings["Emailusername"];
                                string        Subject  = "Student Login";
                                StringBuilder MailBody = new StringBuilder();
                                MailBody.Append("<br/>Dear " + _obj.FirstName + " " + _obj.LastName + ",<br/>");
                                MailBody.Append("<br/>Thank you for registering at Study in India.");
                                MailBody.Append("<br/>To activate your account <b><a target='_blank' href='" + FullyQualifiedApplicationPath(ControllerContext.RequestContext.HttpContext.Request) + "admission/login'>Click Here</a> </b>");
                                MailBody.Append("<br/>Username: "******"UserName"].ToString() + "(You can also use your email id for logging in)");
                                MailBody.Append("<br/>Password: "******"<br/>Please note: This is an auto generated email.<br/>");
                                MailBody.Append("<br/><br/><br/>Regards,<br/>");
                                MailBody.Append("Study in India Team<br/>");
                                string bcc = "";
                                string cc  = "";
                                _objseedemail.SendEmailInBackgroundThread(strform, _obj.Email, bcc, cc, Subject, MailBody.ToString(), "", true);
                            }
                        }
                        else
                        {
                            flagValidID = false;
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(Json(new
            {
                flagCaptcha = flagCaptcha,
                flagValidID = flagValidID
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
Exemple #25
0
        public JsonResult CheckLogin(Student_Register _obj)
        {
            bool   flagCaptcha         = false;
            bool   flagLogin           = false;
            bool   flagPasswordChanged = true;
            bool   flagValidID         = false;
            String RegistrationPhase   = "";

            try
            {
                if (this.Session["CaptchaImageText"].ToString() == _obj.Captchastr)
                //if (CaptchaValid)
                {
                    flagCaptcha = true;
                    StudentRepository _objRepository = new StudentRepository();
                    DataSet           ds             = _objRepository.Login_Student(_obj);
                    if (ds != null)
                    {
                        Session["IsChangePwd"] = null;
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            flagValidID = true;
                            DataRow dr             = ds.Tables[0].Rows[0];
                            string  actualPassword = dr["ActualPassword"].ToString();
                            string  random         = "";
                            if (dr["Random"] != null)
                            {
                                random = dr["Random"].ToString();
                            }
                            if (dr["IsPasswordChanged"].ToString().ToLower() == "true" && dr["ischangedpassword"].ToString().ToLower() == "true")
                            {
                                string PASSWORD = _obj.ActualPassword;
                                string MD5      = Helper.VerifyHash(PASSWORD, "MD5", actualPassword).ToString();
                                string SHA1     = Helper.VerifyHash(PASSWORD, "SHA1", actualPassword).ToString();
                                string sha256   = Helper.VerifyHash(PASSWORD, "SHA256", actualPassword).ToString();
                                string sha384   = Helper.VerifyHash(PASSWORD, "SHA384", actualPassword).ToString();
                                string sha512   = Helper.VerifyHash(PASSWORD, "SHA512", actualPassword).ToString();
                                if (MD5 == "True" || SHA1 == "True" || sha256 == "True" || sha384 == "True" || sha512 == "True")
                                {
                                    TempData["old_password"] = PASSWORD;
                                    flagLogin = true;
                                }
                            }
                            else
                            {
                                if (random != "")
                                {
                                    if (random == _obj.ActualPassword)
                                    {
                                        flagLogin                = true;
                                        flagPasswordChanged      = false;
                                        TempData["old_password"] = random;
                                    }
                                }
                            }
                            if (flagLogin)
                            {
                                Session["studentid"] = dr["studentid"].ToString();


                                Session["studentname"]       = dr["studentname"].ToString();
                                Session["Email"]             = dr["Email"].ToString();
                                Session["Mobile"]            = dr["Mobile"].ToString();
                                Session["StudentProfilePic"] = "/assets/img/avatar.png";
                                Session["submitChoiceFill"]  = dr["submitChoiceFill"].ToString();
                                Session["submitchoiceDate"]  = dr["submitchoiceDate"].ToString();
                                Session["EditApplication"]   = dr["EditApplication"].ToString();
                                //Session["submitChoiceFill"] = "false";
                                Session["IsPasswordChanged"]            = dr["IsPasswordChanged"].ToString();
                                Session["ischangedpassword"]            = dr["ischangedpassword"].ToString();
                                Session["IsSeatAlloted"]                = dr["IsSeatAlloted"].ToString();
                                Session["IsAllowEditData"]              = dr["IsAllowEditData"].ToString();
                                Session["AllowChoiceFilling"]           = dr["AllowChoiceFilling"].ToString();
                                Session["CountryID"]                    = dr["CountryID"].ToString();
                                Session["RegistrationPhase"]            = dr["RegistrationPhase"].ToString();
                                RegistrationPhase                       = dr["RegistrationPhase"].ToString();
                                Session["OpenChoiceFilling_"]           = dr["OpenChoiceFilling_"].ToString();
                                Session["IndividualOpenChoiceFilling_"] = dr["IndividualOpenChoiceFilling_"].ToString();
                                Session["ApplyingForCourse"]            = dr["ApplyingForCourse"].ToString();
                                Session["isTestStudent"]                = dr["isTestStudent"].ToString();
                                Session["Photo"]               = dr["Photo"].ToString();
                                Session["Signature"]           = dr["Signature"].ToString();
                                Session["IsTestCentreCountry"] = dr["IsTestCentreCountry"].ToString();
                                Session["IsIndSATStudent"]     = dr["IsIndSATStudent"].ToString();
                                //if (dr["student_path"]!= null)
                                //{
                                //    if (dr["student_path"].ToString() != "")
                                //    {
                                //        Session["StudentProfilePic"] = dr["student_path"].ToString();
                                //    }
                                //}
                                Session["SCH_UG"]  = "No";
                                Session["SCH_PG"]  = "No";
                                Session["SCH_PhD"] = "No";



                                string localIP = "?";
                                localIP            = Request.ServerVariables["REMOTE_ADDR"].ToString();
                                Session["localIP"] = localIP;
                                flagLogin          = true;
                            }
                        }
                        if (ds.Tables[1].Rows.Count > 0)
                        {
                            foreach (DataRow _dr in ds.Tables[1].Rows)
                            {
                                if (_dr["AddressType"].ToString() == "Residential")
                                {
                                    Session["Addressline1"] = _dr["Addressline1"].ToString();
                                    Session["Addressline2"] = _dr["Addressline2"].ToString();
                                    Session["State_name"]   = _dr["State_name"].ToString();
                                    Session["City_name"]    = _dr["City_name"].ToString();
                                    Session["Area"]         = _dr["Area"].ToString();
                                    Session["Country_Name"] = _dr["Country_Name"].ToString();
                                }
                            }
                        }
                        if (ds.Tables[3].Rows.Count > 0)
                        {
                            DataRow dr = ds.Tables[3].Rows[0];
                            Session["SCH_UG"]  = dr["UG"].ToString();
                            Session["SCH_PG"]  = dr["PG"].ToString();
                            Session["SCH_PhD"] = dr["PhD"].ToString();
                        }

                        if (ds.Tables[4].Rows.Count > 0)
                        {
                            foreach (DataRow _dr in ds.Tables[4].Rows)
                            {
                                if (_dr["ProgrammeLevel"].ToString() == "UG")
                                {
                                    Session["UG_ReEdit_DateTime"] = _dr["ClosingDate"].ToString();
                                }
                                else if (_dr["ProgrammeLevel"].ToString() == "PG")
                                {
                                    Session["PG_ReEdit_DateTime"] = _dr["ClosingDate"].ToString();
                                }
                                else if (_dr["ProgrammeLevel"].ToString() == "PhD")
                                {
                                    Session["PhD_ReEdit_DateTime"] = _dr["ClosingDate"].ToString();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(Json(new
            {
                flagCaptcha = flagCaptcha,
                flagLogin = flagLogin,
                flagPasswordChanged = flagPasswordChanged,
                flagValidID = flagValidID,
                RegistrationPhase = RegistrationPhase
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }