protected void btnRegistration_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    BStudent  objBStudent  = new BStudent();
                    BEStudent objBEStudent = new BEStudent()
                    {
                        strFirstName            = txtFirstName.Text.Trim(),
                        strLastName             = txtLastName.Text.Trim(),
                        strPassword             = txtPassword.Text.Trim(),
                        strConfirmPassword      = txtConfirmPassword.Text.Trim(),
                        strUserName             = txtUserName.Text.Trim(),
                        strGender               = ddlGender.SelectedValue,
                        strphoneNumber          = txtPhoneNumber.Text,
                        strTimeZone             = ddlTimeZone.SelectedValue,
                        strQuestion1            = ddlSecurityQuestion1.SelectedValue,
                        strPrefferedPhoneNumber = txtPrefferedPhoneNumber.Text,
                        strAnswer1              = txtAnswer1.Text,
                        strQuestion2            = ddlSecurityQuestion2.SelectedValue,
                        strAnswer2              = txtAnswer2.Text,
                        strQuestion3            = ddlSecurityQuestion3.SelectedValue,
                        strAnswer3              = txtAnswer3.Text,
                    };



                    if (IdentificationFileUpload.HasFile)
                    {
                        string strpath             = Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["UploadedDocumentsLocation"]);
                        string strOriginalFileName = IdentificationFileUpload.FileName;
                        string strUploadFileName   = CommonFunctions.generateUploadFileName(IdentificationFileUpload.FileName);
                        string strTotalPath        = strpath + '\\' + strUploadFileName;
                        string pathex = Path.GetExtension(strTotalPath);
                        if (pathex.ToLower() == ".jpg" || pathex.ToLower() == ".gif" || pathex.ToLower() == ".png" || pathex.ToLower() == ".bmp" || pathex.ToLower() == ".pdf")
                        {
                            IdentificationFileUpload.SaveAs(strTotalPath);
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowFailure", "alert('" + Resources.ResMessages.Reg_Validuploadfiles + "')", true);
                            return;
                        }

                        //if (IdentificationFileUpload.PostedFile.ContentLength > 1024000)
                        //{
                        //    ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowFail", "alert('" + Resources.ResMessages.Reg_Uploadfilesize + "')", true);
                        //    File.Delete(strTotalPath);
                        //    return;
                        //}

                        //System.Drawing.Image image = System.Drawing.Image.FromFile(strTotalPath);
                        //int width = 0;
                        //int height = 0;
                        //if (image != null)
                        //{
                        //    width = image.Width;
                        //    height = image.Height;
                        //    if (height > 300)
                        //    {
                        //        ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowFailure", "alert('" + Resources.ResMessages.Reg_Uploadfileheight + "')", true);
                        //        image.Dispose();
                        //        File.Delete(strTotalPath);
                        //        return;
                        //    }
                        //}
                        objBEStudent.strUploadPath       = strUploadFileName;
                        objBEStudent.strOriginalFileName = strOriginalFileName;

                        objBStudent.BStudentRegistration(objBEStudent);

                        if (objBEStudent.IntResult == 0)
                        {
                            lblMessage.Text = Resources.ResMessages.Reg_UserExists;
                            this.ClearFields();
                        }
                        else if (objBEStudent.IntResult == 1)
                        {
                            lblMessage.Text = Resources.ResMessages.Reg_StudentRegSuccess;
                            this.ClearFields();
                            try
                            {
                                BEMail objBEMail = new BEMail();
                                BMail  objBMail  = new BMail();
                                if (objBEStudent.IntUserID != 0)
                                {
                                    objBEMail.IntUserID = objBEStudent.IntUserID;
                                }
                                else
                                {
                                    objBEMail.IntUserID = 0;
                                }
                                objBEMail.IntTransID      = 0;
                                objBEMail.StrTemplateName = BaseClass.EnumEmails.StudentRegistrationConfirmation.ToString();
                                objBMail.BSendEmail(objBEMail);
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }
                            this.ClearFields();
                        }
                        else if (objBEStudent.IntResult == 9)
                        {
                            lblMessage.Text = Resources.ResMessages.Reg_StudentRegFail;
                            lblMessage.Text = Resources.ResMessages.Reg_NoStudentDet;
                            this.ClearFields();
                        }
                    }
                    else
                    {
                        objBEStudent.strUploadPath       = string.Empty;
                        objBEStudent.strOriginalFileName = string.Empty;
                        lblMessage.Text = "Please upload the valid file";
                    }
                }
            }
            catch (Exception)
            {
                // ErrorLog.WriteError(Ex);
            }
        }
        protected void btnSaveImage_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                BEStudent objBEStudent = new BEStudent();

                BStudent objBStudent = new BStudent();

                objBEStudent.IntUserID = Convert.ToInt32(Session[BaseClass.EnumPageSessions.USERID]);

                if (IdentificationFileUpload.HasFile)
                {
                    string strpath             = Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["UploadedDocumentsLocation"]);
                    string strOriginalFileName = IdentificationFileUpload.FileName;
                    string strUploadFileName   = CommonFunctions.generateUploadFileName(IdentificationFileUpload.FileName);
                    string strTotalPath        = strpath + '\\' + strUploadFileName;
                    string pathex = Path.GetExtension(strTotalPath);
                    if (pathex.ToLower() == ".jpg" || pathex.ToLower() == ".jpeg" || pathex.ToLower() == ".gif" || pathex.ToLower() == ".png" || pathex.ToLower() == ".bmp")
                    {
                        //IdentificationFileUpload.SaveAs(strTotalPath);
                        System.Drawing.Image img = System.Drawing.Image.FromStream(IdentificationFileUpload.PostedFile.InputStream);
                        int     height           = img.Height;
                        int     width            = img.Width;
                        decimal size             = Math.Round(((decimal)IdentificationFileUpload.PostedFile.ContentLength / (decimal)1024), 2);
                        if (size > 999)
                        {
                            Stream strm       = IdentificationFileUpload.PostedFile.InputStream;
                            var    targetFile = strTotalPath;
                            ReduceImageSize(0.3, strm, targetFile);
                        }
                        else
                        {
                            IdentificationFileUpload.SaveAs(strTotalPath);
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowFailure", "alert('" + Resources.ResMessages.Reg_Validuploadfiles + "')", true);
                        return;
                    }
                    objBEStudent.strUploadPath       = strUploadFileName;
                    objBEStudent.strOriginalFileName = strOriginalFileName;
                }
                else
                {
                    objBEStudent.strUploadPath       = string.Empty;
                    objBEStudent.strOriginalFileName = string.Empty;
                }

                objBStudent.BUploadPhotoIdentity(objBEStudent);

                if (objBEStudent.IntResult > 0)
                {
                    lblUpload.Text = "<img src='../Images/yes.png'align='middle'/>&nbsp;<font color='#00C000'>" + Resources.ResMessages.MyProfile_FileUploadSuccess + "</font>";
                    this.getPhotoIdentity();
                    ValidatePhotoIdentity();
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "NotSaved", "document.getElementById('" + lblUpload.ClientID.ToString() + "').focus();", true);
                    Session["UPLOAD"] = "YES";
                    Response.Redirect("MyProfile.aspx");
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "NotSaved", "document.getElementById('" + RequiredFieldValidator13.ClientID.ToString() + "').focus();", true);
                    Session["UPLOAD"] = "NO";
                    Response.Redirect("MyProfile.aspx");
                }
            }
        }