Professional Documents
Culture Documents
using System.Data;
using System.Configuration;
using System.Web;
using System.Data.SqlClient;
using System.Runtime.Remoting;
using RmtDataAccess;
using System.Text.RegularExpressions;
//Modified by Deena 16.04.2008 Start
//Purpose: For implementing 65 Character break
using System.Collections;
//Modified by Deena 16.04.2008 End
namespace Rmtgenerator
{
public class Rmtgenerator : MarshalByRefObject, Igenerator.Igenerator
{
general dbOpr = new general();
public Rmtgenerator()
{
// TODO: Add constructor logic here
}
public int iGetCorpID(int intAddressBook)
{
string featureVal;
string sSql;
sSql = "SELECT Corp_ID FROM tblMembers WHERE AddressBook = " + intAd
dressBook;
featureVal = dbOpr.executeScalarQuery(sSql);
return (int.Parse(featureVal));
}
public DataTable dtPopulateCategories(int intAddressBook, int intListMod
e, string pageName)
{
string query = "";
if (intListMode == 0)
{
if (pageName == "PostalPrint")
{
query = "select id,categoryname from tblcategorylist where a
ddressbook=" + intAddressBook + " and categoryname not like 'Opt-Out'ORDER BY ca
tegoryName";
}
else
{
query = "select id,categoryname from tblcategorylist where a
ddressbook=" + intAddressBook + " and categoryname not like 'Opt-Out' and catego
ryname not like 'Invalid EmailAddress' ORDER BY categoryName";
}
}
else
{
query = "select id,categoryname from tblcategorylist where addre
ssbook= " + intAddressBook + " and categoryname not like 'Opt-Out' and categoryn
ame not like 'Invalid EmailAddress'";
query += "and id in (select categoryid from tblusercategory wher
e addressbook= " + intAddressBook + " group by categoryid having count(*)> 0) or
der by categoryname";
}
return (dbOpr.executeQueriesTable(query));
}
public int iGetFeatures(string sFeature, int intAddressBook, int intCorp
ID)
{
string strSQL;
string featureVal;
if (sFeature == "INT_RECRUITING")
{
strSQL = "select addressbook from tblmembers where addressbook='
" + intAddressBook + "' and (industry like 'recruiting%' or industry2 like 'recr
uiting%' or industry3 like 'recruiting%')";
featureVal = dbOpr.executeScalarQuery(strSQL);
if (featureVal != "")
{
return (2);
}
else
{
return (0);
}
}
else if (sFeature == "ISERPLUS")
{
strSQL = " SELECT " + sFeature + " FROM tblcorp WHERE corp_id='
" + intCorpID.ToString() + "'";
featureVal = dbOpr.executeScalarQuery(strSQL);
if (featureVal == "True")
{
strSQL = " SELECT " + sFeature + " FROM tblmembers WHERE ad
dressBook ='" + intAddressBook + "'";
featureVal = dbOpr.executeScalarQuery(strSQL);
if (featureVal == "True")
{
return (1);
}
else
{
return (0);
}
}
else
{
return (0);
}
//return(0);
}
else if (sFeature == "INT_History")
{
strSQL = "select int_history from tblmembers where addressbook =
" + intAddressBook;
featureVal = dbOpr.executeScalarQuery(strSQL);
if (featureVal == "True")
{
return (1);
}
else
{
return (0);
}
}
else if (sFeature == "IscorpNewslet")
{
strSQL = " SELECT INT_NewNewsletter FROM tblCorpFeatures WHERE c
orp_id='" + intCorpID.ToString() + "'";
featureVal = dbOpr.executeScalarQuery(strSQL);
if (featureVal == "2")
{
strSQL = "SELECT " + sFeature + " FROM tblmembers WHERE add
ressBook ='" + intAddressBook + "'";
featureVal = dbOpr.executeScalarQuery(strSQL);
if (featureVal == "True")
{
return (1);
}
else
{
return (0);
}
}
else
{
return (0);
}
}
else
{
strSQL = " SELECT " + sFeature + " FROM tblUserFeatures WHERE a
ddressBook ='" + intAddressBook + "'";
featureVal = dbOpr.executeScalarQuery(strSQL);
if (featureVal == "" || featureVal == "-1")
{
strSQL = "SELECT " + sFeature + " FROM tblCorpFeatures WHERE
corp_ID ='" + intCorpID.ToString() + "'";
featureVal = dbOpr.executeScalarQuery(strSQL);
if (featureVal != "")
return (int.Parse(featureVal));
else
return (0);
}
else
{
return (int.Parse(featureVal));
}
}
}
public DataTable getFinancialSB(int intAddressBook)
{
string sql = "SELECT ''''+ISNULL(NULLIF(UPPER(substring(industry,0,4
)),'REC'),'')+''''+','+''''+ ISNULL(NULLIF(UPPER(substring(industry2,0,4)),'REC'
),'')+''''+','+ ''''+ISNULL(NULLIF(UPPER(substring(industry3,0,4)),'REC'),'') +'
'''FROM tblMembers WHERE AddressBook =" + intAddressBook.ToString();
string sqlQuery = "SELECT tblConcepts.conceptID, tblConcepts.concept
Name as conceptName FROM tblConcepts WHERE tblConcepts.industry in (" + dbOpr.e
xecuteScalarQuery(sql) + ") ORDER BY tblConcepts.conceptName";
return (dbOpr.executeQueriesTable(sqlQuery));
}
// Modified for admin/Wharton module satrt
//public DataTable dtGetFinancialSB(int intAddressBook)
//{
/*string strSqlQuery = "select distinct(tblConcepts.conceptID+ ',' +tblC
oncepts.industry) as Datakeys, tblConcepts.conceptName from tblagent_categories
" +
"inner join tblcorp_categories on tblagent_categories.ca
tegoryid=tblcorp_categories.categoryid " +
"inner join tblConcepts on tblConcepts.industry=ltrim(tb
lcorp_categories.industry) and substring(tblConcepts.industry,1,3)<>'Rec' and (t
blConcepts.active='1' and ((datediff(day,expdate, getdate())<=0)or(isnull((conve
rt(char(26),expdate,101)),'0')='0'))) " +
"where addressbook=" + intAddressBook + " ORDER BY tblCo
ncepts.conceptName"; */
//Modified by Tiju - 21/10/2007 - Include in concept from the industry(t
blmembers) of the agent also --
//modified for wharton 17.11.07
//bool isWharton = blnIswhartonagent(intWhartonId, intAddressBook);
//string strSqlQuery = "";
//strSqlQuery = "select distinct(tblConcepts.conceptID+ ',' +tblConcepts
.industry) as Datakeys, tblConcepts.conceptName from tblagent_categories " +
// "inner join tblcorp_categories on tblagent_categories.
categoryid=tblcorp_categories.categoryid " +
// "inner join tblConcepts on tblConcepts.industry=ltrim(
tblcorp_categories.industry) and substring(tblConcepts.industry,1,3)<>'Rec' and
(tblConcepts.active='1' and ((datediff(day,expdate, getdate())<=0)or(isnull((con
vert(char(26),expdate,101)),'0')='0'))) and corp_id=157 " +
// "where addressbook=" + intAddressBook + " " +
// "union " +
// "select distinct (tblConcepts.conceptID + ',' +tblConc
epts.industry) as datakeys,tblConcepts.conceptName " +
// "from tblConcepts, tblmembers " +
// "where ((tblConcepts.industry=tblmembers.industry and
substring(tblmembers.industry,1,3)<>'Rec')" +
// "or (tblConcepts.industry=tblmembers.industry2 and sub
string(tblmembers.industry2,1,3)<>'Rec') " +
// "or (tblConcepts.industry=tblmembers.industry3 and sub
string(tblmembers.industry3,1,3)<>'Rec')) " +
// "and (tblConcepts.active='1' and " +
// "((datediff(day,expdate, getdate())<=0)or(isnull((conv
ert(char(26),expdate,101)),'0')='0')))" +
// "and tblmembers.addressbook=" + intAddressBook + "ORDE
R BY tblConcepts.conceptName";
//string strSQL = "select case ISNULL(substring(industry,1,3),'') when
'Rec' then '' when NULL then '' else (select industry from tblmembers where addr
essbook=" + intAddressBook + ") end as industry ,case ISNULL(substring(industry
2,1,3),'')when 'Rec' then ''when NULL then '' else (select industry2 from tblmem
bers where addressbook=" + intAddressBook + ")End as industry2,case ISNULL(subs
tring(industry3,1,3),'') when 'Rec' then ''when NULL then '' else (select indust
ry3 from tblmembers where addressbook=" + intAddressBook + ")End as industry3 fr
om tblmembers where addressbook=" + intAddressBook.ToString();
//DataTable dt = dbOpr.executeQueriesTable(strSQL);
//string strSqlQuery = "SELECT tblConcepts.conceptID+ ',' +tblConcepts.i
ndustry as Datakeys, tblConcepts.conceptName FROM tblConcepts WHERE (tblConcepts
.industry='" + dt.Rows[0]["industry"].ToString() + "' or tblConcepts.industry='"
+ dt.Rows[0]["industry2"].ToString() + "' or tblConcepts.industry='" + dt.Rows[
0]["industry3"].ToString() + "') and (tblConcepts.active='1' and ((datediff(day,
expdate, getdate())<=0)or(isnull((convert(char(26),expdate,101)),'0')='0'))) ORD
ER BY tblConcepts.conceptName";
////string strSqlQuery = "SELECT tblConcepts.conceptID+ ',' +tblConcepts
.industry as Datakeys, tblConcepts.conceptName FROM tblConcepts WHERE tblConcept
s.industry='" + dt.Rows[0]["industry"].ToString() + "' or tblConcepts.industry='
" + dt.Rows[0]["industry2"].ToString() + "' or tblConcepts.industry='" + dt.Rows
[0]["industry3"].ToString() + "' ORDER BY tblConcepts.conceptName";
//return (dbOpr.executeQueriesTable(strSqlQuery));
//}
public DataTable dtGetFinancialSB(int intAddressBook, int intWhartonId,
int corp_id, string SBGrpid)
{
//modified for Admin/wharton 17.11.07
bool isWharton = false;
if (corp_id == 157)
{
isWharton = blnIswhartonagent(intWhartonId, intAddressBook);
}
string strSqlQuery = "";
if (isWharton)
{
strSqlQuery = "select conceptid,tblConcepts.conceptID + ',' + tb
lConcepts.industry as Datakeys,isnull(tblConcepts.conceptname,'')+'$#$'+isnull(t
blConcepts.title,'') as conceptname from tblagent_categories " +
"inner join tblcorp_categories on tblagent_categorie
s.categoryid=tblcorp_categories.categoryid and tblcorp_categories.categoryid<>"
+ intWhartonId + " " +
"inner join tblConcepts on tblConcepts.industry=ltri
m(tblcorp_categories.industry) " +
"and substring(tblConcepts.industry,1,3)<>'Rec' and
(tblConcepts.active='1' " +
"and ((datediff(day,expdate, getdate())<=0)or(isnull
((convert(char(26),expdate,101)),'0')='0')))and tblconcepts.conceptid in (select
conceptid from tbl_Group_Concepts where groupid='" + SBGrpid + "') and corp_id=
157 " +
"where addressbook=" + intAddressBook;
DataTable dtWharton = dbOpr.executeQueriesTable(strSqlQuery);
DataTable dtWhartonnew = new DataTable();
foreach (DataRow dr in dtWharton.Rows)
{
strSqlQuery = "select conceptid,tblConcepts.conceptID + ','
+ tblConcepts.industry as Datakeys,isnull(tblConcepts.conceptname,'')+'$#$'+isn
ull(tblConcepts.title,'') as conceptname from tblagent_categories " +
"inner join tblcorp_categories on tblagent_categorie
s.categoryid=tblcorp_categories.categoryid and tblcorp_categories.categoryid=" +
intWhartonId + " " +
"inner join tblConcepts on tblConcepts.industry=ltri
m(tblcorp_categories.industry) and conceptID='" + dr["conceptid"] + "' " +
"and substring(tblConcepts.industry,1,3)<>'Rec' and
(tblConcepts.active='1' " +
"and ((datediff(day,expdate, getdate())<=0)or(isnull
((convert(char(26),expdate,101)),'0')='0'))) and tblconcepts.conceptid in (selec
t conceptid from tbl_Group_Concepts where groupid='" + SBGrpid + "') and corp_id
=157 " +
"where addressbook=" + intAddressBook;
DataTable dtTemp = dbOpr.executeQueriesTable(strSqlQuery);
if (dtTemp.Rows.Count == 0)
{
string[] strArray = new string[3];
strArray[0] = dr[0].ToString();
strArray[1] = dr[1].ToString();
strArray[2] = dr[2].ToString();
dtTemp.Rows.Add(strArray);
}
dtWhartonnew.Merge(dtTemp);
}
strSqlQuery = "select distinct (tblConcepts.conceptID + ',' +tbl
Concepts.industry) as Datakeys,isnull(tblConcepts.conceptname,'')+'$#$'+isnull(t
blConcepts.title,'') as conceptname " +
"from tblConcepts, tblmembers " +
"where ((tblConcepts.industry=tblmembers.industr
y and substring(tblmembers.industry,1,3)<>'Rec')" +
"or (tblConcepts.industry=tblmembers.industry2 a
nd substring(tblmembers.industry2,1,3)<>'Rec') " +
"or (tblConcepts.industry=tblmembers.industry3 a
nd substring(tblmembers.industry3,1,3)<>'Rec')) " +
"and (tblConcepts.active='1' and " +
"((datediff(day,expdate, getdate())<=0)or(isnull
((convert(char(26),expdate,101)),'0')='0'))) and tblconcepts.conceptid in (selec
t conceptid from tbl_Group_Concepts where groupid='" + SBGrpid + "')" +
"and tblmembers.addressbook=" + intAddressBook +
"ORDER BY tblConcepts.conceptName";
dtWhartonnew.Merge(dbOpr.executeQueriesTable(strSqlQuery));
return (dtWhartonnew);
}
else
{
strSqlQuery = "select distinct(tblConcepts.conceptID+ ',' +tblCo
ncepts.industry) as Datakeys, isnull(tblConcepts.conceptname,'')+'$#$'+isnull(tb
lConcepts.title,'') as conceptname from tblagent_categories " +
"inner join tblcorp_categories on tblagent_categ
ories.categoryid=tblcorp_categories.categoryid " +
//"inner join tblConcepts on tblConcepts.industry=ltrim(tblc
orp_categories.industry) and substring(tblConcepts.industry,1,3)<>'Rec' and (tbl
Concepts.active='1' and ((datediff(day,expdate, getdate())<0)or(isnull((convert(
char(26),expdate,101)),'0')='0'))) and corp_id=157 " +
// Modified by Ganesh for loading the StoryBoard based on bo
th corp_id & category_id 06-05-08 -- Start
"inner join tblConcepts on tblConcepts.industry=
ltrim(tblcorp_categories.industry) and substring(tblConcepts.industry,1,3)<>'Rec
' and (tblConcepts.active='1' and ((datediff(day,expdate, getdate())<0)or(isnull
((convert(char(26),expdate,101)),'0')='0'))) and tblconcepts.conceptid in (selec
t conceptid from tbl_Group_Concepts where groupid='" + SBGrpid + "')" +
// End
"where addressbook=" + intAddressBook + " " +
"union " +
"select distinct (tblConcepts.conceptID + ',' +t
blConcepts.industry) as Datakeys,isnull(tblConcepts.conceptname,'')+'$#$'+isnull
(tblConcepts.title,'') as conceptname " +
"from tblConcepts, tblmembers " +
"where ((tblConcepts.industry=tblmembers.industr
y and substring(tblmembers.industry,1,3)<>'Rec')" +
"or (tblConcepts.industry=tblmembers.industry2 a
nd substring(tblmembers.industry2,1,3)<>'Rec') " +
"or (tblConcepts.industry=tblmembers.industry3 a
nd substring(tblmembers.industry3,1,3)<>'Rec')) " +
"and (tblConcepts.active='1' and " +
"((datediff(day,expdate, getdate())<=0)or(isnull
((convert(char(26),expdate,101)),'0')='0'))) and tblconcepts.conceptid in (selec
t conceptid from tbl_Group_Concepts where groupid='" + SBGrpid + "')" +
"and tblmembers.addressbook=" + intAddressBook +
"ORDER BY tblConcepts.conceptName";
return (dbOpr.executeQueriesTable(strSqlQuery));
}
//string strSQL = "select case ISNULL(substring(industry,1,3),'') w
hen 'Rec' then '' when NULL then '' else (select industry from tblmembers where
addressbook=" + intAddressBook + ") end as industry ,case ISNULL(substring(indu
stry2,1,3),'')when 'Rec' then ''when NULL then '' else (select industry2 from tb
lmembers where addressbook=" + intAddressBook + ")End as industry2,case ISNULL(
substring(industry3,1,3),'') when 'Rec' then ''when NULL then '' else (select in
dustry3 from tblmembers where addressbook=" + intAddressBook + ")End as industry
3 from tblmembers where addressbook=" + intAddressBook.ToString();
//DataTable dt = dbOpr.executeQueriesTable(strSQL);
//string strSqlQuery = "SELECT tblConcepts.conceptID+ ',' +tblConcep
ts.industry as Datakeys, tblConcepts.conceptName FROM tblConcepts WHERE (tblConc
epts.industry='" + dt.Rows[0]["industry"].ToString() + "' or tblConcepts.industr
y='" + dt.Rows[0]["industry2"].ToString() + "' or tblConcepts.industry='" + dt.R
ows[0]["industry3"].ToString() + "') and (tblConcepts.active='1' and ((datediff(
day,expdate, getdate())<=0)or(isnull((convert(char(26),expdate,101)),'0')='0')))
ORDER BY tblConcepts.conceptName";
////string strSqlQuery = "SELECT tblConcepts.conceptID+ ',' +tblConc
epts.industry as Datakeys, tblConcepts.conceptName FROM tblConcepts WHERE tblCon
cepts.industry='" + dt.Rows[0]["industry"].ToString() + "' or tblConcepts.indust
ry='" + dt.Rows[0]["industry2"].ToString() + "' or tblConcepts.industry='" + dt.
Rows[0]["industry3"].ToString() + "' ORDER BY tblConcepts.conceptName";
}
if (DiscText.Contains(comp_Text))
{
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHea
der + "\n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n \n";
strEmailBody = strEmailBody.Replace(comp_Text, strOptout
);
}
else
{
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHea
der + "\n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n\n" + s
trOptout + "\n \n";
}
}
//Modified by Jomy James for ticket:456(Bt): Live Office-Issue w
hen disclaimer is empty optout link is not showing in text part on 06-May-2009 S
tart
else if (intCorpid == 157)
{
DiscText = msgDisc + "\n\n" + sAxaNewDisc(strAddressBook) +
"\n\n" + sGetGlobalDisclaimerText("ep_disclaimer", intCorpid);
strOptout = gblOptOutMsg;
strOptout = strOptout + "##DOMAIN_URL##/0/?d=#month-and-year
#&r=#SEND_ID#";
DiscText = InsertBreak(DiscText);
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHeader
+ "\n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n\n" + strOp
tout + "\n \n";
}
else
{
DiscText = msgDisc + sGetGlobalDisclaimerText("ep_disclaimer
", intCorpid);
strOptout = gblOptOutMsg;
strOptout = strOptout + "##DOMAIN_URL##/0/?d=#month-and-year
#&r=#SEND_ID#";
DiscText = InsertBreak(DiscText);
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHeader
+ "\n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n\n" + strOp
tout + "\n \n";
}
//Modified by Jomy James for ticket:456(Bt): Live Office-Issue w
hen disclaimer is empty optout link is not showing in text part on 06-May-2009 E
nd
}
else
{
if (intCorpid == 157)
{
if (sGetAXA_Disclaimer(strAddressBook).Trim() == sAxaNewDisc
(strAddressBook).Trim())
{
DiscText = sGetGlobalDisclaimerText("ep_disclaimer", int
Corpid) + "\n\n" + sAxaNewDisc(strAddressBook);
}
else
{
DiscText = sAxaNewDisc(strAddressBook) + "\n\n" + sGetGl
obalDisclaimerText("ep_disclaimer", intCorpid);
}
}
else if (intCorpid == 127)
{
if (Aux1 == "1")
{
DiscText = "<br>" + HTKP_DISCLAIMER + "<br>" + sGetGloba
lDisclaimerText("ep_disclaimer", intCorpid);
}
else
{
DiscText = sGetGlobalDisclaimerText("ep_disclaimer", int
Corpid);
}
}
else
{
DiscText = sGetGlobalDisclaimerText("ep_disclaimer", intCorp
id);
}
if (DiscText != "")
{
DiscText = msgDisc + "\n\n" + DiscText;
//Modified for Base64 by Deena 11.01.2008 Start
// strOptout = "##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-
year#&req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove & from the out bound E-Mail Links
//strOptout = "##DOMAIN_URL##/0/?d=#month-and-year#&r=#S
END_ID#";
strOptout = "##DOMAIN_URL##/0/?d=#month-and-year#&r=#SEND_ID
#";
//Modified by Deena 05.03.2008 End
//Modified for Base64 by Deena 11.01.2008 End
DiscText = InsertBreak(DiscText);
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHeader
+ "\n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n \n";
if (DiscText.Contains(comp_Text))
{
strEmailBody = strEmailBody.Replace(comp_Text, strOptout
);
}
else
{
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHea
der + "\n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n\n" + s
trOptout + "\n \n";
}
}
else if (intCorpid == 157)
{
DiscText = msgDisc + " \n \n" + sAxaNewDisc(strAddressBook)
+ "\n\n" + sGetGlobalDisclaimerText("ep_disclaimer", intCorpid);
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/Gmailer/us.aspx
?d=#month-and-year#&req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove & from the out bound E-Mail Links
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/0/?d=#month-and
-year#&r=#SEND_ID#";
strOptout = gblOptOutMsg + "##DOMAIN_URL##/0/?d=#month-and-y
ear#&r=#SEND_ID#";
//Modified by Deena 05.03.2008 End
//Modified for Base64 by Deena 11.01.2008 End
DiscText = InsertBreak(DiscText);
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHeader
+ "\n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n\n" + strOp
tout + "\n \n";
}
else
{
DiscText = msgDisc + "\n\n" + sGetGlobalDisclaimerText("wm_d
isclaimer", intCorpid);
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/Gmailer/us.aspx
?d=#month-and-year#&req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove & from the out bound E-Mail Links
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/0/?d=#month-and
-year#&r=#SEND_ID#";
strOptout = gblOptOutMsg + "##DOMAIN_URL##/0/?d=#month-and-y
ear#&r=#SEND_ID#";
//Modified by Deena 05.03.2008 End
//Modified for Base64 by Deena 11.01.2008 End
DiscText = InsertBreak(DiscText);
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHeader
+ "\n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n\n" + strOp
tout + "\n \n";
}
}
strEmailBody = strEmailBody.Replace("'", "''");
SMTPEmail = strUpperBoundary + strEmailBody + "#SendersCopy_List_Tex
t#" + strLowerBoundary;
SMTPEmail = SMTPEmail.Replace("<br>", "\n");
SMTPEmail = RemoveHTML(SMTPEmail);
return SMTPEmail;
}
public string sSmtpLibertyText(int intCorpID, string intAddressBook, str
ing msgContent, string msgClose, string msgDisc, string Guid, string strModuleid
)
{
string strHTMLHeader, strHTMLFooter, SMTPEmail;
string comp_Text, strLink, strOptout, strEmailBody, strUpperBoundary
, strLowerBoundary, HTKP_DISCLAIMER, strSQL, Aux1, msgDisc_HTK = "";
comp_Text = "$#Opt_Out_Link";
strUpperBoundary = "------=_NextPart_" + Guid + "\nContent-Type: tex
t/plain;charset=iso-8859-1\nContent-Transfer-Encoding: 7bit\n\n";
strLowerBoundary = "\n------=_NextPart_" + Guid + "--";
strHTMLHeader = LinkUrls(msgContent.Replace("\r\n", "\n"));
strHTMLFooter = LinkUrls(msgClose.Replace("\r\n", "\n"));
strHTMLFooter = strHTMLFooter + sGetUserMailingAddress(intAddressBoo
k).Replace("<br>", "\n") + "\n#SMAR#";
msgDisc = LinkUrls(msgDisc.Replace("\r\n", "\n"));
strLink = "This is not a download or an attachment.It is a safeguard
ed link.\nSimply Access the Following Link: \n";
//Modified for Base64 by Deena 11.01.2008 Start
//strLink = strLink + "##DOMAIN_URL##/Gmailer/lb.aspx?d=#month-and-y
ear#&req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove & from the out bound E-Mail Links
//strLink = strLink + "##DOMAIN_URL##/6/?d=#month-and-year#&r=#S
END_ID#\n";
strLink = strLink + "##DOMAIN_URL##/" + strModuleid + "/?d=#month-an
d-year#&r=#SEND_ID#\n";
//Modified by Deena 05.03.2008 End
//Modified for Base64 by Deena 11.01.2008 End
strLink = strLink + "If you want more information on the above ebrie
f,\njust request the additional details at the end.";
HTKP_DISCLAIMER = "Registered Representative of, and Securities and
Investment Advisory services offered through Hornor, Townsend & Kent, Inc., (HTK
), Registered Investment Advisor, and Member FINRA/SIPC. HTK is a wholly owned
subsidiary of The Penn Mutual Life Insurance Company. HTK does not offer tax or
legal advice.";
strSQL = "SELECT Aux1 FROM tblMembers WHERE addressBook =" + intAddr
essBook;
Aux1 = dbOpr.executeScalarQuery(strSQL);
if (intCorpID == 127)
{
msgDisc_HTK = msgDisc;
}
else
{
msgDisc = msgDisc + "\n" + sGetGlobalDisclaimerText("en_disclaim
er", intCorpID);
}
if (intCorpID == 157)
{
msgDisc = msgDisc + "\n" + sGetAXA_Disclaimer(intAddressBook);
}
if (intCorpID == 127)
{
if (Aux1 == "1")
{
msgDisc = msgDisc_HTK + "\n\n" + HTKP_DISCLAIMER + "\n" + sG
etGlobalDisclaimerText("en_disclaimer", intCorpID);
}
else
{
msgDisc = msgDisc + "\n" + sGetGlobalDisclaimerText("en_disc
laimer", intCorpID);
}
}
//Modified for Base64 by Deena 11.01.2008 Start
// strOptout = "##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-year#&am
p;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove & from the out bound E-Mail Links
//strOptout = "##DOMAIN_URL##/0/?d=#month-and-year#&r=#SEND_ID#"
;
strOptout = "##DOMAIN_URL##/0/?d=#month-and-year#&r=#SEND_ID#";
//Modified by Deena 05.03.2008 End
//Modified for Base64 by Deena 11.01.2008 End
msgDisc = InsertBreak(msgDisc);
strEmailBody = "Dear " + "#USER_NAME_TEXT#" + ",\n\n" + strHTMLHeade
r + "\n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + msgDisc + "\n" + "\n";
if (strEmailBody.Contains(comp_Text))
{
strEmailBody = strEmailBody.Replace(comp_Text, strOptout);
}
else
{
strEmailBody = "Dear " + "#USER_NAME_TEXT#" + ",\n\n" + strHTMLH
eader + "\n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + msgDisc + "\n\n" +
strOptout + "\n\n";
}
strEmailBody = strEmailBody.Replace("'", "''");
SMTPEmail = strUpperBoundary + strEmailBody + "#SendersCopy_List_Tex
t#" + strLowerBoundary;
SMTPEmail = SMTPEmail.Replace("<br>", "\n");
SMTPEmail = RemoveHTML(SMTPEmail);
return SMTPEmail;
}
public string sSmtpAnnouncementText(int intCorpID, string intAddressBook
, string msgContent, string msgClose, string msgDisc, string Guid)
{
string strHTMLHeader, strHTMLFooter, strLink, comp_Text;
string DiscText, strEmailBody, SMTPEmail, gblOptOutMsg, strOptout, s
trUpperBoundary, strLowerBoundary, HTKP_DISCLAIMER, strSQL, Aux1;
strUpperBoundary = "------=_NextPart_" + Guid + "\nContent-Type: tex
t/plain;charset=iso-8859-1\nContent-Transfer-Encoding: 7bit\n\n";
strLowerBoundary = "\n------=_NextPart_" + Guid + "--";
comp_Text = "$#Opt_Out_Link";
gblOptOutMsg = "\n\n NOTE:\n If you do not wish to receive e-mail fr
om us in the future,\npleasevisit:\n";
strHTMLHeader = msgContent;
strHTMLFooter = msgClose;
strHTMLHeader = LinkUrls(strHTMLHeader.Replace("\r\n", "\n"));
strHTMLFooter = LinkUrls(strHTMLFooter.Replace("\r\n", "\n"));
msgDisc = LinkUrls(msgDisc.Replace("\r\n", "\n"));
strHTMLFooter = strHTMLFooter + sGetUserMailingAddress(intAddressBoo
k).Replace("<br>", "\n");
//sAltLinkText = Trim(GetAltLinkText());
// sAltLinkText = "\n\n If the link above does not open, try this l
ink - or copy and paste this link into your browser.\n";
// strHTMLFooter = strHTMLFooter + sAltLinkText + "##DOMAIN_URL##/Gm
ailer/an.aspx?d=#month-and-year#&req=#SEND_ID#";
strLink = "This is not a download or an attachment.It is a safeguard
ed link.\nSimply Access the Following Link: \n";
//Modified for Base64 by Deena 11.01.2008 Start
//strLink = strLink + "##DOMAIN_URL##/Gmailer/an.aspx?d=#month-and-y
ear#&req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove & from the out bound E-Mail Links
//strLink = strLink + "##DOMAIN_URL##/7/?d=#month-and-year#&r=#S
END_ID#\n";
strLink = strLink + "##DOMAIN_URL##/7/?d=#month-and-year#&r=#SEND_ID
#\n";
//Modified by Deena 05.03.2008 End
//Modified for Base64 by Deena 11.01.2008 End
strLink = strLink + "If you want more information on the above ebrie
f,\njust request the additional details at the end.";
HTKP_DISCLAIMER = "Registered Representative of, and Securities and
Investment Advisory services offered through Hornor, Townsend & Kent, Inc., (HTK
), Registered Investment Advisor, and Member FINRA/SIPC. HTK is a wholly owned
subsidiary of The Penn Mutual Life Insurance Company. HTK does not offer tax or
legal advice.";
strSQL = "SELECT Aux1 FROM tblMembers WHERE addressBook =" + intAddr
essBook;
Aux1 = dbOpr.executeScalarQuery(strSQL);
if (msgDisc == "")
{
if (intCorpID == 157)
{
DiscText = sGetGlobalDisclaimerText("ei_disclaimer", intCorp
ID) + "\n\n" + sGetAXA_Disclaimer(intAddressBook);
}
else if (intCorpID == 127)
{
if (Aux1 == "1")
{
DiscText = "<br>" + HTKP_DISCLAIMER + "<br>" + sGetGloba
lDisclaimerText("ei_disclaimer", intCorpID);
}
else
{
DiscText = sGetGlobalDisclaimerText("ei_disclaimer", int
CorpID);
}
}
else
{
DiscText = sGetGlobalDisclaimerText("ei_disclaimer", intCorp
ID);
}
if (DiscText != "")
{
//Modified for Base64 by Deena 11.01.2008 Start
// strOptout = "##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-
year#&req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove & from the out bound E-Mail Links
//strOptout = "##DOMAIN_URL##/0/?d=#month-and-year#&r=#S
END_ID#";
strOptout = "##DOMAIN_URL##/0/?d=#month-and-year#&r=#SEND_ID
#";
//Modified by Deena 05.03.2008 End
//Modified for Base64 by Deena 11.01.2008 End
DiscText = InsertBreak(DiscText);
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHeader
+ "\n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n\n";
if (DiscText.Contains(comp_Text))
{
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHea
der + "\n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n\n";
strEmailBody = strEmailBody.Replace(comp_Text, strOptout
);
}
else
{
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHea
der + "\n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n\n" + s
trOptout + " \n\n";
}
}
else
{
DiscText = msgDisc + "\n" + sGetGlobalDisclaimerText("ei_dis
claimer", intCorpID);
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/Gmailer/us.aspx
?d=#month-and-year#&req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove & from the out bound E-Mail Links
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/0/?d=#month-and
-year#&r=#SEND_ID#";
strOptout = gblOptOutMsg + "##DOMAIN_URL##/0/?d=#month-and-y
ear#&r=#SEND_ID#";
//Modified by Deena 05.03.2008 End
if (msgDisc == "")
{
if (intCorpid == 157)
{
DiscText = sGetAXA_Disclaimer(strAddressBook) + "<br><br>" +
sGetGlobalDisclaimerText("wm_disclaimer", intCorpid);
}
else if (intCorpid == 127)
{
if (Aux1 == "1")
{
DiscText = "<br>" + HTKP_DISCLAIMER + "<br>" + sGetGloba
lDisclaimerText("wm_disclaimer", intCorpid);
}
else
{
DiscText = sGetGlobalDisclaimerText("wm_disclaimer", int
Corpid);
}
}
else
{
DiscText = sGetGlobalDisclaimerText("wm_disclaimer", intCorp
id);
}
if (DiscText != "")
{
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = "<a href=\"##DOMAIN_URL##/Gmailer/us.aspx?d=#m
onth-and-year#&req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-y
ear#&req=#SEND_ID#</a>";
strOptout = "<a href=\"##DOMAIN_URL##/0/?d=#month-and-year#&
amp;r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&r=#SEND_ID#</a>";
//Modified for Base64 by Deena 11.01.2008 End
if (DiscText.Contains(comp_Text))
{ //modified by ratheesh on 05/08/2008 for tkt 1063; remov
ed background-color: white; from the body cssclass
//Modified By Deena for Ticket Number 1063 Note 2027 Rem
oval of CSS on 20.08.2008
strEmailBody = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML
4.0 Transitional//EN\" ><html><head><title></title> </head><body >" + sHTMLmast
Head + "<p>Dear #USER_NAME#,<br><br>" + strHTMLHeader + "</p><p>" + strLink + "<
/p><p>" + strHTMLFooter + "</p><p>" + DiscText + "<br></p></body></html>";
strEmailBody = strEmailBody.Replace(comp_Text, strOptout
);
}
else
{ //modified by ratheesh on 05/08/2008 for tkt 1063; remov
ed background-color: white; from the body cssclass
//Modified By Deena for Ticket Number 1063 Note 2027 Rem
oval of CSS on 20.08.2008
strEmailBody = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML
4.0 Transitional//EN\" ><html><head><title></title> </head><body >" + sHTMLmast
Head + "<p>Dear #USER_NAME#,<br><br>" + strHTMLHeader + "</p><p>" + strLink + "<
/p><p>" + strHTMLFooter + "</p><p>" + DiscText + "<br>" + strOptout + "</p></bod
y></html>";
}
}
else //if disclaimer text = null
{
DiscText = msgDisc + sGetGlobalDisclaimerText("wm_disclaimer
", intCorpid);
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/Gmail
er/us.aspx?d=#month-and-year#&req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx
?d=#month-and-year#&req=#SEND_ID#</a>";
strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/0/?d=#m
onth-and-year#&r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&r=#SEN
D_ID#</a>";
//Modified for Base64 by Deena 11.01.2008 End
//modified by ratheesh on 05/08/2008 for tkt 1063; removed b
ackground-color: white; from the body cssclass
//Modified By Deena for Ticket Number 1063 Note 2027 Removal
of CSS on 20.08.2008
strEmailBody = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0
Transitional//EN\" ><html><head><title></title> </head><body >" + sHTMLmastHead
+ "<p>Dear #USER_NAME#,<br><br>" + strHTMLHeader + "</p><p>" + strLink + "</p><
p>" + strHTMLFooter + "</p><p>" + DiscText + "<br>" + strOptout + "</p></body></
html>";
}
}
else
{
if (intCorpid == 157)
{
DiscText = sGetAXA_Disclaimer(strAddressBook) + "<br><br>" +
sGetGlobalDisclaimerText("wm_disclaimer", intCorpid);
}
else if (intCorpid == 127)
{
if (Aux1 == "1")
{
DiscText = "<br>" + HTKP_DISCLAIMER + "<br>" + sGetGloba
lDisclaimerText("wm_disclaimer", intCorpid);
}
else
{
DiscText = sGetGlobalDisclaimerText("wm_disclaimer", int
Corpid);
}
}
else
{
DiscText = sGetGlobalDisclaimerText("wm_disclaimer", intCorp
id);
}
if (DiscText != "")
{
DiscText = msgDisc + "<br><br>" + DiscText;
if (msgDisc == "")
{
if (intCorpid == 157)
{
DiscText = sAxaNewDisc(strAddressBook) + "<br><br>" + sGetGl
obalDisclaimerText("ep_disclaimer", intCorpid);
}
else if (intCorpid == 127)
{
if (Aux1 == "1")
{
DiscText = "<br>" + HTKP_DISCLAIMER + "<br>" + sGetGloba
lDisclaimerText("ep_disclaimer", intCorpid);
}
else
{
DiscText = sGetGlobalDisclaimerText("ep_disclaimer", int
Corpid);
}
}
else
{
DiscText = sGetGlobalDisclaimerText("ep_disclaimer", intCorp
id);
}
if (DiscText != "")
{
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = "<a href=\"##DOMAIN_URL##/Gmailer/us.aspx?d=#m
onth-and-year#&req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-y
ear#&req=#SEND_ID#</a>";
strOptout = "<a href=\"##DOMAIN_URL##/0/?d=#month-and-year#&
amp;r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&r=#SEND_ID#</a>";
//Modified for Base64 by Deena 11.01.2008 End
strEmailBody = header + " & vbCrLf & vbCrLf & strLink & vbCr
Lf & vbCrLf " + footer;
//Modified By Deena for Ticket Number 1063 Note 2027 Removal
of CSS on 20.08.2008
strEmailBody = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0
Transitional//EN\"><html><head><title></title> </head><body >" + sHTMLmastHead
+ "<p> Dear #USER_NAME#,<br><br>" + strHTMLHeader + "</p><p>" + strLink + "</p><
p>" + strHTMLFooter + "</p><p>" + DiscText + "<br>" + strOptout + "</p></body></
html>";
//modified by ratheesh on 05/08/2008 for tkt 1063; removed b
ackground-color: white; from the body cssclass
if (DiscText.Contains(comp_Text))
{ //modified by ratheesh on 05/08/2008 for tkt 1063; remov
ed background-color: white; from the body cssclass
//Modified By Deena for Ticket Number 1063 Note 2027 Rem
oval of CSS on 20.08.2008
strEmailBody = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML
4.0 Transitional//EN\" ><html><head><title></title> </head><body >" + sHTMLmast
Head + "<p>Dear #USER_NAME#,<br><br>" + strHTMLHeader + "</p><p>" + strLink + "<
/p><p>" + strHTMLFooter + "</p><p>" + DiscText + "<br></p></body></html>";
strEmailBody = strEmailBody.Replace(comp_Text, strOptout
);
}
else
{ //modified by ratheesh on 05/08/2008 for tkt 1063; remov
ed background-color: white; from the body cssclass
//Modified By Deena for Ticket Number 1063 Note 2027 Rem
oval of CSS on 20.08.2008
strEmailBody = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML
4.0 Transitional//EN\" ><html><head><title></title> </head><body >" + sHTMLmast
Head + "<p>Dear #USER_NAME#,<br><br>" + strHTMLHeader + "</p><p>" + strLink + "<
/p><p>" + strHTMLFooter + "</p><p>" + DiscText + "<br>" + strOptout + "</p></bod
y></html>";
}
}
else if (intCorpid == 157)
{
DiscText = msgDisc + " vbCrLf & vbCrLf" + sAxaNewDisc(strAdd
ressBook) + "vbCrLf&vbCrLf&" + sGetGlobalDisclaimerText("ep_disclaimer", intCorp
id);
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/Gmail
er/us.aspx?d=#month-and-year#&req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx
?d=#month-and-year#&req=#SEND_ID#</a>";
strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/0/?d=#m
onth-and-year#&r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&r=#SEN
D_ID#</a>";
//Modified for Base64 by Deena 11.01.2008 End
//Modified By Deena for Ticket Number 1063 Note 2027 Removal
of CSS on 20.08.2008
strEmailBody = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0
Transitional//EN\"><html><head><title></title> </head><body >" + sHTMLmastHead
+ "<p>Dear #USER_NAME#,<br><br>" + strHTMLHeader + "</p><p>" + strLink + "</p><p
>" + strHTMLFooter + "</p><p>" + DiscText + "<br>" + strOptout + "</p></body></h
tml>";
//modified by ratheesh on 05/08/2008 for tkt 1063; removed b
ackground-color: white; from the body cssclass
}
else
{
DiscText = msgDisc + sGetGlobalDisclaimerText("ep_disclaimer
", intCorpid);
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/Gmail
er/us.aspx?d=#month-and-year#&req=#SEND_ID#\"></a>";
strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/0/?d=#m
onth-and-year#&r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&r=#SEN
D_ID#</a>";
//Modified for Base64 by Deena 11.01.2008 End
//modified by ratheesh on 05/08/2008 for tkt 1063; removed b
ackground-color: white; from the body cssclass
//Modified By Deena for Ticket Number 1063 Note 2027 Removal
of CSS on 20.08.2008
strEmailBody = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0
Transitional//EN\" ><html><head><title></title> </head><body >" + sHTMLmastHead
+ "<p>Dear #USER_NAME#,<br><br>" + strHTMLHeader + "</p><p>" + strLink + "</p><
p>" + strHTMLFooter + "</p><p>" + DiscText + "<br>" + strOptout + "</p></body></
html>";
}
}
else
{
if (intCorpid == 157)
{
if (sGetAXA_Disclaimer(strAddressBook).Trim() == sAxaNewDisc
(strAddressBook).Trim())
{
DiscText = sGetGlobalDisclaimerText("ep_disclaimer", int
Corpid) + "<br><br>" + sAxaNewDisc(strAddressBook);
}
else
{
DiscText = sAxaNewDisc(strAddressBook) + "<br><br>" + sG
etGlobalDisclaimerText("ep_disclaimer", intCorpid);
}
}
else if (intCorpid == 127)
{
if (Aux1 == "1")
{
DiscText = "<br>" + HTKP_DISCLAIMER + "<br>" + sGetGloba
lDisclaimerText("ep_disclaimer", intCorpid);
}
else
{
DiscText = sGetGlobalDisclaimerText("ep_disclaimer", int
Corpid);
}
}
else
{
DiscText = sGetGlobalDisclaimerText("ep_disclaimer", intCorp
id);
}
if (DiscText != "")
{
DiscText = msgDisc + "<br><br>" + DiscText;
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = "<a href=\"##DOMAIN_URL##/Gmailer/us.aspx?d=#m
onth-and-year#&req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-y
ear#&req=#SEND_ID#</a>";
strOptout = "<a href=\"##DOMAIN_URL##/0/?d=#month-and-year#&
amp;r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&r=#SEND_ID#</a>";
//Modified for Base64 by Deena 11.01.2008 End
//Modified By Deena for Ticket Number 1063 Note 2027 Removal
of CSS on 20.08.2008
strEmailBody = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0
Transitional//EN\"><html><head><title></title> </head><body >" + sHTMLmastHead
+ "<p>Dear #USER_NAME#,<br><br>" + strHTMLHeader + "</p><p>" + strLink + "</p><p
>" + strHTMLFooter + "</p><p>" + DiscText + "<br></p></body></html>";
//modified by ratheesh on 05/08/2008 for tkt 1063; removed b
ackground-color: white; from the body cssclass
if (DiscText.Contains(comp_Text))
{
strEmailBody = strEmailBody.Replace(comp_Text, strOptout
);
}
else
{ //modified by ratheesh on 05/08/2008 for tkt 1063; remov
ed background-color: white; from the body cssclass
//Modified By Deena for Ticket Number 1063 Note 2027 Rem
oval of CSS on 20.08.2008
strEmailBody = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML
4.0 Transitional//EN\" ><html><head><title></title> </head><body >" + sHTMLmast
Head + "<p>Dear #USER_NAME#,<br><br>" + strHTMLHeader + "</p><p>" + strLink + "<
/p><p>" + strHTMLFooter + "</p><p>" + DiscText + "<br>" + strOptout + "</p></bod
y></html>";
}
}
else if (intCorpid == 157)
{
DiscText = msgDisc + " vbCrLf & vbCrLf " + sAxaNewDisc(strAd
dressBook) + "&vbCrLf&vbCrLf&" + sGetGlobalDisclaimerText("ep_disclaimer", intCo
rpid);
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/Gmail
er/us.aspx?d=#month-and-year#&req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx
?d=#month-and-year#&req=#SEND_ID#</a>";
strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/0/?d=#m
onth-and-year#&r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&r=#SEN
D_ID#</a>";
//Modified for Base64 by Deena 11.01.2008 End
//Modified By Deena for Ticket Number 1063 Note 2027 Removal
of CSS on 20.08.2008
strEmailBody = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0
Transitional//EN\" ><html><head><title></title> </head><body >" + sHTMLmastHead
+ "<p>Dear #USER_NAME#,<br><br>" + strHTMLHeader + "</p><p>" + strLink + "</p><
p>" + strHTMLFooter + "</p><p>" + DiscText + "<br>" + strOptout + "</p></body></
html>";
//modified by ratheesh on 05/08/2008 for tkt 1063; removed b
ackground-color: white; from the body cssclass
}
else
{
DiscText = msgDisc + "<br><br>" + sGetGlobalDisclaimerText("
wm_disclaimer", intCorpid);
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/Gmail
er/us.aspx?d=#month-and-year#&req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx
?d=#month-and-year#&req=#SEND_ID#</a>";
strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/0/?d=#m
onth-and-year#&r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&r=#SEN
D_ID#</a>";
//Modified for Base64 by Deena 11.01.2008 Start
//Modified By Deena for Ticket Number 1063 Note 2027 Removal
of CSS on 20.08.2008
strEmailBody = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0
Transitional//EN\" ><html><head><title></title> </head><body >" + sHTMLmastHead
+ "<p>Dear #USER_NAME#,<br><br>" + strHTMLHeader + "</p><p>" + strLink + "</p><
p>" + strHTMLFooter + "</p><p>" + DiscText + "<br>" + strOptout + "</p></body></
html>";
//modified by ratheesh on 05/08/2008 for tkt 1063; removed b
ackground-color: white; from the body cssclass
}
}
//for multipartmail
strEmailBody = strEmailBody.Replace("'", "''");
sSmtpEmailText = sSmtpEmailText.Replace(strLowerBoundary.TrimStart()
, strUpperHtmlBoundary);
SMTPEmail = sSmtpEmailText + "\n \n" + strEmailBody + "#SendersCopy_
List#" + "\n \n" + strLowerBoundary.TrimStart();
//End
return SMTPEmail;
}
//public DataTable dtGetChecklist(int intAddressBook)
//{
// string strSQL = "select checklistid,checklistName from tblchecklis
t inner join tblmembers on(tblchecklist.corp_id = tblmembers.corp_id) where addr
essbook=" + intAddressBook.ToString() + " order by checklistname";
// return (dbOpr.executeQueriesTable(strSQL));
//}
/* Modified for admin module Start checklist */
//16.11.07
public DataTable dtGetChecklist(int intAddressBook, int corp_id)
{
string strSQL = "";
//Modified by Deena for content by category 06.05.2008 Start
/*if (corp_id == 157)
{
// string strSQL = "select checklistid,checklistName from tblche
cklist inner join tblmembers on(tblchecklist.corp_id = tblmembers.corp_id) where
addressbook=" + intAddressBook.ToString() + " and ((datediff(day,expdate, getda
te())<=0)or(isnull((convert(char(26),expdate,101)),'0')='0')) order by checklist
name";
strSQL = "select checklistid,checklistName from tblagent_categor
ies " +
"inner join tblchecklist on tblchecklist.categor
yid=tblagent_categories.categoryid and " +
"((datediff(day,expdate, getdate())<=0)or(isnull
((convert(char(26),expdate,101)),'0')='0')) " +
"where tblagent_categories.addressbook=" + intAd
dressBook.ToString() + " and corp_id=" + corp_id.ToString() + " ";
}
else
{
strSQL = "select checklistid,checklistName from tblchecklist inn
er join tblmembers on(tblchecklist.corp_id = tblmembers.corp_id) where addressbo
ok=" + intAddressBook.ToString() + " and ((datediff(day,expdate, getdate())<=0)o
r(isnull((convert(char(26),expdate,101)),'0')='0')) order by checklistname";
}*/
//Modified by Deena for content by category Ticket Number 120 in BT
19.05.2008 Start
strSQL = "select checklistid,checklistName from tblchecklist where c
orp_id = " + corp_id + " and (CategoryID in (select " +
"categoryid from tblagent_categories where categoryid in(select
categoryid from tblcorp_categories " +
"where corp_id = " + corp_id + ") and addressbook = " + intAddre
ssBook + ") or CategoryID is null or CategoryID =0) and " +
"((datediff(day,expdate, getdate())<=0)or(isnull((convert(char(2
6),expdate,101)),'0')='0')) ";
//Modified by Deena for content by category Ticket Number 120 in BT
19.05.2008 End
//Modified by Deena for content by category 06.05.2008 End
//16.11.07 end
return (dbOpr.executeQueriesTable(strSQL));
}
public string sGetChecklistExpDate(int intChecklistId)
{
string strSQL = "select isnull(expdate,getdate()) from tblchecklist
where checklistID=" + intChecklistId + " and ((datediff(day,expdate, getdate())<
=0)or(isnull((convert(char(26),expdate,101)),'0')='0')) order by checklistname";
return (dbOpr.executeScalarQuery(strSQL));
}
}
query = query + " group by emailaddress) prg where addressbook in ("
+ seladdressbook + ") and ob.emailaddress=prg.emailaddress and " +
" prg.date_created = ob.date_created group by prg.emailaddre
ss) b where a.emailaddress = b.emailaddress and a.date_created = b.date_created"
;
//Modified By Deena for Ticket Number 1069 Note 1886 Showing Wrong C
ount in Mailing 13.08.2008 Start
if (sSweepCorpID == intCorpid.ToString())
{
intCorpid = iAXACorpID;
}
if (isGlobalOptOut == "1")
{
if (intCorpid == 189)
{
query = query + " and a.emailaddress not in (select emailadd
ress from tbl_global_optout where OptOutType = 1 and corp_id in(189,121)) ";
}
else
{
query = query + " and a.emailaddress not in (select emailadd
ress from tbl_global_optout where OptOutType = 1 and corp_id = " + intCorpid + "
) ";
}
}
else if (isGlobalOptOut == "2")
{
query = query + " and a.emailaddress not in (select emailaddress
from tbl_global_optout where OptOutType = 2 and corp_id = " + intCorpid + " and
AgencyNumber = '" + strAgencyNo + "') ";
}
//Modified By Deena for Ticket Number 1069 Note 1886 Showing Wrong C
ount in Mailing 13.08.2008 End
query = query + " and a.emailaddress not like '%noemailaddress.void%
' and a.emailaddress not in (select emailaddress from Tbl_agent_Ex_Inc " +
" where addressbook = " + intAddressBook + ") and a.
a_crdate=b.crdate";
//Modified By Deena for Ticket Number 1031 Note 1902 14.08.2008 End
return (dbOpr.executenonQuery(query));
}
public DataTable dtGetFutureSendGroupId_Group(string sBatchid)
{
string SQLStatement = "select case when (addressbook is null or addr
essbook = '')then cast (groupid as varchar(50)) else " +
" cast (groupid as varchar(50)) + '$' + cast
(addressbook as varchar(50)) end as " +
" groupid from tblQcategoryList where batchI
D='" + sBatchid + "'";
return (dbOpr.executeQueriesTable(SQLStatement));
}
public int InsertfromQExInc(int addressbook, string Batchid)
{
string query = "insert tbl_agent_ex_inc select " + addressbook + ",
EmailAddress, contactaddressbook, whattodo " +
" from tblqex_inclusion where batchid = '" + Batchid + "
' and " +
" cast(emailaddress as varchar(50)) + ',' + cast(contact
addressbook as varchar(50)) " +
" not in(select cast(emailaddress as varchar(50)) + ','
+ cast(Prodaddressbook as varchar(50)) " +
" from tbl_agent_ex_inc where addressbook = " + addressb
ook + ")";
return (dbOpr.executenonQuery(query));
}
public void dtUpdateFutureSend_Count_Group(string taskID, int intAddress
Book, int intCorpid, string sSweepCorpID, string strAgencyNo)
{
//Modified by Deena for Ticket Number 950 Note 2350 Futuresend Count
09.09.2008 Start
string query, isGlobalOptOut, SelAddressbooks = "", SelCategories =
"";
if (intCorpid.ToString() == sSweepCorpID)
{
intCorpid = 157;
}
isGlobalOptOut = isGlobalOptout(intCorpid);
if (isFutureCountUpdate(taskID) > 0)
{
SelAddressbooks = GetSelectedAddressbook(taskID);
if (SelAddressbooks == "-1")
SelAddressbooks = intAddressBook.ToString();
SelCategories = GetSelectedCategories(taskID);
if ((SelCategories != "-3") && (SelCategories != "-1"))
{
query = "SELECT COUNT (*) FROM ((SELECT a.emailaddress FROM
prg_" + intAddressBook + " a, (SELECT emailaddress, MIN(date_created) AS date_
created FROM prg_" + intAddressBook +
" WHERE addressbook IN (" + SelAddressbooks + ") GRO
UP BY emailaddress) b WHERE a.emailaddress = b.emailaddress AND " +
" a.date_created = b.date_created AND CAST(a.[id] AS
VARCHAR) + '-' + CAST(a.addressbook AS VARCHAR) NOT IN " +
" (SELECT CAST(userid AS VARCHAR) + '-' + CAST(addr
essbook AS VARCHAR) FROM tblUserCategory " +
" WHERE categoryid IN (SELECT ID FROM tblCategoryLis
t WHERE addressbook IN (" + intAddressBook + ") AND " +
" categoryname IN ('Invalid EmailAddress','opt-Out')
))";
if (SelCategories != "0")
{
query += "and (CAST(a.[id] AS VARCHAR) + '-' + CAST(a.ad
dressbook AS VARCHAR) IN " +
" (SELECT CAST(userid AS VARCHAR) + '-' + CASE
when CAST(addressbook AS VARCHAR) " +
" IS NOT NULL THEN CAST(addressbook AS VARCHAR)
ELSE CAST(" + intAddressBook + " AS VARCHAR) END FROM tblUserCategory " +
" WHERE categoryid IN (" + SelCategories + ")))
";
}
if (isGlobalOptOut == "1")
{
if (intCorpid == 189)
{
query += " AND a.emailaddress NOT IN (SELECT emailad
dress from tbl_global_optout WHERE OptOutType = 1 and corp_id IN(189,121)) ";
}
else
{
query += " AND a.emailaddress NOT IN (SELECT emailad
dress from tbl_global_optout WHERE OptOutType = 1 and corp_id IN(" + intCorpid +
")) ";
}
}
else if (isGlobalOptOut == "2")
{
query += " AND a.emailaddress NOT IN (SELECT emailaddres
s from tbl_global_optout WHERE OptOutType = 2 and corp_id = " + intCorpid + " an
d AgencyNumber = '" + strAgencyNo + "') ";
}
query += "AND a.emailaddress NOT LIKE '%noemailaddress.void%
'" +
" AND a.addressbook IN (SELECT addressbook FROM tbl
members WHERE isactive = 1 and addressbook in " +
" (SELECT addressbookid FROM Tbl_agent_Group_detail
where groupid = (SELECT groupid FROM Tbl_agent_Group_detail " +
" where addressbookid =" + intAddressBook + "))) "
+
" AND a.emailaddress + '-' + CAST(a.addressbook AS
VARCHAR) NOT IN " +
" (SELECT emailaddress + '-' + CASE when CAST(conta
ctaddressbook AS VARCHAR) " +
" IS NOT NULL THEN CAST(contactaddressbook AS VARCH
AR) ELSE CAST(" + intAddressBook + " AS VARCHAR) END " +
" FROM TBLQEX_INCLUSION WHERE Batchid = '" + taskI
D + "' AND whattodo = -1)) " +
" UNION SELECT emailaddress FROM TBLQEX_INCLUSION W
HERE Batchid = '" + taskID + "' AND " +
" emailaddress + '-' + CASE when CAST(contactaddres
sbook AS VARCHAR) IS NOT NULL THEN CAST(contactaddressbook AS VARCHAR) " +
" ELSE CAST(" + intAddressBook + " AS VARCHAR) END
IN (select emailaddress + '-' + CAST(addressbook AS VARCHAR) from prg_" + intAdd
ressBook;
if (SelCategories != "0")
{
query += " where CAST([id] AS VARCHAR) + '-' + CAST(addr
essbook AS VARCHAR) IN " +
" (SELECT CAST(userid AS VARCHAR) + '-' + CASE
when CAST(addressbook AS VARCHAR) IS NOT NULL THEN " +
" CAST(addressbook AS VARCHAR) ELSE CAST(" + in
tAddressBook + " AS VARCHAR) END FROM tblUserCategory WHERE categoryid IN (" + S
elCategories + "))";
}
query += ")AND whattodo in(1) UNION SELECT emailaddress FROM
TBLQEX_INCLUSION WHERE Batchid = '" + taskID + "' AND " +
" emailaddress + '-' + CASE when CAST(contactaddress
book AS VARCHAR) IS NOT NULL THEN CAST(contactaddressbook AS VARCHAR) ELSE CAST
(" + intAddressBook + " AS VARCHAR) END IN " +
" (SELECT emailaddress + '-' + CAST(addressbook AS V
ARCHAR) from prg_" + intAddressBook + ") AND whattodo in(0)) dt";
}
else
{
query = "select Count(*) from tblqex_inclusion a, Tbl_agent_
Group_detail b where b.addressbookid = case when a.contactaddressbook is not nul
l then a.contactaddressbook " +
" else " + intAddressBook + " end and batchid = '" + taskID
+ "' and whattodo in (1,0) and case when a.contactaddressbook is not null then a
.contactaddressbook " +
" else " + intAddressBook + " end in (select addressbook fro
m tblmembers where isactive = 1) ";
}
string Total_Count = "0";
Total_Count = dbOpr.executeScalarQuery(query).ToString();
string strUpdateFSend = "Update tbl_futuresend_details set recCo
unt = '" + Total_Count + "' where TaskId = '" + taskID + "'";
dbOpr.executenonQuery(strUpdateFSend);
string strUpdatetblHSum = "Update tblhistorysummary set TotalEma
ilsQueued = '" + Total_Count + "' where batchId = '" + taskID + "'";
dbOpr.executenonQuery(strUpdatetblHSum);
}
//Modified by Deena for Ticket Number 950 Note 2350 Futuresend Count
09.09.2008 End
}
public string isFutureCheckAll(string batchid, int intAddressBook)
{
string addressbook = "", categories = "", isAll = "0";
DataTable dtAbook = new DataTable();
dtAbook = isFutureCheckAllAddressBooks(intAddressBook);
for (int i = 0; i < dtAbook.Rows.Count; i++)
{
addressbook += dtAbook.Rows[i]["addressbookid"].ToString() + ","
;
}
DataTable dtGroups = new DataTable();
dtGroups = isFutureCheckAllGroups(batchid);
for (int j = 0; j < dtGroups.Rows.Count; j++)
{
if (dtGroups.Rows[j]["addressbook"].ToString() == "0")
{
isAll = "1";
}
else
{
categories += dtGroups.Rows[j]["addressbook"].ToString() + "
,";
}
}
if (isAll == "1")
{
if (addressbook == categories)
isAll = "1";
else
isAll = "0";
}
else
{
isAll = "0";
}
return (isAll);
}
public DataTable isFutureCheckAllAddressBooks(int intAddressBook)
{
string query = "select addressbookid from tbl_agent_group_detail whe
re groupid= " +
" (select groupid from tbl_agent_group_detail where addressbookid="
+ intAddressBook + ") order by addressbookid";
return (dbOpr.executeQueriesTable(query));
}
public DataTable isFutureCheckAllGroups(string batchid)
{
string query = "select addressbook from tblqcategorylist where batch
id = '" + batchid + "'" +
"and groupid = 0 order by addressbook";
return (dbOpr.executeQueriesTable(query));
}
// Modified by Deena Ticket Number 1031 Populate Agent Categories on 08.
07.2008 End
//Modified by Deena for Ticket Number 1031 Populating Individual Emailer
Contacts - 30.07.2008 Start
// Added by KarthikAnand Ticket Number 1031 for displaying the contacts
in Producer group on 08.07.2008 start
public DataTable dtGetProducerDetails(int intAddressBook, string sState,
string prgAddressbooks, int corp_id, string isGlobalOptOut, string strAgencyNo,
string sSweepCorpID)
{
//string SQLStatement = "SELECT mem.lastname+'-'+addr.firstname+' '+
addr.lastname as name,ext.AddressBook,addr.[id],addr.emailAddress,addr.firstname
,addr.lastname,addr.[group],mem.lastname as agentname,ltrim(rtrim(isnull(ext.sta
te,'0')))as state,addr.date_created FROM prg_" + intAddressBook + " as addr"
// + ", (select emailaddress,min(date_created) as date_created fr
om prg_" + intAddressBook
// + " group by emailaddress )b,tbl_addressbook_ext as ext"
// + ", tblmembers as mem where addr.date_created=b.date_created
and addr.emailaddress=b.emailaddress and addr.emailAddress not like '%@noemaila
ddress.void' and addr.id=ext.clientid and"
// + " addr.addressbook = ext.addressbook and addr.addressbook=me
m.addressbook and ext.addressbook in (" + prgAddressbooks + ")"
// + " and addr.id not in (select userid from tblUserCategory wh
ere exists "
// + " (select ID from tblCategoryList where addressbook=" + intA
ddressBook
// + " and (categoryName='opt-Out' or categoryName='Invalid Email
Address') "
// + " and ID=tblUserCategory.categoryid)) order by addr.emailadd
ress";
//Modified by Deena for Ticket Number 403 in BT on 22.01.2009 Start
int iAXACorpID = 157;
string SQLStatement = "select mem.firstname+' '+ mem.lastname+' - '+
a.firstname+' '+a.lastname as name,a.AddressBook,a.[id],a.emailAddress,a.firstna
me,a.lastname, " +
" case when ltrim(rtrim(ext.state)) = '' or ex
t.state is null then '0' else ext.state end as state,a.date_created from prg_" +
intAddressBook + " a left outer join tbl_addressbook_ext ext " +
" on a.addressbook = ext.addressbook and a.id
= ext.clientid ,(select emailaddress, min(date_created) as date_created " +
" from prg_" + intAddressBook + " where addres
sbook in (" + prgAddressbooks + ") and cast([id] as varchar) + '-' + cast(addre
ssbook as varchar) " +
" not in (select cast(userid as varchar) + '-'
+ cast(addressbook as varchar) from tblUserCategory where categoryid in " +
" (select ID from tblCategoryList where addres
sbook in (" + intAddressBook + ") and categoryname in ('Invalid EmailAddress','
opt-Out'))) " +
" group by emailaddress ) b, tblmembers mem wh
ere a.addressbook = mem.addressbook and a.emailaddress = b.emailaddress and " +
" a.date_created = b.date_created ";
if (sSweepCorpID == corp_id.ToString())
{
corp_id = iAXACorpID;
}
if (isGlobalOptOut == "1")
{
SQLStatement += " and a.emailaddress not in (select emailaddress
from tbl_global_optout where OptOutType = 1 and corp_id = " + corp_id + ") ";
}
else if (isGlobalOptOut == "2")
{
SQLStatement += " and a.emailaddress not in (select emailaddress
from tbl_global_optout where OptOutType = 2 and corp_id = " + corp_id + " and A
gencyNumber = '" + strAgencyNo + "') ";
}
SQLStatement += " and a.emailaddress not like '%noemailaddress.void%
' order by name";
//Modified by Deena for Ticket Number 403 in BT on 22.01.2009 End
return (dbOpr.executeQueriesTable(SQLStatement));
}
//Added by Ezhil for Search Contacts ticket no 1231 on 31/01/2009 Start
public DataTable dtGetProducerDetails(int intAddressBook, string sState,
string prgAddressbooks, int corp_id, string isGlobalOptOut, string sSearchText,
string strAgencyNo, string sSweepCorpID)
{
int iAXACorpID = 157;
string SQLStatement = "select mem.firstname+' '+ mem.lastname+' - '+
a.firstname+' '+a.lastname as name,a.AddressBook,a.[id],a.emailAddress,a.firstna
me,a.lastname, " +
" ltrim(rtrim(isnull(ext.state,'0')))as state,
a.date_created from prg_" + intAddressBook + " a left outer join tbl_addressbook
_ext ext " +
" on a.addressbook = ext.addressbook and a.id
= ext.clientid ,(select emailaddress, min(date_created) as date_created " +
" from prg_" + intAddressBook + " where addres
sbook in (" + prgAddressbooks + ") and cast([id] as varchar) + '-' + cast(addre
ssbook as varchar) " +
" not in (select cast(userid as varchar) + '-'
+ cast(addressbook as varchar) from tblUserCategory where categoryid in " +
" (select ID from tblCategoryList where addres
sbook in (" + intAddressBook + ") and categoryname in ('Invalid EmailAddress','
opt-Out'))) " +
" group by emailaddress ) b, tblmembers mem wh
ere a.addressbook = mem.addressbook and a.emailaddress = b.emailaddress and " +
" a.date_created = b.date_created ";
if (sSweepCorpID == corp_id.ToString())
{
corp_id = iAXACorpID;
}
if (isGlobalOptOut == "1")
{
SQLStatement += " and a.emailaddress not in (select emailaddress
from tbl_global_optout where OptOutType = 1 and corp_id = " + corp_id + ") ";
}
else if (isGlobalOptOut == "2")
{
SQLStatement += " and a.emailaddress not in (select emailaddress
from tbl_global_optout where OptOutType = 2 and corp_id = " + corp_id + " and A
gencyNumber = '" + strAgencyNo + "') ";
}
SQLStatement += " and a.emailaddress not like '%noemailaddress.void%
' and ((a.FirstName like '%" + sSearchText + "%') OR (a.LastName like '%" + sSea
rchText + "%') OR (a.EmailAddress LIKE '%" + sSearchText + "%')) order by name";
return (dbOpr.executeQueriesTable(SQLStatement));
}
//Added by Ezhil for Search Contacts ticket no 1231 on 31/01/2009 End
//Modified by Deena for Ticket Number 1031 Populating Individual Emailer
Contacts - 30.07.2008 End
//public int iUpdateContactDetals_Group(int intAddressBook, int iActive)
//{
// string SQLStatement = "Update [" + intAddressBook + "] set active=
" + iActive;
// return dbOpr.executenonQuery(SQLStatement);
//}
//public int iUpdateContactDetals_Group(int intAddressBook, int iActive,
string sListOfEmailAddress)
//{
// string SQLStatement = "Update [" + intAddressBook + "] set active=
" + iActive + " where emailaddress in(" + sListOfEmailAddress + ")";
// return dbOpr.executenonQuery(SQLStatement);
//}
public int iUpdateContactDetals_Group(int intAddressBook, int iActive, s
tring sContactEmailAddress, string sFirstName, string sLastName)
{
// Query Modified by Glastin Ticket Number 1031 on 01/08/2008
string SQLStatement = "insert tbl_agent_ex_inc select " + intAddress
Book + " , emailaddress, " + intAddressBook + ", '1' from [" + intAddressBook +
"] where emailaddress = '" + sContactEmailAddress + "' and emailaddress not in
" +
" (select emailaddress from tbl_agent_ex_inc
where addressbook = " + intAddressBook + " and emailaddress = '" + sContactEmail
Address + "')";
return dbOpr.executenonQuery(SQLStatement);
}
// Ticket No:1313 Future mail send - Announcement and Cards not displayi
ng details note no:7185(1) modified on 17-04-09 start
public int DelExinc(string TaskID)
{
string SQLStatement = "Delete from tblqEX_Inclusion where batchid='"
+ TaskID + "'";
return dbOpr.executenonQuery(SQLStatement);
}
// Ticket No:1313 Future mail send - Announcement and Cards not displayi
ng details note no:7185(1) modified on 17-04-09 End
public string isGlobalOptout(int intCorpid)
{
string Flag = "Yes";
//Modified By Deena for Ticket Number 1069 Note 1886 Showing Wrong C
ount in Mailing 13.08.2008 Start
if (intCorpid == 189)
{
string Metlife_Corp = "", NEF_Corp = "", sSql;
sSql = "SELECT isCorp_Optout FROM tblCorp WHERE corp_id = 121";
Metlife_Corp = dbOpr.executeScalarQuery(sSql);
sSql = "SELECT isCorp_Optout FROM tblCorp WHERE corp_id = 189";
NEF_Corp = dbOpr.executeScalarQuery(sSql);
if ((Metlife_Corp == "0") && (NEF_Corp == "0"))
{
intCorpid = 189;
Flag = "No";
}
else if ((Metlife_Corp == "0") && (NEF_Corp == "1"))
{
intCorpid = 189;
Flag = "No";
}
else if ((Metlife_Corp == "0") && (NEF_Corp == "2"))
{
intCorpid = 189;
Flag = "Yes";
}
else if ((Metlife_Corp == "1") && (NEF_Corp == "0"))
{
intCorpid = 121;
Flag = "Yes";
}
else if ((Metlife_Corp == "1") && (NEF_Corp == "1"))
{
intCorpid = 121;
Flag = "Yes";
}
else if ((Metlife_Corp == "1") && (NEF_Corp == "2"))
{
intCorpid = 121;
Flag = "Yes";
}
else if ((Metlife_Corp == "2") && (NEF_Corp == "0"))
{
intCorpid = 189;
Flag = "No";
}
else if ((Metlife_Corp == "2") && (NEF_Corp == "1"))
{
intCorpid = 189;
Flag = "No";
}
else if ((Metlife_Corp == "2") && (NEF_Corp == "2"))
{
intCorpid = 189;
Flag = "Yes";
}
else
{
intCorpid = 121;
}
}
string isGlobalOptout;
if (Flag == "Yes")
{
string query = "select iscorp_optout from tblcorp where corp_id
= " + intCorpid;
isGlobalOptout = dbOpr.executeScalarQuery(query);
}
else
{
isGlobalOptout = "0";
}
return (isGlobalOptout);
//Modified By Deena for Ticket Number 1069 Note 1886 Showing Wrong C
ount in Mailing 13.08.2008 End
}
// Added by KarthikAnand Ticket Number 1031 on 08.07.2008 End
//Modified by Deena for Ticket Number 950 Note 2019 Futuresend Count 25.
08.2008 Start
public string GetSelectedAddressbook(string taskID)
{
string strSelectedAgents = "", Query = "";
DataTable addressbook = new DataTable();
Query = "SELECT addressbook = CASE WHEN (addressbook IS NULL OR a
ddressbook = '') THEN -1 ELSE addressbook END " +
" FROM tblqcategorylist WHERE batchid = '" + taskID + "'";
addressbook = dbOpr.executeQueriesTable(Query);
for (int i = 0; i < addressbook.Rows.Count; i++)
{
if (!strSelectedAgents.Contains(addressbook.Rows[i]["addressbook
"].ToString()))
strSelectedAgents += addressbook.Rows[i]["addressbook"].ToSt
ring() + ",";
}
if (strSelectedAgents != "")
strSelectedAgents = strSelectedAgents.Remove(strSelectedAgents.L
ength - 1);
return (strSelectedAgents);
}
public string GetSelectedCategories(string taskID)
{
string strSelectedCategories = "", Query = "";
DataTable Categories = new DataTable();
Query = "SELECT groupid FROM tblqcategorylist WHERE batchid = '" +
taskID + "'";
Categories = dbOpr.executeQueriesTable(Query);
for (int i = 0; i < Categories.Rows.Count; i++)
{
if (!strSelectedCategories.Contains(Categories.Rows[i]["groupid"
].ToString()))
strSelectedCategories += Categories.Rows[i]["groupid"].ToStr
ing() + ",";
}
if (strSelectedCategories != "")
strSelectedCategories = strSelectedCategories.Remove(strSelected
Categories.Length - 1);
return (strSelectedCategories);
}
//Modified by Deena for Ticket Number 950 Note 2019 Futuresend Count 25.
08.2008 End
//Modified by Deena for Ticket Number 950 Note 2350 Futuresend Count 09.
09.2008 Start
public int isFutureCountUpdate(string batchid)
{
string QryIsFutUpd = "SELECT COUNT(*) FROM TBLHISTORYSUMMARY WHERE B
ATCHID = '" + batchid + "' AND SMTPEMAIL IS NOT NULL " +
" AND QUEUE = 1 AND BATCHOPENED = 0 AND CONVERT(C
HAR(10),FUTURESENDDATE,20)>=CONVERT(CHAR(10),GETDATE(),20) ";
return (Convert.ToInt32(dbOpr.executeScalarQuery(QryIsFutUpd)));
}
//Modified by Deena for Ticket Number 950 Note 2350 Futuresend Count 09.
09.2008 End
//Modified by Deena for CRM 15.05.2008 Start
public string sGetActivityContact(int intAddressBook, int ContactID)
{
string SQLStatement = "select emailaddress from [" + intAddressBook
+ "] where id =" + ContactID;
return dbOpr.executeScalarQuery(SQLStatement);
}
//Modified by Deena for CRM 15.05.2008 End
public string getResponseVSG(string sAddressBook)
{
string SQLStatement = "";
if (sAddressBook == "")
SQLStatement = "select VSG from tbldomain_switch where domain='e
-relationship-response.com'";
else
SQLStatement = "EXEC sp_DomainSwitch " + sAddressBook;
return dbOpr.executeScalarQuery(SQLStatement);
}
if (catid == "0")
{
strSQL += " from [" + intAddressBook + "] adb left outer join tb
l_addressbook_ext ext on ext.clientid = adb.id " +
" where (adb.id not in(select userid from tblusercateg
ory where addressbook=" + intAddressBook +
" and categoryid in(select id from tblcategorylist whe
re addressbook=" + intAddressBook +
" and categoryname in('opt-out')))and (active!=3.0))"
+
" and ext.addressbook=" + intAddressBook;
}
else if (catid == "2")
{
strSQL += " from [" + intAddressBook + "] adb left outer join tb
l_addressbook_ext ext on ext.clientid = adb.id " +
" where (adb.id not in(select userid from tblusercateg
ory where addressbook=" + intAddressBook +
" and categoryid in(select id from tblcategorylist wher
e addressbook=" + intAddressBook +
" and categoryname in('opt-out')))and (active!=3.0))" +
" and ext.addressbook=" + intAddressBook + " and adb.em
ailaddress like '%@noemailaddress.void%'";
}
else if (catid == "4")
{
strSQL += " from [" + intAddressBook + "] adb left outer join tb
l_addressbook_ext ext on ext.clientid = adb.id " +
" where (adb.id not in(select userid from tblusercatego
ry where addressbook=" + intAddressBook +
" and categoryid in(select id from tblcategorylist wher
e addressbook=" + intAddressBook +
" and categoryname in('opt-out')))and (active!=3.0)) an
d (address1 is not null or address2 is not null) and " +
" (address1 !='' or address2 !='' ) and city is not nu
ll and city !='' and state is not null and state !='' " +
" and zip is not null and zip !='' and ext.addressbook=
" + intAddressBook + "";
}
else
{
strSQL += " from [" + intAddressBook + "] adb left outer join tb
l_addressbook_ext ext on ext.clientid = adb.id " +
" where (adb.id in (select userid from tblusercategor
y where addressbook=" + intAddressBook + " and CategoryID " +
" in (" + catid + ") and userid not in (select userid
from tblusercategory where addressbook=" + intAddressBook +
" and categoryid in(select id from tblcategorylist whe
re addressbook=" + intAddressBook + " and " +
" categoryname in('Opt-Out'))))and (adb.active!=3.0) o
r (adb.active=2.0)) and ext.addressbook=" + intAddressBook;
}
return (dbOpr.executeQueriesTable(strSQL));
}
public void DelSavdTemplate(string tblName, string category, int inAddre
ssBook, string fileName)
{
string strSQL = "";
strSQL = "delete from " + tblName + " where Category = '" + categor
y + "' and Filename = '" + fileName + "' and addressbook = '" + inAddressBook +
"'";
dbOpr.executenonQuery(strSQL);
}
public DataTable dtGetProductSB(int intAddressBook, int corp_id, string
SBGrpid)
{
string strSqlQuery = "";
strSqlQuery = "select distinct (tblConcepts.conceptID + ',' +tblConc
epts.industry) as Datakeys,isnull(tblConcepts.conceptname,'')+'$#$'+isnull(tblCo
ncepts.title,'') as conceptname " +
"from tblConcepts, tblmembers " +
"where ((tblConcepts.industry=tblmembers.industry_psb)" +
"and (tblConcepts.active='1' and " +
"((datediff(day,expdate, getdate())<=0)or(isnull((convert(char(26),e
xpdate,101)),'0')='0'))) and tblconcepts.conceptid in (select conceptid from tbl
_Group_Concepts where groupid='" + SBGrpid + "')" +
"and tblmembers.addressbook=" + intAddressBook + ") ORDER BY tblConc
epts.conceptName";
return (dbOpr.executeQueriesTable(strSqlQuery));
}
public int isPSBactive(int intAddressbook)
{
int isPSBactive = 0;
string Qry_Agentfeature = "select industry_PSB from tblmembers where
addressbook = " + intAddressbook;
DataTable dtAgent = new DataTable();
dtAgent = dbOpr.executeQueriesTable(Qry_Agentfeature);
if (dtAgent.Rows.Count > 0)
{
if ((dtAgent.Rows[0]["industry_PSB"].ToString() != "NULL") && (d
tAgent.Rows[0]["industry_PSB"].ToString() != "NONE") && (dtAgent.Rows[0]["indust
ry_PSB"].ToString() != ""))
{
isPSBactive = 1;
}
}
return (isPSBactive);
}
public int isFuturesendPSB(int intAddressbook, string batchid)
{
int isFuturesendPSB = 0;
string Qry_Agentfeature = "select industry from tblhistoryemail wher
e batchid='" + batchid + "' and industry in(select industry_psb from tblmembers
where addressbook = " + intAddressbook + ")";
DataTable dtAgent = new DataTable();
dtAgent = dbOpr.executeQueriesTable(Qry_Agentfeature);
if (dtAgent.Rows.Count > 0)
{
isFuturesendPSB = 1;
}
return (isFuturesendPSB);
}
public string getIndustry(string Batchid, int intAddressbook)
{
string strQry = "";
strQry = "select case when email.Industry = mem.industry_PSB then 'P
SB' else 'FSB' End as SBType from tblhistoryemail email,tblmembers mem where bat
chid = '" + Batchid + "' and addressbook = " + intAddressbook;
return (dbOpr.executeScalarQuery(strQry));
}
public DataTable dtGetCorpNewsletter(int intCorpID, int addressBook)
{
string strSQL = "execute sp_getCorpNewsletters " + intCorpID + "," +
addressBook;
return (dbOpr.executeQueriesTable(strSQL));
}
public string sAxaNewDisc(string strAddressBook)
{
string DiscNew;
int iAGRegCat, iRARegCat, iLifeCat, iCat5Ind;
iAGRegCat = 24; /* hard coded categoryid for the AGRegistration
* in local: 24 * in staging: 24 * in production: 4 */
iRARegCat = 25; /* hard coded categoryid for the RARegistration
* in local: 25 * in staging: 25 * in production: 5 */
iLifeCat = 26; /* hard coded categoryid for the LifeApptStates
* in local: 26 * in staging: 26 * in production: 6 */
iCat5Ind = 27; /* hard coded categoryid for the Category5Indicator
* in local: 27 * in staging: 27 * in production: 7 */
string strSQLCat = "select count(*) from tblagent_categories where c
ategoryid in(" + iAGRegCat + "," + iRARegCat + "," + iLifeCat + "," + iCat5Ind +
") and addressbook='" + strAddressBook + "'";
string sCatCheck, sInsRec;
sCatCheck = dbOpr.executeScalarQuery(strSQLCat);
string strSQLIns = "select count(*) from tblmembers where addressboo
k='" + strAddressBook + "' and (industry like '%rec%' or industry2 like '%rec%'
or industry3 like '%rec%')";
sInsRec = dbOpr.executeScalarQuery(strSQLIns);
if (sInsRec == "1")
{
DiscNew = "AXA Advisors, LLC (NY, NY 212-314-4600), member FINRA
, SPC. AXA Advisors, LLC is an Equal Opportunity and Affirmative Action Employer
M/F/D/V.";
}
else if (sCatCheck != "4" && sInsRec == "0")
{
DiscNew = "";
}
else
{
DiscNew = sGetAXA_Disclaimer(strAddressBook);
}
return (DiscNew);
}
public DataTable dtGetMailItemDetails(string sModule, string sIndustry,
string sSelectedItem, int intAddressBook, int intCorpID, string sFutDate)
{
string strSQL = "";
if ((sModule == "1") || (sModule == "4"))
{
strSQL = "select 'The '+ConceptName+' Storyboard will be expired
on the date choosen, please select another $#Module-Name#$.' as ExpiryMsg from
tblconcepts where active='1' and conceptID='" + sSelectedItem + "' and industry=
'" + sIndustry + "' and (datediff(dd,'" + sFutDate + "',expdate) <= 0)";
if (sModule == "1")
strSQL = strSQL.Replace("$#Module-Name#$", "Financial Storyb
oard");
else if (sModule == "4")
strSQL = strSQL.Replace("$#Module-Name#$", "Recruiting Story
board");
}
else if (sModule == "6")
{
strSQL = "select 'The '+pdf_title+' Financial Article will be ex
pired on the date choosen, please select another Financial Article.' as ExpiryMs
g from tblCorpNewsletters where corp_id = " + intCorpID + " and active = 1 " +
" and pdf_url='" + sSelectedItem + "' and (datediff(dd,'" +
sFutDate + "',expdate) <= 0) UNION select 'The '+pdf_title+' Financial Article w
ill be expired on the date choosen, please select another Financial Article.' as
ExpiryMsg from tblAgentNewsletters where corp_id = " + intCorpID +
" and addressbook = " + intAddressBook + " and active = 1 an
d pdf_url='" + sSelectedItem + "' and (datediff(dd,'" + sFutDate + "',expdate) <
= 0)";
}
else if (sModule == "8")
{
strSQL = "select 'The '+checklistName+' Checklist will be expire
d on the date choosen, please select another Mini Checklist.' as ExpiryMsg from
tblchecklist where checklistid='" + sSelectedItem + "' and (datediff(dd,'" + sFu
tDate + "',expdate) <= 0)";
}
return (dbOpr.executeQueriesTable(strSQL));
}
public DataTable dtGetHOEmailBuilderTemplates(int corpid, int addressboo
k)
{
string SQLStatement = "";
SQLStatement = "select DocumentTitle as Title, Filename,TemplateId,D
escription,ComplianceNo,CONVERT(VARCHAR(5),Exp_date,101) as Exp_date,categoryid,
Subject " +
"from tbl_HO_Templates where corp_id =" + corpid + " and isactiv
e=1 and (CategoryID is null or CategoryID = 0 or " +
"categoryid in(select categoryid from tblagent_categories where
addressbook=" + addressbook + " and categoryid in (select categoryid from tblcor
p_categories where corp_id=" + corpid + ")))" +
"and ((datediff(day,Exp_Date, getdate())<=0)or(isnull((convert(c
har(26),Exp_Date,101)),'0')='0')) order by Title asc";
return (dbOpr.executeQueriesTable(SQLStatement));
}
public DataTable sGetHOTempDet(string newsletterid)
{
string SQLStatement = "";
SQLStatement = "select DocumentTitle as Title, Filename,TemplateId,D
escription,ComplianceNo,CONVERT(VARCHAR(5),Exp_date,101) as Exp_date,TemplateHtm
l,TemplateOriginal,Subject from tbl_HO_Templates where TemplateId='" + newslette
rid + "'";
return (dbOpr.executeQueriesTable(SQLStatement));
}
public string dtgetSMARNum(string Newsletterurl)
{
string sql = "", SMARNum = "";
sql = "select ISNULL(SMAR_No,'') from tblCorpNewsletters where pdf_u
rl = '" + Newsletterurl + "' and corp_ID = 213";
SMARNum = dbOpr.executeScalarQuery(sql);
if (SMARNum == "")
{
sql = "select ISNULL(SMAR_No,'') from tblAgentNewsletters where
pdf_url = '" + Newsletterurl + "' and corp_ID = 213";
SMARNum = dbOpr.executeScalarQuery(sql);
}
return SMARNum;
}
public string sGetHOTempSubject(string sFilename)
{
string strQry = "select isnull(Subject,'') from tbl_ho_templates whe
re filename = '" + sFilename + "'";
return (dbOpr.executeScalarQuery(strQry));
}
public DataTable dtGetSBGroup(int corp_id)
{
string strgrpQry = "";
strgrpQry = "select distinct groupname ,groupid, SortOrder from tbl_
sb_groups, tbl_Group_Concepts where tbl_Group_Concepts.Groupid = tbl_sb_groups.i
d and Corp_Id=" + corp_id + " order by SortOrder";
return (dbOpr.executeQueriesTable(strgrpQry));
}
public DataTable dtGetOtherSBName(int intAddressBook, int intWhartonId,
int corp_id)
{
string strSqlQuery = "";
bool isWharton = false;
if (corp_id == 157)
{
isWharton = blnIswhartonagent(intWhartonId, intAddressBook);
}
if (isWharton)
{
strSqlQuery = "select conceptid,tblConcepts.conceptID + ',' + tb
lConcepts.industry as Datakeys,isnull(tblConcepts.conceptname,'')+'$#$'+isnull(t
blConcepts.title,'') as conceptname " +
"from tblagent_categories inner join tblcorp_categories on t
blagent_categories.categoryid=tblcorp_categories.categoryid and tblcorp_categori
es.categoryid<> " + intWhartonId +
"inner join tblConcepts on tblConcepts.industry=ltrim(tblcor
p_categories.industry) and substring(tblConcepts.industry,1,3)<>'Rec' and (tblCo
ncepts.active='1' " +
"and ((datediff(day,expdate, getdate())<=0)or(isnull((conver
t(char(26),expdate,101)),'0')='0')))and tblConcepts.conceptID + ',' + tblConcept
s.industry in " +
"(select Datakeys from (select tblConcepts.conceptid,tblConc
epts.industry,tblConcepts.conceptID + ',' + tblConcepts.industry as Datakeys, "
+
"isnull(tblConcepts.conceptname,'')+'$#$'+isnull(tblConcepts
.title,'') as conceptname,addressbook from tblagent_categories " +
"inner join tblcorp_categories on tblagent_categories.catego
ryid=tblcorp_categories.categoryid and tblcorp_categories.categoryid<> " + intWh
artonId +
"inner join tblConcepts on tblConcepts.industry=ltrim(tblcor
p_categories.industry) and substring(tblConcepts.industry,1,3)<>'Rec' and (tblCo
ncepts.active='1' and " +
"((datediff(day,expdate, getdate())<=0)or(isnull((convert(ch
ar(26),expdate,101)),'0')='0'))) where addressbook= " + intAddressBook + ")dg1 "
+
"left join (select conceptid , ltrim(rtrim(industry)) as ind
ustry,GroupID from tbl_Group_Concepts where groupid in(select id from Tbl_SB_Gro
ups where corp_id=157) " +
"and industry in(select ltrim(rtrim(industry)) from tblcorp_
categories where corp_id=157 and ltrim(rtrim(industry))<>'0' union select corp_i
ndustry as industry from tblcorp where corp_id=157))dg2 " +
"on dg1.conceptid = dg2.conceptid and ltrim(rtrim(dg1.ind
ustry)) = ltrim(rtrim(dg2.industry)) where addressbook= " + intAddressBook + "
and GroupID is null) and addressbook= " + intAddressBook;