protected void btn_Login_Click(object sender, EventArgs e) { try { if (IsValidEmail(txt_LoginName.Text) && IsValidPassword(txt_Password.Text)) { //Utils.csIsSystemUser = false; Candidate oCandidate = new Candidate(); CandidateBO oCandidateBO = new CandidateBO(); Result oResult = new Result(); oCandidate.CandidateEmail = txt_LoginName.Text; oCandidate.CandidatePassword = txt_Password.Text; oCandidate.CandidateLoginTime = DateTime.Now; try { oResult = oCandidateBO.CandidateLogin(oCandidate); if (oResult.ResultIsSuccess) { Utils.SetSession(SessionManager.csLoggedUser, (CandidateForExam)oResult.ResultObject); Response.Redirect(ContainerManager.csMasterContainerCandidate + "?option=" + OptionManager.csExamProcess); } else { lbl_Error.ForeColor = Color.Red; lbl_Error.Text = oResult.ResultMessage; } } catch (Exception oEx) { lbl_Error.ForeColor = Color.Red; lbl_Error.Text = "Login Failed."; } } else { lbl_Error.ForeColor = Color.Red; lbl_Error.Text = "Email & Password Required."; } } catch (Exception oEx2) { lbl_Error.ForeColor = Color.Red; lbl_Error.Text = "Login Failed."; } }
private static void SendMailToSystemUser(Object oObject) { logger.Info("start SendMailToSystemUser + Controls_SystemUserEntry"); Object[] oObjectArr = (Object[])oObject; SystemUser oSystemUser = oObjectArr[0] as SystemUser; CandidateBO oCandidateBO = new CandidateBO(); Result oResult = new Result(); MailForSystemUserEntry oMailForSystemUserEntry = new MailForSystemUserEntry(); SmtpClient oSMTPClient = new SmtpClient(); try { if (oSystemUser.SystemUserEmail.Length > 0) { //oResult = oCandidateBO.LoadMailForCandidate(typeof(MailForSystemUserEntry), "CofigurableXML\\MailForSystemUserEntry.xml"); oResult = new MailUtil().LoadMail(typeof(MailForSystemUserEntry), "CofigurableXML\\MailForSystemUserEntry.xml"); if (oResult.ResultIsSuccess) { oMailForSystemUserEntry = (MailForSystemUserEntry)oResult.ResultObject; oSMTPClient.Credentials = new NetworkCredential(WindowsLoginManager.csWindowsUserName, WindowsLoginManager.csWindowsPassword, WindowsLoginManager.csWindowsDomain); oSMTPClient.DeliveryMethod = SmtpDeliveryMethod.Network; oSMTPClient.Host = ServerManager.csSMTPServerAddress; oSMTPClient.Port = (int)EPortManager.SMTPport; MailMessage oTempMailMessage = new MailMessage(); oTempMailMessage.From = new MailAddress(oMailForSystemUserEntry.From); oTempMailMessage.To.Add(oSystemUser.SystemUserEmail); oTempMailMessage.Body = oMailForSystemUserEntry.BodyStart + "<br/>Your Login ID is: " + oSystemUser.SystemUserName + "<br/>Your Password is: " + oSystemUser.SystemUserPassword + "<br/>" + oMailForSystemUserEntry.BodyEnd; oTempMailMessage.Subject = oMailForSystemUserEntry.Subject; oTempMailMessage.IsBodyHtml = true; oSMTPClient.Send(oTempMailMessage); } else { //handle, if mail is not sent to candidate } } } catch (SmtpFailedRecipientException oEXFailedRecipent) { logger.Info("SmtpFailedRecipientException class:Controls_SystemUserEntry method:SendMailToSystemUser" + oEXFailedRecipent.Message); valueStatus = 0; } catch (SmtpException oExSMTP) { logger.Info("SmtpException class:Controls_SystemUserEntry method:SendMailToSystemUser" + oExSMTP.Message); valueStatus = 1; } finally { oSMTPClient = null; } logger.Info("end SendMailToSystemUser + Controls_SystemUserEntry"); }
protected void btn_AddCandidate_Click(object sender, EventArgs e) { try { Boolean bAnyChecked = false; Result oResult = new Result(); CandidateBO oCandidateBO = new CandidateBO(); int[] iArrCheck = new int[oListOfCandidateForExamForGrid.Count]; for (int i = 0; i < iArrCheck.Length; i++) { iArrCheck[i] = 0; } if (IsBeforeExamStarted(oSelectedExam)) { foreach (GridViewRow oGridRow in grid_CandidatesOfExam.Rows) { CheckBox oCheckBox = oGridRow.FindControl("deleteRec") as CheckBox; if (oCheckBox.Checked) { bAnyChecked = true; iArrCheck[grid_CandidatesOfExam.PageIndex*grid_CandidatesOfExam.PageSize+oGridRow.RowIndex] = 1; } //else //{ // iArrCheck[oGridRow.RowIndex] = 0; //} } if (bAnyChecked) { oResult = oCandidateBO.AddCandidatesFromExistingCandidate(oListOfCandidateForExamForGrid, iArrCheck, oSelectedExam); if (oResult.ResultIsSuccess) { lbl_error.ForeColor = Color.Green; lbl_error.Text = oResult.ResultMessage; if (rdoEmaiSendNotSend.SelectedValue.Equals("Send ID & Password")) { SendMailToListOfCandidate(oListOfCandidateForExamForGrid, iArrCheck, oSelectedExam); } else if (rdoEmaiSendNotSend.SelectedValue.Equals("Dont Send")) { } } else { lbl_error.ForeColor = Color.Red; lbl_error.Text = oResult.ResultMessage; } } else { lbl_error.ForeColor = Color.Red; lbl_error.Text = "Please select candidate to add."; } } else { lbl_error.ForeColor = Color.Red; lbl_error.Text = "Add Candidate before Exam Started."; } grid_CandidatesOfExam.Visible = true; btn_AddCandidate.Visible = true; rdoEmaiSendNotSend.Visible = true; grid_CandidatesOfExam.DataSource = oListOfCandidateForExamForGrid; grid_CandidatesOfExam.DataBind(); } catch (Exception oEx) { } }
private void LoadCandidatesForAnExam(Exam oExam) { try { Result oResult = new Result(); CandidateBO oCandidateBO = new CandidateBO(); oResult = oCandidateBO.ShowAllCandidates(oExam); List<CandidateForExam> oListCandidateForExam = (List<CandidateForExam>)oResult.ResultObject; this.ViewState.Add(SessionManager.csStoreGridView, oListCandidateForExam); if (oListCandidateForExam.Count <= 0) { lbl_error.ForeColor = Color.Red; lbl_error.Text = "No Candidate Found."; } else { grid_CandidatesOfExam.Visible = true; btn_AddCandidate.Visible = true; rdoEmaiSendNotSend.Visible = true; grid_CandidatesOfExam.DataSource = oListCandidateForExam; grid_CandidatesOfExam.DataBind(); } } catch (Exception oEx) { } }
private void LoadCandidatesFromDBToGrid() { CandidateBO oCandidateBO = new CandidateBO(); Result oResult = new Result(); List<CandidateForExam> oListCandidateForExam = new List<CandidateForExam>(); try { oResult = oCandidateBO.ShowAllCandidates(oSelectedExam); if (oResult.ResultIsSuccess) { oListCandidateForExam = (List<CandidateForExam>)oResult.ResultObject; //oObjectOfListOfCandidate = oListCandidate; //this.ViewState["DataGrid"] = oObjectOfListOfCandidate; //Utils.SetSession(SessionManager.csStoreGridView, oListCandidate); this.ViewState.Add(SessionManager.csStoreGridView, oListCandidateForExam); if (oListCandidateForExam.Count <= 0) { lbl_error.ForeColor = Color.Red; lbl_error.Text = "No Candidate Found."; tblCanModification.Visible = false; } else { tblCanModification.Visible = true; Grid_Candidates.DataSource = oListCandidateForExam; Grid_Candidates.DataBind(); } lblTotalCandidates.Text = oListCandidateForExam.Count.ToString(); } else { } } catch (Exception oEx) { } }
protected void btn_Remove_Click(object sender, EventArgs e) { //List<CandidateForExam> oListCandidate = new List<CandidateForExam>(); CandidateBO oCandidateBO = new CandidateBO(); Result oResult = new Result(); Boolean bAnyChecked = false; try { int[] iArrCheck = new int[oListOfCandidateForExamForGrid.Count]; for (int i = 0; i < iArrCheck.Length; i++) { iArrCheck[i] = 0; } if (IsBeforeExamStarted(oSelectedExam)) { foreach (GridViewRow oGridRow in Grid_Candidates.Rows) { CheckBox oCheckBox = oGridRow.FindControl("deleteRec") as CheckBox; if (oCheckBox.Checked) { bAnyChecked = true; iArrCheck[Grid_Candidates.PageIndex * Grid_Candidates.PageSize + oGridRow.RowIndex] = 1; } //else //{ // iArrCheck[oGridRow.RowIndex] = 0; //} } //oListCandidate = oListOfCandidateForGrid; if (bAnyChecked) { oResult = oCandidateBO.RemoveCandidate(oListOfCandidateForExamForGrid, iArrCheck); if (oResult.ResultIsSuccess) { oListOfCandidateForExamForGrid = (List<CandidateForExam>)oResult.ResultObject; //Utils.SetSession(SessionManager.csStoreGridView, oListCandidate); this.ViewState.Add(SessionManager.csStoreGridView, oListOfCandidateForExamForGrid); if (oListOfCandidateForExamForGrid.Count <= 0) { tblCanModification.Visible = false; } else { tblCanModification.Visible = true; Grid_Candidates.DataSource = oListOfCandidateForExamForGrid; Grid_Candidates.DataBind(); } lbl_error.ForeColor = Color.Green; lbl_error.Text = oResult.ResultMessage; lblTotalCandidates.Text = oListOfCandidateForExamForGrid.Count.ToString(); } else { lbl_error.ForeColor = Color.Red; lbl_error.Text = oResult.ResultMessage; } } else { lbl_error.ForeColor = Color.Red; lbl_error.Text = "Please Select a Candidate."; } } else { lbl_error.ForeColor = Color.Red; lbl_error.Text = "Remove before Exam Started."; } } catch (Exception oEx) { lbl_error.ForeColor = Color.Red; lbl_error.Text = "Candidate Remove Exception."; } }
protected void btn_Update_Click(object sender, EventArgs e) { List<CandidateForExam> oListCandidateForExam = new List<CandidateForExam>(); CandidateBO oCandidateBO = new CandidateBO(); Result oResult = new Result(); Boolean bAnyChecked = false; try { oListCandidateForExam = oListOfCandidateForExamForGrid; int[] iArrCheck = new int[oListCandidateForExam.Count]; for (int i = 0; i < iArrCheck.Length; i++) { iArrCheck[i] = 0; } foreach (GridViewRow oGridRow in Grid_Candidates.Rows) { CheckBox oCheckBox = oGridRow.FindControl("deleteRec") as CheckBox; TextBox oTxtPassword = oGridRow.FindControl("txtNewPassword") as TextBox; TextBox txtNewEmail = oGridRow.FindControl("txtNewEmail") as TextBox; TextBox oTxtName = oGridRow.FindControl("txtNewName") as TextBox; TextBox oTxtResult = oGridRow.FindControl("txtLastResult") as TextBox; TextBox oTxtInstitution = oGridRow.FindControl("txtLastInstitution") as TextBox; TextBox oTxtPassYear = oGridRow.FindControl("txtLastPassingYear") as TextBox; FileUpload oFupCv = oGridRow.FindControl("fupNewCVName") as FileUpload; DropDownList dr_SelectCGOrMark = oGridRow.FindControl("dr_SelectCGOrMark") as DropDownList; TextBox txtOutOf = oGridRow.FindControl("txtOutOf") as TextBox; FileUpload fup_CandidatePhoto = oGridRow.FindControl("fup_CandidatePhoto") as FileUpload; Label oLblCandidateID = oGridRow.FindControl("lblCandidateID") as Label; if (oCheckBox.Checked) { bAnyChecked = true; if (IsValidCandidatePassword(oTxtPassword.Text)) { oListCandidateForExam[Grid_Candidates.PageIndex * Grid_Candidates.PageSize + oGridRow.RowIndex].CandidateForExamCandidate.CandidatePassword = oTxtPassword.Text; } if (IsValidCandidateName(oTxtName.Text)) { oListCandidateForExam[Grid_Candidates.PageIndex * Grid_Candidates.PageSize + oGridRow.RowIndex].CandidateForExamCandidate.CandidateName = oTxtName.Text; } if (IsValidEmail(txtNewEmail.Text)) { oListCandidateForExam[Grid_Candidates.PageIndex * Grid_Candidates.PageSize + oGridRow.RowIndex].CandidateForExamCandidate.CandidateEmail = txtNewEmail.Text; } if (IsValidLastResult(oTxtResult.Text)) { oListCandidateForExam[Grid_Candidates.PageIndex * Grid_Candidates.PageSize + oGridRow.RowIndex].CandidateForExamCandidate.CandidateLastResult = float.Parse(oTxtResult.Text); } if (IsValidLastInstitution(oTxtInstitution.Text)) { oListCandidateForExam[Grid_Candidates.PageIndex * Grid_Candidates.PageSize + oGridRow.RowIndex].CandidateForExamCandidate.CandiadteLastInstitution = oTxtInstitution.Text; } if (IsValidLastPassingYear(oTxtPassYear.Text)) { oListCandidateForExam[Grid_Candidates.PageIndex * Grid_Candidates.PageSize + oGridRow.RowIndex].CandidateForExamCandidate.CandidateLastPassingYear = int.Parse(oTxtPassYear.Text); } if (IsValidCV(oFupCv)) { if (!Directory.Exists(DirectoryManager.csCandidateCVDirectory + oSelectedExam.ExamName + "\\")) { Directory.CreateDirectory(DirectoryManager.csCandidateCVDirectory + oSelectedExam.ExamName + "\\"); } oListCandidateForExam[Grid_Candidates.PageIndex * Grid_Candidates.PageSize + oGridRow.RowIndex].CandidateForExamCandidate.CandidateCvPath = oSelectedExam.ExamName + "\\" + oLblCandidateID.Text + "_" + oFupCv.FileName; oFupCv.SaveAs(DirectoryManager.csCandidateCVDirectory + oListCandidateForExam[Grid_Candidates.PageIndex * Grid_Candidates.PageSize + oGridRow.RowIndex].CandidateForExamCandidate.CandidateCvPath); } if (IsValidSelection(dr_SelectCGOrMark.SelectedValue)) { oListCandidateForExam[Grid_Candidates.PageIndex * Grid_Candidates.PageSize + oGridRow.RowIndex].CandidateForExamCandidate.LastResultTypaName = dr_SelectCGOrMark.SelectedValue; } if (IsValidLastResultRange(oTxtResult.Text, txtOutOf.Text)) { oListCandidateForExam[Grid_Candidates.PageIndex * Grid_Candidates.PageSize + oGridRow.RowIndex].CandidateForExamCandidate.CandidateLastResultRange = float.Parse(txtOutOf.Text); } if (IsValidCandidatePhoto(fup_CandidatePhoto)) { if (!Directory.Exists(DirectoryManager.csCandidateCVDirectory + oSelectedExam.ExamName + "\\")) { Directory.CreateDirectory(DirectoryManager.csCandidateCVDirectory + oSelectedExam.ExamName + "\\"); } oListCandidateForExam[Grid_Candidates.PageIndex * Grid_Candidates.PageSize + oGridRow.RowIndex].CandidateForExamCandidate.CandidatePicturePath = oSelectedExam.ExamName + "\\" + oLblCandidateID.Text + "_" + fup_CandidatePhoto.FileName; fup_CandidatePhoto.SaveAs(DirectoryManager.csCandidateCVDirectory + oListCandidateForExam[Grid_Candidates.PageIndex * Grid_Candidates.PageSize + oGridRow.RowIndex].CandidateForExamCandidate.CandidatePicturePath); } iArrCheck[Grid_Candidates.PageIndex * Grid_Candidates.PageSize + oGridRow.RowIndex] = 1; } //else //{ // iArrCheck[oGridRow.RowIndex] = 0; //} } if (bAnyChecked) { oResult = oCandidateBO.UpdateCandidate(oListCandidateForExam, iArrCheck); if (oResult.ResultIsSuccess) { LoadCandidatesFromDBToGrid(); //oListCandidateForExam = (List<CandidateForExam>)oResult.ResultObject; //this.ViewState.Add(SessionManager.csStoreGridView, oListCandidateForExam); //oListOfCandidateForExamForGrid = oListCandidateForExam; //Grid_Candidates.DataSource = oListCandidateForExam; //Grid_Candidates.DataBind(); lbl_error.ForeColor = Color.Green; lbl_error.Text = oResult.ResultMessage; //lblTotalCandidates.Text = oListOfCandidateForExamForGrid.Count.ToString(); } else { lbl_error.ForeColor = Color.Red; lbl_error.Text = oResult.ResultMessage; } } else { lbl_error.ForeColor = Color.Red; lbl_error.Text = "Please Select a Candidate."; } } catch (Exception oEx) { lbl_error.ForeColor = Color.Red; lbl_error.Text = "Candidate Update Exception."; } }
private void SendMailToSystemUserForUpdateNotifiaction(List<SystemUser> oListSystemUser, int[] iArrCheck) { try { CandidateBO oCandidateBO = new CandidateBO(); Result oResult = new Result(); MailForSystemUserModification oMailForSystemUserModification = new MailForSystemUserModification(); //oResult = oCandidateBO.LoadMailForCandidate(typeof(MailForSystemUserModification), "CofigurableXML\\MailForSystemUserModification.xml"); oResult = new MailUtil().LoadMail(typeof(MailForSystemUserModification), "CofigurableXML\\MailForSystemUserModification.xml"); if (oResult.ResultIsSuccess) { oMailForSystemUserModification = (MailForSystemUserModification)oResult.ResultObject; for (int i = 0; i < iArrCheck.Length; i++) { if (iArrCheck[i] == 1) { object oObject = new object(); object[] oArr = new object[2]; oArr[0] = oListSystemUser[i]; oArr[1] = oMailForSystemUserModification; oObject = oArr; ThreadPool.QueueUserWorkItem(new WaitCallback(SendMailToSystemUser), oObject); } } } } catch (Exception oEx) { } }
protected void btn_Setup_Click(object sender, EventArgs e) { try { Result oResult = new Result(); Candidate oCandidate = new Candidate(); CandidateForExam oCandidateForExam = new CandidateForExam(); CandidateBO oCandidateBO = new CandidateBO(); Exam oExam = new Exam(); oExam =(Exam)Utils.GetSession(SessionManager.csSelectedExam); if (IsValidCandidateName(txt_CandidateName.Text) && IsValidLastResult(txt_MarkOrCG.Text) && IsValidLastResultRange(txt_MarkOrCG.Text,txtOutOf.Text) && IsValidLastInstitution(txt_LastInstitution.Text) && IsValidLastPassingYear(txt_LastPassingYear.Text) && IsValidCV(fup_ccandidateCv) && IsValidSelection(dr_SelectCGOrMark.SelectedValue) && IsBeforeExamStarted(oExam) && IsValidEmail(txt_Email.Text)) { oCandidate.CandidateCompositeID = txt_CandidateName.Text + DateTime.Now.Ticks.ToString(); //oCandidate.CadidateCandidateExam.CandiadteExamExam = oExam; oCandidate.CandiadteLastInstitution = txt_LastInstitution.Text; oCandidate.CandidateName = txt_CandidateName.Text; oCandidate.CandidateCvPath = oExam.ExamName + "\\" + oCandidate.CandidateCompositeID.ToString()+"_" + fup_ccandidateCv.FileName; // this partially CV path oCandidate.CandidateLastPassingYear = int.Parse(txt_LastPassingYear.Text); oCandidate.CandidateLastResult = float.Parse(txt_MarkOrCG.Text); oCandidate.CandidatePassword = txt_CandidateName.Text.Substring(0, 2) + "@123"; oCandidate.CandidateEmail = txt_Email.Text; oCandidate.CandidateLastResultRange = float.Parse(txtOutOf.Text); oCandidate.LastResultTypaName = dr_SelectCGOrMark.SelectedValue; if (!Directory.Exists(DirectoryManager.csCandidateCVDirectory + oExam.ExamName + "\\")) { Directory.CreateDirectory(DirectoryManager.csCandidateCVDirectory + oExam.ExamName + "\\"); } if (IsValidCandidatePhoto(fup_CandidatePhoto)) { oCandidate.CandidatePicturePath = oExam.ExamName + "\\" + oCandidate.CandidateCompositeID.ToString() + "_" + fup_CandidatePhoto.FileName; fup_CandidatePhoto.SaveAs(DirectoryManager.csCandidateCVDirectory + oCandidate.CandidatePicturePath); } oCandidateForExam.CadidateCandidateExam.CandiadteExamExam = oExam; oCandidateForExam.CandidateForExamCandidate = oCandidate; fup_ccandidateCv.SaveAs(DirectoryManager.csCandidateCVDirectory + oCandidate.CandidateCvPath); oResult = oCandidateBO.CandidateSetup(oCandidateForExam); if (oResult.ResultIsSuccess) { if (rdoEmaiSendNotSend.SelectedValue.Equals("Send ID & Password")) { Object[] oObjArr = new Object[2]; oObjArr[0] = oExam; oObjArr[1] = oCandidate; object oObject = new object(); oObject = oObjArr; ThreadPool.QueueUserWorkItem(new WaitCallback(SendMailToCandidate), oObject); } else if (rdoEmaiSendNotSend.SelectedValue.Equals("Dont Send")) { } lbl_error.ForeColor = Color.Green; lbl_error.Text = oResult.ResultMessage; clearControlValue(); } else { if(File.Exists(DirectoryManager.csCandidateCVDirectory + oCandidate.CandidateCvPath)) { File.Delete(DirectoryManager.csCandidateCVDirectory + oCandidate.CandidateCvPath); } lbl_error.ForeColor = Color.Red; lbl_error.Text = oResult.ResultMessage; } } else { if (!IsBeforeExamStarted(oExam)) { lbl_error.ForeColor = Color.Red; lbl_error.Text = "Setup Candidate Before Exam Started."; } else { if (!IsValidLastPassingYear(txt_LastPassingYear.Text)) { lbl_error.ForeColor = Color.Red; lbl_error.Text = "Passing year must be less than or equal currnet year"; } if(!IsValidCV(fup_ccandidateCv)) { lbl_error.ForeColor = Color.Red; lbl_error.Text = lbl_error.Text + "<br/>Valid CV Extension(.html,.htm,.doc,.pdf,.rtf)"; } if (!IsValidCandidatePhoto(fup_CandidatePhoto)) { lbl_error.ForeColor = Color.Red; lbl_error.Text = lbl_error.Text + "<br/>Valid Photo Extension(.gif,.png,.jpg,.jpeg,.bmp)"; } //if(!IsValidCV(fup_ccandidateCv) || !IsValidCandidatePhoto(fup_CandidatePhoto)) //{ // lbl_error.ForeColor = Color.Red; // lbl_error.Text = "- is not allowed. Valid CV Extension(.html,.htm,.doc,.pdf,.rtf)" + "<br/>" + "- is not allowed. Valid Image Extension(.gif,.png,.jpg,.jpeg,.bmp)"; //} } } } catch (Exception oEx) { lbl_error.ForeColor = Color.Red; lbl_error.Text = "Exception occured during Candidate Setup."; } }
private static void SendMailToCandidate(Object oObject) { logger.Info("start SendMailToCandidate + Controls_CandidateSetup"); Object[] oObjectArr = (Object[])oObject; Exam oExam = oObjectArr[0] as Exam; Candidate oCandidate = oObjectArr[1] as Candidate; CandidateBO oCandidateBO = new CandidateBO(); Result oResult = new Result(); MailForCandidate oMailForCandidate = new MailForCandidate(); /***************************send mail by rakib***********/ SmtpClient oSMTPClient = new SmtpClient(); try { if (oCandidate.CandidateEmail.Length > 0) { //oResult = oCandidateBO.LoadMailForCandidate(typeof(MailForCandidate), "CofigurableXML\\MailForSendCandidate.xml"); oResult = new MailUtil().LoadMail(typeof(MailForCandidate), "CofigurableXML\\MailForSendCandidate.xml"); if (oResult.ResultIsSuccess) { oMailForCandidate = (MailForCandidate)oResult.ResultObject; oSMTPClient.Credentials = new NetworkCredential(WindowsLoginManager.csWindowsUserName, WindowsLoginManager.csWindowsPassword, WindowsLoginManager.csWindowsDomain); oSMTPClient.DeliveryMethod = SmtpDeliveryMethod.Network; oSMTPClient.Host = ServerManager.csSMTPServerAddress; oSMTPClient.Port = (int)EPortManager.SMTPport; MailMessage oTempMailMessage = new MailMessage(); oTempMailMessage.From = new MailAddress(oMailForCandidate.From); oTempMailMessage.To.Add(oCandidate.CandidateEmail); oTempMailMessage.Body = oMailForCandidate.BodyStart + "<br/>Please appear before [" + oExam.ExamDateWithStartingTime.ToString() + "] For Exam:" + oExam.ExamName + "<br/>Your Login ID is: " + oCandidate.CandidateEmail + "<br/>Your Password is: " + oCandidate.CandidatePassword + "<br/>" + oMailForCandidate.BodyEnd; oTempMailMessage.Subject = oMailForCandidate.Subject; oTempMailMessage.IsBodyHtml = true; oSMTPClient.Send(oTempMailMessage); } else { //handle, if mail is not sent to candidate } } } catch (SmtpFailedRecipientException oEXFailedRecipent) { logger.Info("SmtpFailedRecipientException class:Controls_CandidateSetup method:SendMailToCandidate" + oEXFailedRecipent.Message); valueStatus = 0; } catch (SmtpException oExSMTP) { logger.Info("SmtpException class:Controls_CandidateSetup method:SendMailToCandidate" + oExSMTP.Message); valueStatus = 1; } finally { oSMTPClient = null; } /*********************end send mail by rakib*****************/ logger.Info("end SendMailToCandidate + Controls_CandidateSetup"); }