public XmlDocument GetMailingDetailsByMailingName(string UserID, string Password, string CampaignName) { XmlDocument doc = new System.Xml.XmlDocument(); StringBuilder str = new StringBuilder(); str.Append("<CampaignInfo>"); string ConnectionString = GetConnectionString(UserID, Password); DataTable campMaster = CampaignMasterBase.SelectByName("CampaignName", CampaignName.Trim(), ConnectionString); if (campMaster.Rows.Count > 0) { str.Append("<CampaignName>" + campMaster.Rows[0]["CampaignName"].ToString() + "</CampaignName> "); str.Append("<CampaignSubject>" + campMaster.Rows[0]["Subject"].ToString() + "</CampaignSubject>"); str.Append("<FromName>" + campMaster.Rows[0]["FromName"].ToString() + "</FromName>"); str.Append("<FromAddress>" + campMaster.Rows[0]["FromAddress"].ToString() + "</FromAddress>"); if (string.IsNullOrEmpty(campMaster.Rows[0]["ReplaytoName"].ToString())) { str.Append("<ReplyName>" + string.Empty + "</ReplyName>"); } else { str.Append("<ReplyName>" + campMaster.Rows[0]["ReplaytoName"].ToString() + "</ReplyName>"); } if (string.IsNullOrEmpty(campMaster.Rows[0]["ReplytoAddress"].ToString())) { str.Append("<ReplyAddress>" + string.Empty + "</ReplyAddress>"); } else { str.Append("<ReplyAddress>" + campMaster.Rows[0]["ReplytoAddress"].ToString() + "</ReplyAddress>"); } if (!string.IsNullOrEmpty(campMaster.Rows[0]["SelectCondition"].ToString())) { string[] arrList = campMaster.Rows[0]["SelectCondition"].ToString().Split(','); foreach (string arr in arrList) { ListMasterPrimaryKey listpk = new ListMasterPrimaryKey(Convert.ToInt64(arr)); ListMaster listMaster = ListMaster.SelectOne(listpk, ConnectionString); if (listMaster != null) { ListContactMaster objListContactMaster = new ListContactMaster(ConnectionString); DataTable dtContacts = objListContactMaster.getShowListRecipients(Convert.ToInt64(listMaster.ListMasterID), "firstname", "asc"); str.Append("<ListId>" + listMaster.ListMasterID.ToString() + "</ListId>"); str.Append("<ListName>" + Server.HtmlDecode(listMaster.ListName.ToString() + dtContacts.Rows.Count + "</ListName>")); //lstBoxListNames.Items.Add(new ListItem(Server.HtmlDecode(listMaster.ListName.ToString()) + " (" + dtContacts.Rows.Count + ")", listMaster.ListMasterID.ToString(), true)); } } } } else str.Append("<Message>Campaign with name" + CampaignName + " not exist</Message>"); str.Append("</CampaignInfo>"); doc.LoadXml(str.ToString()); return doc; }
public void bindRecipientsToGrid(string fillflag) { try { //get contacts to be added to the list. string sortdir = (fillflag == "sort" ? GetSortDirection() : GridViewSortDirection); ListContactMaster objListContactMaster = new ListContactMaster(ConnectionString); DataTable dtContacts = objListContactMaster.getShowListRecipients(Convert.ToInt64(hiddenEditID.Value), GridSortExpression, sortdir);//listID=23 grdReceipients.DataSource = dtContacts; grdReceipients.DataBind(); if (dtContacts.Rows.Count == 0) { lbtnDeleteRecipients.Visible = false; } else lbtnDeleteRecipients.Visible = true; GridPrevSortExpression = GridSortExpression; } catch (Exception ex) { throw ex; } }
public void listRecipients(string fillflag) { try { int ddllistID = 0; if (ddlList1.SelectedIndex != 0) { ddllistID = Convert.ToInt32(ddlList1.SelectedValue); } //get contacts to be added to the list. string sortdir = (fillflag == "sort" ? GetSortDirection() : GridViewSortDirection); ListContactMaster objListContactMaster = new ListContactMaster(ConnectionString); DataTable dtContacts = objListContactMaster.getShowListRecipients(ddllistID, GridSortExpression, sortdir);//listID=23 grdReceipients.Dispose(); grdReceipients.DataSource = dtContacts; grdReceipients.DataBind(); GridPrevSortExpression = GridSortExpression; UdpnlGridRecipients.Update(); } catch (Exception ex) { throw ex; } }