Example #1
0
        protected void lbtnYes_Click(object sender, EventArgs e)
        {
            try
            {
                //deleteRecipient();
                //bindGrid();
                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 < listsSelected.Count; i++)
                        {
                            strbDeletedContacts.Append(listsSelected[i] + ", ");
                        }
                        strbDeletedContacts.Remove(strbDeletedContacts.Length - 2, 1);
                        AdvanceListMaster ListMaster = new AdvanceListMaster(ConnectionString);
                        ListMaster.RemoveMultipleLists(strbDeletedContacts.ToString());
                        Session["SelectedContacts"] = null;
                        hdrchkselected.Clear();
                        lblMainMsg.Text = "Successfully Deleted Segments(s) with ids: " + strbDeletedContacts.ToString();
                        hdnMeditselect.Value = "false";
                        hdnremselect.Value = "false";
                        udpnlListGridview.Update();
                        bindGrid("", "ASC", "ListName");
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <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="AdvanceListMasterPrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class AdvanceListMaster</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			7/28/2012 02:16:48 PM				Created function
        /// 
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        public static AdvanceListMaster SelectOneWithAdvanceListMasterUsingListMasterID(AdvanceListMasterPrimaryKey pk,string ConnectionString)
        {
            DatabaseHelper oDatabaseHelper = new DatabaseHelper(ConnectionString);
            bool ExecutionState = false;
            AdvanceListMaster 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_AdvanceListMaster_SelectOneWithAdvanceListMasterUsingListMasterID", ref ExecutionState);
            if (dr.Read())
            {
                obj = new AdvanceListMaster(ConnectionString);
                PopulateObjectFromReader(obj,dr);

                dr.NextResult();

                //Get the child records.
                obj.AdvanceListMasters=AdvanceListMaster.PopulateObjectsFromReader(dr,ConnectionString);
            }
            dr.Close();
            oDatabaseHelper.Dispose();
            return obj;
        }
Example #3
0
        protected void bindGrid(string fillFlag, string _sortdir, string _gridSortExp)
        {
            try
            {
                string sortdir = (fillFlag == "sort" ? GetSortDirection() : GridViewSortDirection);

                if (flagreset == true)
                {
                    sortdir = "ASC";
                    GridSortExpression = "ListName";
                }
                AdvanceListMaster objListMaster = new AdvanceListMaster(ConnectionString);
                DataTable dtLists = objListMaster.getAllAdvancedSegmentsWithMembersCount(GridSortExpression, sortdir);
                if (dtLists != null)
                {
                    grdList.DataSource = dtLists;
                    grdList.DataBind();
                    GridPrevSortExpression = GridSortExpression;
                }
                // if grid has no records then disable the remove button
                udpnlListGridview.Update();

            }
            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 AdvanceListMasters</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			7/28/2012 02:16:48 PM		Created function
        /// 
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        //internal static AdvanceListMasters PopulateObjectsFromReader(IDataReader rdr,string ConnectionString )
        //{
        //    AdvanceListMasters list = new AdvanceListMasters();
        //    while (rdr.Read())
        //    {
        //        AdvanceListMaster obj = new AdvanceListMaster(ConnectionString);
        //        PopulateObjectFromReader(obj,rdr);
        //        list.Add(obj);
        //    }
        //    return list;
        //}
        /// <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 AdvanceListMasters</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			7/28/2012 02:16:48 PM		Created function
        /// 
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        internal static AdvanceListMasters PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper, string ConnectionString)
        {
            AdvanceListMasters list = new AdvanceListMasters();

            if (rdr.Read())
            {
                AdvanceListMaster obj = new AdvanceListMaster(ConnectionString);
                PopulateObjectFromReader(obj, rdr);
                list.Add(obj);
                while (rdr.Read())
                {
                    obj = new AdvanceListMaster(ConnectionString);
                    PopulateObjectFromReader(obj, rdr);
                    list.Add(obj);
                }
                oDatabaseHelper.Dispose();
                return list;
            }
            else
            {
                oDatabaseHelper.Dispose();
                return null;
            }
        }
        /// <summary>
        /// This method will select record based on the unique key value
        /// </summary>
        ///
        /// <param name="listName" type="string">listName</param>
        ///
        /// <returns>Object of class AdvanceListMaster</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			7/28/2012 02:16:48 PM		Created function
        /// 
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        public static AdvanceListMaster SelectOneByIX_AdvanceListMasterID(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_AdvanceListMaster_SelectByIX_AdvanceListMasterID", ref ExecutionState);
            AdvanceListMaster obj = new AdvanceListMaster(ConnectionString);
            if (dr.Read())
            {
                PopulateObjectFromReader(obj, dr);
                return obj;
            }
            else
                return null;
        }
        internal static AdvanceListMasters PopulateObjectsFromReader(IDataReader rdr, string ConnectionString)
        {
            AdvanceListMasters list = new AdvanceListMasters();

            while (rdr.Read())
            {
                AdvanceListMaster obj = new AdvanceListMaster(ConnectionString);
                PopulateObjectFromReader(obj, rdr);
                list.Add(obj);
            }
            return list;
        }
        private void buildSegmentFromLists(string fillFlag, int pageIndex)
        {
            try
            {
                string sortdir = (fillFlag == "sort" ? GetSortDirection() : GridViewSortDirection);

                if (flagreset == true)
                {
                    sortdir = "ASC";
                    GridSortExpression = "ListName";
                }
                AdvanceListMaster objListMaster = new AdvanceListMaster(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;
            }
        }
Example #8
0
        protected void bindLists()
        {
            try
            {
                pagingSource = new PagedDataSource();
                if (txtSearchListName.Text == "")
                {
                    AdvanceListMaster objListMaster = new AdvanceListMaster(ConnectionString);
                    dtLists = objListMaster.SelectAllAdvencedLists(ConnectionString, "CreatedDate", "Desc");
                    pagingSource.DataSource = dtLists.DefaultView;
                    pagingSource.AllowPaging = true;
                    pagingSource.PageSize = pSize;
                    pagingSource.CurrentPageIndex = (ViewState["IEPageNumber"] != null) ? (int)ViewState["IEPageNumber"] : 0;
                    ViewState["IEPageCount"] = pagingSource.PageCount;
                    pnlNavigation.Style.Add("display", "Block");
                }
                else
                {
                    SearchedListsDt = new DataTable();
                    SearchedListsDt = AdvanceListMaster.AdvanceSearchSelectLookup(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 = (int)ViewState["IEPageNumber"];
                        ViewState["IEPageCount"] = 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;
            }
        }
Example #9
0
 protected void bindListNames()
 {
     AdvanceListMaster objListMaster = new AdvanceListMaster(ConnectionString);
     dtLists = objListMaster.SelectAllAdvencedLists(ConnectionString, "Listname", "ASC");
     if (dtLists.Rows.Count > 0)
     {
         chkListNames.DataSource = dtLists;
         chkListNames.DataTextField = "ListContacts";
         chkListNames.DataValueField = "ListMasterID";
         chkListNames.DataBind();
     }
 }
Example #10
0
        protected void lBtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                bool status = false;
                lbMsg.Text = string.Empty;
                AdvanceListMaster listMaster = new AdvanceListMaster(ConnectionString);
                listMaster.ListName = txtListName.Text;
                listMaster.ListDesc = txtListDescription.Text;
                listMaster.ListCowner = txtListCreationowner.Text;

                AdvanceListMasters listNames = AdvanceListMaster.SelectByField("ListName", txtListName.Text.Trim(), ConnectionString);
                if (listNames.Count > 0)
                {
                    throw new Exception(string.Format("List: {0},  already exists. Please enter other name.", txtListName.Text));
                }
                listMaster.CreatedDate = System.DateTime.Now;
                status = listMaster.Insert();
                string lbl = "";
                lbl = txtListName.Text;
                if (txtListName.Text.Contains("&quot;")) { lbl = Server.HtmlEncode(txtListName.Text); }
                if (status == true)
                {
                    lblMsg.ForeColor = System.Drawing.Color.Green;
                    lblMsg.Text = string.Format("List: {0} Created Successfully.", lbl);
                }
                else
                {
                    lblMsg.Text = string.Format("List: {0} Created Failed.", lbl);
                }
                upnlMainmsg.Update();
            }
            catch (Exception ex)
            {
                lbMsg.Text = "Error: " + ex.Message;
                ModalPopupExtenderlist.Show();
            }
        }