protected void dlKmlPlaceMarks_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.SelectedItem) { GridView grdList = (GridView)e.Item.FindControl("grdList"); ListMaster objListMaster = new ListMaster(ConnectionString); DataTable dtLists = objListMaster.getAllListsWithMembersCount("ListName", "ASC"); grdList.DataSource = dtLists; grdList.DataBind(); } }
/// <summary> /// This Method is used to bind Recent Lists Grid /// </summary> /// <param name="fillflag"></param> public void bindListGrid(string fillflag) { try { ListMaster objListMaster = new ListMaster(ConnectionString); DataTable dtLists = objListMaster.GetTop5Lists(ConnectionString); if (dtLists.Rows.Count > 0) { grdLists.DataSource = dtLists; grdLists.DataBind(); } } catch (Exception ex) { throw ex; } }
protected void bindGrid() { try { ListMaster objListMaster = new ListMaster(ConnectionString); DataTable dtLists = objListMaster.getAllListsWithMembersCount("ListName", "ASC"); dlList.DataSource = dtLists; dlList.DataBind(); } catch (Exception ex) { throw ex; } }
public void bindGrid(int pageIndex,int pageSize) { try { ListMaster objListMaster = new ListMaster(ConnectionString); DataTable dtLists = objListMaster.getAllAMMAdvListsMembers("Name", "asc", pageIndex, pageSize, out rowCount); if (dtLists.Rows.Count > 0) { RGridAdvListRecs.CurrentPageIndex = pageIndex; RGridAdvListRecs.VirtualItemCount = rowCount; RGridAdvListRecs.DataSource = dtLists; RGridAdvListRecs.PageSize = pageSize; RGridAdvListRecs.DataBind(); } } catch (Exception ex) { throw ex; } }
/// <summary> /// Delete List click event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lbtnYes_Click(object sender, EventArgs e) { try { if (grdList.Rows.Count > 0) { //Get contact Selection rememberContactSelection("grdaddchkSelectContact", "lblListMasterID", grdList, "grdaddselectall"); if (Session["SelectedContacts"] != null) { StringBuilder strbDeletedContacts = new StringBuilder(); //adding selected contatIds to stringbuilder for (int i = 0; i < contactsSelected.Count; i++) { strbDeletedContacts.Append(contactsSelected[i] + ", "); } strbDeletedContacts.Remove(strbDeletedContacts.Length - 2, 1); ListMaster ListMaster = new ListMaster(ConnectionString); ListMaster.RemoveMultipleLists(strbDeletedContacts.ToString(), Convert.ToInt32(RdDeleteList.SelectedValue)); Session["SelectedContacts"] = null; hdrchkselected.Clear(); if (txtListNameSearch.Text != "") { SearchCriteria(0, ""); } else { bindGrid("", "ASC", "ListName"); } lblMainMsg.Text = "Successfully Deleted List(s) with ids: " + strbDeletedContacts.ToString(); hdnMeditselect.Value = "false"; hdnremselect.Value = "false"; udpnlListGridview.Update(); } } } catch (Exception ex) { throw ex; } }
/// <summary> /// Creating List Name save click event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lBtnSave_Click(object sender, EventArgs e) { try { //This logic is developed by ganesh on 29dec09 lbMsg.Text = string.Empty; ListMaster listMaster = new ListMaster(ConnectionString); listMaster.ListName = txtListName.Text; listMaster.ListDesc = txtListDescription.Text; listMaster.ListCowner = txtListCreationowner.Text; if (chkSuppress.Checked) listMaster.Active = false; else listMaster.Active = true; if (chkSeedList.Checked) listMaster.IsSeedList = true; ListMasters list = ListMaster.SelectByField("ListName", txtListName.Text.Trim(), ConnectionString); if (list.Count > 0) { if (list[0].IsDeleted != true) throw new Exception(string.Format("List: {0}, already exists. Please enter other name.", txtListName.Text)); else { lbMsg.ForeColor = Color.Red; throw new Exception(string.Format("List: {0}, was deleted previosly & currently exists as inactive mode for reporting stats. Please provide other name.", txtListName.Text)); } } listMaster.CreatedDate = System.DateTime.Now; lblMainMsg.Text = string.Format(listMaster.Insert() == true ? "List {0} Created Successfully." : "List {0} Created Failed.", txtListName.Text); bindGrid("", "ASC", "ListName"); } catch (Exception ex) { CreateListPopupExtender.Show(); lbMsg.Text = "Error: " + ex.Message; } }
/// <summary> /// Edit Lists save click event / this code is developed by swaraj on 25jan 2010 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lBtnSaveList_Click(object sender, EventArgs e) { try { string ListName = txtEditListName.Text.ToString(); ListMasters list = ListMaster.SelectByField("ListName", txtEditListName.Text.Trim(), ConnectionString); ListMaster listMaster = new ListMaster(ConnectionString); listMaster.ListName = txtEditListName.Text; listMaster.ListDesc = txtEditListDescription.Text; listMaster.ListCowner = txtEditListCreationowner.Text; if (chkESuppress.Checked) listMaster.Active = false; else listMaster.Active = true; if (chkESeedList.Checked) listMaster.IsSeedList = true; else listMaster.IsSeedList = false; // allow if id is greater than 0 if (Convert.ToInt64(hiddenEditID.Value) > 0) { listMaster.ListMasterID = Convert.ToInt64(hiddenEditID.Value); // checking wheather existed list if (list.Count > 0 && list[0].ListMasterID != Convert.ToInt64(hiddenEditID.Value)) { lbMsg2.Text = "List:" + txtEditListName.Text + ", already exists. Please enter other name."; MpextDivEdit.Show(); } else { ListMasterPrimaryKey pk = new ListMasterPrimaryKey(Convert.ToInt64(hiddenEditID.Value)); ListMaster listMasterNew = ListMaster.SelectOne(pk, ConnectionString); listMaster.CreatedDate = listMasterNew.CreatedDate; listMaster.ModifiedDate = System.DateTime.Now; if (listMaster.Update() == true) { lblMainMsg.Text = string.Format("List: {0} Updated Successfully.", Server.HtmlEncode(txtEditListName.Text)); hiddenEditID.Value = null; } else { lblMainMsg.Text = string.Format("List: {0} Updation Failed.", Server.HtmlEncode(txtEditListName.Text)); } bindGrid("", "ASC", "ListName"); // if user edit the list in search mode } } else { lbMsg2.Text = "Invalid ID"; } } catch (Exception ex) { lbMsg2.Text = ex.Message.ToString(); } finally { } }
/// <summary> /// multiple list (Mass Desc Update) - yes Click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lbtnEditMultipleYes_Click(object sender, EventArgs e) { //Edit Functionality if (grdList.Rows.Count > 0) { //Get contact Selection rememberContactSelection("grdaddchkSelectContact", "lblListMasterID", grdList, "grdaddselectall"); if (Session["SelectedContacts"] != null) { StringBuilder strbEditContacts = new StringBuilder(); //adding selected contatIds to stringbuilder for (int i = 0; i < contactsSelected.Count; i++) { strbEditContacts.Append(contactsSelected[i] + ", "); ListMaster ListMaster = new ListMaster(ConnectionString); ListMaster.ListMasterID = Convert.ToInt64(contactsSelected[i]); ListMaster.ListDesc = txtEditMultiListDescription.Text; ListMasterPrimaryKey pk = new ListMasterPrimaryKey(Convert.ToInt64(contactsSelected[i])); ListMaster listMasterNew = ListMaster.SelectOne(pk, ConnectionString); ListMaster.CreatedDate = listMasterNew.CreatedDate; ListMaster.ModifiedDate = System.DateTime.Now; if (ListMaster.SelectedEditUpdate() == true) { hiddenEditID.Value = null; } } strbEditContacts.Remove(strbEditContacts.Length - 2, 1); Session["SelectedContacts"] = null; hdrchkselected.Clear(); if (txtListNameSearch.Text != "") { SearchCriteria(grdList.PageIndex, ""); } else { bindGrid("", "ASC", "ListName"); } lblMainMsg.Text = "Successfully Edit List(s) with ids: " + strbEditContacts.ToString(); hdnMeditselect.Value = "false"; udpnlListGridview.Update(); } } }
public XmlDocument GetMailingStausByMailingID(string UserID, string Password, int MailingID) { XmlDocument doc = new XmlDocument(); StringBuilder str = new StringBuilder(); str.Append("<MailingStatusInfo>"); string ConnectionString = GetConnectionString(UserID, Password); try { if (ConnectionString.Trim().Length != 0 && MailingID > 0) { CampaignMasterPrimaryKey objCampaignMasterPrimaryKey = new CampaignMasterPrimaryKey(MailingID); CampaignMaster objCampaignMaster = CampaignMaster.SelectOneWithCampaignJobUsingCampaignMasterID(objCampaignMasterPrimaryKey, ConnectionString); if (objCampaignMaster != null) { CampaignJobPrimaryKey pk = new CampaignJobPrimaryKey(MailingID); CampaignJobs objCampaignjob = CampaignJob.SelectByField("CampaignMasterID", MailingID, ConnectionString); ListMasterPrimaryKey pkList; ListMaster listMaster = new ListMaster(ConnectionString); ListContactMaster objListContactMaster; string ListNames = string.Empty; string ListIds = string.Empty; if (objCampaignMaster.SelectCondition.Trim().Length > 0) { if (objCampaignMaster.SelectCondition.Trim().Contains(",")) { string[] Lists = objCampaignMaster.SelectCondition.Split(','); foreach (string list in Lists) { pkList = new ListMasterPrimaryKey(Convert.ToInt32(list)); listMaster = ListMaster.SelectOne(pkList, ConnectionString); if (listMaster != null) { ListNames = ListNames + listMaster.ListName + ","; ListIds = ListIds + listMaster.ListMasterID.ToString() + ","; } } ListNames = ListNames.Substring(0, ListNames.Length - 1); ListIds = ListIds.Substring(0, ListIds.Length - 1); } else { pkList = new ListMasterPrimaryKey(Convert.ToInt32(objCampaignMaster.SelectCondition)); listMaster = ListMaster.SelectOne(pkList, ConnectionString); objListContactMaster = new ListContactMaster(ConnectionString); ListNames = listMaster.ListName; ListIds = listMaster.ListMasterID.ToString(); } str.Append("<CurrentStatusForTheMailing>"); if (objCampaignMaster.SelectCondition.Length > 0) str.Append("<ListCreated>Yes</ListCreated>"); else str.Append("<ListCreated>Error</ListCreated>"); if (objCampaignjob[0] != null && objCampaignjob[0].ScheduledDatetime.ToString().Length > 0) str.Append("<ScheduleDefined>Yes</ScheduleDefined>"); else str.Append("<ScheduleDefined>No</ScheduleDefined>"); MailApprovals objMailApprovals = MailApproval.SelectByField("MailingID", MailingID, ConnectionString); if (objMailApprovals.Count > 0) { if (objMailApprovals[0].ApprovalStatus == "Approved") str.Append("<CreativeIsApproved>Yes</CreativeIsApproved>"); else str.Append("<CreativeIsApproved>Waiting For Approval</CreativeIsApproved>"); } if (objCampaignjob.Count > 0 && objCampaignjob[0].CompletionTime != null) { str.Append("<MailingIsInSendingProcess>No</MailingIsInSendingProcess>"); str.Append("<MailingIsComplete>Yes</MailingIsComplete>"); } else { str.Append("<MailingIsInSendingProcess>Yes</MailingIsInSendingProcess>"); str.Append("<MailingIsComplete>No</MailingIsComplete>"); } str.Append("</CurrentStatusForTheMailing>"); str.Append("<MailingSummary>"); str.Append("<Client>" + UserID + "</Client>"); str.Append("<MailingName>" + objCampaignMaster.CampaignName.ToString() + "</MailingName> "); str.Append("<MailingID>" + objCampaignMaster.CampaignId.ToString() + "</MailingID> "); str.Append("<FromName>" + objCampaignMaster.FromName + "</FromName> "); str.Append("<FromMail>" + objCampaignMaster.FromAddress + "</FromMail> "); str.Append("<Subject>" + objCampaignMaster.Subject + "</Subject> "); str.Append("<ReplyToMail>" + objCampaignMaster.ReplytoAddress + "</ReplyToMail> "); str.Append("<MailingListFileQuantity>" + objCampaignjob[0].TotalRecipients + "</MailingListFileQuantity > "); if (objCampaignMaster.SuppressSelection != null && objCampaignMaster.SuppressSelection != "0" && objCampaignMaster.SuppressSelection != "") { ListContactMasters objListContacts = ListContactMaster.SelectByField("ListMasterID", objCampaignMaster.SuppressSelection, ConnectionString); str.Append("<SuppressListFileQuantity>" + objListContacts.Count.ToString() + "</SuppressListFileQuantity > "); } if (objCampaignjob.Count > 0) str.Append("<ScheduleDateTime>" + objCampaignjob[0].ScheduledDatetime + "</ScheduleDateTime> "); str.Append("<MailingListName>" + ListNames + "</MailingListName> "); str.Append("<MailingListID>" + ListIds + "</MailingListID> "); str.Append("</MailingSummary>"); } else str.Append("<Message>List Not Found For The Mailing With ID: " + MailingID + "</Message>"); } else str.Append("<Message>Mailing with id: " + MailingID + " not exist</Message>"); } else str.Append("<Message>Invalid UserName/Password</Message>"); } catch (Exception ex) { str.Append("<Error>" + ex.Message + "</Error>"); } str.Append("</MailingStatusInfo>"); doc.LoadXml(str.ToString()); return doc; }
/// <summary> /// This method will get row(s) from the database using the value of the field specified /// along with the details of the child table. /// </summary> /// /// <param name="pk" type="ListMasterPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class ListMaster</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 11/6/2009 11:39:08 AM Created function /// /// </RevisionHistory> /// /// </remarks> /// public static ListMaster SelectOneWithListContactMasterUsingListMasterID(ListMasterPrimaryKey pk, string ConnectionString) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(ConnectionString); bool ExecutionState = false; ListMaster obj=null; // Pass the values of all key parameters to the stored procedure. System.Collections.Specialized.NameValueCollection nvc = pk.GetKeysAndValues(); foreach (string key in nvc.Keys) { oDatabaseHelper.AddParameter("@" + key,nvc[key] ); } // The parameter '@ErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@ErrorCode", -1, System.Data.ParameterDirection.Output); IDataReader dr=oDatabaseHelper.ExecuteReader("sp_ListMaster_SelectOneWithListContactMasterUsingListMasterID", ref ExecutionState); if (dr.Read()) { obj= new ListMaster(ConnectionString); PopulateObjectFromReader(obj,dr); dr.NextResult(); //Get the child records. obj.ListContactMasters=ListContactMaster.PopulateObjectsFromReader(dr,ConnectionString); } dr.Close(); oDatabaseHelper.Dispose(); return obj; }
private void bindGridto() { try { ListMaster objListMaster = new ListMaster(ConnectionString); DataTable dtLists = objListMaster.getAllListsWithMembersCount("CreatedDate", "desc"); dtLists.AsEnumerable().ToList().ForEach(delegate(DataRow row) { if (row["ListName"].ToString().Contains(""")) row["ListName"] = Server.HtmlEncode(row["ListName"].ToString()); }); GrdList2.DataSource = dtLists; GrdList2.DataBind(); } catch (Exception ex) { throw ex; } }
/// <summary> /// Populates the fields for multiple objects from the columns found in an open reader. /// </summary> /// /// <param name="rdr" type="IDataReader">An object that implements the IDataReader interface</param> /// /// <returns>Object of ListMasters</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 11/6/2009 11:39:08 AM Created function /// /// </RevisionHistory> /// /// </remarks> /// internal static ListMasters PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper, string ConnectionString) { ListMasters list = new ListMasters(); if (rdr.Read()) { ListMaster obj = new ListMaster(ConnectionString); PopulateObjectFromReader(obj, rdr); list.Add(obj); while (rdr.Read()) { obj = new ListMaster(ConnectionString); PopulateObjectFromReader(obj, rdr); list.Add(obj); } oDatabaseHelper.Dispose(); return list; } else { oDatabaseHelper.Dispose(); return null; } }
protected void Page_Load(object sender, EventArgs e) { try { ConnectionString = Session["Connectionstring"].ToString(); Master.ParentModulelbl.Text = "MAILINGS"; AccountSettingsClass objAccCls; // to get the login name for this session //LoginName LoginName = (LoginName)Master.FindControl("LoginName1"); //UserName = LoginName.Page.User.Identity.Name; #region UnComment when integrate with the billing //Billing objBilling=new Billing(); ////save the No of email limits for the client in hidden field ////the first parameter gives the user name from the login name //NoOfEmailLimitsForClient.Value = // objBilling.SelectEmailCount(((LoginName)Master.FindControl("LoginName1")).Page.User.Identity.Name, BillingConnectionString).ToString(); #endregion txtCurDate.Text = DateTime.Now.ToShortDateString(); ScriptManager1.SetFocus(txtCampaignName); lblMainMsg.Text = string.Empty; if (!IsPostBack) { ListMaster objListMaster = new ListMaster(ConnectionString); dtListNames = objListMaster.SelectAllSuppressLists(ConnectionString, "CreatedDate", "Desc"); if (Session["AccCls"] != null) { objAccCls = (AccountSettingsClass)Session["AccCls"]; if (objAccCls.IsCustomizedAMMForms) { RadComboBoxItem Hwitem = new RadComboBoxItem("Wconnect", " <a href='[!RPLINK:2!]'>Wconnect</a> "); RadComboBoxItem Hgitem = new RadComboBoxItem("GoWidener", " <a href='[!RPLINK:3!]'>GoWidener</a> "); RadComboBoxItem Twitem = new RadComboBoxItem("Wconnect", "[!RPLINK:2!]"); RadComboBoxItem Tgitem = new RadComboBoxItem("GoWidener", "[!RPLINK:3!]"); rcbLinks.Items.Add(Hwitem); rcbLinks.Items.Add(Hgitem); RadLinks.Items.Add(Twitem); RadLinks.Items.Add(Tgitem); } } //Code Added by Pushpesh Suman for From Name and Address Issue string Username = User.Identity.Name; if (Username.ToString().ToLower().Equals("admin"))// || Username.ToString().ToLower().Equals("4virtu")) { LinkButton1.Enabled = false; lbtnScheduleCampaign.Enabled = false; } objMembershipUser = Membership.GetUser(Username); objProfileBase = ProfileBase.Create(Username, true); txtFromName.Text = (objProfileBase.GetPropertyValue("FromName").ToString() != string.Empty) ? objProfileBase.GetPropertyValue("FromName").ToString() : Username; txtReplytoAddress.Text = (objProfileBase.GetPropertyValue("ReplyEmail").ToString() != string.Empty) ? objProfileBase.GetPropertyValue("ReplyEmail").ToString() : string.Empty; string fromAddresses = string.Empty; if (User.IsInRole("user")) { objUserProfileBase = ProfileBase.Create(objProfileBase.GetPropertyValue("ParentUserName").ToString(), true); fromAddresses = objUserProfileBase.GetPropertyValue("FromDomain").ToString().Replace(" ", string.Empty); } else { fromAddresses = (objProfileBase.GetPropertyValue("FromDomain").ToString() != string.Empty) ? objProfileBase.GetPropertyValue("FromDomain").ToString().Replace(" ", string.Empty) : Username; } if (fromAddresses.ToString().Trim() != string.Empty && fromAddresses.Contains(',')) { ddlFromAddress.DataSource = fromAddresses.Split(','); ddlFromAddress.DataBind(); } else if (fromAddresses.ToString().Trim() != string.Empty && !fromAddresses.Contains(',')) ddlFromAddress.Items.Add(fromAddresses); //string FromAdd = objProfileBase.GetPropertyValue("FromDomain").ToString(); //if (FromAdd.ToString().Trim() != string.Empty) //{ // txtFromAddress.Text = FromAdd.ToString().Trim(); //} //else //{ // objUserProfileBase = ProfileBase.Create(objProfileBase.GetPropertyValue("ParentUserName").ToString(), true); // FromAdd = objUserProfileBase.GetPropertyValue("FromDomain").ToString(); // txtFromAddress.Text = FromAdd.ToString().Trim(); //} if (!User.IsInRole("user")) { CompanyName = objProfileBase.GetPropertyValue("CompanyName").ToString(); domainNames = objProfileBase.GetPropertyValue("FromDomain").ToString(); Address = objProfileBase.GetPropertyValue("Address").ToString(); state = objProfileBase.GetPropertyValue("State").ToString(); postalcode = objProfileBase.GetPropertyValue("PostalCode").ToString(); country = objProfileBase.GetPropertyValue("Country").ToString(); hdUserAddress.Value = "<span style='font-size :small'>Our mailing address is:<br />" + CompanyName + "," + Address + "," + state + "," + postalcode + "," + country + "</span>"; } else { string ConnectionString1 = System.Configuration.ConfigurationManager.ConnectionStrings["sqlConstr"].ConnectionString; UserInfos objUserInfos = UserInfo.SelectByField("UserId", objMembershipUser.ProviderUserKey.ToString(), ConnectionString1); if (objUserInfos.Count > 0) { //CompanyName = objProfileBase.GetPropertyValue("CompanyName").ToString(); objUserProfileBase = ProfileBase.Create(objProfileBase.GetPropertyValue("ParentUserName").ToString(), true); CompanyName = objUserProfileBase.GetPropertyValue("CompanyName").ToString().Replace(" ", string.Empty); Address = objUserInfos[0].Address1; domainNames = objUserInfos[0].EmailAddress; country = objUserInfos[0].Country; state = objUserInfos[0].State; postalcode = objUserInfos[0].PostalCode; hdUserAddress.Value = "<span style='font-size :small'>Our mailing address is:<br />" + CompanyName + "," + Address + "," + state + "," + postalcode + "," + country + "</span>"; } } RadComboBoxItem MailingaddHTML = new RadComboBoxItem("Mailing Address", hdUserAddress.Value); rcbLinks.Items.Add(MailingaddHTML); RadComboBoxItem MailingaddText = new RadComboBoxItem("Mailing Address", hdUserAddress.Value); RadLinks.Items.Add(MailingaddText); ViewState["CCSelectedAll"] = null; ViewState["CCSelectedLists"] = null; ViewState["SeedSelectedAll"] = null; ViewState["SeedSelectedLists"] = null; ViewState["SeedSelectAllLists"] = null; ViewState["CCSelectedDomains"] = null; ViewState["CCDomainSelectedAll"] = null; ViewState["SupressLists"] = null; ViewState["dtDomain"] = null; lbtnHtml.Visible = true; lbtnText.Visible = true; divtextHtml.Style.Add("display", "none"); bindCampNames(); ////Up to here if (Request.QueryString["id"] != null) { //set main title for the page. lblMainTitle.Text = "Edit Mailing"; hiddenCampaignID.Value = Request.QueryString["id"].ToString(); bindCampaignDetails(hiddenCampaignID.Value); } else { //set main title for the page. lblMainTitle.Text = "New Mailing"; DivUnsubtext.InnerHtml = "If you no longer wish to receive these emails, simply click on the following link: \n" + DDLinktext.SelectedValue; txtUnsubscribe.Text = "If you no longer wish to receive these emails, simply click on the following link:"; lblunsubinfo.Text = "If you no longer wish to receive these emails, simply click on the following link:"; lblunsublinktext.Text = DDLinktext.SelectedItem.Text.ToString(); } //for subjectpf dropdown fill data ddlSubjectpf.Items.Add(new ListItem("--Select--", "--Select--")); ddlSubjectpf.Items.Add(new ListItem("First Name", "[!FirstName!]")); ddlSubjectpf.Items.Add(new ListItem("Last Name", "[!LastName!]")); ddlSubjectpf.Items.Add(new ListItem("Email Address", "[!EmailAddress!]")); DataTable dt = ManageFieldsBase.SelectCustomFields(ConnectionString); for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["PersonalizedField"].ToString() == "True") { if (dt.Rows[i]["FieldType"].ToString() == "Text Box" || dt.Rows[i]["FieldType"].ToString() == "Date" || dt.Rows[i]["FieldType"].ToString() == "Check Box") { ddlSubjectpf.Items.Add(new ListItem(dt.Rows[i]["FieldName"].ToString(), "[!" + dt.Rows[i]["FieldName"].ToString() + "!]")); } } } } this.Form.DefaultFocus = txtCampaignName.ClientID; if (rdoSendLater.Checked == true) { LinkButton1.Visible = true; lbtnScheduleCampaign.Visible = false; } else { LinkButton1.Visible = false; lbtnScheduleCampaign.Visible = true; } } catch (Exception ex) { lblMainMsg.Text = "Error: " + ex.Message; } }
protected void bindGrid(string fillFlag, string _sortdir, string _gridSortExp) { try { string sortdir = (fillFlag == "sort" ? GetSortDirection() : GridViewSortDirection); // to display listname wise sorting whenever a list gets created or removed if (!_gridSortExp.Equals(string.Empty)) { sortdir = _sortdir; GridSortExpression = _gridSortExp; } ListMaster objListMaster = new ListMaster(ConnectionString); DataTable dtLists = objListMaster.getAllListsWithMembersCount(GridSortExpression, sortdir); //to sort grdList1.DataSource = dtLists; GrdList2.DataSource = dtLists; grdList1.DataBind(); GrdList2.DataBind(); // if grid has no records then disable the remove button udpnlGrid1.Update(); udpnlGrid2.Update(); GridPrevSortExpression = GridSortExpression; } catch (Exception ex) { throw ex; } }
protected void bindCampaignDetails(string campaignID) { try { if (Request.QueryString["CampStatus"] == "Clone") { hdCampEditorTab2.Value = "1"; hdCampDetailsTab1.Value = "1"; hdCampDeliveryTab5.Value = "1"; } bindTemplates(); //get campaign details CampaignMasterPrimaryKey pk = new CampaignMasterPrimaryKey(Convert.ToInt64(campaignID)); CampaignMaster objCampMaster = CampaignMaster.SelectOneWithCampaignJobUsingCampaignMasterID(pk, ConnectionString); lblCampName.Text = objCampMaster.CampaignName.ToString().Trim(); if ((objCampMaster.TextContent.ToString().Trim().Length != 0 && objCampMaster.HTMLContent != string.Empty) || (objCampMaster.HTMLContent == string.Empty && objCampMaster.TextContent == string.Empty)) { lbtnHtml.Visible = true; lbtnText.Visible = true; divHtml.Style.Add("display", "block"); divtextHtml.Style.Add("display", "none"); } else if (objCampMaster.HTMLContent == string.Empty && objCampMaster.TextContent != string.Empty) { lbtnText.Visible = true; lbtnHtml.Visible = false; divHtml.Style.Add("display", "none"); divtextHtml.Style.Add("display", "block"); } else { lbtnHtml.Visible = true; lbtnText.Visible = false; divHtml.Style.Add("display", "block"); divtextHtml.Style.Add("display", "none"); } RadEditor1.Content = objCampMaster.HTMLContent; textRadEditor.Content = objCampMaster.TextContent; if (Request.QueryString["CampStatus"] == "Clone") //if (objCampMaster.CampaignJobs[0].Status == 4) { string campname = objCampMaster.CampaignName; if (!campname.Contains("Clone Of")) txtCampaignName.Text = "Clone Of " + objCampMaster.CampaignName + "_" + DateTime.Now.ToString(); else { int x = campname.IndexOf("_"); int length = campname.Length - (x + 1); campname = campname.Remove(x, length); txtCampaignName.Text = campname + "_" + DateTime.Now.ToString(); } hiddenCampaignID.Value = string.Empty; } else { txtCampaignName.Text = objCampMaster.CampaignName; } txtCampaignDescription.Text = objCampMaster.CampaignDescription; txtFromName.Text = objCampMaster.FromName; if (objCampMaster.htmlHasUnsubLink != null && objCampMaster.htmlHasUnsubLink == true) { chkAddress.Checked = true; chkAddress2.Checked = true; } if (objCampMaster.txtHasUnsubLink != null && objCampMaster.txtHasUnsubLink == true) { chkTxtAddress.Checked = true; chkTxtAddress.Checked = true; } if (Convert.ToUInt64(objCampMaster.AssignedCampaignID.ToString()) != 0) { ddlCampsNames.Text = objCampMaster.AssignedCampaignID.ToString(); AssCampIdDb.Value = objCampMaster.AssignedCampaignID.ToString(); } else { ddlCampsNames.Items[0].Selected = true; AssCampIdDb.Value = "0"; } txtReplytoAddress.Text = objCampMaster.ReplytoAddress; txtReplaytoName.Text = objCampMaster.ReplaytoName; txtSubject.Text = objCampMaster.Subject; chkTrackReads.Checked = Convert.ToBoolean(objCampMaster.TrackReads); /* unsub text retrive by swaroop*/ lblunsubinfo.Text = objCampMaster.UnsubscribeText; lblunsublinktext.Text = objCampMaster.UnsubscribeLinkText; DivUnsubtext.InnerHtml = lblunsubinfo.Text + " \n" + lblunsublinktext.Text; hdUnsubscribeText.Value = objCampMaster.UnsubscribeText; hdUnsubscribeLinkText.Value = objCampMaster.UnsubscribeLinkText; txtUnsubscribe.Text = objCampMaster.UnsubscribeText; HDSuppressDomain.Value = objCampMaster.SuppressDomain; ListMaster objListMaster = new ListMaster(ConnectionString); if (!string.IsNullOrEmpty(objCampMaster.SelectCondition)) { //string[] arrList = objCampMaster.SelectCondition.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.getShowCampaignCloneListRecipients(Convert.ToInt64(listMaster.ListMasterID), "firstname", "asc"); // lstBoxListNames.Items.Add(new ListItem(Server.HtmlDecode(listMaster.ListName.ToString()) + " (" + dtContacts.Rows.Count + ")", listMaster.ListMasterID.ToString(), true)); // } //} DataTable dtSelectConditions = objListMaster.SelectAllListBySelectedConditions(ConnectionString, objCampMaster.SelectCondition, "ListName", "asc"); if (dtSelectConditions.Rows.Count > 0) { lstBoxListNames.DataSource = dtSelectConditions; lstBoxListNames.DataTextField = "ListContacts"; lstBoxListNames.DataValueField = "ListMasterID"; lstBoxListNames.DataBind(); } } if (!string.IsNullOrEmpty(objCampMaster.SuppressDomain)) { string[] arrDList = objCampMaster.SuppressDomain.Split(','); //foreach (string arr in arrDList) //{ // lstSuppressedDomain.Items.Add(arr.ToString()); //} lstSuppressedDomain.DataSource = arrDList; lstSuppressedDomain.DataBind(); } if (!string.IsNullOrEmpty(objCampMaster.SuppressSelection)) { //string[] arrList = objCampMaster.SuppressSelection.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"); // lstSuppressList.Items.Add(new ListItem(Server.HtmlDecode(listMaster.ListName.ToString()) + " (" + dtContacts.Rows.Count + ")", listMaster.ListMasterID.ToString(), true)); // } //} //ListMaster objListMaster = new ListMaster(ConnectionString); DataTable dtSuppressSelection = objListMaster.SelectSuppressListBySuppressSelection(ConnectionString, objCampMaster.SuppressSelection, "ListName", "asc"); if (dtSuppressSelection.Rows.Count > 0) { lstSuppressList.DataSource = dtSuppressSelection; lstSuppressList.DataTextField = "ListContacts"; lstSuppressList.DataValueField = "ListMasterID"; lstSuppressList.DataBind(); } } if (objCampMaster.CampaignJobs.Count != 0 && objCampMaster.CampaignJobs[0].SendType != null && objCampMaster.CampaignJobs[0].SendType.ToLower().Equals("later")) { rdoSendLater.Checked = true; rdoSendImmediately.Checked = false; ddlSelectedTime.Enabled = true; txtSelectedDate.Enabled = true; txtSelectedDate.Text = Convert.ToDateTime(objCampMaster.CampaignJobs[0].ScheduledDatetime).ToShortDateString(); ddlSelectedTime.Items.FindByText(Convert.ToDateTime(objCampMaster.CampaignJobs[0].ScheduledDatetime).ToShortTimeString()).Selected = true; } else { rdoSendLater.Checked = false; rdoSendImmediately.Checked = true; } } catch (Exception ex) { throw ex; } }
protected void bindSuppressdList() { //if (ViewState["SupressLists"] != null) //{ ListMaster objListMaster = new ListMaster(ConnectionString); dtLists = objListMaster.SelectAllSuppressLists(ConnectionString, "CreatedDate", "Desc"); //} if (dtLists.Rows.Count > 0) { chkSuppressListNames.DataSource = dtLists; chkSuppressListNames.DataTextField = "ListContacts"; chkSuppressListNames.DataValueField = "ListMasterID"; chkSuppressListNames.DataBind(); } }
/// <summary> /// Populates the fields for multiple objects from the columns found in an open reader. /// </summary> /// /// <param name="rdr" type="IDataReader">An object that implements the IDataReader interface</param> /// /// <returns>Object of ListMasters</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 11/6/2009 11:39:08 AM Created function /// /// </RevisionHistory> /// /// </remarks> /// internal static ListMasters PopulateObjectsFromReader(IDataReader rdr,string ConnectionString) { ListMasters list = new ListMasters(); while (rdr.Read()) { ListMaster obj = new ListMaster(ConnectionString); PopulateObjectFromReader(obj,rdr); list.Add(obj); } return list; }
public void deleteRecipient() { try { if (Convert.ToInt64(hdfldDelID.Value) > 0) { // get the list details to diplay the list name ListMasterPrimaryKey pk = new ListMasterPrimaryKey(Convert.ToInt64(hdfldDelID.Value)); ListMaster listMaster = ListMaster.SelectOne(pk, ConnectionString); //This logic is modified by ganesh on 18jan10 ListMaster objListMaster = new ListMaster(ConnectionString); //delete the list from listmaster and listcontactmaster tables. objListMaster.deleteListFromListMasterAndListContactMaster(Convert.ToInt64(hdfldDelID.Value)); if (!txtListNameSearch.Text.Equals(string.Empty)) { SearchCriteria(0, ""); } else { bindGrid("", "ASC", "ListName"); } lblMainMsg.Text = string.Format("Successfully deleted list with List Name: {0}", listMaster.ListName.ToString()); } } catch (Exception ex) { throw ex; } }
protected void bindLists() { try { pagingSource = new PagedDataSource(); if (txtSearchListName.Text == "") { ListMaster objListMaster = new ListMaster(ConnectionString); dtLists = objListMaster.SelectAllList(ConnectionString, "CreatedDate", "Desc"); pagingSource.DataSource = dtLists.DefaultView; pagingSource.AllowPaging = true; pagingSource.PageSize = pSize; pagingSource.CurrentPageIndex = (ViewState["PageNumber"] != null) ? (int)ViewState["PageNumber"] : 0; ViewState["PageCount"] = pagingSource.PageCount; pnlNavigation.Style.Add("display", "Block"); } else { SearchedListsDt = new DataTable(); SearchedListsDt = ListMaster.SearchSelectLookup(ConnectionString, txtSearchListName.Text); pagingSource.DataSource = SearchedListsDt.DefaultView; if (SearchedListsDt.Rows.Count <= 1) { pnlNavigation.Style.Add("display", "none"); } if (SearchedListsDt.Rows.Count == 0) { lblmsgnewlist.Text = "Records Not Found !"; lblmsgnewlistUp.Update(); } else { lblmsgnewlist.Text = "Records Found " + SearchedListsDt.Rows.Count; lblmsgnewlistUp.Update(); } pagingSource.AllowPaging = true; pagingSource.PageSize = pSize; if (SearchedListsDt.Rows.Count < pSize) { pagingSource.CurrentPageIndex = 0; } else { pagingSource.CurrentPageIndex = (ViewState["PageNumber"] != null) ? (int)ViewState["PageNumber"] : 0; ViewState["PageCount"] = pagingSource.PageCount; } } if (pagingSource.IsFirstPage) { lnkFirst.Visible = false; lnkPrev.Visible = false; } else { lnkFirst.Visible = true; lnkPrev.Visible = true; } if (pagingSource.IsLastPage) { lnkNext.Visible = false; lnkLast.Visible = false; } else { lnkNext.Visible = true; lnkLast.Visible = true; } chkListNames.DataSource = pagingSource; chkListNames.DataTextField = "ListContacts"; chkListNames.DataValueField = "ListMasterID"; chkListNames.DataBind(); upnlgrdList.Update(); } catch (Exception ex) { throw ex; } }
/// <summary> /// To bind List grid /// </summary> /// <param name="fillFlag"></param> /// <param name="_sortdir"></param> /// <param name="_gridSortExp"></param> protected void bindGrid(string fillFlag, string _sortdir, string _gridSortExp) { try { string sortdir = (fillFlag == "sort" ? GetSortDirection() : GridViewSortDirection); if (flagreset == true) { sortdir = "ASC"; GridSortExpression = "ListName"; } ListMaster objListMaster = new ListMaster(ConnectionString); DataTable dtLists = objListMaster.getAllListsWithMembersCount(GridSortExpression, sortdir); if (dtLists.Rows.Count > 0) { grdList.DataSource = dtLists; grdList.DataBind(); GridPrevSortExpression = GridSortExpression; } udpnlListGridview.Update(); } catch (Exception ex) { throw ex; } }
private void buildSegmentFromLists(string fillFlag, int pageIndex) { try { string sortdir = (fillFlag == "sort" ? GetSortDirection() : GridViewSortDirection); if (flagreset == true) { sortdir = "ASC"; GridSortExpression = "ListName"; } ListMaster objListMaster = new ListMaster(ConnectionString); DataTable dtLists = objListMaster.getAllListsWithMembersCount(GridSortExpression, sortdir); if (hdfListId.Value != "") { DataRow[] dataRow = dtLists.Select("ListMasterId=" + hdfListId.Value); dtLists.Rows.Remove(dataRow[0]); } if (dtLists.Rows.Count > 0) { rgdList.DataSource = dtLists; rgdList.CurrentPageIndex = pageIndex; rgdList.DataBind(); GridPrevSortExpression = GridSortExpression; } lblMember.Text = ""; lblListsSelected.Text = ""; divListFiletr.Style.Add("display", "none"); divCampaigns.Style.Add("display", "none"); divCampaignFilter.Style.Add("display", "none"); divLists.Style.Add("display", "block"); } catch (Exception ex) { throw ex; } }
public XmlDocument AddList(string UserID, string Password, string ListName) { XmlDocument doc = new System.Xml.XmlDocument(); StringBuilder str = new StringBuilder(); str.Append("<ListsInsertInfo>"); string ConnectionString = GetConnectionString(UserID, Password); ListMasters list = ListMaster.SelectByField("ListName", ListName, ConnectionString); if (list.Count > 0) { str.Append("<Message> Already exists. Please enter other ListName</Message>"); } else { ListMaster listMaster = new ListMaster(ConnectionString); listMaster.ListName = ListName; listMaster.CreatedDate = System.DateTime.Now; if (listMaster.Insert() == true) { str.Append("<Message> List Created Successfully.</Message>"); } } str.Append("</ListsInsertInfo>"); doc.LoadXml(str.ToString()); return doc; }
/// <summary> /// This method will select record based on the unique key value /// </summary> /// /// <param name="listName" type="string">listName</param> /// /// <returns>Object of class ListMaster</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 11/6/2009 11:39:08 AM Created function /// /// </RevisionHistory> /// /// </remarks> /// public static ListMaster SelectOneByIX_ListMasterID(string listName, string ConnectionString) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(ConnectionString); bool ExecutionState = false; // Pass the value of 'listName' as parameter 'ListName' of the stored procedure. oDatabaseHelper.AddParameter("@ListName", listName); // The parameter '@ErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@ErrorCode", -1, System.Data.ParameterDirection.Output); IDataReader dr=oDatabaseHelper.ExecuteReader("sp_ListMaster_SelectByIX_ListMasterID", ref ExecutionState); ListMaster obj = new ListMaster(ConnectionString); if (dr.Read()) { PopulateObjectFromReader(obj, dr); return obj; } else return null; }
protected void bindListNames() { ListMaster objListMaster = new ListMaster(ConnectionString); dtLists = objListMaster.SelectAllList(ConnectionString, "Listname", "ASC"); if (dtLists.Rows.Count > 0) { chkListNames.DataSource = dtLists; chkListNames.DataTextField = "ListContacts"; chkListNames.DataValueField = "ListMasterID"; chkListNames.DataBind(); } }
public XmlDocument GetAllLists(string UserID, string Password) { XmlDocument doc = new System.Xml.XmlDocument(); string Con = GetConnectionString(UserID, Password); ListMaster objListMaster = new ListMaster(Con); DataTable dtLists = objListMaster.getAllListsWithMembersCount("ListMasterID", "asc"); StringBuilder str = new StringBuilder(); str.Append("<ListsInfo>"); if (dtLists != null) { for (int i = 0; i < dtLists.Rows.Count; i++) { str.Append("<List Row=\"" + i.ToString() + "\"> "); str.Append("<ListMasterID>" + dtLists.Rows[i]["ListMasterID"].ToString() + "</ListMasterID> "); str.Append(" <ListName>" + dtLists.Rows[i]["ListName"].ToString() + "</ListName>"); //str.Append(" <ListDesc>" + dtLists.Rows[i]["ListDesc"].ToString() + "</ListDesc>"); if (string.IsNullOrEmpty(dtLists.Rows[i]["ListDesc"].ToString())) str.Append("<ListDesc>" + string.Empty + "</ListDesc>"); else str.Append("<ListDesc>" + Server.HtmlEncode(dtLists.Rows[i]["ListDesc"].ToString()) + "</ListDesc>"); str.Append(" <ListCowner>" + dtLists.Rows[i]["ListCowner"].ToString() + "</ListCowner>"); str.Append(" <AllMembers>" + dtLists.Rows[i]["AllMembers"].ToString() + "</AllMembers>"); str.Append(" <ValidMembers>" + dtLists.Rows[i]["ValidMembers"].ToString() + "</ValidMembers>"); str.Append(" <CreatedDate>" + Convert.ToDateTime(dtLists.Rows[i]["CreatedDate"]).ToString() + "</CreatedDate>"); str.Append("<Errormessage></Errormessage>"); str.Append("</List>"); string ss = str.ToString(); } } else { str.Append("<Message> Please Enter Valid Inputs</Message>"); } str.Append("</ListsInfo>"); doc.LoadXml(str.ToString()); return doc; }
protected void lBtnSave_Click(object sender, EventArgs e) { try { bool status = false; lbMsg.Text = string.Empty; ListMaster listMaster = new ListMaster(ConnectionString); listMaster.ListName = txtListName.Text; listMaster.ListDesc = txtListDescription.Text; listMaster.ListCowner = txtListCreationowner.Text; if (chkSuppress.Checked) listMaster.Active = false; //Active Column taking as a 'Suppress' else listMaster.Active = true; //Active Column taking as a 'Suppress' if (chkSeedList.Checked) listMaster.IsSeedList = true; ListMasters list = ListMaster.SelectByField("ListName", txtListName.Text.Trim(), ConnectionString); if (list.Count > 0) { if (list[0].IsDeleted != true) throw new Exception(string.Format("List: {0}, already exists. Please enter other name.", txtListName.Text)); else { lbMsg.ForeColor = System.Drawing.Color.Red; throw new Exception(string.Format("List: {0}, was deleted previosly & currently exists as inactive mode for reporting stats. Please provide other name.", txtListName.Text)); } } listMaster.CreatedDate = System.DateTime.Now; status = listMaster.Insert(); string lbl = ""; lbl = txtListName.Text; if (txtListName.Text.Contains(""")) { lbl = Server.HtmlEncode(txtListName.Text); } if (status == true) { lblmsgnewlist.Text = string.Format("List: {0} Created Successfully.", lbl); } else { lblmsgnewlist.Text = string.Format("List: {0} Created Failed.", lbl); } bindLists(); ModalPopupExtenderShowLists.Show(); lblmsgnewlistUp.Update(); } catch (Exception ex) { lbMsg.Text = "Error: " + ex.Message; ModalPopupExtenderlist.Show(); txtListName.Focus(); } }
protected void bindAlreadySelectedList() { if (Request.QueryString["SelectLists"] != null && chkSelectall.Checked == false) { ListMaster objListMaster = new ListMaster(Connectionstring); dtLists = objListMaster.SelectListsBasedOnIds(Connectionstring, "Listname", "ASC", Session["importListIds"].ToString()); if (dtLists.Rows.Count > 0) { chkListNames.DataSource = dtLists; chkListNames.DataTextField = "ListContacts"; chkListNames.DataValueField = "ListMasterID"; chkListNames.DataBind(); } foreach (DataRow dr in dtLists.Rows) { lstBoxListNames.Items.Add(new ListItem(dr["ListContacts"].ToString(), dr["ListMasterID"].ToString())); } } }