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); } }