/// <summary> /// Sends the email to user on print. /// </summary> /// <param name="results">The results.</param> /// <param name="parentSiteURL">The parent site URL.</param> /// <param name="strAddress">The STR address.</param> /// <param name="contextForMail">The context for mail.</param> public void SendEmailToUserOnPrint(string results, string parentSiteURL, string strAddress, SPContext contextForMail) { DataTable dtPrintChapterDetails = null; ActiveDirectoryService objADS = null; try { try { objADS = new ActiveDirectoryService(); } catch (Exception) { objADS = new ActiveDirectoryService(contextForMail); } dtPrintChapterDetails = new DataTable(); CommonUtility objUtility = new CommonUtility(); objCommonDAL = new CommonDAL(); string strToMailID = string.Empty; string strAccessLink = string.Empty; string strMessage = string.Empty; string strCamlQuery = @"<Where><Eq><FieldRef Name='RequestID' /><Value Type='Text'>" + results + "</Value></Eq></Where>"; dtPrintChapterDetails = objCommonDAL.GetChapterPrintDetails(strCamlQuery, parentSiteURL, "DWB Chapter Print Details"); if (dtPrintChapterDetails != null && dtPrintChapterDetails.Rows.Count > 0) { /// Loop through the values in Chapter Print Details list. foreach (DataRow dtRow in dtPrintChapterDetails.Rows) { try { strToMailID = objADS.GetEmailID(dtRow["UserName"].ToString()); } catch (Exception) { } strAccessLink = parentSiteURL + "/Pages/eWBPDFViewer.aspx?mode=chapter&requestID=" + results; objUtility.SendMailforPrintUpdate(strToMailID, strAccessLink, parentSiteURL, strAddress, contextForMail); } } } catch (Exception) { throw; } finally { if (dtPrintChapterDetails != null) dtPrintChapterDetails.Dispose(); } }