You are on page 1of 135

using System;

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

public bool blnIswhartonagent(int intWhartonId, int intAddressBook)


{
string strSQL = "select categoryid from tblagent_categories where ca
tegoryid=" + intWhartonId + " and addressbook=" + intAddressBook + "";
string catid = dbOpr.executeScalarQuery(strSQL);
if (catid == "")
{
return (false);
}
else
{
return (true);
}
}
//modified for Admin/wharton 17.11.07 end
public DataTable dtGetFinancialSB(int intAddressBook, string type, strin
g SBGrpid)
{
string strSQL = "", strSqlQuery = "";
strSQL = "select case ISNULL(substring(industry,1,3),'') when 'Rec'
then industry when NULL then '' else '' end as industry ,case ISNULL(substring
(industry2,1,3),'')when 'Rec' then industry2 when NULL then '' else '' End as in
dustry2,case ISNULL(substring(industry3,1,3),'') when 'Rec' then industry3 when
NULL then '' else '' End as industry3 from tblmembers where addressbook=" + int
AddressBook.ToString();
DataTable dt = dbOpr.executeQueriesTable(strSQL);
//Changes for ticket 865 - Start
//strSqlQuery = "SELECT tblConcepts.conceptID+ ',' +tblConcepts.indu
stry as Datakeys, tblConcepts.conceptName FROM tblConcepts WHERE tblConcepts.in
dustry='" + 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";
//strSqlQuery = "SELECT tblConcepts.conceptID+ ',' +tblConcepts.indu
stry as Datakeys, tblConcepts.conceptName FROM tblConcepts WHERE (tblConcepts.i
ndustry='" + 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,ex
pdate, getdate())<=0)or(isnull((convert(char(26),expdate,101)),'0')='0'))) ORDER
BY tblConcepts.conceptName";
strSqlQuery = "SELECT tblConcepts.conceptID+ ',' +tblConcepts.indust
ry as Datakeys, isnull(tblConcepts.conceptname,'')+'$#$'+isnull(tblConcepts.titl
e,'') as 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)o
r(isnull((convert(char(26),expdate,101)),'0')='0'))) and tblconcepts.conceptid i
n (select conceptid from tbl_Group_Concepts where groupid='" + SBGrpid + "') ORD
ER BY tblConcepts.conceptName";
//Changes for ticket 865 - End
return (dbOpr.executeQueriesTable(strSqlQuery));
}
public string sGetFinancialArticle(int intAddressBook)
{
string sql = "select addressbook from tblmembers WHERE AddressBook =
" + intAddressBook.ToString() + " and emailaddress in('awing@inetmetrics.com','r
krumroy@mindspring.com','ron_davis@identitybranding.com','gregory@mediatraq.com'
,'swsupport@e-relationship.com')";
return (dbOpr.executeScalarQuery(sql));
}
public DataTable dtGetCards(string serverPath, int intCorpID)
{
using (DataSet dsCards = new DataSet())
{
dsCards.ReadXml(serverPath + "/e_cards/globalCards.xml");
using (DataTable dtCards = new DataTable())
{
DataColumn dcTitle = new DataColumn("title");
DataColumn dcFilePath = new DataColumn("filename");
dtCards.Columns.Add(dcTitle);
dtCards.Columns.Add(dcFilePath);
DataRow[] drow;
drow = dsCards.Tables[0].Select("corpid like '%," + intCorpI
D.ToString() + ",%' AND status='enabled'", "title ASC");
for (int i = 0; i < drow.Length; i++)
{
DataRow dr = dtCards.NewRow();
dr[0] = drow[i][1];
dr[1] = "e_cards/global/" + drow[i][2];
dtCards.Rows.Add(dr);
}
dsCards.Dispose();
dsCards.ReadXml(serverPath + "/e_cards/globalOverrides.xml")
;
drow.Initialize();
drow = dsCards.Tables[0].Select("corpid ='" + intCorpID.ToSt
ring() + "' AND status='enabled'", "title ASC");
for (int i = 0; i < drow.Length; i++)
{
DataRow dr = dtCards.NewRow();
dr[0] = drow[i][1];
dr[1] = "e_cards/corp/" + intCorpID.ToString() + "/" + d
row[i][2];
dtCards.Rows.Add(dr);
}
dtCards.DefaultView.Sort = "title ASC";
return (dtCards);
}
}
}

public DataTable dtGetInvitationBackgrounds(string serverPath, int intCo


rpID)
{
using (DataSet dsInvitations = new DataSet())
{
if (intCorpID == 189)
{
dsInvitations.ReadXml(serverPath + "Invitations189.xml");
}
else if (intCorpID == 121)
{
dsInvitations.ReadXml(serverPath + "Invitations121.xml");
}
else
{
dsInvitations.ReadXml(serverPath + "Invitations0.xml");
}
if (intCorpID != 157)
{
DataRow drow = dsInvitations.Tables[0].NewRow();
drow[0] = "Invite1.jpg";
drow[1] = "Wine";
dsInvitations.Tables[0].Rows.Add(drow);
}
if (intCorpID != 113 && intCorpID != 123 && intCorpID != 157)
{
DataRow drow = dsInvitations.Tables[0].NewRow();
drow[0] = "Invite2.jpg";
drow[1] = "Money";
dsInvitations.Tables[0].Rows.Add(drow);
}
dsInvitations.Tables[0].DefaultView.Sort = " InvitationName ASC"
;
return (dsInvitations.Tables[0]);
}
}
//Modified by Ezhil for without Fake emailaddress select on 31/03/2008 S
tart
public string sTakecount(string catid, int intAddressBook)
{
string query = "";
if (catid == "0")
{
// query = "select count(*) from [" + intAddressBook + "] where
id not in(select userid from tblusercategory where addressbook=" + intAddressBoo
k + " and categoryid in(select id from tblcategorylist where addressbook=" + int
AddressBook + " and categoryname in('opt-out','invalid emailaddress')))";
query = "select count(*) from [" + intAddressBook + " ] where em
ailaddress not like '%@noemailaddress.void%' and id not in(select userid from tb
lusercategory where addressbook=" + intAddressBook + " and categoryid in(select
id from tblcategorylist where addressbook=" + intAddressBook + " and categoryn
ame in('opt-out','invalid emailaddress')))and (active!=3.0)";
}
else
{
//query = "SELECT count(*) FROM [" + intAddressBook + "] WHERE I
D IN(SELECT userid FROM tblUserCategory WHERE AddressBook = " + intAddressBook +
" AND CategoryID in (" + catid + ") )";
query = "select count(*) from [" + intAddressBook + " ] where em
ailaddress not like '%@noemailaddress.void' and id in (select userid from tbluse
rcategory 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 where ad
dressbook=" + intAddressBook + " and categoryname in('Invalid Emailaddress','Op
t-Out'))))and (active!=3.0) or (active=2.0)";
}
return (dbOpr.executeScalarQuery(query));
}
public string sFuturesendcount(int intAddressBook, string isFirstTime, s
tring Batchid)
{
//Modified By Deena for Ticket Number 950: Auto Future Mail Number N
ot updating Start
string query = "";
//if (isFirstTime == "true")
//query = "select totalemailsqueued from tblhistorysummary where bat
chid='" + Batchid + "' ";
//else
// Ticket No:950 Auto Future Mail Number Not updating 29-05-08 - Sta
rt
//query = "select count(*) from [" + intAddressBook + "] emailaddres
s not like '%noemailaddress.void' and (active=1.0) or (active=2.0)";
query = "select count(*) from [" + intAddressBook + "] where emailad
dress not like '%noemailaddress.void' and (active=1.0) or (active=2.0)";
// End 29-05-08
return (dbOpr.executeScalarQuery(query));
//Modified By Deena for Ticket Number 950: Auto Future Mail Number N
ot updating End
}
//Modified by Ezhil for without Fake emailaddress select on 31/03/2008 E
nd
public DataTable dtGetLibertyNewsletter(int intCorpID, int addressBook)
{
//string strQuery = "execute sp_getNewslettersNew " + int.Parse(intC
orpID.ToString());
//string strQuery = "execute sp_getNewslettersNew1 " + int.Parse(int
CorpID.ToString());
string strSQL = "execute sp_getNewsletters " + intCorpID + "," + add
ressBook;
return (dbOpr.executeQueriesTable(strSQL));
}
//Modified by Gopi for displaying newsletter based on Agent Category on
05-05-2008 end
// for Story Board
public DataTable dtGetUserInfo(int intAddressBook)
{
//DataTable dat;
string strQuery = "SELECT addressBook,company,address1,address2,city
,state,zip,agentUrl,APHOTO_ENABLE,BLOGO_ENABLE,agentimage,complogoimage,isnull(d
isclaimer,'')as agentdisc FROM tblMembers WHERE AddressBook =" + intAddressBook
;
return (dbOpr.executeQueriesTable(strQuery));
}
#region for multipart mailing New functions
public string sSmtpSBText(int intCorpid, string strAddressBook, string E
mailAddress, string ModuleSent, string Industry, string Subject, string SBoardID
, string CategoryIDList, string header, string footer, string msgDisc, string Gu
id)
{ //
string strHTMLHeader, strHTMLFooter, comp_Text, strInd, strLink, str
UpperBoundary, strLowerBoundary;
string DiscText, strEmailBody, SMTPEmail, gblOptOutMsg, strOptout, H
TKP_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\nNOTE: \nIf you do not wish to receive e-mail fro
m us in the future,\nplease€visit:\n";
//Modified for Base64 by Deena 11.01.2008 Start
//strLink = "\nThis is not a download or an attachment.It is a safeg
uarded link.\nSimply Access the Following Link: \n" +
//"##DOMAIN_URL##/Gmailer/sb.aspx?d=#month-and-year#&amp;req=#SEND_I
D#\n";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strLink = "\nThis is not a download or an attachment.It is a safeg
uarded link.\nSimply Access the Following Link: \n" +
//"##DOMAIN_URL##/" + ModuleSent + "/?d=#month-and-year#&amp;r=#SEND
_ID#\n";
strLink = "\nThis is not a download or an attachment. It is a safegu
arded link. Simply Access the Following Link: \n" +
"##DOMAIN_URL##/" + ModuleSent + "/?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 + "\nIf you want more information on the above ebr
ief, just request the additional details at the end.";
strHTMLHeader = header;
strHTMLFooter = "\n" + footer;
strHTMLHeader = LinkUrls(strHTMLHeader.Replace("\r\n", "\n"));
strHTMLFooter = LinkUrls(strHTMLFooter.Replace("\r\n", "\n"));
msgDisc = LinkUrls(msgDisc.Replace("\r\n", "\n"));
strHTMLFooter = strHTMLFooter + sGetUserMailingAddress(strAddressBoo
k).Replace("<br>", "\n");
strInd = Industry;
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 =" + strAddr
essBook;
Aux1 = dbOpr.executeScalarQuery(strSQL);
if (msgDisc == "")
{
if (intCorpid == 157)
{
if (ModuleSent == "4")
{
DiscText = "AXA Advisors, LLC (NY, NY 212-314-4600), mem
ber FINRA, SPC. AXA Advisors, LLC is an Equal Opportunity and Affirmative Action
Employer M/F/D/V." +
"\n\n" + sGetDisclaimerText(SBoardID, Industry);
}
else
{
DiscText = sGetAXA_Disclaimer(strAddressBook) + "\n\n" +
sGetDisclaimerText(SBoardID, Industry);
}
}
else if (intCorpid == 127)
{
if (Aux1 == "1")
{
DiscText = "<br>" + HTKP_DISCLAIMER + "<br>" + sGetDiscl
aimerText(SBoardID, Industry);
}
else
{
DiscText = sGetDisclaimerText(SBoardID, Industry);
}
}
else
{
DiscText = sGetDisclaimerText(SBoardID, Industry);
}
if (DiscText != "")
{
if (intCorpid == 127)
{
if (Aux1 == "1")
{
if (msgDisc != "")
{
DiscText = "<br>" + msgDisc + "<br>" + DiscText;
}
}
else
{
DiscText = sGetDisclaimerText(SBoardID, Industry);
}
}
else if (intCorpid == 157)
{
if (ModuleSent == "4")
{
DiscText = "AXA Advisors, LLC (NY, NY 212-314-4600),
member FINRA, SPC. AXA Advisors, LLC is an Equal Opportunity and Affirmative Ac
tion Employer M/F/D/V." +
"\n\n" + sGetDisclaimerText(SBoardID, Industry);
}
else
{
DiscText = sGetAXA_Disclaimer(strAddressBook) + "\n\
n" + sGetDisclaimerText(SBoardID, Industry);
}
}
else
{
DiscText = sGetDisclaimerText(SBoardID, Industry);
}
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = "##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-y
ear#&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strOptout = "##DOMAIN_URL##/0/?d=#month-and-year#&amp;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);
if (DiscText.Contains(comp_Text))
{
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHea
der + "\n" + strLink + "\n" + "\n" + strHTMLFooter + "\n" + DiscText + "\n\n";
strEmailBody = strEmailBody.Replace(comp_Text, strOptout
);
}
else
{
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHea
der + "\n" + strLink + "\n" + "\n" + strHTMLFooter + "\n" + DiscText + "\n" + st
rOptout + "\n";
}
}
else
{
DiscText = "\n" + msgDisc + sGetDisclaimerText(SBoardID, Ind
ustry);
DiscText = InsertBreak(DiscText);
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/Gmailer/us.aspx
?d=#month-and-year#&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/0/?d=#month-and
-year#&amp;r=#SEND_ID#";
strOptout = gblOptOutMsg + "##DOMAIN_URL##/0/?d=#month-and-y
ear#&r=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Modified for Base64 by Deena 11.01.2008 End
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHeader
+ "\n" + "\n" + strLink + "\n\n" + strHTMLFooter + "\n" + DiscText + "\n" + strO
ptout + "\n";
}
}
else
{
if (intCorpid == 157)
{
if (ModuleSent == "4")
{
DiscText = "AXA Advisors, LLC (NY, NY 212-314-4600), mem
ber FINRA, SPC. AXA Advisors, LLC is an Equal Opportunity and Affirmative Action
Employer M/F/D/V." +
"\n\n" + sGetDisclaimerText(SBoardID, Industry);
}
else
{
DiscText = sGetAXA_Disclaimer(strAddressBook) + "\n\n" +
sGetDisclaimerText(SBoardID, Industry);
}
}
else if (intCorpid == 127)
{
if (Aux1 == "1")
{
DiscText = "<br>" + HTKP_DISCLAIMER + "<br>" + sGetDiscl
aimerText(SBoardID, Industry);
}
else
{
DiscText = sGetDisclaimerText(SBoardID, Industry);
}
}
else
{
DiscText = sGetDisclaimerText(SBoardID, Industry);
}
if (DiscText != "")
{
if (intCorpid == 127)
{
if (msgDisc != "")
{
DiscText = "\n" + msgDisc + "\n" + DiscText;
}
}
else if (intCorpid == 157)
{
if (ModuleSent == "4")
{
DiscText = "\n" + msgDisc + "\n\n" +
"AXA Advisors, LLC (NY, NY 212-314-4600), member
FINRA, SPC. AXA Advisors, LLC is an Equal Opportunity and Affirmative Action Em
ployer M/F/D/V." +
"\n\n" + sGetDisclaimerText(SBoardID, Industry);
}
else
{
DiscText = "\n" + msgDisc + "\n\n" + sGetAXA_Disclai
mer(strAddressBook) + "\n\n" + sGetDisclaimerText(SBoardID, Industry);
}
}
else
{
DiscText = "\n" + msgDisc + "\n\n" + sGetDisclaimerText(
SBoardID, Industry);
}
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = "##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-y
ear#&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strOptout = "##DOMAIN_URL##/0/?d=#month-and-year#&amp;r=#S
END_ID#";
strOptout = "##DOMAIN_URL##/0/?d=#month-and-year#&r=#SEND_ID
#";
//Modified by Deena 05.03.2008 Start

//Modified for Base64 by Deena 11.01.2008 End


DiscText = InsertBreak(DiscText);
if (DiscText.Contains(comp_Text))
{
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHea
der + "\n" + "\n" + strLink + "\n\n" + strHTMLFooter + "\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" + DiscText + "\n" +
strOptout + "\n";
}
}
else
{
DiscText = "\n" + msgDisc + "\n\n" + sGetDisclaimerText(SBoa
rdID, Industry);
DiscText = InsertBreak(DiscText);
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/Gmailer/us.aspx
?d=#month-and-year#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx?d=#month-
and-year#&amp;req=#SEND_ID#";
//Modified by Deena 06.02.2008 Start
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/0/?d=#month-and
-year#&amp;r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&amp;r=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/0/?d=#month-and
-year#&amp;r=#SEND_ID#";
strOptout = gblOptOutMsg + "##DOMAIN_URL##/0/?d=#month-and-y
ear#&r=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Modified by Deena 06.02.2008 End
//Modified for Base64 by Deena 11.01.2008 End
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHeader
+ "\n" + "\n" + strLink + "\n\n" + strHTMLFooter + "\n" + DiscText + "\n" + strO
ptout + "\n";
}
}
strEmailBody = strEmailBody.Replace("'", "''");
SMTPEmail = strUpperBoundary + strEmailBody + "#SendersCopy_List_Tex
t#" + strLowerBoundary;
SMTPEmail = SMTPEmail.Replace("<br>", "\n");
SMTPEmail = ReplaceBreak(SMTPEmail);
SMTPEmail = RemoveHTML(SMTPEmail);
return SMTPEmail;
}
public string sSmtpInvitationText(int intCorpID, string intAddressBook,
string msgContent, string msgClose, string msgDisc, string Guid)
{
string strHTMLHeader, strHTMLFooter, strLink, comp_Text, strUpperBou
ndary, strLowerBoundary;
string DiscText, strEmailBody, SMTPEmail, gblOptOutMsg, strOptout, H
TKP_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\nNOTE:\nIf you do not wish to receive e-mail from
us in the future,\nplease visit:\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");
//Modified for Base64 by Deena 11.01.2008 Start
//strLink = "This is not a download or an attachment.It is a safegua
rded link.\nSimply Access the Following Link: \n" +
//"##DOMAIN_URL##/Gmailer/iv.aspx?d=#month-and-year#&amp;req=#SEND_I
D#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links

//strLink = "This is not a download or an attachment.It is a safegua


rded link.\nSimply Access the Following Link: \n" +
//"##DOMAIN_URL##/5/?d=#month-and-year#&amp;r=#SEND_ID#\n";
strLink = "This is not a download or an attachment.It is a safeguard
ed link.\nSimply Access the Following Link: \n" +
"##DOMAIN_URL##/5/?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);
}
DiscText = InsertBreak(DiscText);
if (DiscText != "")
{
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = "##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-y
ear#&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strOptout = "##DOMAIN_URL##/0/?d=#month-and-year#&amp;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
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHeader
+ "\n" + "\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n\n</bo
dy></html>";
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
" + strOptout + "\n\n";
}
}
else
{
DiscText = msgDisc + " \n\n" + sGetGlobalDisclaimerText("ei_
disclaimer", intCorpID);
DiscText = InsertBreak(DiscText);
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/Gmailer/us.aspx
?d=#month-and-year#&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/0/?d=#month-and
-year#&amp;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
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHeader
+ "\n" + "\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n\n" +
strOptout + "\n\n";
}
}
else
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 != "")
{
DiscText = msgDisc + "\n\n" + DiscText;
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = "##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-year#
&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strOptout = "##DOMAIN_URL##/0/?d=#month-and-year#&amp;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
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" + strHTMLHeader
+ "\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" + strHTMLHeader
+ "\n" + "\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n\n" +
strOptout + "\n\n";
}
}
else
{
DiscText = msgDisc + "\n\n" + sGetGlobalDisclaimerText("ei_discl
aimer", intCorpID);
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/Gmailer/us.aspx?d=#
month-and-year#&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/0/?d=#month-and-yea
r#&amp;r=#SEND_ID#";
strOptout = gblOptOutMsg + "##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" + strO
ptout + "\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 sSmtpGenMailerText(int intCorpid, string strAddressBook, s
tring Subject, string header, string footer, string msgDisc, string strHypLink,
string sPAlbmLink, string gblECWebAddress, string Guid, string strAxaSeminarLink
)
{
string strHTMLHeader, strHTMLFooter, strLink, comp_Text, strUpperBou
ndary, strLowerBoundary; ;
string DiscText, strEmailBody, SMTPEmail, gblOptOutMsg, strOptout, H
TKP_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 f
rom us in the future,\nplease€visit:\n";
strHTMLHeader = header;
strHTMLFooter = footer;
strHTMLHeader = LinkUrls(strHTMLHeader.Replace("\r\n", "\n"));
strHTMLFooter = LinkUrls(strHTMLFooter.Replace("\r\n", "\n"));
msgDisc = LinkUrls(msgDisc.Replace("\r\n", "\n"));
strHTMLFooter = strHTMLFooter + sGetUserMailingAddress(strAddressBoo
k).Replace("<br>", "\n");
//for Link options
string strAlbumLink = sPAlbmLink;
strAlbumLink.Replace(" ", "%20");
// string strLink = sAddHypLink(strHypLink);
// modified by ratheesh on 01/10/2008 for tkt. 10835 start
/*
if (strHypLink != "")
{
if (strHypLink.Contains("https:"))
{
strHypLink = strHypLink.Replace("https://", "");
strLink = "Simply Access the Following Link: \nhttps://" + s
trHypLink + "";
}
else
{
strHypLink = strHypLink.Replace("http://", "");
strLink = "Simply Access the Following Link: \nhttp://" + st
rHypLink + "";
}
}
else
{
strLink = "";
}
*/
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 =" + strAddr
essBook;
Aux1 = dbOpr.executeScalarQuery(strSQL);
strLink = "";
if ((strAxaSeminarLink != "") && (intCorpid == 157))
{
strLink = strLink + "To access this important information:\n";
strLink = strLink + strAxaSeminarLink + "\n\n";
}
if (strHypLink != "")
{
strLink = strLink + "Simply Access the Following Link:\n";
strLink = strLink + "##DOMAIN_URL##/2/?d=#month-and-year#&r=#SEN
D_ID#";
}
// modified by ratheesh on 01/10/2008 for tkt. 1085 end
if (strAlbumLink != "")
{
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//string Link1 = "" + "##DOMAIN_URL##/photoalbum/album.aspx?ab="
+ strAddressBook + "&amp;id=" + strAlbumLink;
string Link1 = "" + "##DOMAIN_URL##/photoalbum/album.aspx?ab=" +
strAddressBook + "&id=" + strAlbumLink;
//Modified by Deena 05.03.2008 End
// Modified by Gopi for ticket 0000060: Plain text general email
with hyperlink added not displaying properly on 16-02-2008
if (strHypLink == "")
{
strLink = strLink + "\n" + "Simply access below the attached
photo album.\n " + Link1;
}
else
{
strLink = strLink + "\n\n" + "Simply access below the attach
ed photo album.\n " + Link1;
}
}
// strLink = sAttPhotoAlbm(sPAlbmLink, strHypLink, strAddressBook, g
blECWebAddress);
// Modified by Gopi for ticket 0000060: Plain text general email wit
h hyperlink added not displaying properly on 16-02-2008
if (strHypLink != "" || strAlbumLink != "")
{
strLink = strLink + "\n\nIf you want more information on the abo
ve ebrief,\njust request the additional details at the end.";
}
else
{
strLink = strLink + "\nIf you want more information on the above
ebrief,\njust request the additional details at the end.";
}
if (msgDisc == "")
{
if (intCorpid == 157)
{
DiscText = sGetAXA_Disclaimer(strAddressBook) + "\n\n" + sGe
tGlobalDisclaimerText("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 = "##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-
year#&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strOptout = "##DOMAIN_URL##/0/?d=#month-and-year#&amp;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);
if (DiscText.Contains(comp_Text))
{
if (strHypLink == "")
{
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTM
LHeader + "\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n \n";
strEmailBody = strEmailBody.Replace(comp_Text, strOp
tout);
}
else
{
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTM
LHeader + "\n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n \n
";
strEmailBody = strEmailBody.Replace(comp_Text, strOp
tout);
}
}
else
{
if (strHypLink == "")
{
strEmailBody = "Dear #USER_NAME_TEXT#,\n \n" + strHT
MLHeader + "\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n\n"
+ strOptout + "\n \n";
}
else
{
strEmailBody = "Dear #USER_NAME_TEXT#,\n \n" + strHT
MLHeader + "\n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n\n
" + strOptout + "\n \n";
}
}
}
else //if disclaimer text = null
{
DiscText = msgDisc + sGetGlobalDisclaimerText("wm_disclaimer
", intCorpid);
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/Gmailer/us.aspx
?d=#month-and-year#&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/0/?d=#month-and
-year#&amp;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);
if (strHypLink == "")
{
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHea
der + "\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n\n" + str
Optout + "\n \n";
}
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 = sGetAXA_Disclaimer(strAddressBook) + "\n\n" + sGe
tGlobalDisclaimerText("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 + "\n\n" + DiscText;

//Modified for Base64 by Deena 11.01.2008 Start


// strOptout = "##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-
year#&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strOptout = "##DOMAIN_URL##/0/?d=#month-and-year#&amp;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);
if (DiscText.Contains(comp_Text))
{
if (strHypLink == "")
{
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTM
LHeader + "\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n \n";
strEmailBody = strEmailBody.Replace(comp_Text, strOp
tout);
}
else
{
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTM
LHeader + "\n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n \n
";
strEmailBody = strEmailBody.Replace(comp_Text, strOp
tout);
}
}
else
{
if (strHypLink == "")
{
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTM
LHeader + "\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n\n" +
strOptout + "\n \n";
}
else
{
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTM
LHeader + "\n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n\n"
+ strOptout + "\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#&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/0/?d=#month-and
-year#&amp;r=#SEND_ID#";
strOptout = gblOptOutMsg + "##DOMAIN_URL##/0/?d=#month-and-y
ear#&r=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//Modified for Base64 by Deena 11.01.2008 End
DiscText = InsertBreak(DiscText);
if (strHypLink == "")
{
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHea
der + "\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n\n" + str
Optout + "\n \n";
}
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";
}
}
}
strEmailBody = strEmailBody.Replace("'", "''");
SMTPEmail = strUpperBoundary + strEmailBody + "#SendersCopy_List_Tex
t#" + strLowerBoundary;
SMTPEmail = SMTPEmail.Replace("<br>", "\n");
SMTPEmail = RemoveHTML(SMTPEmail);
return SMTPEmail;
}
public string sSmtpEcardText(int intCorpid, string strAddressBook, strin
g Subject, string header, string footer, string msgDisc, string gblECWebAddress,
string Guid)
{
string strHTMLHeader, strHTMLFooter, strLink, comp_Text;
string DiscText, strEmailBody, SMTPEmail, gblOptOutMsg, strOptout, s
trUpperBoundary, strLowerBoundary, HTKP_DISCLAIMER, strSQL, Aux1;
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 + "--";
gblOptOutMsg = "\n \n NOTE:\n If you do not wish to receive e-mail f
rom us in the future,\nplease€visit:\n";
strHTMLHeader = header;
strHTMLFooter = footer;
strHTMLHeader = LinkUrls(strHTMLHeader.Replace("\r\n", "\n"));
strHTMLFooter = LinkUrls(strHTMLFooter.Replace("\r\n", "\n"));
msgDisc = LinkUrls(msgDisc.Replace("\r\n", "\n"));
strHTMLFooter = strHTMLFooter + sGetUserMailingAddress(strAddressBoo
k).Replace("<br>", "\n");
//string query = "SELECT altlink_msg FROM tblDefaults";
//string sAltLinkText = dbOpr.executeScalarQuery(query);
//if (sAltLinkText != "")
//{
// strHTMLFooter = strHTMLFooter + sAltLinkText + "##DOMAIN_URL##
/Gmailer/cd.aspx?d=#month-and-year#&amp;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/cd.aspx?d=#month-and-y
ear#&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strLink = strLink + "##DOMAIN_URL##/3/?d=#month-and-year#&amp;r=#S
END_ID#\n";
strLink = strLink + "##DOMAIN_URL##/3/?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 =" + strAddr
essBook;
Aux1 = dbOpr.executeScalarQuery(strSQL);
if (msgDisc == "")
{
if (intCorpid == 157)
{
DiscText = sAxaNewDisc(strAddressBook) + "\n\n" + sGetGlobal
DisclaimerText("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 = "##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-
year#&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strOptout = "##DOMAIN_URL##/0/?d=#month-and-year#&amp;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 = header + " \n\n" + strLink + "\n\n" + footer;
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHeader
+ "\n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n\n" + strOp
tout + "\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";
}
}
//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#&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strOptout = "##DOMAIN_URL##/0/?d=#month-and-year#&amp;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#&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/0/?d=#month-and
-year#&amp;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#&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/0/?d=#month-and
-year#&amp;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#&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strLink = strLink + "##DOMAIN_URL##/6/?d=#month-and-year#&amp;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 &amp; from the out bound E-Mail Links
//strOptout = "##DOMAIN_URL##/0/?d=#month-and-year#&amp;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,\nplease€visit:\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#&amp;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#&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strLink = strLink + "##DOMAIN_URL##/7/?d=#month-and-year#&amp;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#&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strOptout = "##DOMAIN_URL##/0/?d=#month-and-year#&amp;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#&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strOptout = gblOptOutMsg + "##DOMAIN_URL##/0/?d=#month-and
-year#&amp;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
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 != "")
{
DiscText = msgDisc + "\n" + DiscText;
//Modified for Base64 by Deena 11.01.2008 Start
// strOptout = "##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-year
#&amp;req=#SEND_ID#";
//Modified by Deena 05.03.2008 Start
//Purpose: To Remove &amp; from the out bound E-Mail Links
//strOptout = "##DOMAIN_URL##/0/?d=#month-and-year#&amp;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
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" + strHTMLHeader
+ "\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" + strHTMLHeader
+ "\n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n\n" + strOp
tout + "\n\n";
}
}
else
{
DiscText = msgDisc + "\n" + sGetGlobalDisclaimerText("ei_disclai
mer", intCorpID);
strOptout = gblOptOutMsg;
DiscText = InsertBreak(DiscText);
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHeader + "\
n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\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;
}
//Modified by Jomy James on 28-Feb-2009 for ticket 443: 1285: NYL Checkl
ist Disclaimer wrong - URGENT Start
public string sSmtpChkListText(int intCorpid, string strAddressBook, str
ing Subject, string header, string footer, string msgDisc, string gblECWebAddres
s, string Guid)
{
string strHTMLHeader, strHTMLFooter, strLink, comp_Text, strUpperBou
ndary, strLowerBoundary;
string DiscText, SMTPEmail, strOptout, strEmailBody = "";
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";
strHTMLHeader = header;
strHTMLFooter = footer;
strHTMLHeader = LinkUrls(strHTMLHeader.Replace("\r\n", "\n"));
strHTMLFooter = LinkUrls(strHTMLFooter.Replace("\r\n", "\n"));
msgDisc = LinkUrls(msgDisc.Replace("\r\n", "\n"));
strHTMLFooter = strHTMLFooter + sGetUserMailingAddress(strAddressBoo
k).Replace("<br>", "\n");
strLink = "This is not a download or an attachment.It is a safeguard
ed link.\nSimply Access the Following Link: \n";
strLink = strLink + "##DOMAIN_URL##/8/?d=#month-and-year#&r=#SEND_ID
#\n";
strLink = strLink + "If you want more information on the above ebrie
f,\njust request the additional details at the end.";
string HTKP_DISCLAIMER = "Registered Representative of, and Securiti
es offered through\nHornor, Townsend & Kent, Inc. Member NASD/SIPC, a wholly own
ed\nsubsidiary of the Penn Mutual Life Insurance Company.\n600 Dresher Road, Hor
sham, PA 19044.";
string strSQL = "SELECT Aux1 FROM tblMembers WHERE addressBook =" +
strAddressBook;
string Aux1 = dbOpr.executeScalarQuery(strSQL);
strOptout = "##DOMAIN_URL##/0/?d=#month-and-year#&r=#SEND_ID#";
if (intCorpid == 157)
{
DiscText = "\n\n" + sGetGlobalDisclaimerText("ck_disclaimer", in
tCorpid) + "\n" + sGetAXA_Disclaimer(strAddressBook);
}
else
{
if (intCorpid == 127)
{
if (Aux1 == "1")
{
DiscText = "\n" + HTKP_DISCLAIMER + "\n" + sGetGlobalDis
claimerText("ck_disclaimer", intCorpid);
}
else
{
DiscText = sGetGlobalDisclaimerText("ck_disclaimer", int
Corpid);
}
}
else
{
DiscText = sGetGlobalDisclaimerText("ck_disclaimer", intCorp
id);
}
}
if (DiscText == "")
{
DiscText = "NOTE:\nIf you do not wish to receive e-mail from us
in the future,\nplease€visit:\n";
}
DiscText = LinkUrls(msgDisc) + "\n" + DiscText;
DiscText = InsertBreak(DiscText);
strEmailBody = "Dear #USER_NAME_TEXT#,\n\n" + strHTMLHeader + "\n\n"
+ strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\n" + "\n";
if (strEmailBody.IndexOf(comp_Text, 0, strEmailBody.Length - 1) > 0)
strEmailBody = strEmailBody.Replace(comp_Text, strOptout);
else
strEmailBody = "Dear " + "#USER_NAME_TEXT#" + ",\n\n" + strHTMLH
eader + "\n\n" + strLink + "\n\n" + strHTMLFooter + "\n\n" + DiscText + "\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;
}
//Modified by Jomy James on 28-Feb-2009 for ticket 443: 1285: NYL Checkl
ist Disclaimer wrong - URGENT End
public string RemoveHTML(string in_HTML)
{
return Regex.Replace(in_HTML, "<(.|\n)*?>", "");
}
public string ReplaceBreak(string sContent)
{
sContent = sContent.Replace("<br>", "\n");
sContent = sContent.Replace("<BR>", "\n");
sContent = sContent.Replace("<p>", "\n\n");
sContent = sContent.Replace("<P>", "\n\n");
return sContent;
}
#endregion
public string sQueue(int intCorpid, string strAddressBook, string EmailA
ddress, string ModuleSent, string Industry, string Subject, string SBoardID, str
ing CategoryIDList, string header, string footer, string msgDisc, string sSmtpEm
ailText, string Guid)
{
//
// TODO: Add constructor logic here
//
//System.Web.HttpContext.Current.Trace.Write(intCorpid + "," + strAd
dressBook + "," + EmailAddress + "," + ModuleSent + "," + Industry + "," + Subje
ct + "," + SBoardID + "," + CategoryIDList + "," + header + "," + footer);
// for multipart mailing
string sHTMLmastHead = "";
sHTMLmastHead = GetHTMLMastHead(strAddressBook, intCorpid);
string strHTMLHeader, strHTMLFooter, sAltLinkText, strLink, comp_Tex
t, strInd, strUpperHtmlBoundary, strLowerBoundary;
string DiscText, strEmailBody, SMTPEmail, gblOptOutMsg, strOptout, H
TKP_DISCLAIMER, strSQL, Aux1;
comp_Text = "$#Opt_Out_Link";
strUpperHtmlBoundary = "------=_NextPart_" + Guid + "\nContent-Type:
text/html;charset=iso-8859-1\nContent-Transfer-Encoding: 7bit\n\n";
strLowerBoundary = "\n------=_NextPart_" + Guid + "--";
//end
gblOptOutMsg = "<br><br><b>NOTE:</b><br>If you do not wish to receiv
e e-mail from us in the future, please€visit:<br>";
strHTMLHeader = header;
strHTMLFooter = footer;
strHTMLHeader = LinkUrls(strHTMLHeader.Replace("\r\n", "<br>"));
strHTMLFooter = LinkUrls(strHTMLFooter.Replace("\r\n", "<br>"));
msgDisc = LinkUrls(msgDisc.Replace("\r\n", "<br>"));
strHTMLFooter = strHTMLFooter + sGetUserMailingAddress(strAddressBoo
k);
//sAltLinkText = Trim(GetAltLinkText());
//Commented on 2008-01-07 for the Multipart email as requested by Ro
b by email
//sAltLinkText = "<br><br>If the link above does not open, try this
link - or copy and paste this link into your browser.<br>";
//strHTMLFooter = strHTMLFooter + sAltLinkText + "##DOMAIN_URL##/Gma
iler/sb.aspx?d=#month-and-year#&amp;req=#SEND_ID#";
//strHTMLFooter = strHTMLFooter;
//Modified for Base64 by Deena 11.01.2008 Start
//strLink = "This is not a download or an attachment. It is a safegu
arded link.<br>Simply " +
//"<a href=\"##DOMAIN_URL##/Gmailer/sb.aspx?d=#month-and-year#&amp;r
eq=#SEND_ID#\">Access-Here</a>";
strLink = "This is not a download or an attachment. It is a safeguar
ded link.<br>Simply " +
"<a href=\"##DOMAIN_URL##/" + ModuleSent + "/?d=#month-and-year#&amp
;r=#SEND_ID#\">Access-Here</a>";
//Modified for Base64 by Deena 11.01.2008 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 =" + strAddr
essBook;
Aux1 = dbOpr.executeScalarQuery(strSQL);
strInd = Industry;
if (msgDisc == "")
{
if (intCorpid == 157)
{
if (ModuleSent == "4")
{
DiscText = "AXA Advisors, LLC (NY, NY 212-314-4600), mem
ber FINRA, SPC. AXA Advisors, LLC is an Equal Opportunity and Affirmative Action
Employer M/F/D/V." +
"<br><br>" + sGetDisclaimerText(SBoardID, Industry);
}
else
{
DiscText = sGetAXA_Disclaimer(strAddressBook) + "<br><br
>" + sGetDisclaimerText(SBoardID, Industry);
}
}
else if (intCorpid == 127)
{
if (Aux1 == "1")
{
DiscText = "<br>" + HTKP_DISCLAIMER + "<br><br>" + sGetD
isclaimerText(SBoardID, Industry);
}
else
{
DiscText = sGetDisclaimerText(SBoardID, Industry);
}
}
else
{
DiscText = sGetDisclaimerText(SBoardID, Industry);
}
if (DiscText != "")
{
if (intCorpid == 127)
{
if (Aux1 == "1")
{
if (msgDisc != "")
{
DiscText = "<br>" + msgDisc + "<br>" + DiscText;
}
}
else
{
DiscText = sGetDisclaimerText(SBoardID, Industry);
}
}
else if (intCorpid == 157)
{
if (ModuleSent == "4")
{
DiscText = "AXA Advisors, LLC (NY, NY 212-314-4600),
member FINRA, SPC. AXA Advisors, LLC is an Equal Opportunity and Affirmative Ac
tion Employer M/F/D/V." +
"<br><br>" + sGetDisclaimerText(SBoardID, Indust
ry);
}
else
{
DiscText = sGetAXA_Disclaimer(strAddressBook) + "<br
><br>" + sGetDisclaimerText(SBoardID, Industry);
}
}
else
{
DiscText = sGetDisclaimerText(SBoardID, Industry);
}
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = "<a href=\"##DOMAIN_URL##/Gmailer/us.aspx?d=#m
onth-and-year#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-y
ear#&amp;req=#SEND_ID#</a>";
strOptout = "<br>" + "<a href=\"##DOMAIN_URL##/0/?d=#month-a
nd-year#&amp;r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&amp;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
{
DiscText = msgDisc + sGetDisclaimerText(SBoardID, Industry);
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/Gmail
er/us.aspx?d=#month-and-year#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx
?d=#month-and-year#&amp;req=#SEND_ID#</a>";
strOptout = gblOptOutMsg + "<br>" + "<a href=\"##DOMAIN_URL#
#/0/?d=#month-and-year#&amp;r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&a
mp;r=#SEND_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 (ModuleSent == "4")
{
DiscText = "AXA Advisors, LLC (NY, NY 212-314-4600), mem
ber FINRA, SPC. AXA Advisors, LLC is an Equal Opportunity and Affirmative Action
Employer M/F/D/V." +
"<br><br>" + sGetDisclaimerText(SBoardID, Industry);
}
else
{
DiscText = sGetAXA_Disclaimer(strAddressBook) + "<br><br
>" + sGetDisclaimerText(SBoardID, Industry);
}
}
else if (intCorpid == 127)
{
if (Aux1 == "1")
{
DiscText = "<br>" + HTKP_DISCLAIMER + "<br><br>" + sGetD
isclaimerText(SBoardID, Industry);
}
else
{
DiscText = sGetDisclaimerText(SBoardID, Industry);
}
}
else
{
DiscText = sGetDisclaimerText(SBoardID, Industry);
}
if (DiscText != "")
{
if (intCorpid == 127)
{
if (msgDisc != "")
{
DiscText = "<br>" + msgDisc + "<br>" + DiscText;
}
}
else if (intCorpid == 157)
{
if (ModuleSent == "4")
{
DiscText = msgDisc + "<br><br>" +
"AXA Advisors, LLC (NY, NY 212-314-4600), member
FINRA, SPC. AXA Advisors, LLC is an Equal Opportunity and Affirmative Action Em
ployer M/F/D/V." +
"<br><br>" + sGetDisclaimerText(SBoardID, Indust
ry);
}
else
{
DiscText = msgDisc + "<br><br>" + sGetAXA_Disclaimer
(strAddressBook) + "<br><br>" + sGetDisclaimerText(SBoardID, Industry);
}
}
else
{
DiscText = msgDisc + "<br><br>" + sGetDisclaimerText(SBo
ardID, Industry);
}
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = "<a href=\"##DOMAIN_URL##/Gmailer/us.aspx?d=#m
onth-and-year#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-y
ear#&amp;req=#SEND_ID#</a>";
strOptout = "<br>" + "<a href=\"##DOMAIN_URL##/0/?d=#month-a
nd-year#&amp;r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&amp;r=#SEND_ID#<
/a>";
//Modified for Base64 by Deena 11.01.2008 End
if (DiscText.Contains(comp_Text))
{
//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>";
//modified by ratheesh on 05/08/2008 for tkt 1063; remov
ed background-color: white; from the body cssclass
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
{
DiscText = msgDisc + "<br><br>" + sGetDisclaimerText(SBoardI
D, Industry);
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/Gmail
er/us.aspx?d=#month-and-year#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx
?d=#month-and-year#&amp;req=#SEND_ID#</a>";
strOptout = gblOptOutMsg + "<br>" + "<a href=\"##DOMAIN_URL#
#/0/?d=#month-and-year#&amp;r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&a
mp;r=#SEND_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>";
}
}
strEmailBody = strEmailBody.Replace("'", "''");
//for multipartmail
sSmtpEmailText = sSmtpEmailText.Replace(strLowerBoundary.TrimStart()
, strUpperHtmlBoundary);
SMTPEmail = sSmtpEmailText + "\n \n" + strEmailBody + "#SendersCopy_
List#" + "\n \n" + strLowerBoundary.TrimStart();
//End
return SMTPEmail;
}
public string sGetDisclaimerText(string sbID, string industry)
{
string sGetDisclaimerText = "";
string Sql, DiscID;
if ((sbID == "") || (industry == ""))
{
return sGetDisclaimerText;
}
else
{
Sql = "select ISNULL(DiscID,'') from tblConcepts where (Lower(co
nceptID) = '" + sbID + "') and (Lower(industry) = '" + industry + "')";
//Sql = "select DiscID from tblConcepts where (Lower(conceptID)
= '" + sbID + "') and (Lower(industry) = 'AXA')";
DiscID = dbOpr.executeScalarQuery(Sql);
//System.Web.HttpContext.Current.Trace.Write("GetDisclaimerText_
1 ===>" + Sql);
if (DiscID.Length > 0)
{
Sql = "select disc_text from tblDisc where disc_id = " + Dis
cID.ToString();
//System.Web.HttpContext.Current.Trace.Write("GetDisclaimerT
ext_2 ====>" + Sql);
sGetDisclaimerText = dbOpr.executeScalarQuery(Sql);
return sGetDisclaimerText;
}
else
{
return sGetDisclaimerText;
}
}
}
//Modified by Ezhil for 000677: 0001475: AXA - Disclaimer Changes on 11/
10/2009 Start
public string sGetAXA_Disclaimer(string strAddressBook)
{
string strSQLNew, DiscTextNew, strSQL;
strSQLNew = "select disc_Text from tblDisc where disc_Id='326'";
DataTable dt1 = new DataTable();
dt1 = dbOpr.executeQueriesTable(strSQLNew);
DiscTextNew = dt1.Rows[0]["disc_Text"].ToString();
strSQLNew = "select firstName,middleName,lastName,corp_id from tblMe
mbers where addressBook='" + strAddressBook + "' ";
DataTable dt2 = new DataTable();
dt2 = dbOpr.executeQueriesTable(strSQLNew);
DiscTextNew = DiscTextNew.Replace("$#Agent_Name", dt2.Rows[0]["first
Name"].ToString() + " " + dt2.Rows[0]["middleName"].ToString() + " " + dt2.Rows[
0]["lastName"].ToString());
/* hard coded categoryid for the RARegistration
* in local: 25
* in staging: 25
* in production: 5 */
int RACateID = 5;
strSQL = "select categoryid from tblagent_categories where addressbo
ok='" + strAddressBook + "' and categoryid=" + RACateID;
string strRARegistation = dbOpr.executeScalarQuery(strSQL);
if (strRARegistation != "")
DiscTextNew = DiscTextNew.Replace("$#RARegistation", "and invest
ment advisor representative ");
else
DiscTextNew = DiscTextNew.Replace("$#RARegistation", "");
strSQL = "select isnull(company,'1') as company from tblmembers wher
e emailaddress not like '%@axa-advisors.com' and addressbook='" + strAddressBook
+ "'";
string strDBACompany = dbOpr.executeScalarQuery(strSQL);
if (strDBACompany != "")
{
DiscTextNew = DiscTextNew.Replace("$#Ins_FullText", "is not a re
gistered investment advisor and is not owned or operated by AXA Advisors or AXA
Network.");
if (strDBACompany != "1")
DiscTextNew = DiscTextNew.Replace("$#Agent_Domain", "<br>" +
strDBACompany + "");
else
DiscTextNew = DiscTextNew.Replace("$#Agent_Domain", "");
/* hard coded categoryid for the category Wharton 7
* in local: 251, * in staging: 51,* in production: 23 */
/* hard coded categoryid for the category Wharton 6
* in local: 250, * in staging: 50,* in production: 22 */
/* hard coded categoryid for the category Wharton
* in local: 203, * in staging: 28,* in production: 8 */
string iWhartonId;
iWhartonId = "23,22,8";
string strSqlCate = "select categoryid from tblagent_categories
where categoryid in (" + iWhartonId + ") and addressbook=" + strAddressBook + ""
;
string strcatId = dbOpr.executeScalarQuery(strSqlCate);
if (strcatId == "")
{
DiscTextNew = DiscTextNew.Replace("$#DBA_Wharton", "");
}
else
{
DiscTextNew = DiscTextNew.Replace("$#DBA_Wharton", "Retireme
nt Planning Specialist title awarded by AXA Advisors, based upon receipt of a Ce
rtificate in Retirement Planning from the Wharton School of the University of Pe
nnsylvania.");
}
}
else
{
DiscTextNew = DiscTextNew.Replace("$#Ins_FullText", "");
DiscTextNew = DiscTextNew.Replace("$#DBA_Wharton", "");
DiscTextNew = DiscTextNew.Replace("$#Agent_Domain", "");
}
return (DiscTextNew);
}
//Modified by Ezhil for 000677: 0001475: AXA - Disclaimer Changes on 11/
10/2009 End
public string sGetUserMailingAddress(string AddressBook)
{
DataTable dat = new DataTable();
int intAddressbook = Convert.ToInt32(AddressBook);
dat = dtGetUserInfo(intAddressbook);
string UserInfo = "";
//Modified by Deena for Ticket Number 1058 Inclusion of Agent Photo/
Corp Logo on 01.09.2008 Start
string isAgentPhoto, isCorpLogo;
//Modified by Deena for Ticket Number 1058 Inclusion of Agent Photo/
Corp Logo on 01.09.2008 End
if (dat.Rows.Count > 0)
{
if (dat.Rows[0]["company"].ToString() != "")
{
UserInfo = "<br>" + dat.Rows[0]["company"].ToString();
}
if (dat.Rows[0]["address1"].ToString() != "")
{
UserInfo = UserInfo + "<br>" + dat.Rows[0]["address1"].ToStr
ing();
}
if (dat.Rows[0]["address2"].ToString() != "")
{
UserInfo = UserInfo + "<br>" + dat.Rows[0]["address2"].ToStr
ing();
}
//Modified by glastin 0001067: Add a new state to admin profile
start
UserInfo = UserInfo + "<br>";
if (dat.Rows[0]["city"].ToString().Trim() != "")
{
UserInfo = UserInfo + dat.Rows[0]["city"].ToString() + ", ";
}
if (dat.Rows[0]["state"].ToString() != "")
{
UserInfo = UserInfo + dat.Rows[0]["state"].ToString();
}
//Modified by glastin 0001067: Add a new state to admin profile
end
if (dat.Rows[0]["zip"].ToString() != "")
{
UserInfo = UserInfo + " " + dat.Rows[0]["zip"].ToString();
}
if (dat.Rows[0]["agentUrl"].ToString() != "")
{
//UserInfo = UserInfo + "<br>" + dat.Rows[0]["agentUrl"].ToS
tring();
UserInfo = UserInfo + "<br> <a href=" + dat.Rows[0]["agentUr
l"].ToString() + ">" + dat.Rows[0]["agentUrl"].ToString() + "</a>";
}
UserInfo = UserInfo + "<br>";
//Modified by Deena for Ticket Number 1058 Inclusion of Agent Ph
oto/Corp Logo on 01.09.2008 Start
isAgentPhoto = sGetAgentPhoto(intAddressbook);
if (isAgentPhoto == "1")
{
if (dat.Rows[0]["APHOTO_ENABLE"].ToString() == "True")
{
UserInfo = UserInfo + " <img src='http://www.e-relations
hip.com/erplus/Agent_photo/" + dat.Rows[0]["agentimage"].ToString() + ".jpg'>&nb
sp;&nbsp;&nbsp;";
}
}
isCorpLogo = sGetCorpLogo(intAddressbook);
if (isCorpLogo == "1")
{
if (dat.Rows[0]["BLOGO_ENABLE"].ToString() == "True")
{
UserInfo = UserInfo + " <img src='http://www.e-relations
hip.com/erplus/Company_Logo/" + dat.Rows[0]["complogoimage"].ToString() + ".jpg'
>";
}
}
UserInfo = UserInfo.Replace("'", "''");
//Modified by Deena for Ticket Number 1058 Inclusion of Agent Ph
oto/Corp Logo on 01.09.2008 End
}
return UserInfo;
}
//Modified by Deena for Ticket Number 1058 Inclusion of Agent Photo/Corp
Logo on 01.09.2008 Start
public string sGetAgentPhoto(int intAddressbook)
{
string isAgentPhoto = "0", Qry_Agentfeature = "select isnull(INT_APH
OTO,-1) as INT_APHOTO from tbluserfeatures where addressbook = " + intAddressboo
k;
DataTable dtAgent = new DataTable();
dtAgent = dbOpr.executeQueriesTable(Qry_Agentfeature);
if (dtAgent.Rows.Count > 0)
{
if (dtAgent.Rows[0]["INT_APHOTO"].ToString() == "-1")
{
string Qry_Corpfeature = "select INT_APHOTO from tblcorpfeat
ures where corp_id in (select corp_id FROM tblMembers WHERE AddressBook =" + in
tAddressbook + ")";
DataTable dtCorp = new DataTable();
dtCorp = dbOpr.executeQueriesTable(Qry_Corpfeature);
if (dtCorp.Rows.Count > 0)
{
if (dtCorp.Rows[0]["INT_APHOTO"].ToString() == "1")
{
isAgentPhoto = "1";
}
}
}
else if (dtAgent.Rows[0]["INT_APHOTO"].ToString() == "1")
{
isAgentPhoto = "1";
}
}
return (isAgentPhoto);
}
public string sGetCorpLogo(int intAddressbook)
{
string isCorpLogo = "0", Qry_Agentfeature = "select isnull(INT_BLOGO
,-1) as INT_BLOGO from tbluserfeatures where addressbook = " + intAddressbook;
DataTable dtAgent = new DataTable();
dtAgent = dbOpr.executeQueriesTable(Qry_Agentfeature);
if (dtAgent.Rows.Count > 0)
{
if (dtAgent.Rows[0]["INT_BLOGO"].ToString() == "-1")
{
string Qry_Corpfeature = "select INT_BLOGO from tblcorpfeatu
res where corp_id in (select corp_id FROM tblMembers WHERE AddressBook =" + int
Addressbook + ")";
DataTable dtCorp = new DataTable();
dtCorp = dbOpr.executeQueriesTable(Qry_Corpfeature);
if (dtCorp.Rows.Count > 0)
{
if (dtCorp.Rows[0]["INT_BLOGO"].ToString() == "1")
{
isCorpLogo = "1";
}
}
}
else if (dtAgent.Rows[0]["INT_BLOGO"].ToString() == "1")
{
isCorpLogo = "1";
}
}
return (isCorpLogo);
}
//Modified by Deena for Ticket Number 1058 Inclusion of Agent Photo/Corp
Logo on 01.09.2008 End
// For e-Invitation ---------------------------------------------------
----------------------------------------
public string sInvitationQueue(int intCorpID, string intAddressBook, str
ing msgContent, string msgClose, string msgDisc, string sSmtpEmailText, string G
uid)
{
// for multipart mailing
string sHTMLmastHead = "";
sHTMLmastHead = GetHTMLMastHead(intAddressBook, intCorpID);
string strHTMLHeader, strHTMLFooter, sAltLinkText, strLink, comp_Tex
t, strUpperHtmlBoundary, strLowerBoundary; ;
string DiscText, strEmailBody, SMTPEmail, gblOptOutMsg, strOptout, H
TKP_DISCLAIMER, strSQL, Aux1;
strUpperHtmlBoundary = "------=_NextPart_" + Guid + "\nContent-Type:
text/html;charset=iso-8859-1\nContent-Transfer-Encoding: 7bit\n\n";
strLowerBoundary = "\n------=_NextPart_" + Guid + "--";
//end
comp_Text = "$#Opt_Out_Link";
gblOptOutMsg = "<br><br><b>NOTE:</b><br>If you do not wish to receiv
e e-mail from us in the future, please€visit:<br>";
strHTMLHeader = msgContent;
strHTMLFooter = msgClose;
strHTMLHeader = LinkUrls(strHTMLHeader.Replace("\r\n", "<br>"));
strHTMLFooter = LinkUrls(strHTMLFooter.Replace("\r\n", "<br>"));
msgDisc = LinkUrls(msgDisc.Replace("\r\n", "<br>"));
strHTMLFooter = strHTMLFooter + sGetUserMailingAddress(intAddressBoo
k);
//sAltLinkText = Trim(GetAltLinkText());
//Commented on 2008-01-07 for the Multipart email as requested by Ro
b by email
//sAltLinkText = "<br><br>If the link above does not open, try this
link - or copy and paste this link into your browser.<br>";
//strHTMLFooter = strHTMLFooter + sAltLinkText + "##DOMAIN_URL##/Gma
iler/iv.aspx?d=#month-and-year#&amp;req=#SEND_ID#";
strHTMLFooter = strHTMLFooter;
//Modified for Base64 by Deena 11.01.2008 Start
//strLink = "This is not a download or an attachment. It is a safegu
arded link.<br>Simply " +
//"<a href=\"##DOMAIN_URL##/Gmailer/iv.aspx?d=#month-and-year#&amp;r
eq=#SEND_ID#\">Access-Here</a>";
strLink = "This is not a download or an attachment. It is a safeguar
ded link.<br>Simply " +
"<a href=\"##DOMAIN_URL##/5/?d=#month-and-year#&amp;r=#SEND_ID#\">Ac
cess-Here</a>";
//Modified for Base64 by Deena 11.01.2008 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) + "<br><br>" + 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 = "<a href=\"##DOMAIN_URL##/Gmailer/us.aspx?d=#m
onth-and-year#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-y
ear#&amp;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#&amp;r=#SEND_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></p></body></html>";
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
{
DiscText = msgDisc + " <br>" + sGetGlobalDisclaimerText("ei_
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#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx
?d=#month-and-year#&amp;req=#SEND_ID#</a>";
strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/0/?d=#m
onth-and-year#&amp;r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&amp;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
if (intCorpID == 157)
{
DiscText = sGetGlobalDisclaimerText("ei_disclaimer", intCorp
ID) + "<br><br>" + 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 != "")
{
DiscText = msgDisc + "<br>" + DiscText;
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = "<a href=\"##DOMAIN_URL##/Gmailer/us.aspx?d=#month
-and-year#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-year#
&amp;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#&amp;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 Tra
nsitional//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 backg
round-color: white; from the body cssclass
if (DiscText.Contains(comp_Text))
{ //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></p></body></html>";
strEmailBody = strEmailBody.Replace(comp_Text, strOptout);
}
else
{ //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></h
tml>";
}
}
else
{
DiscText = msgDisc + "<br>" + sGetGlobalDisclaimerText("ei_discl
aimer", intCorpID);
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/Gmailer/u
s.aspx?d=#month-and-year#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx?d=#
month-and-year#&amp;req=#SEND_ID#</a>";
strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/0/?d=#month
-and-year#&amp;r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&amp;r=#SEND_ID
#</a>";
//Modified for Base64 by Deena 11.01.2008 End
//modified by ratheesh on 05/08/2008 for tkt 1063; removed backg
round-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 Tra
nsitional//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
>";
}
//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 string sGetGlobalDisclaimerText(string discType, int intCorpID)
{
string retvalDisclaimerText = "";
if (discType == "")
{
return retvalDisclaimerText;
}
else
{
string Sql = "select " + discType + " from tblCorp where corp_id
=" + intCorpID;
string DiscID = dbOpr.executeScalarQuery(Sql);
if (DiscID.Length > 0)
{
Sql = "select disc_text from tblDisc where disc_id = " + Dis
cID.ToString();
retvalDisclaimerText = dbOpr.executeScalarQuery(Sql);
return retvalDisclaimerText;
}
else
{
return retvalDisclaimerText;
}
}
}
public DataTable dtPopulateMessageContent(int intAddressBook)
{
string query = "SELECT tblMembers.emailAddress, tblMembers.message,
tblMembers.messageClose,disclaimer FROM tblMembers WHERE (((tblMembers.addressbo
ok)=" + intAddressBook + "))";
return (dbOpr.executeQueriesTable(query));
}
public string sGenMailerQueue(int intCorpid, string strAddressBook, stri
ng Subject, string header, string footer, string msgDisc, string strHypLink, str
ing sPAlbmLink, string gblECWebAddress, string sSmtpEmailText, string Guid, stri
ng strAxaSeminarLink)
{
string sHTMLmastHead = "";
sHTMLmastHead = GetHTMLMastHead(strAddressBook, intCorpid);
string strHTMLHeader, strHTMLFooter, strLink, comp_Text;
// for multipart mailing
string DiscText, strEmailBody, SMTPEmail, gblOptOutMsg, strOptout, s
trUpperHtmlBoundary, strLowerBoundary, HTKP_DISCLAIMER, strSQL, Aux1;
strUpperHtmlBoundary = "------=_NextPart_" + Guid + "\nContent-Type:
text/html;charset=iso-8859-1\nContent-Transfer-Encoding: 7bit\n\n";
strLowerBoundary = "\n------=_NextPart_" + Guid + "--";
//end
comp_Text = "$#Opt_Out_Link";
gblOptOutMsg = "<br><br><b>NOTE:</b><br>If you do not wish to receiv
e e-mail from us in the future, please€visit:<br>";
strHTMLHeader = header;
strHTMLFooter = footer;
strHTMLHeader = LinkUrls(strHTMLHeader.Replace("\r\n", "<br>"));
strHTMLFooter = LinkUrls(strHTMLFooter.Replace("\r\n", "<br>"));
msgDisc = LinkUrls(msgDisc.Replace("\r\n", "<br>"));
strHTMLFooter = strHTMLFooter + sGetUserMailingAddress(strAddressBoo
k);
//for Link options
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 =" + strAddr
essBook;
Aux1 = dbOpr.executeScalarQuery(strSQL);
strLink = "";
if ((strAxaSeminarLink != "") && (intCorpid == 157))
{
strLink = "To access this important information<br><a href=" + s
trAxaSeminarLink + ">" + strAxaSeminarLink + "</a>";
}
strLink += sAttPhotoAlbm(sPAlbmLink, strHypLink, strAddressBook, gbl
ECWebAddress);

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#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-y
ear#&amp;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#&amp;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#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx
?d=#month-and-year#&amp;req=#SEND_ID#</a>";
strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/0/?d=#m
onth-and-year#&amp;r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&amp;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;

//Modified for Base64 by Deena 11.01.2008 Start


//strOptout = "<a href=\"##DOMAIN_URL##/Gmailer/us.aspx?d=#m
onth-and-year#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-y
ear#&amp;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#&amp;r=#SEND_ID#</a>";
//Modified for Base64 by Deena 11.01.2008 End
if (DiscText.Contains(comp_Text))
{
//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>";
//modified by ratheesh on 05/08/2008 for tkt 1063; remov
ed background-color: white; from the body cssclass
strEmailBody = strEmailBody.Replace(comp_Text, strOptout
);
}
else
{
//there is a linkurl there please check
//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>";
} //modified by ratheesh on 05/08/2008 for tkt 1063; remov
ed background-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#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx
?d=#month-and-year#&amp;req=#SEND_ID#</a>";
strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/0/?d=#m
onth-and-year#&amp;r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&amp;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
}
strEmailBody = strEmailBody.Replace("'", "''");
//for multipartmail
sSmtpEmailText = sSmtpEmailText.Replace(strLowerBoundary.TrimStart()
, strUpperHtmlBoundary);
SMTPEmail = sSmtpEmailText + "\n \n" + strEmailBody + "#SendersCopy_
List#" + "\n \n" + strLowerBoundary.TrimStart();
//End
return SMTPEmail;
}
public string sAddHypLink(string strHypLink)
{
if (strHypLink != "")
{
if (strHypLink.Contains("https:"))
{
strHypLink = strHypLink.Replace("https://", "");
strHypLink = "<br><br><A href='https://" + strHypLink + "'ta
rget=_blank >Click Here</a><br><br>";
}
else
{
strHypLink = strHypLink.Replace("http://", "");
strHypLink = "<br><br><A href='http://" + strHypLink + "'tar
get=_blank >Click Here</a><br><br>";
}
return (strHypLink);
}
else
{
return (strHypLink = " ");
}
}
public string sAttPhotoAlbm(string sPAlbmLink, string strHypLink, string
intaddBook, string gblECWebAddress)
{
string strLink = "";
string strAlbumLink = sPAlbmLink;
strAlbumLink.Replace(" ", "%20");
// modified by ratheesh on 01/10/2008 for tkt. 1085
//string strLink = sAddHypLink(strHypLink);
if (strHypLink != "")
{
strLink = "<a href=\"##DOMAIN_URL##/2/?d=#month-and-year#&amp;r=
#SEND_ID#\">Click Here</a><br>";
}
if (strAlbumLink != "")
{
string Link1 = "" + "##DOMAIN_URL##/photoalbum/album.aspx?ab=" +
intaddBook + "&amp;id=" + strAlbumLink;
if (strHypLink == "")
{
strLink = strLink + "Simply <A href=" + " " + Link1 + " targ
et='_blank'>Click-Here</A> to access the attached photo album.";
}
else
{
strLink = strLink + "<br>Simply <A href=" + " " + Link1 + "
target='_blank'>Click-Here</A> to access the attached photo album.";
}
}
return (strLink);
}
//Modified for admin module
public DataTable dtGetFinacialArticlePDF(int intAddressBook, int intCorp
ID)
{
// Modified for Admin Module Expiry Date on 16.10.2007 Start
string strSQL;
//Modified by Deena for content by category 06.05.2008 Start
/*if (intCorpID == 0)
{
//strSQL = "SELECT pdf_title as NewsletterName,pdf_url as Newsle
tterId FROM tblCorpNewsletters WHERE corp_ID=" + intCorpID + " OR corp_ID IS NUL
L and active=1 order by pdf_title";
strSQL = "select pdf_title as NewsletterName, isnull(pdf_url,url
) as NewsletterId from tblCorpNewsletters WHERE (corp_ID= " + intCorpID + " OR c
orp_ID IS NULL) and active=1 and ((datediff(day,expdate, getdate())<=0)or(isnull
((convert(char(26),expdate,101)),'0')='0')) order by pdf_title";
}
if (intCorpID == 157)
{
strSQL = "select pdf_title as NewsletterName, isnull(pdf_url,url
) as NewsletterId from tblcorp_categories " +
"inner join tblCorpNewsletters on tblCorpNewsletters.cat
egoryid=tblcorp_categories.categoryid and " +
"((datediff(day,expdate, getdate())<=0)or(isnull((conver
t(char(26),expdate,101)),'0')='0')) and active=1" +
"where tblcorp_categories.corp_id=157 ";
}
else
{
//strSQL = "SELECT pdf_title as NewsletterName,pdf_url as Newsle
tterId FROM tblCorpNewsletters WHERE corp_ID=" + intCorpID + " and active=1 ord
er by pdf_title";
strSQL = "select pdf_title as NewsletterName, isnull(pdf_url,url
) as NewsletterId from tblCorpNewsletters WHERE corp_ID= " + intCorpID + " and a
ctive=1 and ((datediff(day,expdate, getdate())<=0)or(isnull((convert(char(26),ex
pdate,101)),'0')='0')) order by pdf_title";
}*/
//Modified by Deena for content by category Ticket Number 120 in BT
19.05.2008 Start
strSQL = "select pdf_title as NewsletterName,isnull(pdf_url,url) as
NewsletterId from tblCorpNewsletters where corp_id = " + intCorpID +
"and (CategoryID in (select categoryid from tblagent_catego
ries where categoryid in(select categoryid from " +
"tblcorp_categories where corp_id = " + intCorpID + ") and
addressbook =" + intAddressBook + ") or CategoryID is null or CategoryID =0) and
" +
"((datediff(day,expdate, getdate())<=0)or(isnull((convert(c
har(26),expdate,101)),'0')='0')) and active = 1 order by pdf_title Asc"; // Tick
et No:1120 Note No:2628 - Added the order by condition

//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
return (dbOpr.executeQueriesTable(strSQL));
// Modified for Admin Module Expiry Date on 16.10.2007 End
}
//public DataTable dtGetFinacialArticlePDF(int intCorpID)
//{
// string strSQL;
// if (intCorpID == 0)
// {
// strSQL = "SELECT pdf_title as NewsletterName,pdf_url as Newsle
tterId FROM tblCorpNewsletters WHERE corp_ID=" + intCorpID + " OR corp_ID IS NUL
L and active=1 order by pdf_title";
// }
// else
// {
// strSQL = "SELECT pdf_title as NewsletterName,pdf_url as Newsle
tterId FROM tblCorpNewsletters WHERE corp_ID=" + intCorpID + " and active=1 ord
er by pdf_title";
// }
// return (dbOpr.executeQueriesTable(strSQL));
//}
//Modified by Ezhil for ticket no 1324 Expdate validation on 18/04/2009
Start
//Added by Rajmohan for Ticket Number 374 on 31.12.2008 Start
public DataTable dtGetAgentFinacialArticlePDF(int intAddressBook, int in
tCorpID)
{
string strSQL;
strSQL = "select * from (select pdf_title as NewsletterName,isnull(p
df_url,url) as NewsletterId from tblCorpNewsletters where corp_id = " + intCorpI
D +
" and (CategoryID in (select categoryid from tblagent_categ
ories where categoryid in(select categoryid from " +
"tblcorp_categories where corp_id = " + intCorpID + ") and
addressbook =" + intAddressBook + ") or CategoryID is null or CategoryID =0) and
" +
"((datediff(day,expdate, getdate())< 0)or(isnull((convert(c
har(26),expdate,101)),'0')='0')) and active = 1 "
+ "UNION" +
" select pdf_title as NewsletterName,isnull(pdf_url,url) as
NewsletterId from tblAgentNewsletters where corp_id = " + intCorpID +
" and addressbook =" + intAddressBook + " and " +
"((datediff(day,expdate, getdate())<= 0)or(isnull((convert(
char(26),expdate,101)),'0')='0')) and active = 1)a order by NewsletterName Asc";
return (dbOpr.executeQueriesTable(strSQL));
}
//Added by Rajmohan for Ticket Number 374 on 31.12.2008 End
//Added by rajmohan for 1238: PDF upload in e-Financial Article module o
n 6/01/09 start.
//Modified by Ezhil for ticket no 1324 Expdate validation on 18/04/2009
End
public DataTable dtGetAgentFinacialArticlePDFTitle(int intAddressBook)
{
string strSQL;
strSQL = "select pdf_title as NewsletterName,isnull(pdf_url,url) as
NewsletterId from tblAgentNewsletters where addressbook=" + intAddressBook;
//" and convert(varchar,CreatedDate,101)=convert(varchar,getdate(),1
01)";
return (dbOpr.executeQueriesTable(strSQL));
}
public DataTable dtGetAgentFinacialArticlePDFValid(string pdf_title, int
intAddressBook, int intCorpID)
{
string strSQL;
strSQL = "select pdf_title from tblAgentNewsletters where pdf_title=
'" + pdf_title + "' and addressbook=" + intAddressBook + " UNION select pdf_titl
e from tblCorpNewsletters where pdf_title='" + pdf_title + "' and corp_id=" + in
tCorpID + "";
return (dbOpr.executeQueriesTable(strSQL));
}
//Added by rajmohan for 1238: PDF upload in e-Financial Article module o
n 6/01/09 End.
//Added by rajmohan for 1238: PDF upload in e-Financial Article module o
n 7/01/09 start.
public int iInsert_Newsletter(string Corp_ID, int AddressBook, string GU
ID, string newsletterName, string Expdate, string SMARNum)
{
string SQL = "";
if (Expdate != "null")
{
SQL = "insert into tblAgentNewsletters(corp_ID,pdf_title,pdf_des
c,pdf_url,from_date,active,AddressBook,CreatedDate,Expdate,SMAR_No)values(" + Co
rp_ID + ",'" + newsletterName.Trim() + "','" + newsletterName.Trim() + "','" + G
UID + "',getdate(),1," + AddressBook + ",getdate(),'" + Expdate.Trim() + "', '"
+ SMARNum.Trim() + "')";
}
else
{
SQL = "insert into tblAgentNewsletters(corp_ID,pdf_title,pdf_des
c,pdf_url,from_date,active,AddressBook,CreatedDate,SMAR_No)values(" + Corp_ID +
",'" + newsletterName.Trim() + "','" + newsletterName.Trim() + "','" + GUID + "'
,getdate(),1," + AddressBook + ",getdate(),'" + SMARNum.Trim() + "')";
}
return dbOpr.executenonQuery(SQL);
}
//Added by rajmohan for 1238: PDF upload in e-Financial Article module o
n 7/01/09 End.
public string sEcardQueue(int intCorpid, string strAddressBook, string S
ubject, string header, string footer, string msgDisc, string gblECWebAddress, st
ring sSmtpEmailText, string Guid)
{
// for multipart mailing
string sHTMLmastHead = "";
sHTMLmastHead = GetHTMLMastHead(strAddressBook, intCorpid);
string strHTMLHeader, strHTMLFooter, strLink, comp_Text;
string DiscText, strEmailBody, SMTPEmail, gblOptOutMsg, strOptout, s
trUpperHtmlBoundary, strLowerBoundary, HTKP_DISCLAIMER, strSQL, Aux1;
strUpperHtmlBoundary = "------=_NextPart_" + Guid + "\nContent-Type:
text/html;charset=iso-8859-1\nContent-Transfer-Encoding: 7bit\n\n";
strLowerBoundary = "\n------=_NextPart_" + Guid + "--";
//end
comp_Text = "$#Opt_Out_Link";
gblOptOutMsg = "<br><br><b>NOTE:</b><br>If you do not wish to receiv
e e-mail from us in the future, please€visit:<br>";
strHTMLHeader = header;
strHTMLFooter = footer;
strHTMLHeader = LinkUrls(strHTMLHeader.Replace("\r\n", "<br>"));
strHTMLFooter = LinkUrls(strHTMLFooter.Replace("\r\n", "<br>"));
msgDisc = LinkUrls(msgDisc.Replace("\r\n", "<br>"));
strHTMLFooter = strHTMLFooter + sGetUserMailingAddress(strAddressBoo
k);
//Commented on 2008-01-07 for the Multipart email as requested by Ro
b by email
//string query = "SELECT altlink_msg FROM tblDefaults";
//string sAltLinkText = dbOpr.executeScalarQuery(query);
//if (sAltLinkText != "")
//{
// strHTMLFooter = strHTMLFooter + sAltLinkText + "##DOMAIN_URL##
/Gmailer/cd.aspx?d=#month-and-year#&amp;req=#SEND_ID#";
//}
strLink = "This is not a download or an attachment. It is a safegua
rded link.<br/> Simply ";
//Modified for Base64 by Deena 11.01.2008 Start
//strLink = strLink + "<a target='_blank' href=\"##DOMAIN_URL##/Gmai
ler/cd.aspx?d=#month-and-year#&amp;req=#SEND_ID#\">Access-Here</a>.";
strLink = strLink + "<a target='_blank' href=\"##DOMAIN_URL##/3/?d=#
month-and-year#&amp;r=#SEND_ID#\">Access-Here</a>.";
//Modified for Base64 by Deena 11.01.2008 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 =" + strAddr
essBook;
Aux1 = dbOpr.executeScalarQuery(strSQL);

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#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-y
ear#&amp;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#&amp;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#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx
?d=#month-and-year#&amp;req=#SEND_ID#</a>";
strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/0/?d=#m
onth-and-year#&amp;r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&amp;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#&amp;req=#SEND_ID#\"></a>";
strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/0/?d=#m
onth-and-year#&amp;r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&amp;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#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-y
ear#&amp;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#&amp;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#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx
?d=#month-and-year#&amp;req=#SEND_ID#</a>";
strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/0/?d=#m
onth-and-year#&amp;r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&amp;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#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx
?d=#month-and-year#&amp;req=#SEND_ID#</a>";
strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/0/?d=#m
onth-and-year#&amp;r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&amp;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));
}

public string sGetChecklistDisclaimer(int intChecklistId)


{
string strSQL = "select disclaimer from tblchecklist where checklist
ID=" + intChecklistId + "";
return (dbOpr.executeScalarQuery(strSQL));
}
/* Modified for admin module checklist End*/
public DataTable dtGetCheckPreview(int intChecklistId)
{
string strSQL = "select questID,question,answercount,required,textpr
ompt,displaytext from checklistQuestions where checklistid=" + intChecklistId +
" order by questionnumber";
return (dbOpr.executeQueriesTable(strSQL));
}
public string sAnnouncementQueue(int intCorpID, string intAddressBook, s
tring msgContent, string msgClose, string msgDisc, string sSmtpEmailText, string
Guid)
{
// for multipart mailing
string sHTMLmastHead = "";
sHTMLmastHead = GetHTMLMastHead(intAddressBook, intCorpID);
string strHTMLHeader, strHTMLFooter, sAltLinkText, strLink, comp_Tex
t, strUpperHtmlBoundary, strLowerBoundary, HTKP_DISCLAIMER, strSQL, Aux1;
string DiscText, strEmailBody, SMTPEmail, gblOptOutMsg, strOptout;
strUpperHtmlBoundary = "------=_NextPart_" + Guid + "\nContent-Type:
text/html;charset=iso-8859-1\nContent-Transfer-Encoding: 7bit\n\n";
strLowerBoundary = "\n------=_NextPart_" + Guid + "--";
//end
comp_Text = "$#Opt_Out_Link";
gblOptOutMsg = "<br><br><b>NOTE:</b><br>If you do not wish to receiv
e e-mail from us in the future, please€visit:<br>";
strHTMLHeader = msgContent;
strHTMLFooter = msgClose;
strHTMLHeader = LinkUrls(strHTMLHeader.Replace("\r\n", "<br>"));
strHTMLFooter = LinkUrls(strHTMLFooter.Replace("\r\n", "<br>"));
msgDisc = LinkUrls(msgDisc.Replace("\r\n", "<br>"));
strHTMLFooter = strHTMLFooter + sGetUserMailingAddress(intAddressBoo
k);
//sAltLinkText = Trim(GetAltLinkText());
//Commented on 2008-01-07 for the Multipart email as requested by Ro
b by email
//sAltLinkText = "<br><br>If the link above does not open, try this
link - or copy and paste this link into your browser.<br>";
//strHTMLFooter = strHTMLFooter + sAltLinkText + "##DOMAIN_URL##/Gma
iler/an.aspx?d=#month-and-year#&amp;req=#SEND_ID#";
strHTMLFooter = strHTMLFooter;
strLink = "This is not a download or an attachment. It is a safeguar
ded link.<br>Simply " +
//Modified for Base64 by Deena 11.01.2008 Start
//"<a href=\"##DOMAIN_URL##/Gmailer/an.aspx?d=#month-and-year#&a
mp;req=#SEND_ID#\">Access-Here</a>";
"<a href=\"##DOMAIN_URL##/7/?d=#month-and-year#&amp;r=#SEND_ID#\">Ac
cess-Here</a>";
//Modified for Base64 by Deena 11.01.2008 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) + "<br><br>" + 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 = "<a href=\"##DOMAIN_URL##/Gmailer/us.aspx?d=#m
onth-and-year#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-y
ear#&amp;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#&amp;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))
{ //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
{
DiscText = msgDisc + " <br>" + sGetGlobalDisclaimerText("ei_
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#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx
?d=#month-and-year#&amp;req=#SEND_ID#</a>";
strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/0/?d=#m
onth-and-year#&amp;r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&amp;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 = sGetGlobalDisclaimerText("ei_disclaimer", intCorp
ID) + "<br><br>" + 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 != "")
{
DiscText = msgDisc + "<br>" + DiscText;
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = "<a href=\"##DOMAIN_URL##/Gmailer/us.aspx?d=#month
-and-year#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-year#
&amp;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#&amp;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 Tra
nsitional//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 backg
round-color: white; from the body cssclass
if (DiscText.Contains(comp_Text))
{ //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></p></body></html>";
strEmailBody = strEmailBody.Replace(comp_Text, strOptout);
}
else
{ //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></h
tml>";
}
}
else
{
DiscText = msgDisc + "<br>" + sGetGlobalDisclaimerText("ei_discl
aimer", intCorpID);
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/Gmailer/u
s.aspx?d=#month-and-year#&amp;req=#SEND_ID#\">##DOMAIN_URL##/Gmailer/us.aspx?d=#
month-and-year#&amp;req=#SEND_ID#</a>";
strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/0/?d=#month
-and-year#&amp;r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&amp;r=#SEND_ID
#</a>";
//modified by ratheesh on 05/08/2008 for tkt 1063; removed backg
round-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 Tra
nsitional//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
>";
}
strEmailBody = strEmailBody.Replace("'", "''");
//for multipartmail
sSmtpEmailText = sSmtpEmailText.Replace(strLowerBoundary.TrimStart()
, strUpperHtmlBoundary);
SMTPEmail = sSmtpEmailText + "\n \n" + strEmailBody + "#SendersCopy_
List#" + "\n \n" + strLowerBoundary.TrimStart();
//End
return SMTPEmail;
}
//Modified by Jomy James on 28-Feb-2009 for ticket 443: 1285: NYL Checkl
ist Disclaimer wrong - URGENT Start
public string sChkListQueue(int intCorpid, string strAddressBook, string
Subject, string header, string footer, string msgDisc, string gblECWebAddress,
string sSmtpEmailText, string Guid)
{
string sHTMLmastHead = "";
sHTMLmastHead = GetHTMLMastHead(strAddressBook, intCorpid);
string strHTMLHeader, strHTMLFooter, strLink, comp_Text, strUpperHtm
lBoundary, strLowerBoundary;
string DiscText, SMTPEmail, strOptout, strEmailBody = "";
strUpperHtmlBoundary = "------=_NextPart_" + Guid + "\nContent-Type:
text/html;charset=iso-8859-1\nContent-Transfer-Encoding: 7bit\n\n";
strLowerBoundary = "\n------=_NextPart_" + Guid + "--";
comp_Text = "$#Opt_Out_Link";
strHTMLHeader = header;
strHTMLFooter = footer;
strHTMLHeader = LinkUrls(strHTMLHeader.Replace("\r\n", "<br>"));
strHTMLFooter = LinkUrls(strHTMLFooter.Replace("\r\n", "<br>"));
msgDisc = LinkUrls(msgDisc.Replace("\r\n", "<br>"));
strHTMLFooter = strHTMLFooter + sGetUserMailingAddress(strAddressBoo
k);
strLink = "This is not a download or an attachment. It is a safegua
rded link.<br/> Simply ";
strLink = strLink + "<A href=\"##DOMAIN_URL##/8/?d=#month-and-year#&
amp;r=#SEND_ID#\">Access-Here</A>.";
string HTKP_DISCLAIMER = "Registered Representative of, and Securiti
es 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.";
string strSQL = "SELECT Aux1 FROM tblMembers WHERE addressBook =" +
strAddressBook;
string Aux1 = dbOpr.executeScalarQuery(strSQL);
strOptout = "<A href=\"##DOMAIN_URL##/0/?d=#month-and-year#&amp;r=#S
END_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&amp;r=#SEND_ID#</A>";
if (intCorpid == 157)
{
DiscText = "<br><br>" + sGetGlobalDisclaimerText("ck_disclaimer"
, intCorpid) + "<br/><br/>" + sGetAXA_Disclaimer(strAddressBook);
}
else
{
if (intCorpid == 127)
{
if (Aux1 == "1")
{
DiscText = "<br>" + HTKP_DISCLAIMER + "<br>" + sGetGloba
lDisclaimerText("ck_disclaimer", intCorpid);
}
else
{
DiscText = "<br>" + sGetGlobalDisclaimerText("ck_disclai
mer", intCorpid);
}
}
else
{
DiscText = "<br>" + sGetGlobalDisclaimerText("ck_disclaimer"
, intCorpid);
}
}
if (DiscText == "")
{
DiscText = "<br><br><b>NOTE:</b><br>If you do not wish to receiv
e e-mail from us in the future, please€visit:<br>";
}
DiscText = LinkUrls(msgDisc) + "<br>" + DiscText;
strEmailBody = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transit
ional//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>
";
if (strEmailBody.IndexOf(comp_Text, 0, strEmailBody.Length - 1) > 0)
strEmailBody = strEmailBody.Replace(comp_Text, strOptout);
else
strEmailBody = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Tra
nsitional//EN\" ><html><head><title></title> </head><body >" + sHTMLmastHead + "
<p>" + "Dear " + "#USER_NAME#" + ",<br><br>" + strHTMLHeader + "</p><p>" + strLi
nk + "</p><p>" + strHTMLFooter + "</p><p>" + DiscText + "<br>" + strOptout + "</
p></body></html>";
strEmailBody = strEmailBody.Replace("\n", "<br>");
strEmailBody = strEmailBody.Replace("'", "''");
sSmtpEmailText = sSmtpEmailText.Replace(strLowerBoundary.TrimStart()
, strUpperHtmlBoundary);
SMTPEmail = sSmtpEmailText + "\n \n" + strEmailBody + "#SendersCopy_
List#" + "\n \n" + strLowerBoundary.TrimStart();
return SMTPEmail;
}
//Modified by Jomy James on 28-Feb-2009 for ticket 443: 1285: NYL Checkl
ist Disclaimer wrong - URGENT End
public string sLibertyQueue(int intCorpID, string intAddressBook, string
msgContent, string msgClose, string msgDisc, string sSmtpEmailText, string Guid
, string strModuleid)
{
// for multipart mailing
string sHTMLmastHead = "";
sHTMLmastHead = GetHTMLMastHead(intAddressBook, intCorpID);
string strHTMLHeader, strHTMLFooter, SMTPEmail, strUpperHtmlBoundary
, strLowerBoundary, HTKP_DISCLAIMER, strSQL, Aux1, msgDisc_HTK = "";
strUpperHtmlBoundary = "------=_NextPart_" + Guid + "\nContent-Type:
text/html;charset=iso-8859-1\nContent-Transfer-Encoding: 7bit\n\n";
strLowerBoundary = "\n------=_NextPart_" + Guid + "--";
//end
string sAltLinkText, comp_Text, strLink, strOptout, strEmailBody;
comp_Text = "$#Opt_Out_Link";
strHTMLHeader = LinkUrls(msgContent.Replace("\r\n", "<br>"));
strHTMLFooter = LinkUrls(msgClose.Replace("\r\n", "<br>"));
strHTMLFooter = strHTMLFooter + sGetUserMailingAddress(intAddressBoo
k) + "<br>#SMAR#";
msgDisc = LinkUrls(msgDisc.Replace("\r\n", "<br>"));
//Commented on 2008-01-07 for the Multipart email as requested by Ro
b by email
//sAltLinkText = getAltLinkText();
//if (sAltLinkText.Trim() != "")
//{
// strHTMLFooter = strHTMLFooter + sAltLinkText + "##DOMAIN_URL##
/Gmailer/lb.aspx?d=#month-and-year#&amp;req=#SEND_ID#";
//}
strLink = "This is not a download or an attachment. It is a safegua
rded link.<br>Simply ";
//Modified for Base64 by Deena 11.01.2008 Start
//strLink = strLink + "<a href=\"##DOMAIN_URL##/Gmailer/lb.aspx?d=#m
onth-and-year#&amp;req=" + "#SEND_ID#\" >Access-Here</a>.";
strLink = strLink + "<a href=\"##DOMAIN_URL##/" + strModuleid + "/?d
=#month-and-year#&amp;r=" + "#SEND_ID#\" >Access-Here</a>.";
//Modified for Base64 by Deena 11.01.2008 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 + "<br>" + sGetGlobalDisclaimerText("en_discla
imer", intCorpID);
}
if (intCorpID == 157)
{
msgDisc = msgDisc + "<br>" + sGetAXA_Disclaimer(intAddressBook);
}
if (intCorpID == 127)
{
if (Aux1 == "1")
{
msgDisc = msgDisc_HTK + "<br><br>" + HTKP_DISCLAIMER + "<br>
" + sGetGlobalDisclaimerText("en_disclaimer", intCorpID);
}
else
{
msgDisc = msgDisc + "<br>" + sGetGlobalDisclaimerText("en_di
sclaimer", intCorpID);
}
}
//Modified for Base64 by Deena 11.01.2008 Start
//strOptout = "<A href=\"##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and
-year#&amp;req=#SEND_ID#\">" + "##DOMAIN_URL##/Gmailer/us.aspx?d=#month-and-year
#&amp;req=#SEND_ID#</A>";
strOptout = "<A href=\"##DOMAIN_URL##/0/?d=#month-and-year#&amp;r=#S
END_ID#\">" + "##DOMAIN_URL##/0/?d=#month-and-year#&amp;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 Transit
ional//EN\" ><html><head><title></title> </head><body >" + sHTMLmastHead + "<p>"
+ "Dear " + "#USER_NAME#" + ",<br><br>" + strHTMLHeader + "</p><p>" + strLink +
"</p><p>" + strHTMLFooter + "</p><p>" + msgDisc + "<br>" + "</p></body></html>"
;
//modified by ratheesh on 05/08/2008 for tkt 1063; removed backgroun
d-color: white; from the body cssclass
if (strEmailBody.Contains(comp_Text))
{
strEmailBody = strEmailBody.Replace(comp_Text, strOptout);
}
else
{ //modified by ratheesh on 05/08/2008 for tkt 1063; removed backg
round-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 Tra
nsitional//EN\" ><html><head><title></title> </head><body >" + sHTMLmastHead + "
<p>" + "Dear " + "#USER_NAME#" + ",<br><br>" + strHTMLHeader + "</p><p>" + strLi
nk + "</p><p>" + strHTMLFooter + "</p><p>" + msgDisc + "<br>" + strOptout + "</p
></body></html>";
}
strEmailBody = strEmailBody.Replace("\n", "<br>");
strEmailBody = strEmailBody.Replace("'", "''");
//for multipartmail
sSmtpEmailText = sSmtpEmailText.Replace(strLowerBoundary.TrimStart()
, strUpperHtmlBoundary);
SMTPEmail = sSmtpEmailText + "\n \n" + strEmailBody + "#SendersCopy_
List#" + "\n \n" + strLowerBoundary.TrimStart();
//End
return SMTPEmail;
}
public string LinkUrls(string strInput)
{
//For activating links in email message body and closing---Ticket no
-2259----------------------
string strResult = "";
if (strInput.Contains("https"))
{
//string strPattern = @"(?<url>https://(?:[\w-]+\.)+[\w-]+(?:/[\
w-./?%&~=]*[^.])?)";
//string strPattern = @"(?<url>https://(?:[\w-]+\.)+[\w-]+(?:/[\
w-./?%&~=]*[^.|<])?)";
string strPattern = @"(?<url>https://(?:[\w-]+\.)+[\w-]+(?:/[\w-
./?%&~=()]*[^.|<])?)";
string strReplace = "<a href=\"${url}\">${url}</a>";

strResult = Regex.Replace(strInput, strPattern, strReplace);


//strPattern = @"(?<!https://)(?<url>www\.(?:[\w-]+\.)+[\w-]+(?:
/[\w-./?%&~=]*[^.])?)";
strPattern = @"(?<!https://)(?<url>www\.(?:[\w-]+\.)+[\w-]+(?:/[
\w-./?%&~=()]*[^.])?)";
strReplace = "<a href=\"https://${url}\" target=_blank>${url}</a
>";
strResult = Regex.Replace(strResult, strPattern, strReplace);
}
else
{
//string strPattern = @"(?<url>http://(?:[\w-]+\.)+[\w-]+(?:/[\w
-./?%&~=]*[^.])?)";
//string strPattern = @"(?<url>http://(?:[\w-]+\.)+[\w-]+(?:/[\w
-./?%&~=]*[^.|<])?)";
string strPattern = @"(?<url>http://(?:[\w-]+\.)+[\w-]+(?:/[\w-.
/?%&~=()]*[^.|<])?)";
string strReplace = "<a href=\"${url}\">${url}</a>";
strResult = Regex.Replace(strInput, strPattern, strReplace);
//strPattern = @"(?<!http://)(?<url>www\.(?:[\w-]+\.)+[\w-]+(?:/
[\w-./?%&~=]*[^.])?)";
strPattern = @"(?<!http://)(?<url>www\.(?:[\w-]+\.)+[\w-]+(?:/[\
w-./?%&~=()]*[^.])?)";
strReplace = "<a href=\"http://${url}\" target=_blank>${url}</a>
";
strResult = Regex.Replace(strResult, strPattern, strReplace);
}
return strResult;
}
// Hyper link in the inside card message via Email send - Ticket No:857
Start
// Modified by Ganesh 19-04-08
public string LinkUrls_eCard(string strInput)
{
string strResult = strInput;
strResult = AddHttp_eCard(strResult);
strResult = AddHttps_eCard(strResult);
return strResult;
}
public string AddHttp_eCard(string strInput)
{
string strResult = strInput;
string strPattern = @"(?<url>http://(?:[\w-]+\.)+[\w-]+(?:/[\w-./?%&
~=()]*[^.|<])?)";
string strReplace = "<a href=\"${url}\">${url}</a>";
strResult = Regex.Replace(strInput, strPattern, strReplace);
strPattern = @"(?<!http://)(?<!https://)(?<url>www\.(?:[\w-]+\.)+[\w
-]+(?:/[\w-./?%&~=()]*[^.])?)";
strReplace = "<a href=\"http://${url}\" target=_blank>${url}</a>";
strResult = Regex.Replace(strResult, strPattern, strReplace);
return strResult;
}
public string AddHttps_eCard(string strInput)
{
string strResult = strInput;
if (strInput.Contains("https://"))
{
string strPattern = @"(?<url>https://(?:[\w-]+\.)+[\w-]+(?:/[\w-
./?%&~=()]*[^.|<])?)";
string strReplace = "<a href=\"${url}\">${url}</a>";
strResult = Regex.Replace(strInput, strPattern, strReplace);
}
return strResult;
} // End
public string getAltLinkText()
{
string altText;
string query = "SELECT altlink_msg FROM tblDefaults";
altText = dbOpr.executeScalarQuery(query);
return altText;
}
//modified for admin module start
public DataTable sCheckStatus_FutureSend(string taskID, int moduleid)
{
string SQLStatement = "";
switch (moduleid)
{
case 1:
SQLStatement = "SELECT queue,isnull(datediff(day,expdate,get
date()),0) as ddiff,isnull(active,1) as active FROM tblHistorySummary " +
"inner join tblhistoryemail on tblhistoryemai
l.batchid=tblHistorySummary.batchid " +
"inner join tblconcepts on conceptid=sboardid
and tblhistoryemail.Industry=tblconcepts.Industry " +
"inner join tbl_futuresend_details on tbl_fut
uresend_details.taskid=tblHistorySummary.batchid " +
"WHERE tblHistorySummary.batchID = '" + task
ID + "'";
break;
case 6:
/*Modified by Jomy James for 1371:Future send for agent pdf
upload in financial article showing HO expired on 05-June-2009 Start*/
string strsql, pdfexist;
strsql = "SELECT pdf_url FROM tblagentnewsletters WHERE pdf_
url=(SELECT newsletterid FROM tblhistoryemail WHERE batchID = '" + taskID + "')"
;
pdfexist = dbOpr.executeScalarQuery(strsql);
if (pdfexist.Trim() != "")
{
SQLStatement = "SELECT queue,isnull(datediff(day,expdate
,getdate()),0) as ddiff,isnull(active,1) as active FROM tblHistorySummary " +
"inner join tblhistoryemail on tblhistor
yemail.batchid=tblHistorySummary.batchid " +
"inner join tblagentnewsletters on pdf_u
rl=newsletterid " +
"inner join tbl_futuresend_details on tb
l_futuresend_details.taskid=tblHistorySummary.batchid " +
"WHERE tblHistorySummary.batchID = '" +
taskID + "'";
}
else
{
SQLStatement = "SELECT queue,isnull(datediff(day,expdate
,getdate()),0) as ddiff,isnull(active,1) as active FROM tblHistorySummary " +
"inner join tblhistoryemail on tblhistoryema
il.batchid=tblHistorySummary.batchid " +
"inner join tblcorpnewsletters on pdf_url=ne
wsletterid " + // changed left join to inner join to check delete option
"inner join tbl_futuresend_details on tbl_fu
turesend_details.taskid=tblHistorySummary.batchid " +
"WHERE tblHistorySummary.batchID = '" + tas
kID + "'";
}
break;
/*Modified by Jomy James for 1371:Future send for agent pdf uplo
ad in financial article showing HO expired on 05-June-2009 End*/
/* added by ratheesh on 16/07/2008 for mantis ticket: 988 start*
/
case 8:
SQLStatement = "SELECT queue,isnull(datediff(day,expdate,get
date()),0) as ddiff,active = 1 FROM tblHistorySummary " +
"inner join tblhistoryemail on tblhistoryema
il.batchid=tblHistorySummary.batchid " +
"inner join tblchecklist on tblchecklist.che
cklistid=tblhistoryemail.checklistid " + // changed left join to inner join to
check delete option
"inner join tbl_futuresend_details on tbl_fu
turesend_details.taskid=tblHistorySummary.batchid " +
"WHERE tblHistorySummary.batchID = '" + tas
kID + "'";
break;
case 3:
/* modified by ratheesh on 02/08/2008 for mantis ticket: 988
start*/
//Modified by Deena for 1031 issue in Futuresend Bind Issue
06.09.2008 Start
string strSqlBg, strBg = "", cardType = "", filename = "", s
trSqlCorpId, strCorpId = "";
strSqlBg = "select background from tblhistoryemail where bat
chid = '" + taskID + "'";
strBg = dbOpr.executeScalarQuery(strSqlBg);
if ((strBg.Trim() != "") && (strBg.Trim() != null))
{
string[] arrBg = strBg.Split('/');
strSqlCorpId = "select corp_id from tblmembers where add
ressbook in " +
" (select addressbook from tblhistorysummary
where batchid = '" + taskID + "' )";
strCorpId = dbOpr.executeScalarQuery(strSqlCorpId);
if (arrBg[3].Contains("."))
{
cardType = arrBg[2];
filename = arrBg[3];
}
else
{
cardType = "overrides";
filename = arrBg[4];
}
}
//Modified by Deena for 1031 issue in Futuresend Bind Issue
06.09.2008 End
SQLStatement = "SELECT queue, ddiff=0, case when status='ena
bled' then '1' else '0' end as active FROM tblHistorySummary " +
"inner join tblhistoryemail on tblhistoryemai
l.batchid=tblHistorySummary.batchid " +
"inner join tbl_ecards on tbl_ecards.filename
= '" + filename + "' and card_type = '" + cardType + "' " + // changed left joi
n to inner join to check delete option
"inner join tbl_futuresend_details on tbl_fut
uresend_details.taskid=tblHistorySummary.batchid " +
"WHERE (tbl_ecards.corpid = '" + strCorpId +
"' or tbl_ecards.corpid like '%," + strCorpId + ",%') and tblHistorySummary.batc
hID = '" + taskID + "'";
/* modified by ratheesh on 02/08/2008 for mantis ticket: 988
end*/
break;
/* added by ratheesh on 16/07/2008 for mantis ticket: 988 end*/
/* added by ratheesh on 19/08/2008 for ticket: 988 start */
// added for liberty newsletter futuresend
case 9:
SQLStatement = "SELECT queue, ddiff=0, case when archive = 0
then '1' else '0' end as active FROM tblHistorySummary " +
"inner join tblhistoryemail on tblHistorySumm
ary.batchid = tblhistoryemail.batchid " +
"inner join tblerplusnewsletter on tblhistory
email.NewsLetterID = tblerplusnewsletter.id " +
"inner join tbl_futuresend_details on tbl_fut
uresend_details.taskid=tblHistorySummary.batchid " +
"WHERE tblHistorySummary.batchID = '" + task
ID + "'";
break;
/* added by ratheesh on 19/08/2008 for ticket: 988 end */
case 72:
SQLStatement = "SELECT queue, ddiff=0, case when archive = 0
then '1' else '0' end as active FROM tblHistorySummary " +
"inner join tblhistoryemail on tblHistorySumm
ary.batchid = tblhistoryemail.batchid " +
"inner join tbl_New_Newsletter on tblhistorye
mail.NewsLetterID = tbl_New_Newsletter.id " +
"inner join tbl_futuresend_details on tbl_fut
uresend_details.taskid=tblHistorySummary.batchid " +
"WHERE tblHistorySummary.batchID = '" + task
ID + "'";
break;
case 75:
SQLStatement = "SELECT queue,isnull(datediff(day,Exp_Date,ge
tdate()),0) as ddiff,isnull(IsActive,1) as active FROM tblHistorySummary " +
"inner join tblhistoryemail on tblhistoryemai
l.batchid=tblHistorySummary.batchid " +
"inner join tbl_HO_Templates on TemplateId=Ne
wsLetterID " + //and tblhistoryemail.Industry=tblconcepts.Industry " +
"inner join tbl_futuresend_details on tbl_fut
uresend_details.taskid=tblHistorySummary.batchid " +
"WHERE tblHistorySummary.batchID = '" + task
ID + "'";
break;
default:
SQLStatement = "SELECT queue,ddiff=0,active=1 FROM tblHisto
rySummary WHERE batchID = '" + taskID + "'";
break;
}
return (dbOpr.executeQueriesTable(SQLStatement));
}
//modified for admin module End
public string sCheckStatus_FutureSend(string taskID)
{
string sQStatus;
string SQLStatement = "";
SQLStatement = "SELECT queue FROM tblHistorySummary WHERE batchID =
'" + taskID + "'";
sQStatus = dbOpr.executeScalarQuery(SQLStatement);
return sQStatus;
}
public void vUpdate_FutureSend(string taskTitle, string taskID)
{
string SQLStatement = "UPDATE tbl_futuresend_details SET taskTitle='
" + taskTitle + "' WHERE taskID ='" + taskID + "'";
dbOpr.executenonQuery(SQLStatement);
}
public void vDelete_FutureSend(string taskID, string inQueue)
{
string SQLStatement;
if (inQueue == "1")
{
SQLStatement = "Delete FROM tblHistorySummary WHERE batchID ='"
+ taskID + "'";
dbOpr.executenonQuery(SQLStatement);
SQLStatement = "Delete FROM tblHistoryEmail WHERE batchID ='" +
taskID + "'";
dbOpr.executenonQuery(SQLStatement);
SQLStatement = "Delete FROM tblQCategoryList WHERE batchID ='" +
taskID + "'";
dbOpr.executenonQuery(SQLStatement);
SQLStatement = "Delete FROM tblQEx_Inclusion WHERE batchID ='" +
taskID + "'";
dbOpr.executenonQuery(SQLStatement);
}
SQLStatement = "Delete FROM tbl_futuresend_details WHERE taskID ='"
+ taskID + "'";
dbOpr.executenonQuery(SQLStatement);
}
public DataTable dtGetFutureSendDetails(int iAddressbook, string sSortCo
l, string sSortOrder)
{
int intYear = DateTime.Now.Year;
string SQLStatement = "SELECT taskid,tasktitle,tasktype,taskdate,rec
count FROM tbl_futuresend_details as tblfut, tblHistorySummary as tblhis " +
"WHERE tblfut.addressBook = '" + iAddressbook
+ "' and tblhis.batchid = tblfut.taskid and tblhis.batchopened <> 2";
for (int i = 2006; i < intYear; i++)
{
SQLStatement += " Union all SELECT taskid,tasktitle,tasktype,ta
skdate,reccount FROM tbl_futuresend_details as " +
"tblfut, tblHistorySummary" + i.ToString().Subst
ring(2, 2) + " as tblhis WHERE tblfut.addressBook = '" + iAddressbook + "' and t
blhis.batchid = tblfut.taskid and " +
" tblhis.batchopened <> 2";
}
if (sSortCol != "")
{
SQLStatement += " ORDER BY tblfut." + sSortCol + sSortOrder;
}
return (dbOpr.executeQueriesTable(SQLStatement));
}
public string sGetSMTPEmail(string batchID)
{
string SQLStatement = "SELECT SMTPEmail FROM tblHistorySummary WHERE
batchID = '" + batchID + "'";
return dbOpr.executeScalarQuery(SQLStatement);
}
public DataTable dtGetQueuedCategories(string batchid)
{
string SQLStatement = "select GroupID from tblQCategoryList where ba
tchid='" + batchid + "'";
return (dbOpr.executeQueriesTable(SQLStatement));
}
public DataTable dtGetResponses(int intAddressBook, string sSortCol, str
ing sSortOrder)
{
string SQLStatement = "SELECT sendID,subject,from_name as fromName,r
esponse_date,convert(char(10),response_date,101) as dateSent,module as moduleNam
e,response,addressBook" +
" FROM tbl_response WHERE response is not null and (addressBook=
'" + intAddressBook + "') ";
if (sSortCol != "")
{
SQLStatement += " ORDER BY " + sSortCol + sSortOrder;
}
return (dbOpr.executeQueriesTable(SQLStatement));
}
public DataTable dtGetResponseEmail(int intAddressBook, string sid)
{
string strSQL = "Select from_name,subject,response_date,response FRO
M tbl_response WHERE addressBook = '" + intAddressBook + "' and sendID='" + sid
+ "'";
return (dbOpr.executeQueriesTable(strSQL));
}
// //
//Added for Individual Emailer
public int iUpdateContactDetals(int intAddressBook, int iActive)
{
string SQLStatement = "Update [" + intAddressBook + "] set active="
+ iActive;
return dbOpr.executenonQuery(SQLStatement);
}
public int iUpdateContactDetals(int intAddressBook, int iActive, string
sListOfEmailAddress)
{
string SQLStatement = "Update [" + intAddressBook + "] set active="
+ iActive + " where emailaddress in(" + sListOfEmailAddress + ")";
return dbOpr.executenonQuery(SQLStatement);
}
public int iUpdateContactDetals(int intAddressBook, int iActive, string
sContactEmailAddress, string sFirstName, string sLastName)
{
string SQLStatement = "Update [" + intAddressBook + "] set active="
+ iActive + ", firstname='" + sFirstName + "', lastname='" + sLastName + "' wher
e emailaddress ='" + sContactEmailAddress + "'";
return dbOpr.executenonQuery(SQLStatement);
}
public bool blnCheckOptoutInvalidEmail(int intAddressBook, string sEmail
Address)
{
string SQLStatement = "Select ID from [" + intAddressBook + "] where
emailaddress='" + sEmailAddress + "' and " +
"Id in(SELECT UserID FROM tblUserCategory WHER
E CategoryID IN" +
"(SELECT ID FROM tblCategoryList where address
book=" + intAddressBook + " and " +
"(CategoryName='Opt-Out' Or CategoryName='Inva
lid EmailAddress')))";
if (dbOpr.executeScalarQuery(SQLStatement) != "")
{
return true;
}
else
{
return false;
}
}
public bool blnCheckContactExists(int intAddressBook, string sEmailAddre
ss)
{
string SQLStatement = "Select emailaddress from [" + intAddressBook
+ "] where emailaddress='" + sEmailAddress + "'";
if (dbOpr.executeScalarQuery(SQLStatement) != "")
{
return true;
}
else
{
return false;
}
}
public string sGetMaxID(int intAddressBook)
{
string SQLStatement = "select max(id) from [" + intAddressBook + "]
";
string maxId = dbOpr.executeScalarQuery(SQLStatement);
if (maxId == "")
{
maxId = "0";
}
return maxId;
}
public string sGetBatchID()
{
string SQLStatement, sbatchID;
SQLStatement = "select newid() as batchid";
sbatchID = dbOpr.executeScalarQuery(SQLStatement);
sbatchID = sbatchID.Replace("{", "");
sbatchID = sbatchID.Replace("}", "");
return sbatchID;
}
public bool blnCheckAutoIntroFacility(int sCorpID, int intAddressBook)
{
// Modified for sending AutoIntro message when checkbox is checked -
by Gopi on 16-02-2008 start
string SQLStatement = "select AutoIntro from tblmembers where addres
sbook='" + intAddressBook + "'";
if (dbOpr.executeScalarQuery(SQLStatement) != "True")
{
return false;
}
else
{
SQLStatement = "select addressbook from tblmembers where address
book='" + intAddressBook + "' and " +
"(industry like '%RECruiting%' or industry2 li
ke '%RECruiting%' or industry3 like '%RECruiting%')";
if (dbOpr.executeScalarQuery(SQLStatement) != "")
{
return false;
}
else
{
if (blnCheckAutoIntroFacility(sCorpID))
return true;
else
return false;
}
}
// Modified for sending AutoIntro message when checkbox is checked -
by Gopi on 16-02-2008 end
}
public bool blnCheckAutoIntroFacility(int sCorpID)
{
string SQLStatement = "select INT_AUTOINTROFACILITY from tblcorpfeat
ures where corp_id=" + sCorpID;
if (dbOpr.executeScalarQuery(SQLStatement) == "1")
{
return true;
}
else
{
return false;
}
}
public DataTable dtGetAgentDetails(string sColumns, int iAddressBook, st
ring sSortCol, string sSortOrder)
{
string SQLStatement = "SELECT " + sColumns + " FROM tblmembers WHER
E addressBook='" + iAddressBook + "' ";
if (sSortCol != "")
{
SQLStatement += " ORDER BY " + sSortCol + sSortOrder;
}
return (dbOpr.executeQueriesTable(SQLStatement));
}
public DataTable dtGetContactDetails(int intAddressBook)
{
string strSQL = "execute sp_GetContactDetails " + intAddressBook;
return (dbOpr.executeQueriesTable(strSQL));
}
public DataTable dtGetContactDetails(string sColumns, int intAddressBook
, string sEmailAddress)
{
//Modified by Deena for CRM 15.05.2008 Start
if (sColumns.Contains("id"))
{
sColumns = sColumns.Replace("id", "ab.id");
}
//string SQLStatement = "Select " + sColumns + " from [" + intAddres
sBook + "] where emailaddress='" + sEmailAddress + "'";
//Modified by Ezhil for CRM ticket no 1154 on 04/11/2008 Start
string SQLStatement = "select " + sColumns + " from [" + intAddressB
ook + "] ab left outer join tbl_addressbook_ext ext on ext.addressbook = " + int
AddressBook + " and ab.id = ext.clientid where ab.emailaddress = '" + sEmailAdd
ress + "'";
//Modified by Ezhil for CRM ticket no 1154 on 04/11/2008 End
return (dbOpr.executeQueriesTable(SQLStatement));
//Modified by Deena for CRM 15.05.2008 End
}
public DataTable dtGetContactDetails(string sColumns, int iAddressBook,
int iClientID, string sSortCol, string sSortOrder)
{
string SQLStatement = "SELECT " + sColumns + " from [" + iAddressBoo
k + "] where ID=" + iClientID;
if (sSortCol != "")
{
SQLStatement += " ORDER BY " + sSortCol + sSortOrder;
}
return (dbOpr.executeQueriesTable(SQLStatement));
}
public int iInsertIntoHistorySummary(string sSummaryValues)
{
string SQLStatement = "insert into tblhistorysummary(BatchID,Address
book,AgentEmail,ModuleSent,Queue,FutureSendDate) values (" + sSummaryValues + ")
";
return (dbOpr.executenonQuery(SQLStatement));
}
public int iInsertIntoHistoryEmail(string sEmailValues)
{
string SQLStatement = "insert into tblhistoryEmail(BatchID,Industry)
values (" + sEmailValues + ")";
return (dbOpr.executenonQuery(SQLStatement));
}
public int iInsertIntoHistoryDetail(string sDetailValues)
{
string SQLStatement = "insert into tblhistorydetail(BatchID,SendID,A
ddressBook,ContactEmail,ContactFirstName,ContactLastName,ClientID) values (" + s
DetailValues + ")";
return (dbOpr.executenonQuery(SQLStatement));
}
public DataTable dtGetExclusionInclusion(string sBatchid)
{
string SQLStatement = "select EmailAddress,Whattodo from tblQEx_Incl
usion where batchid='" + sBatchid + "'";
return (dbOpr.executeQueriesTable(SQLStatement));
}
//Added on August 2, 2007
public int iCreateNewContact(int intAddressBook, string sFname, string s
Lname, string sEmail, int iClientID, int iActive)
{
string SQLStatement = "insert into [" + intAddressBook + "](id,first
name,lastname,emailaddress,active,date_created)" +
"values (" + (iClientID + 1) + ",'" + sFname.T
rim().Replace("'", "''") + "','" + sLname.Trim().Replace("'", "''") + "','" + sE
mail.Trim().Replace("'", "''") + "'," + iActive + ",getdate())";
return (dbOpr.executenonQuery(SQLStatement));
}
public DataTable dtGetFutureSendGroupId(string sBatchid)
{
string SQLStatement = "select groupid from tblQcategoryList where ba
tchID='" + sBatchid + "'";
return (dbOpr.executeQueriesTable(SQLStatement));
}
public string sGetExclusionInclusion(string sBatchid)
{
string SQLStatement = "select EmailAddress from tblQEx_Inclusion whe
re batchid='" + sBatchid + "'";
return dbOpr.executeScalarQuery(SQLStatement);
}
public int iUpdateActiveStatus(int intAddressBook, int iActive, int sGro
upIDs)
{
string SQLStatement = "update [" + intAddressBook + "] set active="
+ iActive +
" Where id in (select userid from tblusercat
egory where addressbook=" + intAddressBook + " and" +
" categoryid in (" + sGroupIDs + ") and" +
" userid not in (select userid from tbluserc
ategory where addressbook=" + intAddressBook + " and" +
" categoryid in (select id from tblcategoryl
ist where addressbook=" + intAddressBook + " and categoryname in('opt-out','inva
lid emailaddress'))))";
return (dbOpr.executenonQuery(SQLStatement));
}
public DataTable dtGetFutureSendDetails(int iAddressbook, string staskID
, string sSortCol, string sSortOrder)
{
string SQLStatement = "SELECT * FROM tbl_futuresend_details WHERE
addressBook='" + iAddressbook + "' and taskID='" + staskID + "'";
if (sSortCol != "")
{
SQLStatement += " ORDER BY " + sSortCol + sSortOrder;
}
return (dbOpr.executeQueriesTable(SQLStatement));
}
public string sGetHistorySummary(string batchID, string sColumn)
{
string SQLStatement = "SELECT " + sColumn + " FROM tblHistorySummary
WHERE batchID = '" + batchID + "'";
return dbOpr.executeScalarQuery(SQLStatement);
}
public DataTable dtGetHistoryEmail(string sBatchid, string sColumns)
{
string SQLStatement = "select " + sColumns + ",industry,NewsLetterID
from tblHistoryEmail where batchID='" + sBatchid + "'";
return (dbOpr.executeQueriesTable(SQLStatement));
}
#region For state
public DataTable dtListState()
{
string SQLStatement = "SELECT StateID,State,RTrim(LTrim(Code)) as Co
de FROM State where StateID<60 or StateID>66 and stateid not in (80) ORDER BY St
ateID";
return (dbOpr.executeQueriesTable(SQLStatement));
}
public int iUpdateState(int intAddressBook, string sState, int intClient
ID)
{
string SQLStatement = "update tbl_addressbook_ext set state='" + sSt
ate + "' where clientid = " + intClientID +
" and addressbook=" + intAddressBook;
return (dbOpr.executenonQuery(SQLStatement));
}
public bool blnCheckExtExits(int intAddressBook, int intClientID)
{
string SQLStatement = "select id from tbl_addressbook_ext where clie
ntid =" + intClientID + " and addressbook=" + intAddressBook;
if (dbOpr.executeScalarQuery(SQLStatement) != "")
{
return true;
}
else
{
return false;
}
}
public int iInsertState(int intAddressBook, int intClientID, string sSta
te)
{
string SQLStatement = "insert into tbl_addressbook_ext (addressbook,
clientid,state)" +
"values (" + intAddressBook + "," + intClientI
D + ",'" + sState + "')";
return (dbOpr.executenonQuery(SQLStatement));
}
// Added by KarthikAnand Ticket Number 1031 for displaying the contacts
in Producer group on 08.07.2008 start
public DataTable dtGetContactDetails(int intAddressBook, string sState)
{
//Modified for avoiding fake emailaddress by Gopi on 31-03-2008 star
t
//Modified by Deena for Ticket Number 403 in BT on 22.01.2009 Start
string SQLStatement = "SELECT addr.id, addr.firstName+' '+ addr.last
Name as name,addr.firstName, addr.lastName, addr.emailAddress,case when ltrim(rt
rim(ext.state)) = '' or ext.state is null then '0' else ext.state end as state F
ROM " +
"[" + intAddressBook + "] as addr,tbl_addressbook_ext as ext whe
re addr.emailAddress not like '%@noemailaddress.void' and " +
"addr.id*=ext.clientid and " +
"ext.addressbook=" + intAddressBook +
" and addr.id not in " +
"(select userid from tblUserCategory where exists " +
"(select ID from tblCategoryList where addressbook=" + intAddres
sBook +
"and (categoryName='opt-Out' or categoryName='Invalid EmailAddre
ss') " +
"and ID=tblUserCategory.categoryid)) ORDER BY lastName";
//Modified by Deena for Ticket Number 403 in BT on 22.01.2009 End
//Modified for avoiding fake emailaddress by Gopi on 31-03-2008 end
return (dbOpr.executeQueriesTable(SQLStatement));
}
// Added by KarthikAnand Ticket Number 1031 on 08.07.2008 End
//Added by Ezhil for Search Contacts ticket no 1231 on 01/01/2009 Start
public DataTable dtGetContactDetails(int intAddressBook, string sState,
string sSearchText)
{
//Modified for avoiding fake emailaddress by Gopi on 31-03-2008 star
t
string SQLStatement = "SELECT addr.id, addr.firstName+' '+ addr.last
Name as name,addr.firstName, addr.lastName, addr.emailAddress,ltrim(rtrim(isnull
(ext.state,'0'))) as state FROM " +
"[" + intAddressBook + "] as addr,tbl_addressbook_ext as ext whe
re addr.emailAddress not like '%@noemailaddress.void' and " +
"addr.id*=ext.clientid and " +
"ext.addressbook=" + intAddressBook +
" and addr.id not in " +
"(select userid from tblUserCategory where exists " +
"(select ID from tblCategoryList where addressbook=" + intAddres
sBook +
"and (categoryName='opt-Out' or categoryName='Invalid EmailAddre
ss') " +
"and ID=tblUserCategory.categoryid))" +
"and ((FirstName like '%" + sSearchText + "%') OR (LastName like
'%" + sSearchText + "%') OR (EmailAddress LIKE '%" + sSearchText + "%')) ORDER
BY lastName";
//Modified for avoiding fake emailaddress by Gopi on 31-03-2008 end
return (dbOpr.executeQueriesTable(SQLStatement));
}
//Added by Ezhil for Search Contacts ticket no 1231 on 01/01/2009 End
#endregion
//13.11.07
public DataTable dtgetExistingContact(int intAddressBook, string sEmailA
ddress)
{
string SQLStatement = "Select Firstname,lastname,emailaddress,state
from [" + intAddressBook + "] a left join tbl_addressbook_ext b on b.clientid=a.
ID and b.addressbook=" + intAddressBook + " where emailaddress='" + sEmailAddres
s + "'";
return (dbOpr.executeQueriesTable(SQLStatement));
}
//13.11.07 end
//public string InsertBreak(string sContent)
//{
// int ContentLength, LastIndex = 0, CurrentIndex = 0, Limit = 60;
// //sContent = sContent.Replace("\r\n", " <br>");
// ContentLength = sContent.Length;
// sContent = sContent + " ";
// while (LastIndex < ContentLength)
// {
// //sContent = sContent.Insert(i, "\n");
// //i = i + 65;
// CurrentIndex = sContent.IndexOf(" ", CurrentIndex + 1);
// if (CurrentIndex != -1)
// {
// if (CurrentIndex > Limit)
// {
// sContent = sContent.Remove(LastIndex, 1);
// sContent = sContent.Insert(LastIndex, "\r\n");
// Limit = Limit + 60;
// ContentLength = sContent.Length;
// //CurrentIndex = 0;
// }
// LastIndex = CurrentIndex;
// }
// else
// {
// LastIndex = ContentLength;
// }
// }
// return sContent;
//}
//modified by Gopi for multipart text format on 30-01-2008 - start
public string InsertLine(string sContent)
{
int ContentLength = 0, LastIndex = 0, CurrentIndex = 0, Limit = 65,
midIndex = 0;
string sCon = null;
ContentLength = sContent.Length;
sContent = sContent + " ";
sCon = sContent;
while (LastIndex < ContentLength)
{
CurrentIndex = sCon.IndexOf(" ", CurrentIndex + 1);
if (CurrentIndex != -1)
{
if (CurrentIndex >= Limit)
{
if (midIndex == 0)
{
midIndex = midIndex + LastIndex;
sContent = sContent.Remove(midIndex, 1);
sContent = sContent.Insert(midIndex, "\r\n");
}
else
{
midIndex = midIndex + LastIndex;
sContent = sContent.Remove(midIndex + 2, 1);
sContent = sContent.Insert(midIndex + 2, "\r\n");
}
sCon = sContent.Substring(midIndex + 2, sContent.Length
- midIndex - 2);
ContentLength = sCon.Length;
CurrentIndex = 0;
}
LastIndex = CurrentIndex;
}
else
{
LastIndex = ContentLength;
}
}
return sContent;
}
//Modified by Deena 16.04.2008 Start
//Purpose: For implementing 65 Character break
public string InsertBreak(string sContent)
{
int ContentLength, LastIndex = 0, CurrentIndex = 0, Limit = 60;
//sContent = sContent.Replace("\r\n", " <br>");
ContentLength = sContent.Length;
sContent = sContent + " ";
while (LastIndex < ContentLength)
{
//sContent = sContent.Insert(i, "\n");
//i = i + 65;
CurrentIndex = sContent.IndexOf(" ", CurrentIndex + 1);
if (CurrentIndex != -1)
{
if (CurrentIndex > Limit)
{
sContent = sContent.Remove(LastIndex, 1);
sContent = sContent.Insert(LastIndex, "\r\n");
Limit = Limit + 60;
ContentLength = sContent.Length;
//CurrentIndex = 0;
}
LastIndex = CurrentIndex;
}
else
{
LastIndex = ContentLength;
}
}
return sContent;
}
//Modified by Deena 16.04.2008 End
//modified by Gopi for multipart text format on 30-01-2008 - end
// Modified for getting mailbox count in tblDomain for new user created
by Gopi on 15-02-2008 start
public int countDomain(string name)
{
string strCount = null;
strCount = "select count(addressbook) from tbldomain where mailbox l
ike '" + name + "%'";
return Convert.ToInt32(dbOpr.executeScalarQuery(strCount));
}
// Modified for getting mailbox count in tblDomain for new user created
by Gopi on 15-02-2008 end
//Modified by Ezhil for Replace Variable in InsideCard(eCard) Message on
07/05/2007 Start
public DataTable dtGetVariableReplace(int intAddressBook)
{
string sSQL = "select appearsAs,emailaddress,corp_id,industry,firstN
ame,lastName,company,title,address1," +
"address2,city,state,zip,Phone,fax from tblmembers whe
re addressbook= " + intAddressBook + "";
return (dbOpr.executeQueriesTable(sSQL));
}
//Modified by Ezhil for Replace with Variable in InsideCard(eCard) Messa
ge on 07/05/2007 End
// Ticket No:950 Auto Future Mail Number Not updating 29-05-08 - Start
// Modified by Ganesh
public void dtUpdateFutureSend_Count(string taskID, int intAddressBook)
{
//Modified by Deena for Ticket Number 950 Note 2350 Futuresend Count
09.09.2008 Start
string Total_Count = "0";
if (isFutureCountUpdate(taskID) > 0)
{
string QuerySelectAll = "Select count(*) as cnt FROM [" + intAdd
ressBook + "] AS ABook WHERE EmailAddress NOT LIKE '%@noemailaddress.void' and"
+
" EmailAddress NOT IN (SELECT EmailAddre
ss FROM tblQEx_Inclusion WHERE" +
" BatchID = '" + taskID + "' AND WhatToD
o=-1) and id not in" +
" (select userid from tblusercategory wh
ere addressbook=" + intAddressBook + " and categoryid in" +
" (select id from tblcategorylist where
addressbook=" + intAddressBook + " and categoryname in('opt-out','invalid emaila
ddress')))";
string QuerySelectCat = "Select count(*) FROM [" + intAddressBoo
k + "] AS ABook WHERE EmailAddress NOT LIKE '%@noemailaddress.void' and" +
" (ABook.id IN(SELECT UserID FROM tblUse
rCategory WHERE AddressBook=" + intAddressBook + " AND" +
" CategoryID IN(SELECT GroupID FROM tblq
CategoryList where BatchID='" + taskID + "')) OR" +
" EmailAddress IN (SELECT EmailAddress F
ROM tblQEx_Inclusion WHERE BatchID='" + taskID + "'" +
" AND WhatToDo=1)) AND EmailAddress NOT
IN (SELECT EmailAddress FROM tblQEx_Inclusion" +
" WHERE BatchID='" + taskID + "' AND Wha
tToDo=-1) " +
" and id not in (select userid from tblu
sercategory where addressbook=" + intAddressBook + " and categoryid in" +
" (select id from tblcategorylist where
addressbook=" + intAddressBook + " and categoryname in('opt-out','invalid emaila
ddress')))";
string strCategoryId = "select GroupId from tblqCategoryList whe
re BatchId = '" + taskID + "' ";
DataTable dtCategoryId = dbOpr.executeQueriesTable(strCategoryId
);
if (dtCategoryId.Rows.Count > 0)
{
if (dtCategoryId.Rows.Count == 1)
{
if (dtCategoryId.Rows[0]["GroupId"].ToString() == "0")
{
Total_Count = dbOpr.executeScalarQuery(QuerySelectAl
l);
}
else
{
Total_Count = dbOpr.executeScalarQuery(QuerySelectCa
t).ToString();
}
}
else
{
Total_Count = dbOpr.executeScalarQuery(QuerySelectCat).T
oString();
}
}
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
}
// End 29-05-08
//Modified by Ezhil for eCard bind based on the Category on 19/05/2008 S
tart
public DataTable dtgetCategory(int intAddressBook)
{
string SQLCategory = "select Categoryid from tblagent_categories whe
re addressbook=" + intAddressBook;
return (dbOpr.executeQueriesTable(SQLCategory));
}
//Modified by Ezhil for eCard bind based on the Category on 19/05/2008 E
nd
// 13-05-08 End
//Modified by Glastin for on 19/05/2008 for induidual contact update ema
il address Start
public bool blnCheckContactExists(int intAddressBook, string sFirstName,
string sLastName)
{
string SQLStatement = "Select emailaddress from [" + intAddressBook
+ "] where firstname='" + sFirstName + "' and lastname='" + sLastName + "' and
emailaddress like '%@noemailaddress.void'";
if (dbOpr.executeScalarQuery(SQLStatement) != "")
{
return true;
}
else
{
return false;
}
}
public int iUpdatenullemailcontact(int intAddressBook, int iActive, stri
ng sContactEmailAddress, string sFirstName, string sLastName)
{
string SQLStatement = "Update [" + intAddressBook + "] set active="
+ iActive + ", emailaddress ='" + sContactEmailAddress + "' where firstname='"
+ sFirstName + "' and lastname='" + sLastName + "' and emailaddress like '%@noem
ailaddress.void'";
return dbOpr.executenonQuery(SQLStatement);
}
//Modified by Glastin for on 19/05/2008 for induidual contact update ema
il address end
// Modified By Sathya for Print Labels Ticket Number 145 in BT on 22.05.
2008 Start
//Modified by Glastin on 10/06/2008 for Print Labels Ticket Removing "in
valid email address" start
//Modified by Ezhil for print Lable Ticket no 1263 on 05/02/2009 Start
public DataTable dtGetAgentlist(string catid, int intAddressBook)
{
// Modified By Sathya for Content Lock Based on Corp Ticket Number 1
47 in BT on 20.05.2008 Start
//Modified By Deena for Content Lock Based on Corp Ticket Number 147
in BT on 16.05.2008 Start
string strSQL = "";
strSQL = "select adb.firstname+' '+adb.lastname as Name,ext.address1
as Address1,ext.address2 as Address2,ext.city," +
" (isnull((case when ltrim(ext.city)='' then'' else rt
rim(ltrim(ext.city))+ ', ' end ),'') + " +
" isnull((select top 1 state from state where code = e
xt.state),'') +' '+ isnull(ext.zip,'') ) as citystatezip," +
" isnull((select top 1 state from state where code = e
xt.state),'') as state,ext.zip as zip" +
" from [" + intAddressBook + "] adb left outer join tb
l_addressbook_ext ext on ext.clientid = adb.id";
if (catid == "0")
{
strSQL += " 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;
// "strSQL = "select FirstName,LastName,emailAddress from [" + i
ntAddressBook + " ] where emailaddress not like '%@noemailaddress.void%' and id
not in(select userid from tblusercategory where addressbook=" + intAddressBook +
" and categoryid in(select id from tblcategorylist where addressbook=" + intAd
dressBook + " and categoryname in('opt-out','invalid emailaddress')))and (activ
e!=3.0)";
}
else if (catid == "2")
{
strSQL += " 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 + " and adb.e
mailaddress like '%@noemailaddress.void%'";
}
else if (catid == "4")
{
strSQL += " 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)) a
nd (address1 is not null or address2 is not null) and " +
" (address1 !='' or address2 !='' ) and city is not n
ull and city !='' and state is not null and state !='' " +
" and zip is not null and zip !='' and ext.addressbook
=" + intAddressBook + "";
}
else
{
strSQL += " 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 wher
e addressbook=" + intAddressBook + " and " +
" categoryname in('Opt-Out'))))and (adb.active!=3.0) or
(adb.active=2.0)) and ext.addressbook=" + intAddressBook;
//strSQL = "select FirstName,LastName,emailAddress from [" + int
AddressBook + " ] where emailaddress not like '%@noemailaddress.void' and id in
(select userid from tblusercategory where addressbook=" + intAddressBook + " an
d CategoryID in (" + catid + ") and userid not in (select userid from tbluserca
tegory where addressbook=" + intAddressBook + " and categoryid in(select id fro
m tblcategorylist where addressbook=" + intAddressBook + " and categoryname in(
'Invalid Emailaddress','Opt-Out'))))and (active!=3.0) or (active=2.0)";
}
return (dbOpr.executeQueriesTable(strSQL));
//Modified by Ezhil for print Lable Ticket no 1263 on 05/02/2009 End
}
//Modified by Ezhil for print Lable Ticket no 1263 on 05/02/2009 Start
public DataTable dtGetAgentlistcsv(string catid, int intAddressBook)
{
string strSQL = "";
strSQL = "select ltrim(rtrim(adb.firstname))+' '+ltrim(rtrim(adb.las
tname)) as Name,ltrim(rtrim(ext.address1)) as Address1,ltrim(rtrim(ext.address2)
) as Address2,ltrim(rtrim(ext.city)) as city," +
" ltrim(rtrim(isnull((select top 1 state from state whe
re code = ext.state),''))) as state,ltrim(rtrim(ext.zip)) as zip,ltrim(rtrim(adb
.home_phone)) as HomePhone,ltrim(rtrim(adb.bus_phone)) as BusPhone,ltrim(rtrim(a
db.other_phone)) as OtherPhone" +
" from [" + intAddressBook + "] adb left outer join tbl
_addressbook_ext ext on ext.clientid = adb.id";
if (catid == "0")
{
strSQL += " 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 += " 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 += " 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)) 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 += " where (adb.id in (select userid from tblusercategory
where addressbook=" + intAddressBook + " and " +
" CategoryID in (" + catid + ") and userid not in (sele
ct userid from tblusercategory where addressbook=" + intAddressBook +
" and categoryid in(select id from tblcategorylist wher
e addressbook=" + intAddressBook + " and " +
" categoryname in('Opt-Out'))))and (adb.active!=3.0) or
(adb.active=2.0)) and ext.addressbook=" + intAddressBook;
}
return (dbOpr.executeQueriesTable(strSQL));
}
//Modified by Ezhil for print Lable Ticket no 1263 on 05/02/2009 End
//Modified by Glastin on 10/06/2008 for Print Labels Ticket Removing "in
valid email address" end
// Modified By Sathya for Print Labels Ticket Number 145 in BT on 22.05.
2008 End
/* Added by sathya for get cards from Sqltable on 13.6.2008 start */
public DataSet dtOverridecards()
{
string strSQL = "select * from tbl_eCards where card_type='overrides
'";
return (dbOpr.fillDataSet(strSQL));
}
public DataSet dtGcards()
{
string strSQL = "select * from tbl_eCards where card_type='global'";
return (dbOpr.fillDataSet(strSQL));
}
/* Added by sathya for get cards from Sqltable on 13.6.2008 End */
/* Added by sathya for Producer Group Project on 28.6.2008 Start*/
// Modified by Deena Ticket Number 1031 Populate Agent Categories on 08.
07.2008 Start
public DataTable dtPopulateGroupCategories(string Prodgroup, int intList
Mode)
{
//Modified by Deena for Inactive user issue on 28.07.2008 Start
string query = "";
if (intListMode == 0)
{
query = "select cast (a.id as varchar(50)) + '$'+ cast (b.addres
sbook as varchar(50)) as ID,firstname+' '+lastname+' - '+categoryname as categor
yname " +
" from tblcategorylist a ,tblmembers b where b.ad
dressbook in(" + Prodgroup + ") and b.addressbook=a.addressbook and categoryname
not like 'Opt-Out'" +
" and categoryname not like 'Invalid EmailAddress
' and b.isactive = 1 ORDER BY categoryName ";
}
else
{
query = "select cast (a.id as varchar(50)) + '$'+ cast (b.addres
sbook as varchar(50)) as ID,firstname+' '+lastname+' - '+categoryname as categor
yname" +
" from tblcategorylist a ,tblmembers b where b.addressbo
ok in(" + Prodgroup + ") and b.addressbook=a.addressbook " +
" and categoryname not like 'Opt-Out' and categoryname n
ot like 'Invalid EmailAddress' " +
" and a.id in (select categoryid from tblusercategory wh
ere addressbook in(" + Prodgroup + ") group by categoryid having count(*)> 0) "
+
" and b.isactive = 1 ORDER BY categoryName";
}
//Modified by Deena for Inactive user issue on 28.07.2008 End
return (dbOpr.executeQueriesTable(query));
}
public DataTable dtPopulateGroupAll(string Prodgroup)
{
//Modified by Deena for Inactive user issue on 28.07.2008 Start
string query = "select '0$'+ cast (addressbook as varchar(50)) as ID
,firstname+' '+lastname+' - All' as categoryname from tblmembers where isactive
= 1 and addressbook in(" + Prodgroup + ")";
//Modified by Deena for Inactive user issue on 28.07.2008 End
return (dbOpr.executeQueriesTable(query));
}
public string sTakecountAll(string seladdressbook, string categories, in
t intAddressBook, string Prodgroup, string choice)
{
string query = " ";
query = "select count(*) from prg_" + intAddressBook + " a left oute
r join Tbl_agent_Ex_Inc b on a.addressbook = " +
" b.Prodaddressbook and a.emailaddress = b.emailaddress wher
e a.addressbook in (" + Prodgroup + ") and " +
" b.addressbook = " + intAddressBook + " and a.emailaddress
not like '%noemailaddress.void%'" +
" and (b.whattodo in('0','1'))";
return (dbOpr.executeScalarQuery(query));
}
public void Delete_Temp_Ex_Inc(int intAddressBook, int Option)
{
string SQLStatement;
if (Option == 0)
{
SQLStatement = "Delete from Tbl_agent_Ex_Inc WHERE addressbook =
'" + intAddressBook + "'";
}
else
{
SQLStatement = "Delete from Tbl_agent_Ex_Inc WHERE addressbook =
'" + intAddressBook + "' and whattodo = '1'";
}
dbOpr.executenonQuery(SQLStatement);
}

public int iInsertExcInc(int intAddressBook, string seladdressbook, stri


ng categories, string Prodgroup, string isGlobalOptOut, int intCorpid, string sS
weepCorpID, string strAgencyNo)
{
string SQLStatement = "Delete from Tbl_agent_Ex_Inc WHERE addressboo
k ='" + intAddressBook + "' and whattodo = '1'";
dbOpr.executenonQuery(SQLStatement);
string query = "";
int iAXACorpID = 157;
if ((seladdressbook == "") || (seladdressbook == null) || (seladdres
sbook == "0"))
{
seladdressbook = Prodgroup;
}
//Modified By Deena for Ticket Number 1031 Note 1902 14.08.2008 Star
t
query = " Insert Tbl_agent_Ex_Inc Select " + intAddressBook + " , a.
emailaddress,a.addressbook ,'1' from (select x.*,oba.crdate as a_crdate from " +
" prg_" + intAddressBook + " x left outer join sysobjects ob
a on cast(x.addressbook as varchar) = oba.[name] ) a left outer join " +
" tbl_agent_ex_inc c on a.addressbook = c.prodaddressbook an
d a.emailaddress = c.emailaddress and " +
" c.addressbook = " + intAddressBook + " , (select prg.email
address, min(prg.date_created) as date_created, min(ob.a_crdate) as crdate " +
" from (select x.*,oba.crdate as a_crdate from prg_" + intAd
dressBook + " x left outer join sysobjects oba on cast(x.addressbook as " +
" varchar) = oba.[name] ) ob,(select emailaddress, min(date_
created) as date_created from prg_" + intAddressBook + " where addressbook " +
" in (" + seladdressbook + ") and cast([id] as varchar) + '-
' + cast(addressbook as varchar) not in(select cast(userid as " +
" varchar) + '-' + cast(addressbook as varchar) from tblUser
Category where categoryid in ( select ID from tblCategoryList " +
" where addressbook in (" + intAddressBook + ") and category
name in ('Invalid EmailAddress','opt-Out'))) ";
if ((categories != "0") && (categories != null) && (categories != ""
))
{
//Modified by Deena for Ticket Number 1031 Note 1961 18.08.2008
Start
query = query + " and cast([id] as varchar) + '-' + cast(address
book as varchar) in (select cast(userid as " +
" varchar) + '-' + cast(addressbook as varchar) from tblUserCate
gory where categoryid in (" + categories + ")) ";
//Modified by Deena for Ticket Number 1031 Note 1961 18.08.2008
End

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

//Added by Deena for Ticket Number 374 in BT on 01.01.2009 Start


public string isAgentPDFUpload(int intAddressBook)
{
string isAgentPDFUpload, isCorpPDFUpload, isPDFUpload = "0";
isAgentPDFUpload = dbOpr.executeScalarQuery("select isnull(INT_AGENT
PDFUPLOAD,'-1') from tbluserfeatures where addressbook = " + intAddressBook + ""
);
if (isAgentPDFUpload == "2")
{
isPDFUpload = "1";
}
else if (isAgentPDFUpload == "-1")
{
isCorpPDFUpload = dbOpr.executeScalarQuery("select isnull(INT_AG
ENTPDFUPLOAD,'0') from tblcorpfeatures where corp_id in (select corp_id from tbl
members where addressbook = " + intAddressBook + ")");
if (isCorpPDFUpload == "2" && isAgentPDFUpload == "-1")
{
isPDFUpload = "1";
}
else
{
isPDFUpload = "0";
}
}
return isPDFUpload;
}
//Added by Deena for Ticket Number 374 in BT on 01.01.2009 End
//1239 start
public DataTable dtGetTemplateCategories(int corpid)
{
string SQLStatement = "";
SQLStatement = "select Category,SubCategories,Depth from tbl_Announ_
Category where (corp_id like '%," + corpid + ",%' or corp_id is null) order by S
ort_order";
return (dbOpr.executeQueriesTable(SQLStatement));
}
public DataTable dtGetAnnounTemplates(int addressBook, string sCategory,
string corpid)
{
string SQLStatement = "";
SQLStatement = "select Title, Filename from tbl_Announ_Templates whe
re addressbook in (0," + addressBook + ") and category='" + sCategory + "' and (
corp_id like '%," + corpid + ",%' or corp_id is null) order by Title asc";
return (dbOpr.executeQueriesTable(SQLStatement));
}
public DataTable GetAgentDetails(int iAddressbook)
{
string sQuery;
DataTable agent = new DataTable();
sQuery = "select emailaddress,firstName,agentUrl,compLogoimage,agent
Image,firstName + ' ' + lastName as agentname,appearsAs,address1,address2,city,s
tate,zip,country,dbo.formatPhonenumber(phone,'','1',corp_id) as phone,ph_extn,fa
x,company from tblmembers where addressbook=" + iAddressbook;
return dbOpr.executeQueriesTable(sQuery);
}
public string PullAgentDetails(int iAddressbook, string sInput, string s
Root)
{
string sOutput;
sOutput = sInput;
DataTable dtagent = new DataTable();
dtagent = dbOpr.executeQueriesTable("select isnull(compLogoimage,'')
as compLogoimage, isnull(agentImage,'') as agentImage,firstName + ' ' + lastNam
e as agentname,appearsAs,address1,address2,city,state,zip,country,dbo.formatPhon
enumber(phone,'','1',corp_id) as phone,ph_extn,fax,company from tblmembers where
addressbook=" + iAddressbook);
if (dtagent.Rows[0]["compLogoimage"].ToString().Trim() == "")
{
sOutput = sOutput.Replace("<company logo>", "&nbsp;");
sOutput = sOutput.Replace("&lt;company logo&gt;", "&nbsp;");
}
else
{
sOutput = sOutput.Replace("<company logo>", "<img src='" + sRoot
+ "/ErPlus/Company_Logo/" + dtagent.Rows[0]["compLogoimage"].ToString() + ".jpg
'>");
sOutput = sOutput.Replace("&lt;company logo&gt;", "<img src='" +
sRoot + "/ErPlus/Company_Logo/" + dtagent.Rows[0]["compLogoimage"].ToString() +
".jpg'>");
}
if (dtagent.Rows[0]["agentImage"].ToString().Trim() == "")
{
sOutput = sOutput.Replace("<agent photo>", "&nbsp;");
sOutput = sOutput.Replace("&lt;agent photo&gt;", "&nbsp;");
}
else
{
sOutput = sOutput.Replace("<agent photo>", "<img src='" + sRoot
+ "/ErPlus/Agent_photo/" + dtagent.Rows[0]["agentImage"].ToString() + ".jpg'>");
sOutput = sOutput.Replace("&lt;agent photo&gt;", "<img src='" +
sRoot + "/ErPlus/Agent_photo/" + dtagent.Rows[0]["agentImage"].ToString() + ".jp
g'>");
}
sOutput = sOutput.Replace("<agent name>", dtagent.Rows[0]["agentname
"].ToString());
sOutput = sOutput.Replace("&lt;agent name&gt;", dtagent.Rows[0]["age
ntname"].ToString());
sOutput = sOutput.Replace("<name-designation>", dtagent.Rows[0]["app
earsAs"].ToString());
sOutput = sOutput.Replace("&lt;name-designation&gt;", dtagent.Rows[0
]["appearsAs"].ToString());
sOutput = sOutput.Replace("<agent address1>", dtagent.Rows[0]["addre
ss1"].ToString());
sOutput = sOutput.Replace("&lt;agent address1&gt;", dtagent.Rows[0][
"address1"].ToString());
if (dtagent.Rows[0]["address2"].ToString().Trim() == "")
{
sOutput = sOutput.Replace("<agent address2><br>", "");
sOutput = sOutput.Replace("&lt;agent address2&gt;&lt;br&gt;", ""
);
sOutput = sOutput.Replace("<agent address2> <br />", "");
sOutput = sOutput.Replace("&lt;agent address2&gt; &lt;br /&gt;",
"");
sOutput = sOutput.Replace("<agent address2><br />", "");
sOutput = sOutput.Replace("&lt;agent address2&gt;&lt;br /&gt;",
"");
sOutput = sOutput.Replace("<agent address2><br/>", "");
sOutput = sOutput.Replace("&lt;agent address2&gt;&lt;br/&gt;", "
");
sOutput = sOutput.Replace("<agent address2>", "");
sOutput = sOutput.Replace("&lt;agent address2&gt;", "");
}
else
{
sOutput = sOutput.Replace("<agent address2>", dtagent.Rows[0]["a
ddress2"].ToString());
sOutput = sOutput.Replace("&lt;agent address2&gt;", dtagent.Rows
[0]["address2"].ToString());
}
if (dtagent.Rows[0]["city"].ToString().Trim() == "")
{
sOutput = sOutput.Replace("<agent city><br>", "");
sOutput = sOutput.Replace("&lt;agent city&gt;&lt;br&gt;", "");
sOutput = sOutput.Replace("<agent city><br/>", "");
sOutput = sOutput.Replace("&lt;agent city&gt;&lt;br/&gt;", "");
sOutput = sOutput.Replace("<agent city><br />", "");
sOutput = sOutput.Replace("&lt;agent city&gt;&lt;br /&gt;", "");
sOutput = sOutput.Replace("<agent city> <br />", "");
sOutput = sOutput.Replace("&lt;agent city&gt; &lt;br /&gt;", "")
;
sOutput = sOutput.Replace("<agent city>,", "");
sOutput = sOutput.Replace("&lt;agent city&gt;,", "");
sOutput = sOutput.Replace("<agent city> ,", "");
sOutput = sOutput.Replace("&lt;agent city&gt; ,", "");
sOutput = sOutput.Replace("<agent city>", "");
sOutput = sOutput.Replace("&lt;agent city&gt;", "");
}
else
{
sOutput = sOutput.Replace("<agent city>", dtagent.Rows[0]["city"
].ToString());
sOutput = sOutput.Replace("&lt;agent city&gt;", dtagent.Rows[0][
"city"].ToString());
}
sOutput = sOutput.Replace("<agent state>", dtagent.Rows[0]["state"].
ToString());
sOutput.Replace("&lt;agent state&gt;", dtagent.Rows[0]["state"].ToSt
ring());
sOutput = sOutput.Replace("<agent zip>", dtagent.Rows[0]["zip"].ToSt
ring());
sOutput = sOutput.Replace("&lt;agent zip&gt;", dtagent.Rows[0]["zip"
].ToString());
sOutput = sOutput.Replace("<agent country>", dtagent.Rows[0]["countr
y"].ToString());
sOutput = sOutput.Replace("&lt;agent country&gt;", dtagent.Rows[0]["
country"].ToString());
sOutput = sOutput.Replace("<agent phone>", dtagent.Rows[0]["phone"].
ToString());
sOutput = sOutput.Replace("&lt;agent phone&gt;", dtagent.Rows[0]["ph
one"].ToString());
//sOutput = sOutput.Replace("<agent extension>", dtagent.Rows[0]["ph
_extn"].ToString());
// sOutput = sOutput.Replace("&lt;agent extension&gt;", dtagent.Rows
[0]["ph_extn"].ToString());
sOutput = sOutput.Replace("<agent fax>", dtagent.Rows[0]["fax"].ToSt
ring());
sOutput = sOutput.Replace("&lt;agent fax&gt;", dtagent.Rows[0]["fax"
].ToString());
sOutput = sOutput.Replace("<company name>", dtagent.Rows[0]["company
"].ToString());
sOutput = sOutput.Replace("&lt;company name&gt;", dtagent.Rows[0]["c
ompany"].ToString());
sOutput = sOutput.Replace("<float_begin>", "<table><tr><td>");
sOutput = sOutput.Replace("&lt;float_begin&gt;", "<table><tr><td>");
sOutput = sOutput.Replace("<float_end>", "</td></tr></table>");
sOutput = sOutput.Replace("&lt;float_end&gt;", "</td></tr></table>")
;
return sOutput;
}
public int Insert_Template(string strTitle, string strFilename, int intA
ddressbook)
{
string SQL = "";
SQL = "insert into tbl_announ_templates(Category,Title,Filename,Addr
essbook,Created_Date,IsDeleted,corp_id) values ('Saved_Templates','" + strTitle
+ "','" + strFilename + "'," + intAddressbook + ",getdate(),0,null)";
return dbOpr.executenonQuery(SQL);
}
public bool Check_Template(string strTitle, int intAddressbook)
{
string strSQL = "select Title from tbl_announ_templates where Categ
ory = 'Saved_Templates' and title = '" + strTitle + "' and addressbook =" + intA
ddressbook;
string Title = dbOpr.executeScalarQuery(strSQL);
if (Title == "")
{
return (false);
}
else
{
return (true);
}
}
public string dtGetAnnounTitle(int addressBook, string sFileName, string
sCategory)
{
string strSQL = "select replace(convert(varchar,Subcategories,100),'
$',' - ') + ' : ' + Title as Title from tbl_announ_templates a," +
"tbl_Announ_Category b where a.category=b.category a
nd a.Category = '" + sCategory + "' and a.FileName = '" + sFileName + "' and " +
"a.addressbook =" + addressBook;
return dbOpr.executeScalarQuery(strSQL);
}
//1239 end
//Added by Rajmohan for 0000536: 1362: New Module E-Template Builder on
2/6/09 start
public DataTable dtGetEmailBuilderTempCat(int corpid, string demostatus)
{
if (demostatus == "2")
{
demostatus = "1";
}
string SQLStatement = "";
SQLStatement = "select Category,SubCategories,Depth from tbl_EmailBu
ilder_Category where (corp_id like '%," + corpid + ",%' or corp_id is null) and
Is_DemoCategory in(2," + demostatus + ") order by Sort_order";
return (dbOpr.executeQueriesTable(SQLStatement));
}
public DataTable dtGetEmailBuilderTemplates(int addressBook, string sCat
egory, string corpid)
{
string SQLStatement = "";
SQLStatement = "select Title, Filename from tbl_EmailBuilder_Templat
es where addressbook in (0," + addressBook + ") and category='" + sCategory + "'
and (corp_id like '%," + corpid + ",%' or corp_id is null) order by Title asc";
return (dbOpr.executeQueriesTable(SQLStatement));
}
public int Insert_EmailBuilder_Template(string strTitle, string strFilen
ame, int intAddressbook, string strCategory)
{
string SQL = "";
if (strCategory == "")
{
SQL = "insert into tbl_EmailBuilder_Templates(Category,Title,Fil
ename,Addressbook,Created_Date,IsDeleted,corp_id) values ('Saved_Templates','" +
strTitle + "','" + strFilename + "'," + intAddressbook + ",getdate(),0,null)";
}
else
{
SQL = "insert into tbl_EmailBuilder_Templates(Category,Title,Fil
ename,Addressbook,Created_Date,IsDeleted,corp_id) values ('" + strCategory + "',
'" + strTitle + "','" + strFilename + "'," + intAddressbook + ",getdate(),0,null
)";
}
return dbOpr.executenonQuery(SQL);
}
public bool Check__EmailBuilder_Template(string strTitle, int intAddress
book, string strCategory)
{
if (strCategory == "")
{
string strSQL = "select Title from tbl_EmailBuilder_Templates w
here Category = 'Saved_Templates' and title = '" + strTitle + "' and addressbook
=" + intAddressbook;
string Title = dbOpr.executeScalarQuery(strSQL);
if (Title == "")
{
return (false);
}
else
{
return (true);
}
}
else
{
string strSQL = "select Title from tbl_EmailBuilder_Templates w
here Category = '" + strCategory + "' and title = '" + strTitle + "' and address
book =" + intAddressbook;
string Title = dbOpr.executeScalarQuery(strSQL);
if (Title == "")
{
return (false);
}
else
{
return (true);
}
}
}
public string dtGetEmailBuilderTitle(int addressBook, string sFileName,
string sCategory)
{
string strSQL = "select replace(convert(varchar,Subcategories,100),'
$',' - ') + ' : ' + Title as Title from tbl_EmailBuilder_Templates a," +
"tbl_EmailBuilder_Category b where a.category=b.cate
gory and a.Category = '" + sCategory + "' and a.FileName = '" + sFileName + "' a
nd " +
"a.addressbook =" + addressBook;
return dbOpr.executeScalarQuery(strSQL);
}
public int GetEmailBuilderCatDepth(int corpid)
{
string strSQL = "";
strSQL = "select max(Depth) from tbl_EmailBuilder_Category where cor
p_id like '%," + corpid + ",%' or corp_id is null";
return int.Parse(dbOpr.executeScalarQuery(strSQL));
}
public string GetEmailBuilderPath(string sAnnouncat)
{
string strSQL = "";
strSQL = "select subcategories from tbl_EmailBuilder_Category where
category='" + sAnnouncat + "'";
return dbOpr.executeScalarQuery(strSQL);
}
//Added by Rajmohan for 0000536: 1362: New Module E-Template Builder on
2/6/09 End
public string GetstrAgentURL(int AddressBook)
{
string strSQL = "";
strSQL = "select agenturl from tblmembers where addressbook= " + Add
ressBook;
return dbOpr.executeScalarQuery(strSQL);
}
public int GetAnnounCatDepth(int corpid)
{
string strSQL = "";
strSQL = "select max(Depth) from tbl_Announ_Category where corp_id l
ike '%," + corpid + ",%' or corp_id is null";
return int.Parse(dbOpr.executeScalarQuery(strSQL));
}
public string GetAnnounPath(string sAnnouncat)
{
string strSQL = "";
strSQL = "select subcategories from tbl_Announ_Category where catego
ry='" + sAnnouncat + "'";
return dbOpr.executeScalarQuery(strSQL);
}
//Ticket NO:1336 Ability for agents to use real email address Technical
document 3.G(Project 300 agent creations from Manager Stat.) Start
public string getagentname(string agentname, string corpid, string addre
ssbook)
{
string sqlQuery = "", Corpfeature = "", Userfeature = "", RealEmail
= "", Feature = "";
sqlQuery = "select isnull(INT_RealEmail,10) as Userfeature from tblu
serfeatures where addressbook = " + addressbook;
Userfeature = dbOpr.executeScalarQuery(sqlQuery);
if (Userfeature == "10")
{
sqlQuery = "select isnull(INT_RealEmail,1) as Corpfeature from t
blcorpfeatures where corp_id = " + corpid;
Corpfeature = dbOpr.executeScalarQuery(sqlQuery);
if (Corpfeature == "2")
{
sqlQuery = "";
sqlQuery = "select isnull(INT_RealEmailUser,1) as Feature fr
om tbluserfeatures where addressbook = " + addressbook;
Feature = dbOpr.executeScalarQuery(sqlQuery);
if (Feature == "2")
{
sqlQuery = "select emailaddress from tblmembers where ad
dressbook = " + addressbook;
RealEmail = dbOpr.executeScalarQuery(sqlQuery);
}
}
}
else if (Userfeature == "2")
{
sqlQuery = "";
sqlQuery = "select isnull(INT_RealEmailUser,1) as Feature from t
bluserfeatures where addressbook = " + addressbook;
Feature = dbOpr.executeScalarQuery(sqlQuery);
if (Feature == "2")
{
sqlQuery = "select emailaddress from tblmembers where addres
sbook = " + addressbook;
RealEmail = dbOpr.executeScalarQuery(sqlQuery);
}
}
return (RealEmail);
}
//Ticket NO:1336 Ability for agents to use real email address Technical
document 3.G(Project 300 agent creations from Manager Stat.) End
public string sSmtpETemplateText(int intCorpID, string intAddressBook, s
tring Guid, string sETemplateDetails)
{
string comp_Text, HTKP_DISCLAIMER, strSQL, Aux1;
string DiscText, strEmailBody, SMTPEmail, gblOptOutMsg, strOptout, s
trUpperBoundary, strLowerBoundary, agentdisc, sqlQuery = "";
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,\nplease€visit:\n";
sqlQuery = "select isnull(disclaimer,'')as agentdisc from tblmembers
where addressbook=" + intAddressBook;
agentdisc = dbOpr.executeScalarQuery(sqlQuery);
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 (iGetFeatures("INT_HO_Template", Convert.ToInt16(intAddressBook),
intCorpID) == 2)
agentdisc = "";
else
agentdisc = agentdisc + "\n\n";
if (intCorpID == 157)
{
DiscText = sGetAXA_Disclaimer(intAddressBook) + "\n\n" + sGetGlo
balDisclaimerText("et_disclaimer", intCorpID);
}
else if (intCorpID == 127)
{
if (Aux1 == "1")
{
DiscText = "<br>" + HTKP_DISCLAIMER + "<br>" + sGetGlobalDis
claimerText("et_disclaimer", intCorpID);
}
else
{
DiscText = sGetGlobalDisclaimerText("et_disclaimer", intCorp
ID);
}
}
else
{
DiscText = sGetGlobalDisclaimerText("et_disclaimer", intCorpID);
}
if ((DiscText == "") || (DiscText == "\n\n"))
{
DiscText = agentdisc + sGetGlobalDisclaimerText("et_disclaimer",
intCorpID);
strOptout = gblOptOutMsg + "##DOMAIN_URL##/0/?d=#month-and-year#
&r=#SEND_ID#";
DiscText = InsertBreak(DiscText);
strEmailBody = sETemplateDetails + "\n\n" + DiscText + "\n\n" +
strOptout + " \n\n";
}
else
{
strOptout = "##DOMAIN_URL##/0/?d=#month-and-year#&r=#SEND_ID#";
DiscText = InsertBreak(DiscText);
if (DiscText.Contains(comp_Text))
{
strEmailBody = sETemplateDetails + "\n\n" + agentdisc + Disc
Text + "\n\n";
strEmailBody = strEmailBody.Replace(comp_Text, strOptout);
}
else
{
strEmailBody = sETemplateDetails + "\n\n" + agentdisc + Disc
Text + "\n\n" + strOptout + " \n\n";
}
}
strEmailBody = strEmailBody.Replace("'", "''");
strEmailBody = strEmailBody.Replace("response_e-template.aspx", "##D
OMAIN_URL##/Gmailer/response_e-template.aspx");
SMTPEmail = strUpperBoundary + strEmailBody + "#SendersCopy_List_Tex
t#" + strLowerBoundary;
SMTPEmail = SMTPEmail.Replace("<contact first name>", "&lt;contact f
irst name&gt;");//Added by rajmohan for 0000569: 1393: HTML builder enhancement
on 14 - 7 - 2009
SMTPEmail = SMTPEmail.Replace("<br>", "\n");
SMTPEmail = RemoveHTML(SMTPEmail);
return SMTPEmail;
}
public string sSmtpETemplateQueue(int intCorpID, string intAddressBook,
string sSmtpEmailText, string Guid, string sETemplateDetails)
{
string comp_Text, strUpperHtmlBoundary, strLowerBoundary, HTKP_DISCL
AIMER, strSQL, Aux1;
string DiscText, strEmailBody, SMTPEmail, gblOptOutMsg, strOptout, a
gentdisc, sqlQuery = "", LtdWdth = "25%", CtdWdth = "65%";
int INT_HO_Template = 0;
strUpperHtmlBoundary = "------=_NextPart_" + Guid + "\nContent-Type:
text/html;charset=iso-8859-1\nContent-Transfer-Encoding: 7bit\n\n";
strLowerBoundary = "\n------=_NextPart_" + Guid + "--";
comp_Text = "$#Opt_Out_Link";
gblOptOutMsg = "<br><br><b>NOTE:</b><br>If you do not wish to receiv
e e-mail from us in the future, please€visit:<br>";
sqlQuery = "select isnull(disclaimer,'')as agentdisc from tblmembers
where addressbook=" + intAddressBook;
agentdisc = dbOpr.executeScalarQuery(sqlQuery);
agentdisc = agentdisc.Replace("\r\n", "<br>");
INT_HO_Template = iGetFeatures("INT_HO_Template", Convert.ToInt16(in
tAddressBook), intCorpID);
if (INT_HO_Template == 2)
{
agentdisc = "";
LtdWdth = "15%";
CtdWdth = "75%";
}
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);
string sETemplateDetailLink = "<img src=''##DOMAIN_URL##/Gmailer/et.
aspx?d=#month-and-year#&amp;req=#SEND_ID#'' alt='' '' width=''1px'' height=''1px
''>";
if (intCorpID == 157)
{
DiscText = sGetAXA_Disclaimer(intAddressBook) + "<br><br>" + sGe
tGlobalDisclaimerText("et_disclaimer", intCorpID);
}
else if (intCorpID == 127)
{
if (Aux1 == "1")
{
DiscText = "<br>" + HTKP_DISCLAIMER + "<br>" + sGetGlobalDis
claimerText("et_disclaimer", intCorpID);
}
else
{
DiscText = sGetGlobalDisclaimerText("et_disclaimer", intCorp
ID);
}
}
else
{
DiscText = sGetGlobalDisclaimerText("et_disclaimer", intCorpID);
}
DiscText = DiscText.Replace("\r\n", "<br>");
if ((DiscText == "") || (DiscText == "<br><br>"))
{
if (agentdisc == "")
DiscText = agentdisc + "<br><br>" + sGetGlobalDisclaimerText
("et_disclaimer", intCorpID);
else
DiscText = sGetGlobalDisclaimerText("et_disclaimer", intCorp
ID);
strOptout = gblOptOutMsg + "<a href=\"##DOMAIN_URL##/0/?d=#month
-and-year#&amp;r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&amp;r=#SEND_ID
#</a>";
if (INT_HO_Template == 2)
DiscText = DiscText.TrimStart('<', 'B', 'R', '>').TrimStart(
'<', 'b', 'r', '>');
if ((DiscText == "") || (DiscText == "<br><br>"))
strEmailBody = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0
Transitional//EN\" >" + sETemplateDetails + "<table width='100%'><tr><td width=
'" + LtdWdth + "'></td><td width='" + CtdWdth + "'><p style='font-size: 10pt; fo
nt-family: Arial;color:Black;'>" + strOptout + "</p></td><td width='10%'></td></
tr></table></div> \n \n #SendersCopy_List# \n \n" + sETemplateDetailLink + "</bo
dy></html>";
else
strEmailBody = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0
Transitional//EN\" >" + sETemplateDetails + "<table width='100%'><tr><td width=
'" + LtdWdth + "'></td><td width='" + CtdWdth + "'><p style='font-size: 10pt; fo
nt-family: Arial;color:Black;'>" + DiscText + "</p><p style='font-size: 10pt; fo
nt-family: Arial;color:Black;'>" + strOptout + "</p></td><td width='10%'></td></
tr></table></div> \n \n #SendersCopy_List# \n \n" + sETemplateDetailLink + "</bo
dy></html>";
}
else
{
strOptout = "<a href=\"##DOMAIN_URL##/0/?d=#month-and-year#&amp;
r=#SEND_ID#\">##DOMAIN_URL##/0/?d=#month-and-year#&amp;r=#SEND_ID#</a>";
if (DiscText.Contains(comp_Text))
{
strEmailBody = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0
Transitional//EN\" >" + sETemplateDetails + "<p><table width='100%'><tr><td wid
th='" + LtdWdth + "'></td><td width='" + CtdWdth + "' align='left'><p style='fon
t-size: 10pt; font-family: Arial;color:Black;'>" + agentdisc + "</p><p style='fo
nt-size: 10pt; font-family: Arial;color:Black;'>" + DiscText + "</p><br></td><td
width='10%'></td></tr></table></div> \n \n #SendersCopy_List# \n \n" + sETempla
teDetailLink + "</body></html>";
strEmailBody = strEmailBody.Replace(comp_Text, strOptout);
}
else
{
strEmailBody = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0
Transitional//EN\" >" + sETemplateDetails + "<p><table width='100%'><tr><td wid
th='" + LtdWdth + "'></td><td width='" + CtdWdth + "' align='left'><p style='fon
t-size: 10pt; font-family: Arial;color:Black;'>" + agentdisc + "</p><p style='fo
nt-size: 10pt; font-family: Arial;color:Black;'>" + DiscText + "</p><p style='fo
nt-size: 10pt; font-family: Arial;color:Black;'>" + strOptout + "</p></td><td wi
dth='10%'></td></tr></table></div> \n \n #SendersCopy_List# \n \n" + sETemplateD
etailLink + "</body></html>";
}
}
strEmailBody = strEmailBody.Replace("'", "''");
strEmailBody = strEmailBody.Replace("response_e-template.aspx", "##D
OMAIN_URL##/Gmailer/response_e-template.aspx");
//Modified by Ezhil for Ticket no 1362 on 31/07/2009 Start
//for multipartmail
sSmtpEmailText = sSmtpEmailText.Replace(strLowerBoundary.TrimStart()
, strUpperHtmlBoundary);
SMTPEmail = sSmtpEmailText + "\n \n" + strEmailBody + "\n \n" + strL
owerBoundary.TrimStart();
//End
//Modified by Ezhil for Ticket no 1362 on 31/07/2009 End
return SMTPEmail;
}
// Modified by rajmohan for 000542: 1371: Future send for agent pdf uplo
ad in financial article showing HO expired, note no.: 0008939 on 6/6/09 start
public string dtgetnewsletID(string BatchID)
{
string strSQL;
strSQL = "select NewsLetterID from tblHistoryemail where BatchID= '"
+ BatchID + "'";
return dbOpr.executeScalarQuery(strSQL);
}
// Modified by rajmohan for 000542: 1371: Future send for agent pdf uplo
ad in financial article showing HO expired, note no.: 0008939 on 6/6/09 end
public DataTable sETemplate_AddtionalFields(string batchID)
{
string SQLStatement = "SELECT * FROM tblHistorySummary WHERE batchID
= '" + batchID + "'";
return (dbOpr.executeQueriesTable(SQLStatement));
}
public int Get_eTemplateDemoStatus(int addressBook, int corpid)
{
int Demostatus = 0, corpstatus = 0, UserStatus = 0;
string SQLStatement = "";
SQLStatement = "select INT_ETemplate_Demo from tblCorpFeatures where
corp_id=" + corpid;
corpstatus = int.Parse(dbOpr.executeScalarQuery(SQLStatement));
SQLStatement = "select INT_ETemplate_Demo from tbluserFeatures where
addressBook=" + addressBook;
UserStatus = int.Parse(dbOpr.executeScalarQuery(SQLStatement));
if (corpstatus != 0 && UserStatus != 0)
{
Demostatus = UserStatus;
}
return Demostatus;
}
//Modified by rajmohan for 0000569: 1393: HTML builder enhancement on 08
/07/09 start
public DataTable GetProfileDetails(int iAddressbook)
{
string sQuery;
DataTable agent = new DataTable();
sQuery = "select firstName,agentImage,firstName + ' ' + lastName as
agentname,address1,address2,city,state,zip,dbo.formatPhonenumber(phone,'','1',co
rp_id) as phone,fax,emailaddress,agenturl,compLogoimage,company from tblmembers
where addressbook=" + iAddressbook;
return dbOpr.executeQueriesTable(sQuery);
}
//Modified by rajmohan for 0000569: 1393: HTML builder enhancement on 08
/07/09 end
//Modified by rajmohan for 0000569: 1393: HTML builder enhancement on 09
/07/09 start
public string PullAgentDetailsDemo(int iAddressbook, string sInput, stri
ng sRoot)
{
string sLblPhone = System.Configuration.ConfigurationSettings.AppSet
tings["sLblPhone"].ToString();
string sLblFax = System.Configuration.ConfigurationSettings.AppSetti
ngs["sLblFax"].ToString();
string sOutput;
sOutput = sInput;
DataTable dtagent = new DataTable();
dtagent = dbOpr.executeQueriesTable("select isnull(compLogoimage,'')
as compLogoimage, isnull(agentImage,'') as agentImage,firstName + ' ' + lastNam
e as agentname,firstName,emailaddress,appearsAs,agentUrl,address1,address2,city,
state,zip,country,dbo.formatPhonenumber(phone,'','1',corp_id) as phone,ph_extn,f
ax,company,corp_id from tblmembers where addressbook=" + iAddressbook);
if (dtagent.Rows[0]["corp_id"].ToString().Trim() != "157")
{
sLblFax = "";
sLblPhone = "";
}
//sOutput = sOutput.Replace("<contact first name>", dtagent.Rows[0][
"firstName"].ToString());
//sOutput = sOutput.Replace("&lt;contact first name&gt;", dtagent.Ro
ws[0]["firstName"].ToString());
if (dtagent.Rows[0]["agentImage"].ToString().Trim() == "")
{
sOutput = sOutput.Replace("<agent photo>", "");
sOutput = sOutput.Replace("&lt;agent photo&gt;<br />", "");
sOutput = sOutput.Replace("&lt;agent photoo&gt;", "");
}
else
{
sOutput = sOutput.Replace("<agent photo>", "<img src='" + sRoot
+ "/ErPlus/Agent_photo/" + dtagent.Rows[0]["agentImage"].ToString() + ".jpg'>");
sOutput = sOutput.Replace("&lt;agent photo&gt;", "<img src='" +
sRoot + "/ErPlus/Agent_photo/" + dtagent.Rows[0]["agentImage"].ToString() + ".jp
g'>");
}
sOutput = sOutput.Replace("<agent name>", dtagent.Rows[0]["agentname
"].ToString());
sOutput = sOutput.Replace("&lt;agent name&gt;", dtagent.Rows[0]["age
ntname"].ToString());
sOutput = sOutput.Replace("<agent address1>", dtagent.Rows[0]["addre
ss1"].ToString());
sOutput = sOutput.Replace("&lt;agent address1&gt;", dtagent.Rows[0][
"address1"].ToString());
if (dtagent.Rows[0]["address2"].ToString().Trim() == "")
{
sOutput = sOutput.Replace("<agent address2><br>", "");
sOutput = sOutput.Replace("&lt;agent address2&gt;&lt;br&gt;", ""
);
sOutput = sOutput.Replace("<agent address2> <br />", "");
sOutput = sOutput.Replace("&lt;agent address2&gt; &lt;br /&gt;",
"");
sOutput = sOutput.Replace("<agent address2><br />", "");
sOutput = sOutput.Replace("&lt;agent address2&gt;&lt;br /&gt;",
"");
sOutput = sOutput.Replace("<agent address2><br/>", "");
sOutput = sOutput.Replace("&lt;agent address2&gt;&lt;br/&gt;", "
");
sOutput = sOutput.Replace("&lt;agent address2&gt;<br />", "");
sOutput = sOutput.Replace("<agent address2>", "");
sOutput = sOutput.Replace("&lt;agent address2&gt;", "");
}
else
{
sOutput = sOutput.Replace("<agent address2>", dtagent.Rows[0]["a
ddress2"].ToString());
sOutput = sOutput.Replace("&lt;agent address2&gt;", dtagent.Rows
[0]["address2"].ToString());
}
if (dtagent.Rows[0]["city"].ToString().Trim() == "")
{
sOutput = sOutput.Replace("<agent city><br>", "");
sOutput = sOutput.Replace("&lt;agent city&gt;&lt;br&gt;", "");
sOutput = sOutput.Replace("<agent city><br/>", "");
sOutput = sOutput.Replace("&lt;agent city&gt;&lt;br/&gt;", "");
sOutput = sOutput.Replace("<agent city><br />", "");
sOutput = sOutput.Replace("&lt;agent city&gt;&lt;br /&gt;", "");
sOutput = sOutput.Replace("<agent city> <br />", "");
sOutput = sOutput.Replace("&lt;agent city&gt; &lt;br /&gt;", "")
;
sOutput = sOutput.Replace("<agent city>,", "");
sOutput = sOutput.Replace("&lt;agent city&gt;,", "");
sOutput = sOutput.Replace("<agent city> ,", "");
sOutput = sOutput.Replace("&lt;agent city&gt; ,", "");
sOutput = sOutput.Replace("&lt;agent city&gt;<br />", "");
sOutput = sOutput.Replace("<agent city>", "");
sOutput = sOutput.Replace("&lt;agent city&gt;", "");
}
else
{
sOutput = sOutput.Replace("<agent city>", dtagent.Rows[0]["city"
].ToString());
sOutput = sOutput.Replace("&lt;agent city&gt;", dtagent.Rows[0][
"city"].ToString());
}
sOutput = sOutput.Replace("<agent state>", dtagent.Rows[0]["state"].
ToString());
sOutput = sOutput.Replace("&lt;agent state&gt;", dtagent.Rows[0]["st
ate"].ToString());
if (dtagent.Rows[0]["zip"].ToString().Trim() == "")
{
sOutput = sOutput.Replace("<agent zip><br>", "");
sOutput = sOutput.Replace("&lt;agent zip&gt;&lt;br&gt;", "");
sOutput = sOutput.Replace("<agent zip><br/>", "");
sOutput = sOutput.Replace("&lt;agent zip&gt;&lt;br/&gt;", "");
sOutput = sOutput.Replace("<agent zip><br />", "");
sOutput = sOutput.Replace("&lt;agent zip&gt;&lt;br /&gt;", "");
sOutput = sOutput.Replace("<agent zip> <br />", "");
sOutput = sOutput.Replace("&lt;agent zip&gt; &lt;br /&gt;", "");
sOutput = sOutput.Replace("<agent zip>,", "");
sOutput = sOutput.Replace("&lt;agent zip&gt;,", "");
sOutput = sOutput.Replace("<agent zip> ,", "");
sOutput = sOutput.Replace("&lt;agent zip&gt; ,", "");
sOutput = sOutput.Replace("&lt;agent zip&gt;<br />", "");
sOutput = sOutput.Replace("<agent zip>", "");
sOutput = sOutput.Replace("&lt;agent zip&gt;", "");
}
else
{
sOutput = sOutput.Replace("<agent zip>", dtagent.Rows[0]["zip"].
ToString());
sOutput = sOutput.Replace("&lt;agent zip&gt;", dtagent.Rows[0]["
zip"].ToString());
}
sOutput = sOutput.Replace("<agent phone>", sLblPhone + dtagent.Rows[
0]["phone"].ToString());
sOutput = sOutput.Replace("&lt;agent phone&gt;", sLblPhone + dtagent
.Rows[0]["phone"].ToString());
if (dtagent.Rows[0]["fax"].ToString().Trim() == "")
{
sOutput = sOutput.Replace("<agent fax><br>", "");
sOutput = sOutput.Replace("&lt;agent fax&gt;&lt;br&gt;", "");
sOutput = sOutput.Replace("<agent fax><br/>", "");
sOutput = sOutput.Replace("&lt;agent fax&gt;&lt;br/&gt;", "");
sOutput = sOutput.Replace("<agent fax><br />", "");
sOutput = sOutput.Replace("&lt;agent fax&gt;&lt;br /&gt;", "");
sOutput = sOutput.Replace("<agent fax> <br />", "");
sOutput = sOutput.Replace("&lt;agent fax&gt; &lt;br /&gt;", "");
sOutput = sOutput.Replace("<agent fax>,", "");
sOutput = sOutput.Replace("&lt;agent fax&gt;,", "");
sOutput = sOutput.Replace("<agent fax> ,", "");
sOutput = sOutput.Replace("&lt;agent fax&gt; ,", "");
sOutput = sOutput.Replace("&lt;agent fax&gt;<br />", "");
sOutput = sOutput.Replace("<agent fax>", "");
sOutput = sOutput.Replace("&lt;agent fax&gt;", "");
}
else
{
sOutput = sOutput.Replace("<agent fax>", sLblFax + dtagent.Rows[
0]["fax"].ToString());
sOutput = sOutput.Replace("&lt;agent fax&gt;", sLblFax + dtagent
.Rows[0]["fax"].ToString());
}
sOutput = sOutput.Replace("<profile email>", dtagent.Rows[0]["emaila
ddress"].ToString());
sOutput = sOutput.Replace("&lt;profile email&gt;", dtagent.Rows[0]["
emailaddress"].ToString());
if (dtagent.Rows[0]["agentUrl"].ToString().Trim() == "")
{
sOutput = sOutput.Replace("<profile website><br>", "");
sOutput = sOutput.Replace("&lt;profile website&gt;&lt;br&gt;", "
");
sOutput = sOutput.Replace("<profile website><br/>", "");
sOutput = sOutput.Replace("&lt;profile website&gt;&lt;br/&gt;",
"");
sOutput = sOutput.Replace("<profile website><br />", "");
sOutput = sOutput.Replace("&lt;profile website&gt;&lt;br /&gt;",
"");
sOutput = sOutput.Replace("<profile website> <br />", "");
sOutput = sOutput.Replace("&lt;profile website&gt; &lt;br /&gt;"
, "");
sOutput = sOutput.Replace("<profile website>,", "");
sOutput = sOutput.Replace("&lt;profile website&gt;,", "");
sOutput = sOutput.Replace("<profile website> ,", "");
sOutput = sOutput.Replace("&lt;profile website&gt; ,", "");
sOutput = sOutput.Replace("&lt;profile website&gt;<br />", "");
sOutput = sOutput.Replace("<profile website>", "");
sOutput = sOutput.Replace("&lt;profile website&gt;", "");
}
else
{
sOutput = sOutput.Replace("<profile website>", dtagent.Rows[0]["
agentUrl"].ToString());
sOutput = sOutput.Replace("&lt;profile website&gt;", dtagent.Row
s[0]["agentUrl"].ToString());
}
if (dtagent.Rows[0]["compLogoimage"].ToString().Trim() == "")
{
sOutput = sOutput.Replace("<company logo>", "&nbsp;");
sOutput = sOutput.Replace("&lt;company logo&gt;<br />", "");
sOutput = sOutput.Replace("&lt;company logo&gt;", "");
}
else
{
sOutput = sOutput.Replace("<company logo>", "<img src='" + sRoot
+ "/ErPlus/Company_Logo/" + dtagent.Rows[0]["compLogoimage"].ToString() + ".jpg
'>");
sOutput = sOutput.Replace("&lt;company logo&gt;", "<img src='" +
sRoot + "/ErPlus/Company_Logo/" + dtagent.Rows[0]["compLogoimage"].ToString() +
".jpg'>");
}
if (dtagent.Rows[0]["company"].ToString().Trim() == "")
{
sOutput = sOutput.Replace("<company name><br>", "");
sOutput = sOutput.Replace("&lt;company name&gt;&lt;br&gt;", "");
sOutput = sOutput.Replace("<company name><br/>", "");
sOutput = sOutput.Replace("&lt;company name&gt;&lt;br/&gt;", "")
;
sOutput = sOutput.Replace("<company name><br />", "");
sOutput = sOutput.Replace("&lt;company name&gt;&lt;br /&gt;", ""
);
sOutput = sOutput.Replace("<company name> <br />", "");
sOutput = sOutput.Replace("&lt;company name&gt; &lt;br /&gt;", "
");
sOutput = sOutput.Replace("<company name>,", "");
sOutput = sOutput.Replace("&lt;company name&gt;,", "");
sOutput = sOutput.Replace("<company name> ,", "");
sOutput = sOutput.Replace("&lt;company name&gt; ,", "");
sOutput = sOutput.Replace("&lt;company name&gt;<br />", "");
sOutput = sOutput.Replace("<company name>", "");
sOutput = sOutput.Replace("&lt;company name&gt;", "");
}
else
{
sOutput = sOutput.Replace("<company name>", dtagent.Rows[0]["com
pany"].ToString());
sOutput = sOutput.Replace("&lt;company name&gt;", dtagent.Rows[0
]["company"].ToString());
}
return sOutput;
}
//Modified by rajmohan for 0000569: 1393: HTML builder enhancement on 09
/07/09 end
//Modified by rajmohan for 0000569: 1393: HTML builder enhancement on 10
/07/09 start
public string GetETemplateSupervisor(string addressbook, int corpid)
{
string SQLStatement = null, sAddress = null;
SQLStatement = "select INT_ETemplate_Demo from tblCorpFeatures where
corp_id=" + corpid;
int corpstatus = int.Parse(dbOpr.executeScalarQuery(SQLStatement));
if (corpstatus == 1)
{
string StrSql = "select addressbook from tbluserFeatures where I
NT_ETemplate_Demo=1 and addressbook in (select addressbook from tblmembers where
corp_id=" + corpid + ")";
sAddress = dbOpr.executeScalarQuery(StrSql);
if (sAddress == "")
{
return addressbook;
}
else
{
return sAddress;
}
}
else
{
return addressbook;
}
}
//Modified by rajmohan for 0000569: 1393: HTML builder enhancement on 10
/07/09 end
public string GetFirmDes(string iuserID, int iAddressbook)
{
string strSQL = "select top 1 categoryDesc from Tblcategorylist wher
e CategoryType = 1 and id in (select categoryID from tblusercategory where addre
ssbook =" + iAddressbook + " and userID =" + iuserID + ")";
return (dbOpr.executeScalarQuery(strSQL));
}
public string GetHTMLMastHead(string addressbook, int corpid)
{
string sSQl = "select top 1 htmlmasthead from tbl_htmlmasthead where
corpid =" + corpid + " and addressbook in (0, " + addressbook + ") order by add
ressbook desc";
return (dbOpr.executeScalarQuery(sSQl));
}
public string dtGetInternalBccTarget(int inAddressBook)
{
string strSQL = "";
strSQL = "select i.emailaddress as Internal_EmailAddress from Tblmem
ber_Internals m, Tbl_Internals i where i.isActive=1 and bcc_response=1 and m.int
ernalid=i.internalid and m.addressbook=" + inAddressBook + "";
return (dbOpr.executeScalarQuery(strSQL));
}
//Modified by rajmohan for 0000640: 1440: field office opt-out vs global
optout on 13/10/09 Start
public string dtGetAgencyNo(int intAddressBook)
{
string strSQL = "";
strSQL = "SELECT officenumber FROM tblMembers WHERE AddressBook = "
+ intAddressBook;
return (dbOpr.executeScalarQuery(strSQL));
}
//Modified by rajmohan for 0000640: 1440: field office opt-out vs global
optout on 13/10/09 End
public bool blnGetisSubLock(int intCorpID)
{
string SQLStatement = "select isnull(isSubLock,0)as isSubLock from t
blCorp where corp_id= " + intCorpID;
if (dbOpr.executeScalarQuery(SQLStatement) == "True")
{
return true;
}
else
{
return false;
}
}
public DataTable dtGetAgentlistRMScsv(string catid, int intAddressBook)
{
string strSQL = " select ltrim(rtrim(isnull(ext.DearName,''))) as De
arName," +
" ltrim(rtrim(isnull(adb.Prefix,''))) as Prefix," +
" ltrim(rtrim(adb.firstname)) as FirstName,ltrim(rtr
im(adb.lastname)) as LastName, " +
" ltrim(rtrim(isnull(adb.Suffix,''))) as Suffix, " +
" ltrim(rtrim(isnull(ext.company,''))) as CompanyNam
e, " +
" ltrim(rtrim(isnull(ext.address1,''))) as AddressLi
ne1, " +
" ltrim(rtrim(isnull(ext.address2,''))) as AddressLi
ne2, " +
" ltrim(rtrim(isnull(ext.city,''))) as City, " +
" ltrim(rtrim(isnull((select top 1 state as state fr
om state where code = ext.state),''))) as StateProvince, " +
" ltrim(rtrim(isnull(ext.zip,''))) as PostalCode, "
+
" CASE WHEN adb.emailAddress like '%noemailaddress.v
oid' THEN '' ELSE adb.emailAddress END as EmailAddress, " +
" ltrim(rtrim(isnull(adb.home_phone,''))) as PhoneNu
mber, " +
" ltrim(rtrim(isnull(adb.bus_phone,''))) as FaxNumbe
r, " +
" ltrim(rtrim(isnull(adb.other_phone,''))) as CellNu
mber ";

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;

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 + ',' + t
blConcepts.industry in " +
"(select Datakeys from (select tblConcepts.conceptid
,tblConcepts.industry,tblConcepts.conceptID + ',' + tblConcepts.industry as Data
keys, " +
"isnull(tblConcepts.conceptname,'')+'$#$'+isnull(tbl
Concepts.title,'') as conceptname,addressbook 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 subst
ring(tblConcepts.industry,1,3)<>'Rec' and (tblConcepts.active='1' and " +
"((datediff(day,expdate, getdate())<=0)or(isnull((co
nvert(char(26),expdate,101)),'0')='0'))) where addressbook= " + intAddressBook +
")dg1 " +
"left join (select conceptid , ltrim(rtrim(industry)
) as industry,GroupID from tbl_Group_Concepts where groupid in(select id from Tb
l_SB_Groups where corp_id=157) " +
"and industry in(select ltrim(rtrim(industry)) from
tblcorp_categories where corp_id=157 and ltrim(rtrim(industry))<>'0' union selec
t corp_industry as industry from tblcorp where corp_id=157))dg2 " +
"on dg1.conceptid = dg2.conceptid and ltrim(rtrim
(dg1.industry)) = ltrim(rtrim(dg2.industry)) where addressbook= " + intAddressB
ook + " and GroupID is null) and 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 conceptid,Datakeys,conceptname,GroupID f
rom (" +
// "select distinct (tblConcepts.conceptID + ',' +tblConcepts
.industry) as datakeys,isnull(tblConcepts.conceptname,'')+'$#$'+isnull(tblConcep
ts.title,'') as conceptname,addressbook,isnull(GroupID,'0') as GroupID " +
// "from tblConcepts, tblmembers " +
// "where ((tblConcepts.industry=tblmembers.indus
try and substring(tblmembers.industry,1,3)<>'Rec')" +
// "or (tblConcepts.industry=tblmembers.industry2
and substring(tblmembers.industry2,1,3)<>'Rec') " +
// "or (tblConcepts.industry=tblmembers.industry3
and substring(tblmembers.industry3,1,3)<>'Rec')) " +
// "and (tblConcepts.active='1' and " +
// "((datediff(day,expdate, getdate())<=0)or(isnu
ll((convert(char(26),expdate,101)),'0')='0')))" +
// "and tblconcepts.conceptid not in (select conceptid from t
bl_Group_Concepts where groupid in(select id from Tbl_SB_Groups where corp_id=15
7) and industry in" +
// "(select ltrim(rtrim(industry)) from tblcorp_categories w
here corp_id=157 and ltrim(rtrim(industry))<>'0' union select corp_industry as i
ndustry from tblcorp where corp_id=157))" +
// " left join (select conceptid , ltrim(rtrim(in
dustry)) as industry,GroupID from tbl_Group_Concepts where groupid in(select id
from Tbl_SB_Groups where corp_id=157) " +
// " and industry in(select ltrim(rtrim(industry)) fr
om tblcorp_categories where corp_id=157 and ltrim(rtrim(industry))<>'0' " +
// " union select corp_industry as industry from tblc
orp where corp_id=157))dg on tblconcepts.conceptid = dg.conceptid and ltrim(rt
rim(tblconcepts.industry)) = ltrim(rtrim(dg.industry))" +
// " where addressbook=" + intAddressBook + ")dd wher
e GroupID = 0 ORDER BY conceptName";
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.industry an
d substring(tblmembers.industry,1,3)<>'Rec')" +
"or (tblConcepts.industry=tblmembers.industry2 and s
ubstring(tblmembers.industry2,1,3)<>'Rec') " +
"or (tblConcepts.industry=tblmembers.industry3 and s
ubstring(tblmembers.industry3,1,3)<>'Rec')) " +
"and (tblConcepts.active='1' and " +
"((datediff(day,expdate, getdate())<=0)or(isnull((co
nvert(char(26),expdate,101)),'0')='0'))) and tblConcepts.conceptID + ',' + tblCo
ncepts.industry in " +
"(select Datakeys from (select distinct (tblConcepts
.conceptID + ',' +tblConcepts.industry) as datakeys,tblConcepts.conceptID,tblCo
ncepts.industry,isnull(tblConcepts.conceptname,'')+'$#$'+isnull(tblConcepts.titl
e,'') as conceptname, " +
"addressbook from tblConcepts, tblmembers where ((tb
lConcepts.industry=tblmembers.industry and substring(tblmembers.industry,1,3)<>'
Rec') " +
"or (tblConcepts.industry=tblmembers.industry2 and s
ubstring(tblmembers.industry2,1,3)<>'Rec') or (tblConcepts.industry=tblmembers.i
ndustry3 and substring(tblmembers.industry3,1,3)<>'Rec')) " +
"and (tblConcepts.active='1' and ((datediff(day,expd
ate, getdate())<=0)or(isnull((convert(char(26),expdate,101)),'0')='0'))) and tbl
concepts.conceptid not in (select conceptid from tbl_Group_Concepts where groupi
d in(select id from Tbl_SB_Groups where corp_id=157) and industry in " +
"(select ltrim(rtrim(industry)) from tblcorp_categor
ies where corp_id=157 and ltrim(rtrim(industry))<>'0' union select corp_industry
as industry from tblcorp where corp_id=157)))dg1 " +
"left join (select conceptid , ltrim(rtrim(industry)
) as industry,GroupID from tbl_Group_Concepts where groupid in(select id from Tb
l_SB_Groups where corp_id=157) " +
"and industry in(select ltrim(rtrim(industry)) from
tblcorp_categories where corp_id=157 and ltrim(rtrim(industry))<>'0' union selec
t corp_industry as industry from tblcorp where corp_id=157))dg2 " +
"on dg1.conceptid = dg2.conceptid and ltrim(rtrim(
dg1.industry)) = ltrim(rtrim(dg2.industry)) where addressbook= " + intAddressBoo
k + " and GroupID is null) ";
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_cate
gories.categoryid=tblcorp_categories.categoryid " +
"inner join tblConcepts on tblConcepts.industry
=ltrim(tblcorp_categories.industry) and substring(tblConcepts.industry,1,3)<>'Re
c' and (tblConcepts.active='1' and" +
"((datediff(day,expdate, getdate())<0)or(isnull
((convert(char(26),expdate,101)),'0')='0'))) and tblconcepts.conceptid not in (s
elect conceptid from tbl_Group_Concepts where groupid in(select id from Tbl_SB_G
roups where corp_id=" + corp_id + ") and industry in" +
"(select ltrim(rtrim(industry)) from tblcorp_ca
tegories where corp_id=" + corp_id + " and ltrim(rtrim(industry))<>'0' union sel
ect corp_industry as industry from tblcorp where corp_id=" + corp_id + ")) " +
"where addressbook=" + intAddressBook + " " +
"union " +
"select distinct (tblConcepts.conceptID + ',' +
tblConcepts.industry) as Datakeys,isnull(tblConcepts.conceptname,'')+'$#$'+isnul
l(tblConcepts.title,'') as conceptname " +
"from tblConcepts, tblmembers " +
"where ((tblConcepts.industry=tblmembers.indust
ry and substring(tblmembers.industry,1,3)<>'Rec')" +
"or (tblConcepts.industry=tblmembers.industry2
and substring(tblmembers.industry2,1,3)<>'Rec') " +
"or (tblConcepts.industry=tblmembers.industry3
and substring(tblmembers.industry3,1,3)<>'Rec')) " +
"and (tblConcepts.active='1' and " +
"((datediff(day,expdate, getdate())<=0)or(isnul
l((convert(char(26),expdate,101)),'0')='0')))" +
"and tblconcepts.conceptid not in (select conce
ptid from tbl_Group_Concepts where groupid in(select id from Tbl_SB_Groups where
corp_id=" + corp_id + ") and industry in" +
"(select ltrim(rtrim(industry)) from tblcorp_ca
tegories where corp_id=" + corp_id + " and ltrim(rtrim(industry))<>'0' union sel
ect corp_industry as industry from tblcorp where corp_id= " + corp_id + ")) and
tblmembers.addressbook=" + intAddressBook + "ORDER BY tblConcepts.conceptName";
return (dbOpr.executeQueriesTable(strSqlQuery));
}
}
public DataTable dtGetOtherPSBName(int intAddressBook, int corp_id)
{
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 not in (select conceptid from
tbl_Group_Concepts where groupid in(select id from Tbl_SB_Groups where corp_id=
" + corp_id + ") and industry in" +
"(select industry_PSB as industry from tblcorp where corp_id=" + cor
p_id + ")) and tblmembers.addressbook=" + intAddressBook + ") ORDER BY tblConcep
ts.conceptName";
return (dbOpr.executeQueriesTable(strSqlQuery));
}
public DataTable dtGetFinancialSB(int intAddressBook, string type, int c
orp_id)
{
string strSQL = "", strSqlQuery = "";
strSQL = "select case ISNULL(substring(industry,1,3),'') when 'Rec'
then industry when NULL then '' else '' end as industry ,case ISNULL(substring
(industry2,1,3),'')when 'Rec' then industry2 when NULL then '' else '' End as in
dustry2,case ISNULL(substring(industry3,1,3),'') when 'Rec' then industry3 when
NULL then '' else '' End as industry3 from tblmembers where addressbook=" + int
AddressBook.ToString();
DataTable dt = dbOpr.executeQueriesTable(strSQL);
//Changes for ticket 865 - Start
//strSqlQuery = "SELECT tblConcepts.conceptID+ ',' +tblConcepts.indu
stry as Datakeys, tblConcepts.conceptName FROM tblConcepts WHERE tblConcepts.in
dustry='" + 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";
//strSqlQuery = "SELECT tblConcepts.conceptID+ ',' +tblConcepts.indu
stry as Datakeys, tblConcepts.conceptName FROM tblConcepts WHERE (tblConcepts.i
ndustry='" + 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,ex
pdate, getdate())<=0)or(isnull((convert(char(26),expdate,101)),'0')='0'))) ORDER
BY tblConcepts.conceptName";
strSqlQuery = "SELECT tblConcepts.conceptID+ ',' +tblConcepts.indust
ry as Datakeys, isnull(tblConcepts.conceptname,'')+'$#$'+isnull(tblConcepts.titl
e,'') as 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)o
r(isnull((convert(char(26),expdate,101)),'0')='0'))) " +
"and tblconcepts.conceptid not in (select conceptid from tbl_Group_C
oncepts where groupid in(select id from Tbl_SB_Groups where corp_id=" + corp_id
+ ") and industry in" +
"(select industry from tblcorp_categories where corp_id=" + corp_id
+ " and ltrim(rtrim(industry))<>'0' union select corp_industry as industry from
tblcorp where corp_id=" + corp_id + ")) ORDER BY tblConcepts.conceptName";
//Changes for ticket 865 - End
return (dbOpr.executeQueriesTable(strSqlQuery));
}
}
}

You might also like