protected void btnSubmit_Click(object sender, EventArgs e)
 {
     DataTable dt = GetGridviewData();
     if (dt != null && dt.Rows.Count > 0)
     {
         StudentInformation _AlumniInfo = new StudentInformation();
         _AlumniInfo.nAlumniID = 0;
         _AlumniInfo.sAlumniName = txtAlumniName.Text.Trim();
         _AlumniInfo.sAdmissionYear = txtAdmissionYear.Text.Trim();
         _AlumniInfo.sPassingYear = txtPassingYear.Text.Trim();
         _AlumniInfo.nBranchID = Convert.ToInt64(BranchName.Value);
         _AlumniInfo.sContactNo = txtContactNo.Text.Trim();
         _AlumniInfo.sAlternateContactNo = txtAltContactNo.Text.Trim();
         _AlumniInfo.sPersonalEmailID = txtPersonalEmail.Text.Trim();
         _AlumniInfo.sOfficeEmailID = txtOfficeEmail.Text.Trim();
         _AlumniInfo.sCorrespondanceAddress = txtCorresAddr.Text.Trim();
         _AlumniInfo.sPermanentAddress = txtPermanentAddr.Text.Trim();
         _AlumniInfo.sOccupation = txtOccupation.Text.Trim();
         _AlumniInfo.sDesigation = txtDesignation.Text.Trim();
         _AlumniInfo.sCompanyName = txtCompanyName.Text.Trim();
         _AlumniInfo.sCompanyAddress = txtCompanyAddr.Text.Trim();
         _AlumniInfo.sWhatsUpDetails = txtWhatsup.Text.Trim();
         _AlumniInfo.sFacebookDetails = txtFacebook.Text.Trim();
         _AlumniInfo.sLinkedinDetails = txtLinkedin.Text.Trim();
         _AlumniInfo.InsertUpdateAlumniStudentInfo(dt);
     }
 }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            DataTable _dt = null;
            StudentInformation _studInfo=new StudentInformation();
            _dt = _studInfo.GetStudentDetailsByUserName(txtUserName.Text.Trim());

            if (_dt!=null&&_dt.Rows.Count>0)
            {
                string sPassword = Encryption.DecryptToBase64String(Convert.ToString(_dt.Rows[0]["sPassword"]));
                if (sPassword==txtPassword.Text)
                {
                    Session["UserName"] = Convert.ToString(_dt.Rows[0]["sUserName"]);
                    Session["StudentName"] = Convert.ToString(_dt.Rows[0]["Student Name"]);
                    Session["StudentEmail"] = Convert.ToString(_dt.Rows[0]["sStudEmailID"]);
                    Session["StudentID"] = Convert.ToString(_dt.Rows[0]["nStudentID"]);

                    Response.Redirect("RegistrationForm.aspx");
                }
                else
                {
                    dvLoginError.Style.Add("display", "Block");
                    lbLoginError.InnerHtml = "Please enter correct password";
                }
            }
        }
        private DataTable GetAllatestNews(int nNewsType)
        {
            DataTable _dt = null;

            DataAccess _DataAccess = new DataAccess();
            StudentInformation _Student = new StudentInformation();
            try
            {
                _dt = _Student.GetLatestNEWS(nNewsType, true);
            }
            catch (Exception)
            {
                if (_DataAccess != null) { _DataAccess.RollBack(); _DataAccess.CloseConnection(false); }
            }
            finally
            {
            }
            return _dt;
        }
        private DataTable GetDepartmentFaculty()
        {
            DataTable _dt = null;
            DataAccess _DataAccess = new DataAccess();
            StudentInformation _studentInfo = new StudentInformation();

            try
            {
                _dt = _studentInfo.GetDepartmentFacultyList(2);
            }
            catch (Exception)
            {
                if (_DataAccess != null) { _DataAccess.RollBack(); _DataAccess.CloseConnection(false); }
            }
            finally
            {
            }
            return _dt;
        }
        private DataTable GetBranchIntake()
        {
            DataTable _dt = null;

            DataAccess _DataAccess = new DataAccess();
            StudentInformation _Student = new StudentInformation();
            try
            {
                _dt = _Student.GetBranchIntakeDetails(13);
            }
            catch (Exception)
            {
                if (_DataAccess != null) { _DataAccess.RollBack(); _DataAccess.CloseConnection(false); }
            }
            finally
            {
            }
            return _dt;
        }
        private DataTable GetPaperPresentedByStaff()
        {
            DataTable _dt = null;

            DataAccess _DataAccess = new DataAccess();
            StudentInformation _Student = new StudentInformation();
            try
            {
                _dt = _Student.GetPaperPresentedByStaff(6);
            }
            catch (Exception)
            {
                if (_DataAccess != null) { _DataAccess.RollBack(); _DataAccess.CloseConnection(false); }
            }
            finally
            {
            }
            return _dt;
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            StudentInformation _studInfo = new StudentInformation();
            DataAccess _DataAccess = new DataAccess();

            _studInfo.nStudentID = 0;
            _studInfo.sStudFirstName = txtFirstName.Text;
            _studInfo.sStudMiddleName = txtMiddleName.Text;
            _studInfo.sStudLastName = txtLastName.Text;
            if (!bIsModify)
            {
                _studInfo.sStudUserName = txtUserName.Text;
                _studInfo.sStudPassword = Encryption.EncryptToBase64String(txtConfirmPassword.Text);
            }
            _studInfo.sStudEmailID = txtEmailID.Text;
            _studInfo.sStudRegistrationID = txtRegistrationID.Text;
            _studInfo.sStudCurrentYear = CurrentYear.Value;
            _studInfo.dtStudDOB = Convert.ToDateTime(txtDOB.Text);
            _studInfo.nBranchID = Convert.ToInt64(BranchName.Value);
            _studInfo.bIsStudentActive = true;
            _studInfo.nEduDtlsID = 0;
            _studInfo.sSSCMarks = txtSscMarks.Text;
            _studInfo.sHSCMarks = txtHscMarks.Text;
            _studInfo.sDiplomaMarks = txtDiplomaMarks.Text;
            _studInfo.sFirstYearMarks = txtFirstYearMarks.Text;
            _studInfo.sSecondYearMarks = txtSecondYearMarks.Text;
            _studInfo.sThirdYearMarks = txtThirdYearMarks.Text;
            _studInfo.sBEMarks = txtBEMarks.Text;

            try
            {
                _studInfo.InsertUpdateStudentInfo();
            }
            catch (Exception)
            {
            }
            finally
            {
            }
        }
        public static string GetStudentDetails(string id)
        {
            DataTable _dt = null;
            string sStudentDetails = string.Empty;

            DataAccess _DataAccess = new DataAccess();
            StudentInformation _Student = new StudentInformation();
            try
            {
                _dt = _Student.GetStudentDetailInfo(Convert.ToInt64(id));

                if (_dt!=null&&_dt.Rows.Count>0)
                {
                    foreach (DataRow dr in _dt.Rows)
                    {
                        foreach (DataColumn dc in _dt.Columns)
                        {
                            if (sStudentDetails=="")
                            {
                                sStudentDetails = dr[dc].ToString();
                            }
                            else
                            {
                                sStudentDetails = sStudentDetails + "^" + dr[dc].ToString();
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                if (_DataAccess != null) { _DataAccess.RollBack(); _DataAccess.CloseConnection(false); }
            }
            finally
            {
            }
            return sStudentDetails;
        }
        private DataTable GetSeminarOrganized()
        {
            DataTable _dt = null;

            DataAccess _DataAccess = new DataAccess();
            StudentInformation _Student = new StudentInformation();
            try
            {
                _dt = _Student.GetSeminarOrganized(2);
            }
            catch (Exception)
            {
                if (_DataAccess != null) { _DataAccess.RollBack(); _DataAccess.CloseConnection(false); }
            }
            finally
            {
            }
            return _dt;
        }
        private DataTable GetAllAlumni(string sSearchString, int nSearchCriteria)
        {
            DataTable _dt = null;

            DataAccess _DataAccess = new DataAccess();
            StudentInformation _Student = new StudentInformation();
            try
            {
                _dt = _Student.GetAlumniInfo(sSearchString,nSearchCriteria);
            }
            catch (Exception)
            {
                if (_DataAccess != null) { _DataAccess.RollBack(); _DataAccess.CloseConnection(false); }
            }
            finally
            {
            }
            return _dt;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                PopulateYearDatalist(0);
                PopulateBranchDatalist();
                Int64 nStudentID = Convert.ToInt64(Session["StudentID"]);
                if (nStudentID != 0)
                {
                    dvLoginDetails.Style.Add("Display","none");
                    bIsModify = true;
                    StudentInformation _studInfo = new StudentInformation();
                    DataTable _dtStudentInfo = _studInfo.GetEditStudentDetailInfo(nStudentID);
                    if (_dtStudentInfo != null && _dtStudentInfo.Rows.Count > 0)
                    {
                        foreach (DataRow dr in _dtStudentInfo.Rows)
                        {

                            txtRegistrationID.Text = Convert.ToString(dr["sStudRegistrationID"]);
                            txtEmailID.Text = Convert.ToString(dr["sStudEmailID"]);
                            txtFirstName.Text = Convert.ToString(dr["sStudFirstName"]);
                            txtMiddleName.Text = Convert.ToString(dr["sStudMiddleName"]);
                            txtLastName.Text = Convert.ToString(dr["sStudLastName"]);
                            txtDOB.Text = Convert.ToDateTime(dr["dtStudDOB"]).ToString("yyyy-MM-dd");
                            CurrentYear.SelectedIndex = Convert.ToInt16(dr["sCurrentYear"]);
                            BranchName.SelectedIndex = Convert.ToInt16(dr["nBranchID"]);
                            txtUserName.Text = Convert.ToString(dr["sUserName"]);
                            //txtpassword.Text = Convert.ToString(dr[""]);
                            txtSscMarks.Text = Convert.ToString(dr["sSSCMarks"]);
                            txtHscMarks.Text = Convert.ToString(dr["sHSCMarks"]);
                            txtDiplomaMarks.Text = Convert.ToString(dr["sDiplomaMarks"]);
                            txtFirstYearMarks.Text = Convert.ToString(dr["sFirstYearMarks"]);
                            txtSecondYearMarks.Text = Convert.ToString(dr["sSecondYearMarks"]);
                            txtThirdYearMarks.Text = Convert.ToString(dr["sThirdYearMarks"]);
                            txtBEMarks.Text = Convert.ToString(dr["sBEMarks"]);

                        }

                    }
                }
            }
        }