Exemplo n.º 1
0
 public void getCampaignCompareCounts()
 {
     DataTable CampareDt = (DataTable)ViewState["CampareDt"];
     List<string> xValues = new List<string>();
     List<decimal> yValuesFirstCamp = new List<decimal>();
     List<decimal> yValuesSecCamp = new List<decimal>();
     List<decimal> yValuesThirdCamp = new List<decimal>();
     for (int i = 0; i < CampareDt.Rows.Count; i++)
     {
         xValues.Add(CampareDt.Rows[i][0].ToString());
         yValuesFirstCamp.Add(Convert.ToDecimal(CampareDt.Rows[i][1].ToString().Split('(')[0]));
         yValuesSecCamp.Add(Convert.ToDecimal(CampareDt.Rows[i][2].ToString().Split('(')[0]));
         if (CampareDt.Columns.Count == 4)
             yValuesThirdCamp.Add(Convert.ToDecimal(CampareDt.Rows[i][3].ToString().Split('(')[0]));
     }
     showCampaignCampareChart(CampareDt, xValues.ToArray(), yValuesFirstCamp.ToArray(), yValuesSecCamp.ToArray(), yValuesThirdCamp.ToArray());
 }
Exemplo n.º 2
0
        public void getTopTenCampaignsByOpenRateData()
        {
            try
            {
                CampaignJobs objCampaignJob = CampaignJob.SelectAll(ConnectionString);
                //get campaigns whose sent count is greater than 20.
                List<CampaignJob> campaignJobs = (List<CampaignJob>)objCampaignJob.ToList().FindAll(delegate(CampaignJob job) { return job.DeliveredCount > 20; });

                List<string> xValues = new List<string>();
                List<string> yValues = new List<string>();

                foreach (CampaignJob job in campaignJobs)
                {
                    //get names of campaigns.
                    CampaignMasterPrimaryKey pk = new CampaignMasterPrimaryKey(Convert.ToInt64(job.CampaignMasterID));
                    CampaignMaster objCampaignMaster = CampaignMaster.SelectOne(pk, ConnectionString);
                    yValues.Add(objCampaignMaster.CampaignName);

                    //Calculate openrate of campaigns
                    //get sum of opencount of all jobs in this month.
                    int opencount = Convert.ToInt32(campaignJobs.Sum(delegate(CampaignJob campjob) { return campjob.OpenCount; }));
                    //get sum of sentcount of all jobs in this month.
                    int sentcount = Convert.ToInt32(campaignJobs.Sum(delegate(CampaignJob campjob) { return campjob.DeliveredCount; }));
                    //Calculate openrate for that particular month.
                    if (sentcount != 0)
                    {
                        xValues.Add(Convert.ToString(Convert.ToDecimal(opencount) / Convert.ToDecimal(sentcount) * 100));
                    }

                    showChartTopTenCampaignsByOpenRate(xValues.ToArray(), yValues.ToArray());

                }
            }
            catch (Exception ex)
            { throw ex; }
        }
Exemplo n.º 3
0
        public void checklistupdate()
        {
            try
            {
                ListContactMasters listContMastersContacts = ListContactMaster.SelectByField("ContactId", contactID, ConnectionString);
                //Modified By Anwar Jan17 2012
                List<int> removelist = new List<int>();
                for (int j = 0; j < listContMastersContacts.Count; j++)
                {
                    if (!list.Contains(listContMastersContacts[j].ListMasterID.ToString()))
                        removelist.Add(Convert.ToInt32(listContMastersContacts[j].ListMasterID));
                }

                for (int k = 0; k < removelist.Count; k++)
                {
                    ListContactMasters listContactMaster = ListContactMaster.SelectAllByListIDAndContactID(Convert.ToInt64(removelist[k].ToString()), contactID, ConnectionString);
                    ListContactMaster listContMaster = new ListContactMaster(ConnectionString);
                    listContMaster.ListContactId = listContactMaster[0].ListContactId;
                    if (listContactMaster.Count > 0)
                    {
                        bool statusDelete = listContMaster.Delete();
                    }
                }

                for (int k = 0; k < list.Count; k++)
                {
                    ListContactMasters listContactMaster = ListContactMaster.SelectAllByListIDAndContactID(Convert.ToInt64(list[k].ToString()), contactID, ConnectionString);
                    ListContactMaster listContMaster = new ListContactMaster(ConnectionString);
                    listContMaster.ContactId = contactID;
                    listContMaster.ListMasterID = Convert.ToInt64(list[k].ToString());
                    listContMaster.CreatedDate = DateTime.Now;
                    listContMaster.IsActive = true;
                    if (listContactMaster.Count > 0)
                    {
                    }
                    else
                    {
                        bool statusInsert = listContMaster.InsertWithActiveStatus();
                    }
                }
                if (!chkIsActive1.Checked && lstBoxListNames.Items.Count > 0)
                {
                    bool Status = ListContactMaster.ChangeContactStatusByList(contactID, chkIsActive1.Checked, ConnectionString);
                }
                binddata(contactID);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 4
0
        public void getRecipientStatusSnapshotData()
        {
            try
            {
                List<string> xValues = new List<string>();
                List<decimal> yValues = new List<decimal>();

                ContactMasters objContactMaster;// = ContactMaster.SelectAll(ConnectionString);
                if (ddlDays.SelectedIndex == 0)
                {
                    objContactMaster = ContactMaster.SelectAllByToday(ConnectionString);
                    lblFromDate.Text =  DateTime.Now.ToString("dd/MM/yyyy");
                    lblToDate.Text = " - " + DateTime.Now.ToString("dd/MM/yyyy");

                }
                else if (ddlDays.SelectedIndex > 0 && ddlDays.SelectedIndex < 4)
                {
                    objContactMaster = ContactMaster.SelectAllByDays(Convert.ToInt32(ddlDays.SelectedValue), ConnectionString);
                    lblFromDate.Text =  DateTime.Now.AddDays(Convert.ToDouble(ddlDays.SelectedValue)).ToString("dd/MM/yyyy");
                    lblToDate.Text = " - " + DateTime.Now.Date.AddDays(-1).ToString("dd/MM/yyyy");

                }
                else if (ddlDays.SelectedIndex == 4)
                {
                    objContactMaster = ContactMaster.SelectAllByWeek(ConnectionString, ref fdate, ref tdate);
                    lblFromDate.Text =  fdate.ToString("dd/MM/yyyy");
                    lblToDate.Text = " - " + tdate.ToString("dd/MM/yyyy");

                }
                else
                {
                    objContactMaster = ContactMaster.SelectAllByMonths(DateTime.Now.AddMonths(Convert.ToInt32(ddlDays.SelectedValue)), DateTime.Now.AddMonths(-1), ConnectionString);

                    arDates = new ArrayList();
                    arDates = FirstAndLastdates(Convert.ToInt32(ddlDays.SelectedValue));
                    lblFromDate.Text =  Convert.ToDateTime(arDates[0]).ToString("dd/MM/yyyy");
                    lblToDate.Text = " - " + Convert.ToDateTime(arDates[1]).ToString("dd/MM/yyyy");

                }

                //get active contacts.
                IEnumerable<ContactMaster> activeContacts = (IEnumerable<ContactMaster>)objContactMaster.ToList().FindAll(delegate(ContactMaster contact) { return contact.IsActive == true; });
                xValues.Add("Active");
                yValues.Add(activeContacts.Count());
                //if (objContactMaster.Count() != 0)
                //yValues.Add(Convert.ToDecimal(activeContacts.Count()) / Convert.ToDecimal(objContactMaster.Count()) * 100);
                //else
                //    yValues.Add(0);

                //get inactive contacts.
                IEnumerable<ContactMaster> inactiveContacts = (IEnumerable<ContactMaster>)objContactMaster.ToList().FindAll(delegate(ContactMaster contact) { return contact.IsActive == false && (contact.IsDeleted == false || contact.IsDeleted == null); });
                xValues.Add("InActive");
                yValues.Add(inactiveContacts.Count());

                //get deleted contacts
                ContactDeleteds objContactsDeleted;// = ContactDeleted.SelectAll(ConnectionString);
                if (ddlDays.SelectedIndex == 0)
                {
                    objContactsDeleted = ContactDeleted.SelectAllByToday(ConnectionString);
                }
                else if (ddlDays.SelectedIndex>0 && ddlDays.SelectedIndex < 4)
                    objContactsDeleted = ContactDeleted.SelectAllByDays(Convert.ToInt32(ddlDays.SelectedValue), ConnectionString);
                else if (ddlDays.SelectedIndex == 4)
                    objContactsDeleted = ContactDeleted.SelectAllByWeek(ConnectionString, ref fdate, ref tdate);
                else
                    objContactsDeleted = ContactDeleted.SelectAllByMonths(DateTime.Now.AddMonths(Convert.ToInt32(ddlDays.SelectedValue)), DateTime.Now.AddMonths(-1), ConnectionString);
                xValues.Add("Deleted Contacts");
                yValues.Add(objContactsDeleted.Count());

                //get unverified contacts
                IEnumerable<ContactMaster> unverifiedContacts = (IEnumerable<ContactMaster>)objContactMaster.ToList().FindAll(delegate(ContactMaster contact) { return contact.IsVerified != true && contact.IsDeleted != true; });
                xValues.Add("UnVerified Contacts");
                yValues.Add(unverifiedContacts.Count());

                //get inactive and unverified contacts.
                IEnumerable<ContactMaster> inactiveandunverifiedContacts = (IEnumerable<ContactMaster>)objContactMaster.ToList().FindAll(delegate(ContactMaster contact) { return contact.IsActive == false && contact.IsVerified != true && contact.IsDeleted != true; });
                xValues.Add("InActive and UnVerified Contacts");
                yValues.Add(inactiveandunverifiedContacts.Count());

                //Show chart.
                showChartRecipientStatusSnapshot(xValues.ToArray(), yValues.ToArray());
            }
            catch (Exception ex)
            { throw ex; }
        }
Exemplo n.º 5
0
        public void getTopTenCampaignsByOpenRateData()
        {
            try
            {
                CampaignJobs objCampaignJob;// = CampaignJob.SelectAll(ConnectionString);
                if (ddlDays.SelectedIndex == 0)
                {
                    objCampaignJob = CampaignJob.SelectAllByToday(ConnectionString);
                    lblFromDate.Text =DateTime.Now.ToString("dd/MM/yyyy");
                    lblToDate.Text = " - " + DateTime.Now.ToString("dd/MM/yyyy");

                }
                else if (ddlDays.SelectedIndex > 0 && ddlDays.SelectedIndex < 4)
                {
                    objCampaignJob = CampaignJob.SelectAllByDays(Convert.ToInt32(ddlDays.SelectedValue), ConnectionString);

                    lblFromDate.Text =  DateTime.Now.AddDays(Convert.ToDouble(ddlDays.SelectedValue)).ToString("dd/MM/yyyy");
                    //lblToDate.Text = " - " + DateTime.Now.ToString("dd/MM/yyyy");
                    lblToDate.Text = " - " + DateTime.Now.Date.AddDays(-1).ToString("dd/MM/yyyy");

                }
                else if (ddlDays.SelectedIndex == 4)
                {
                    objCampaignJob = CampaignJob.SelectAllByWeek(ConnectionString, ref fdate, ref tdate);

                    lblFromDate.Text = fdate.ToString("dd/MM/yyyy");
                    lblToDate.Text = " - " + tdate.ToString("dd/MM/yyyy");

                }

                else
                {
                    objCampaignJob = CampaignJob.SelectAllByMonths(DateTime.Now.AddMonths(Convert.ToInt32(ddlDays.SelectedValue)), DateTime.Now.AddMonths(-1), ConnectionString);

                    arDates = new ArrayList();
                    arDates = FirstAndLastdates(Convert.ToInt32(ddlDays.SelectedValue));
                    lblFromDate.Text =  Convert.ToDateTime(arDates[0]).ToString("dd/MM/yyyy");
                    lblToDate.Text = " - " + Convert.ToDateTime(arDates[1]).ToString("dd/MM/yyyy");
                }

                //get top 10 campaigns whose sent count is greater than 20 and in order by descending.
                IEnumerable<CampaignJob> campaignJobs = (IEnumerable<CampaignJob>)(objCampaignJob.ToList().FindAll(delegate(CampaignJob job) { return job.DeliveredCount > 0; }).OrderByDescending(delegate(CampaignJob job) { return job.DeliveredCount; })).Take(10);
                List<string> xValues = new List<string>();
                List<decimal> yValues = new List<decimal>();

                foreach (CampaignJob job in campaignJobs)
                {
                    //get names of campaigns.
                    CampaignMasterPrimaryKey pk = new CampaignMasterPrimaryKey(Convert.ToInt64(job.CampaignMasterID));
                    CampaignMaster objCampaignMaster = CampaignMaster.SelectOne(pk, ConnectionString);
                    xValues.Add(objCampaignMaster.CampaignName);

                    //Calculate openrate of campaigns
                    //get sum of opencount of all jobs in this month.
                    int opencount = Convert.ToInt32(job.OpenCount);
                    //get sum of sentcount of all jobs in this month.
                    int sentcount = Convert.ToInt32(job.DeliveredCount);
                    //Calculate openrate for that particular month.
                    if (sentcount != 0)
                    {
                        yValues.Add(Convert.ToDecimal(opencount) / Convert.ToDecimal(sentcount) * 100);
                    }
                }

                //Show chart.
                showChartTopTenCampaignsByOpenRate(xValues.ToArray(), yValues.ToArray());
            }
            catch (Exception ex)
            { throw ex; }
        }
        //Vikas Kumar Bhatnagar
        public void getListHealthOverLast12MonthsDomainData()
        {
            try
            {
                IEnumerable<CampaignJob> campaignJobs;
                CampaignJobs objCampaignJob;// = CampaignJob.SelectAll(ConnectionString);
                if (ddlDays.SelectedIndex == 0)
                {
                    objCampaignJob = CampaignJob.SelectAllDomianByToday(ConnectionString);
                    lblFromDate.Text =DateTime.Now.ToString("dd/MM/yyyy");
                    lblToDate.Text = " - " + DateTime.Now.ToString("dd/MM/yyyy");

                }
                else if (ddlDays.SelectedIndex == 3)
                {
                    objCampaignJob = CampaignJob.SelectAllDomianLast90Days(ConnectionString);
                    lblFromDate.Text =  DateTime.Now.AddDays(Convert.ToDouble(ddlDays.SelectedValue)).ToString("dd/MM/yyyy");
                    //lblToDate.Text = " - " + DateTime.Now.ToString("dd/MM/yyyy");
                    lblToDate.Text = " - " + DateTime.Now.Date.AddDays(-1).ToString("dd/MM/yyyy");

                }
                else if (ddlDays.SelectedIndex == 4)
                {
                    objCampaignJob = CampaignJob.SelectAllDomianByWeek(ConnectionString, ref fdate, ref  tdate);

                    lblFromDate.Text = fdate.ToString("dd/MM/yyyy");
                    lblToDate.Text = " - " + tdate.ToString("dd/MM/yyyy");
                }

                else if (ddlDays.SelectedIndex == 1)
                {
                    objCampaignJob = CampaignJob.SelectAllDomianByWeek(ConnectionString, ref fdate, ref  tdate);
                }

                else if (ddlDays.SelectedIndex == 6)
                {
                    objCampaignJob = CampaignJob.SelectAllDomianLast90Days(ConnectionString);
                }

                else
                {
                    objCampaignJob = CampaignJob.SelectAllDomianByMonth(ConnectionString);

                    arDates = new ArrayList();
                    arDates = FirstAndLastdates(Convert.ToInt32(ddlDays.SelectedValue));
                    //lblFromDate.Text = "Current View : " + Convert.ToDateTime(arDates[0]).ToString("dd/MM/yyyy");
                    //lblToDate.Text = " - " + Convert.ToDateTime(arDates[1]).ToString("dd/MM/yyyy");

                }
                //CampaignJobs objCampaignJob = CampaignJob.SelectAllDomianLast12Months(ConnectionString);
                //calculate last 12 month names to show on X-axis
                List<string> xValues = new List<string>();
                List<decimal> yValues = new List<decimal>();
                foreach (CampaignJob job in objCampaignJob)
                {
                    //get names of campaigns.

                    //CampaignMasterPrimaryKey pk = new CampaignMasterPrimaryKey(Convert.ToInt64(job.CampaignMasterID));
                    //CampaignMaster objCampaignMaster = CampaignMaster.SelectOne(pk, ConnectionString);
                    xValues.Add(job.Domain);
                    yValues.Add(Convert.ToDecimal(job.Accepted));

                }

                //Show chart.
                showChartTopTenCampaignsByBounceRate2(xValues.ToArray(), yValues.ToArray());
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
        public void getGraphByCampaignId()
        {
            try
            {
                lblSubtitle1.Text = ddlcampaigns.SelectedItem.Text + " Campaign Report";
                List<string> xValues = new List<string>();
                List<decimal> yValuesSentCount = new List<decimal>();
                List<decimal> yValuesOpenCount = new List<decimal>();

                List<decimal> yValuesOpenCountChart = new List<decimal>();
                List<decimal> yValuesClickCountChart = new List<decimal>();
                CampaignMasterPrimaryKey pk = new CampaignMasterPrimaryKey(Convert.ToInt64(ddlcampaigns.SelectedValue));
                CampaignMaster objCampaignMaster = CampaignMaster.SelectOne(pk, ConnectionString);

                CampaignJobPrimaryKey Camppk = new CampaignJobPrimaryKey(Convert.ToInt64(ddlcampaigns.SelectedValue));
                //CampaignJob objCampaignJob = CampaignJob.SelectOne(Camppk, ConnectionString);
                CampaignJobs objCampaignJob = CampaignJob.SelectByField("CampaignMasterID", ddlcampaigns.SelectedValue.ToString(), ConnectionString);
                int opencount = 0; int sentcount = 0; int clickcount = 0;
                foreach (CampaignJob job in objCampaignJob)
                {
                    //Calculate LastTopTenCampaignsSent
                    //get sum of opencount of all jobs in this month.
                    opencount = (job.OpenCount != null) ? Convert.ToInt32(job.OpenCount.ToString()) : 0;
                    //opencount = Convert.ToInt32(job.OpenCount.ToString());
                    //get sum of sentcount of all jobs in this month.
                    sentcount = (job.DeliveredCount != null) ? Convert.ToInt32(job.OpenCount.ToString()) : 0;//Convert.ToInt32(job.DeliveredCount.ToString());
                    //get sum of sentcount of all jobs in this month.
                    clickcount = (job.ClickCount != null) ? Convert.ToInt32(job.OpenCount.ToString()) : 0;//Convert.ToInt32(job.ClickCount);
                }
                xValues.Add(objCampaignMaster.CampaignName);
                yValuesSentCount.Add(Convert.ToDecimal(sentcount));
                yValuesOpenCount.Add(Convert.ToDecimal(opencount));

                //this is to bind the open count chart
                if (sentcount > 0)
                {
                    yValuesOpenCountChart.Add(Convert.ToDecimal(opencount) / Convert.ToDecimal(sentcount) * 100);
                }
                else
                {
                    yValuesOpenCountChart.Add(0);
                }

                //Calculate click for that particular month.
                if (opencount != 0)
                {
                    yValuesClickCountChart.Add(Convert.ToDecimal(clickcount) / Convert.ToDecimal(opencount) * 100);
                }
                else
                {
                    yValuesClickCountChart.Add(0);
                }
                //Show chart for sent and open count
                showChartLastTopTenCampaignsSent(xValues.ToArray(), yValuesSentCount.ToArray(), yValuesOpenCount.ToArray());

                //Show chart for open count
                showChartTopTenCampaignsByOpenRate(xValues.ToArray(), yValuesOpenCountChart.ToArray());

                //Show chart for click count
                showChartTopTenCampaignsByClickRate(xValues.ToArray(), yValuesClickCountChart.ToArray());
            }
            catch (Exception ex)
            {

            }
        }
        public void getLastTopTenCampaignsSentData()
        {
            CampaignJobs objCampaignJob;

            try
            {
                 DataTable campaignjobreport = CampaignJob.GetTop5CampaignJobs(4, ConnectionString);
                 if (ddlDays.SelectedIndex == 0)
                 {
                     campaignjobreport = CampaignJob.GetCampaignNamesByDays(1, 1, ConnectionString);
                 }
                 else if (ddlDays.SelectedIndex == 1)
                 {
                     campaignjobreport = CampaignJob.GetCampaignNamesByDays(7, 0, ConnectionString);
                 }
                 else if (ddlDays.SelectedIndex == 2)
                 {
                     campaignjobreport = CampaignJob.GetCampaignNamesByDays(30, 0, ConnectionString);
                 }
                 else if (ddlDays.SelectedIndex == 3)
                 {
                     campaignjobreport = CampaignJob.GetCampaignNamesByDays(90, 0, ConnectionString);
                 }
                 ddlcampaigns.DataSource = campaignjobreport;
                 ddlcampaigns.DataTextField = "CampaignName";
                 ddlcampaigns.DataValueField = "Id";
                 ddlcampaigns.DataBind();

                 if (campaignjobreport.Rows.Count > 0)
                 {

                     if (ddlcampaigns.SelectedIndex != 5)
                     {
                         objCampaignJob = SingleCampaignReports();
                         lblSubtitle1.Text = ddlcampaigns.SelectedItem.Text + " Campaign Report";
                     }
                     else
                     {
                         objCampaignJob = AllCampaignReport();
                         lblSubtitle1.Text = "Last Top 10 Campaigns report";
                     }

                     //get top 10 campaigns whose sent count is greater than 20 and in order by descending.
                     //IEnumerable<CampaignJob> campaignJobs = (IEnumerable<CampaignJob>)(objCampaignJob.ToList().FindAll(delegate(CampaignJob job) { return job.DeliveredCount > 0; }).OrderByDescending(delegate(CampaignJob job) { return job.DeliveredCount; })).Take(10);
                     IEnumerable<CampaignJob> campaignJobs = (IEnumerable<CampaignJob>)(objCampaignJob.ToList().FindAll(delegate(CampaignJob job) { return job.Status == 4; }));

                     List<string> xValues = new List<string>();
                     List<decimal> yValuesSentCount = new List<decimal>();
                     List<decimal> yValuesOpenCount = new List<decimal>();

                     List<decimal> yValuesOpenCountChart = new List<decimal>();
                     List<decimal> yValuesClickCountChart = new List<decimal>();

                     if (campaignJobs != null)
                     {
                         foreach (CampaignJob job in campaignJobs)
                         {
                             //get names of campaigns.
                             CampaignMasterPrimaryKey pk = new CampaignMasterPrimaryKey(Convert.ToInt64(job.CampaignMasterID));
                             CampaignMaster objCampaignMaster = CampaignMaster.SelectOne(pk, ConnectionString);
                             xValues.Add(objCampaignMaster.CampaignName);

                             //Calculate LastTopTenCampaignsSent
                             //get sum of opencount of all jobs in this month.
                             int opencount = Convert.ToInt32(job.OpenCount);
                             //get sum of sentcount of all jobs in this month.
                             int sentcount = Convert.ToInt32(job.DeliveredCount);
                             //get sum of sentcount of all jobs in this month.
                             int clickcount = Convert.ToInt32(job.ClickCount);

                             yValuesSentCount.Add(Convert.ToDecimal(sentcount));
                             yValuesOpenCount.Add(Convert.ToDecimal(opencount));

                             //this is to bind the open count chart
                             if (sentcount > 0)
                             {

                                 yValuesOpenCountChart.Add(Convert.ToDecimal(opencount) / Convert.ToDecimal(sentcount) * 100);
                             }
                             else
                             {
                                 yValuesOpenCountChart.Add(0);
                             }

                             //Calculate click for that particular month.
                             if (opencount != 0)
                             {

                                 yValuesClickCountChart.Add(Convert.ToDecimal(clickcount) / Convert.ToDecimal(opencount) * 100);

                             }
                             else
                             {
                                 yValuesClickCountChart.Add(0);
                             }

                         }
                     }
                     //Show chart for sent and open count
                     showChartLastTopTenCampaignsSent(xValues.ToArray(), yValuesSentCount.ToArray(), yValuesOpenCount.ToArray());

                     //Show chart for open count
                     showChartTopTenCampaignsByOpenRate(xValues.ToArray(), yValuesOpenCountChart.ToArray());

                     //Show chart for click count
                     showChartTopTenCampaignsByClickRate(xValues.ToArray(), yValuesClickCountChart.ToArray());
                 }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// To get the top 10 campaigns 
        /// </summary>
        public void getLastTopTenCampaignsSentData()
        {
            CampaignJobs campaignJobs = CampaignJob.SelectTop10SentCamps(ConnectionString);

            List<string> xValues = new List<string>();
            List<Int32> yValuesSentCount = new List<Int32>();
            List<Int32> yValuesOpenCount = new List<Int32>();

            foreach (CampaignJob job in campaignJobs)
            {
                //get names of campaigns.
                CampaignMasterPrimaryKey pk = new CampaignMasterPrimaryKey(Convert.ToInt64(job.CampaignMasterID));
                CampaignMaster objCampaignMaster = CampaignMaster.SelectOne(pk, ConnectionString);

                int opencount = 0, sentcount = 0;

                //Calculate LastTopTenCampaignsSent
                //get sum of opencount of all jobs in this month.
                opencount = Convert.ToInt32(job.OpenCount);
                //get sum of sentcount of all jobs in this month.
                sentcount = Convert.ToInt32(job.DeliveredCount);
                //Calculate openrate for that particular month.

                // for restricting the campaignjobs whcich have the sent count as zero
                if (sentcount != 0)
                {
                    xValues.Add(objCampaignMaster.CampaignName);
                    yValuesSentCount.Add(Convert.ToInt32(sentcount));
                    yValuesOpenCount.Add(Convert.ToInt32(opencount));
                }
            }

            //Show chart.
            showChartLastTopTenCampaignsSent(xValues.ToArray(), yValuesSentCount.ToArray(), yValuesOpenCount.ToArray());
        }
Exemplo n.º 10
0
        public List<LinkItem> LinkFinder(string file)
        {
            List<LinkItem> list = new List<LinkItem>();
            // 1.
            // Find all matches in file.
            MatchCollection m1 = Regex.Matches(file, @"(<a.*?>.*?</a>)",
                RegexOptions.Singleline);

            // 2.
            // Loop over each match.
            foreach (Match m in m1)
            {
                string value = m.Groups[1].Value;
                LinkItem i = new LinkItem();

                // 3.
                // Get href attribute.
                Match m2 = Regex.Match(value, @"href=\""(.*?)\""",
                    RegexOptions.Singleline);
                if (m2.Success)
                {
                    i.Href = m2.Groups[1].Value;
                }

                // 4.
                // Remove inner tags from text.
                string t = Regex.Replace(value, @"\s*<.*?>\s*", "",
                    RegexOptions.Singleline);
                i.Text = t;
                if (i.Href != null && i.Text != null)
                {
                    if ((i.Href != "[!RPLINK:MIRRORWEBLINK!]") && (i.Href != "[!RPLINK:LISTUNSUBSCRIBE!]") && (i.Href != "[!RPLINK:FORWARDTOFRIEND!]") && (i.Href != "[!RPLINK:GLOBALUNSUBSCRIBE!]"))
                    {
                        if (!(i.Href.Contains("mailto")) && !(i.Href.Contains("RPLINK")))
                        {
                            if (!(i.Href.Trim() == "#"))
                                list.Add(i);
                        }
                    }
                }
            }
            return list;
        }
Exemplo n.º 11
0
        public void CustomTrackUrls()
        {
            if (hiddenCampaignID.Value == string.Empty)
            {
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('Please save the Mailing to avail this option.')", true);
            }
            else
            {
                bindTemplates();
                CustomLabel objCustomLabel1 = new CustomLabel(ConnectionString);
                Int64 CampaignId = Convert.ToInt32(hiddenCampaignID.Value);
                Int64 TemplateId = (ddlTemplate.SelectedItem.Value != defaultListItem) ? Convert.ToInt32(ddlTemplate.SelectedItem.Value) : 0;
                DataTable CusLabel = objCustomLabel1.getCustomLabel(TemplateId, CampaignId);
                string customLabelingDivContent = "<table widht=\"670px\"><tbody><th widht=\"200px\" Align=\"left\"><B>Label</B></th><th widht=\"470px\" Align=\"left\"><B>URL</B></th>";
                htmlContent = RadEditor1.Content;
                #region this logic will add click link to the content

                if (htmlContent.Contains("!RPLINK"))
                {
                    string[] startDelimiter = new string[] { "[!RPLINK:" };
                    string[] endDelimiter = new string[] { "!]" };
                    string[] splittedContent = htmlContent.Split(startDelimiter, StringSplitOptions.None);
                    string LinkURL = string.Empty;
                    for (int i = 1; i < splittedContent.Length; i++)
                    {
                        string linkID = splittedContent[i].Split(endDelimiter, StringSplitOptions.None)[0];
                        //get linkDetails using linkID.
                        if (!string.IsNullOrEmpty(linkID))
                        {
                            if ((linkID != "MIRRORWEBLINK") && (linkID != "LISTUNSUBSCRIBE") && (linkID != "FORWARDTOFRIEND") && (linkID != "GLOBALUNSUBSCRIBE"))
                            {
                                LinkDetailPrimaryKey objLinkDetail = new LinkDetailPrimaryKey(Convert.ToInt64(linkID));
                                LinkDetail linkData = LinkDetail.SelectOne(objLinkDetail, ConnectionString);
                                if (linkData.LinkURL.ToLower().Contains("http://"))
                                    linkData.LinkURL = linkData.LinkURL.Replace("http://", "");
                                LinkURL = linkData.LinkURL;
                                if (linkData != null)
                                {
                                    if (htmlContent.ToLower().Contains(linkID))
                                    {
                                        htmlContent = htmlContent.Replace(startDelimiter[0] + linkID + endDelimiter[0], LinkURL.ToString());
                                    }

                                }
                            }
                        }

                    }

                }

                #endregion

                string textContent = textRadEditor.Content;

                #region this logic will add click link to the content

                if (textContent.Contains("!RPLINK"))
                {
                    string[] startDelimiter = new string[] { "[!RPLINK:" };
                    string[] endDelimiter = new string[] { "!]" };
                    string[] splittedContent = textContent.Split(startDelimiter, StringSplitOptions.None);
                    string LinkURL = string.Empty;
                    for (int i = 1; i < splittedContent.Length; i++)
                    {
                        string linkID = splittedContent[i].Split(endDelimiter, StringSplitOptions.None)[0];
                        //get linkDetails using linkID.
                        if (!string.IsNullOrEmpty(linkID))
                        {
                            if ((linkID != "MIRRORWEBLINK") && (linkID != "LISTUNSUBSCRIBE") && (linkID != "FORWARDTOFRIEND") && (linkID != "GLOBALUNSUBSCRIBE"))
                            {
                                LinkDetailPrimaryKey objLinkDetail = new LinkDetailPrimaryKey(Convert.ToInt64(linkID));
                                LinkDetail linkData = LinkDetail.SelectOne(objLinkDetail, ConnectionString);
                                if (linkData.LinkURL.ToLower().Contains("http://"))
                                    linkData.LinkURL = linkData.LinkURL.Replace("http://", "");
                                LinkURL = linkData.LinkURL;
                                if (linkData != null)
                                {
                                    if (textContent.ToLower().Contains(linkID))
                                    {
                                        textContent = textContent.Replace(startDelimiter[0] + linkID + endDelimiter[0], LinkURL.ToString());
                                    }

                                }
                            }
                        }
                    }
                }
                #endregion

                if (textContent != string.Empty)
                {
                    textContent = textContent.Replace("&quot;", "\"");
                    textContent = textContent.Replace("&lt;", "<");
                    textContent = textContent.Replace("&gt;", ">");
                }
                if (htmlContent != string.Empty)
                    HTMLlist = LinkFinder(htmlContent);
                if (textContent != string.Empty)
                    Textlist = LinkFinder(textContent);

                if (Textlist.Count > 0)
                    HTMLlist = HTMLlist.Concat(Textlist).ToList();

                List<string> URLlist = new List<string>();
                for (int i = 0; i < HTMLlist.Count; i++)
                {
                    URLlist.Add(HTMLlist[i].Href);
                }
                URLlist = URLlist.Distinct().ToList();
                if (CusLabel.Rows.Count != URLlist.Distinct().ToList().Count && CusLabel.Rows.Count > 0)
                {

                    for (int i = 0; i < CusLabel.Rows.Count; i++)
                    {
                        for (int j = 0; j < URLlist.Count; j++)
                        {
                            if (URLlist[j] == CusLabel.Rows[i]["LinkURL"].ToString())
                                URLlist.RemoveAt(j);
                        }
                    }
                    if (URLlist.Count > 0)
                    {
                        for (int i = 0; i < URLlist.Count; i++)
                        {
                            string txtBoxId = "txt" + i;
                            string divId = "div" + i;
                            customLabelingDivContent += "<tr widht=\"670px\"><td widht=\"200px\"><input type=\"text\" id='" + txtBoxId + "'runat=\"server\" value='" + URLlist[i] + "'></td><td><div id='" + divId + "'style=\"width:470px; word-wrap: break-word\">" + URLlist[i] + "</div></td></tr>";
                        }
                    }
                }
                if (CusLabel.Rows.Count != 0)
                {
                    for (int loopcount = 0; loopcount < CusLabel.Rows.Count; loopcount++)
                    {
                        string txtBoxId = "txt" + loopcount;
                        string divId = "div" + loopcount;
                        string str = string.Empty;
                        string url = string.Empty;

                        str = CusLabel.Rows[loopcount]["CustomLabel"].ToString();
                        url = CusLabel.Rows[loopcount]["LinkURL"].ToString();
                        customLabelingDivContent += "<tr widht=\"670px\"><td widht=\"200px\"><input type=\"text\" id='" + txtBoxId + "'runat=\"server\" value='" + str + "'></td><td><div id='" + divId + "'style=\"width:470px; word-wrap: break-word\">" + url + "</div></td></tr>";
                    }
                    customLabelingDivContent += "</tbody></table>";
                    customLabeling.InnerHtml = customLabelingDivContent;
                    customLabeling.Visible = true;
                }
                else if (URLlist.Count > 0)
                {
                    for (int i = 0; i < URLlist.Count; i++)
                    {
                        string txtBoxId = "txt" + i;
                        string divId = "div" + i;

                        customLabelingDivContent += "<tr widht=\"670px\"><td widht=\"200px\"><input type=\"text\" id='" + txtBoxId + "'runat=\"server\" value='" + URLlist[i] + "'></td><td><div id='" + divId + "'style=\"width:470px; word-wrap: break-word\">" + URLlist[i] + "</div></td></tr>";

                    }
                    customLabelingDivContent += "</tbody></table>";
                    customLabeling.InnerHtml = customLabelingDivContent;
                    customLabeling.Visible = true;
                }
                else
                { customLabelingDivContent += "<tr><td> No Links Found</td></tr>"; }


            }
        }
Exemplo n.º 12
0
        public void getTopTenCampaignsByClickRateData()
        {
            try
            {
                CampaignJobs objCampaignJob;// = CampaignJob.SelectAll(ConnectionString);

                //if (ddlDays.SelectedIndex == 0)
                //    objCampaignJob = CampaignJob.SelectAll(ConnectionString);
                if (ddlDays.SelectedIndex < 3)
                    objCampaignJob = CampaignJob.SelectAllByDays(Convert.ToInt32(ddlDays.SelectedValue), ConnectionString);
                else if (ddlDays.SelectedIndex == 3)
                    objCampaignJob = CampaignJob.SelectAllByWeek(ConnectionString, ref fdate, ref tdate);
                else
                    objCampaignJob = CampaignJob.SelectAllByMonths(DateTime.Now.AddMonths(Convert.ToInt32(ddlDays.SelectedValue)), DateTime.Now.AddMonths(-1), ConnectionString);
                //get top 10 campaigns whose sent count is greater than 20 and in order by descending.
                //IEnumerable<CampaignJob> campaignJobs = (IEnumerable<CampaignJob>)(objCampaignJob.ToList().FindAll(delegate(CampaignJob job) { return job.DeliveredCount > 20; }).OrderByDescending(delegate(CampaignJob job) { return job.DeliveredCount; })).Take(12);

                IEnumerable<CampaignJob> campaignJobs = (IEnumerable<CampaignJob>)(objCampaignJob.ToList().FindAll(delegate(CampaignJob job) { return job.Status == 4; }));

                List<string> xValues = new List<string>();
                List<decimal> yValues = new List<decimal>();

                foreach (CampaignJob job in campaignJobs)
                {
                    //get names of campaigns.
                    CampaignMasterPrimaryKey pk = new CampaignMasterPrimaryKey(Convert.ToInt64(job.CampaignMasterID));
                    CampaignMaster objCampaignMaster = CampaignMaster.SelectOne(pk, ConnectionString);
                    xValues.Add(objCampaignMaster.CampaignName);

                    //Calculate openrate of campaigns
                    //get sum of opencount of all jobs in this month.
                    int opencount = Convert.ToInt32(job.OpenCount);
                    //get sum of sentcount of all jobs in this month.
                    int clickcount = Convert.ToInt32(job.ClickCount);
                    //Calculate openrate for that particular month.
                    if (opencount != 0)
                    {

                        yValues.Add(Convert.ToDecimal(clickcount) / Convert.ToDecimal(opencount) * 100);

                    }
                    else
                    {
                        yValues.Add(0);
                    }
                }

                //Show chart.
                showChartTopTenCampaignsByClickRate(xValues.ToArray(), yValues.ToArray());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 13
0
        public void BindDropdowns(string[] tableFields, string[] TableTextFields)
        {
            try
            {
                for (int i = 0; i < GridFieldmap.Rows.Count; i++)
                {
                    DropDownList ddlContactMasterFields = (DropDownList)this.GridFieldmap.Rows[i].FindControl("ddlContactMasterFields");
                    ddlContactMasterFields.Items.Clear();
                    for (int j = 0; j < tableFields.Length; j++)
                    {
                        ddlContactMasterFields.Items.Add(new ListItem(TableTextFields[j].ToString(), tableFields[j].ToString()));
                    }
                    DataTable dt = ManageFieldsBase.SelectCustomFields(Connectionstring);
                    dt.AsEnumerable().ToList().ForEach(delegate(DataRow drRow) { ddlContactMasterFields.Items.Add(new ListItem(drRow["FieldName"].ToString(), drRow["ContactFieldName"].ToString())); });
                }
                updatePanelFieldmap.Update();
                if (chkHasColumnNames.Checked == true)
                {
                    #region standard columns for auto mapping

                    //Email Address, Email, E-mail, E mail, E-mail Address, E mail Address, Email Add, E-mail Add
                    List<string> emailColumns = new List<string>();
                    emailColumns.Add("Email Address");
                    emailColumns.Add("emailaddress");
                    emailColumns.Add("email");
                    emailColumns.Add("e-mail");
                    emailColumns.Add("email");
                    emailColumns.Add("e-mailaddress");
                    emailColumns.Add("emailaddress");
                    emailColumns.Add("emailadd");
                    emailColumns.Add("e-mailadd");
                    emailColumns.Add("emailaddress");

                    //First Name, FirstName, Fname, First
                    List<string> fnameColumns = new List<string>();
                    fnameColumns.Add("First Name");
                    fnameColumns.Add("firstname");
                    fnameColumns.Add("fname");
                    fnameColumns.Add("first");

                    //Last Name, LastName, Surname, Last, Lname
                    List<string> lnameColumns = new List<string>();
                    lnameColumns.Add("Last Name");
                    lnameColumns.Add("lastname");
                    lnameColumns.Add("surname");
                    lnameColumns.Add("last");
                    lnameColumns.Add("lname");

                    //Address1, Add1
                    List<string> addrs1Columns = new List<string>();
                    addrs1Columns.Add("Address1");
                    addrs1Columns.Add("address1");
                    addrs1Columns.Add("add1");

                    //Address2, Add2
                    List<string> addrs2Columns = new List<string>();
                    addrs2Columns.Add("Address2");
                    addrs2Columns.Add("address2");
                    addrs2Columns.Add("add2");

                    //City
                    List<string> cityColumns = new List<string>();
                    cityColumns.Add("City");
                    cityColumns.Add("city");

                    //Country
                    List<string> countryColumns = new List<string>();
                    countryColumns.Add("Country");
                    countryColumns.Add("country");

                    //Postal Code
                    List<string> zipColumns = new List<string>();
                    zipColumns.Add("Postal Code");
                    zipColumns.Add("postalcode");
                    zipColumns.Add("zip");
                    zipColumns.Add("postal");
                    zipColumns.Add("zipcode");

                    //State
                    List<string> stateColumns = new List<string>();
                    stateColumns.Add("State");
                    stateColumns.Add("state");
                    stateColumns.Add("province");

                    //Work Phone
                    List<string> wPhoneColumns = new List<string>();
                    wPhoneColumns.Add("Work Phone");
                    wPhoneColumns.Add("workphone");
                    wPhoneColumns.Add("phone");
                    wPhoneColumns.Add("phone#");

                    //Home Phone
                    List<string> hPhoneColumns = new List<string>();
                    hPhoneColumns.Add("Home Phone");
                    hPhoneColumns.Add("homephone");

                    //Mobile Phone
                    List<string> mPhoneColumns = new List<string>();
                    mPhoneColumns.Add("Mobile Phone");
                    mPhoneColumns.Add("mobilephone");
                    mPhoneColumns.Add("mobile");
                    mPhoneColumns.Add("mobile#");

                    //Fax
                    List<string> faxColumns = new List<string>();
                    faxColumns.Add("Fax");
                    faxColumns.Add("fax");

                    //Marital Status
                    List<string> mStatusColumns = new List<string>();
                    mStatusColumns.Add("Marital Status");
                    mStatusColumns.Add("maritalstatus");

                    //Gender
                    List<string> genderColumns = new List<string>();
                    genderColumns.Add("Gender");
                    genderColumns.Add("gender");

                    #endregion
                    for (int i = 0; i < GridFieldmap.Rows.Count; i++)
                    {
                        DropDownList ddlContactMasterFields = (DropDownList)this.GridFieldmap.Rows[i].FindControl("ddlContactMasterFields");
                        //lblHeaderField
                        Label lblFiled = (Label)this.GridFieldmap.Rows[i].FindControl("lblHeaderField");

                        for (int j = 0; j < tableFields.Length; j++)
                        {
                            if (emailColumns.Contains(lblFiled.Text.ToString().Replace(" ", "").ToLower()))
                                ddlContactMasterFields.Items.FindByText(emailColumns[0]).Selected = true;
                            else if (fnameColumns.Contains(lblFiled.Text.ToString().Replace(" ", "").ToLower()))
                                ddlContactMasterFields.Items.FindByText(fnameColumns[0]).Selected = true;
                            else if (lnameColumns.Contains(lblFiled.Text.ToString().Replace(" ", "").ToLower()))
                                ddlContactMasterFields.Items.FindByText(lnameColumns[0]).Selected = true;
                            else if (addrs1Columns.Contains(lblFiled.Text.ToString().Replace(" ", "").ToLower()))
                                ddlContactMasterFields.Items.FindByText(addrs1Columns[0]).Selected = true;
                            else if (addrs2Columns.Contains(lblFiled.Text.ToString().Replace(" ", "").ToLower()))
                                ddlContactMasterFields.Items.FindByText(addrs2Columns[0]).Selected = true;
                            else if (cityColumns.Contains(lblFiled.Text.ToString().Replace(" ", "").ToLower()))
                                ddlContactMasterFields.Items.FindByText(cityColumns[0]).Selected = true;
                            else if (stateColumns.Contains(lblFiled.Text.ToString().Replace(" ", "").ToLower()))
                                ddlContactMasterFields.Items.FindByText(stateColumns[0]).Selected = true;
                            else if (countryColumns.Contains(lblFiled.Text.ToString().Replace(" ", "").ToLower()))
                                ddlContactMasterFields.Items.FindByText(countryColumns[0]).Selected = true;
                            else if (zipColumns.Contains(lblFiled.Text.ToString().Replace(" ", "").ToLower()))
                                ddlContactMasterFields.Items.FindByText(zipColumns[0]).Selected = true;
                            else if (wPhoneColumns.Contains(lblFiled.Text.ToString().Replace(" ", "").ToLower()))
                                ddlContactMasterFields.Items.FindByText(wPhoneColumns[0]).Selected = true;
                            else if (hPhoneColumns.Contains(lblFiled.Text.ToString().Replace(" ", "").ToLower()))
                                ddlContactMasterFields.Items.FindByText(hPhoneColumns[0]).Selected = true;
                            else if (mPhoneColumns.Contains(lblFiled.Text.ToString().Replace(" ", "").ToLower()))
                                ddlContactMasterFields.Items.FindByText(mPhoneColumns[0]).Selected = true;
                            else if (faxColumns.Contains(lblFiled.Text.ToString().Replace(" ", "").ToLower()))
                                ddlContactMasterFields.Items.FindByText(faxColumns[0]).Selected = true;
                            else if (genderColumns.Contains(lblFiled.Text.ToString().Replace(" ", "").ToLower()))
                                ddlContactMasterFields.Items.FindByText(genderColumns[0]).Selected = true;
                            else if (mStatusColumns.Contains(lblFiled.Text.ToString().Replace(" ", "").ToLower()))
                                ddlContactMasterFields.Items.FindByText(mStatusColumns[0]).Selected = true;
                            else
                            {
                                ddlContactMasterFields.SelectedIndex = 0;
                                LinkButton lbtnRemove = (LinkButton)GridFieldmap.Rows[i].FindControl("lbtnRemoveMapping");
                                lbtnRemove.Enabled = false; lbtnRemove.Attributes.Add("style", "text-decoration:none;");
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }