public IList<GetTributesFeed> GetYourTributesFeed(object[] objparam)
        {
            List<GetTributesFeed> lstTributes = new List<GetTributesFeed>();
            try
            {
                DataSet _objDataSet = GetDataSet("usp_GetYourTributesFeed", objparam);
                if (_objDataSet.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in _objDataSet.Tables[0].Rows)
                    {
                        GetTributesFeed objMyTributes = new GetTributesFeed();
                        objMyTributes.TributeId = int.Parse(dr["TributeId"].ToString());
                        objMyTributes.UserId = int.Parse(dr["UserTributeId"].ToString());
                        objMyTributes.TributeName = dr["TributeName"].ToString();
                        objMyTributes.TributeImage = dr["TributeImage"].ToString();
                        if (dr["Date1"].ToString() != null)
                            objMyTributes.DOB = dr["Date1"].ToString();
                        objMyTributes.DOD = dr["Date2"].ToString();
                        objMyTributes.MessageWithoutHtml = dr["MessageWithoutHtml"].ToString();
                        if (!(string.IsNullOrEmpty(dr["ModifiedDate"].ToString())))
                            objMyTributes.ModifiedDate = DateTime.Parse(dr["ModifiedDate"].ToString());
                        objMyTributes.TypeDescription = dr["TypeDescription"].ToString();
                        objMyTributes.StartDate = DateTime.Parse(dr["StartDate"].ToString());
                        objMyTributes.TributeUrl = dr["TributeUrl"].ToString();
                        lstTributes.Add(objMyTributes);
                        objMyTributes = null;
                    }
                }
                return lstTributes;

            }
            catch (System.Data.SqlClient.SqlException sqlEx)
            {
                if (sqlEx.Number >= 50000)
                {
                    Errors objError = new Errors();
                    objError.ErrorMessage = sqlEx.Message;
                    GetTributesFeed objMyTributes = new GetTributesFeed();
                    objMyTributes.CustomError = objError;
                    lstTributes.Add(objMyTributes);
                    objMyTributes = null;
                }
                return lstTributes;
            }
        }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //UserInfoResource objUserInfo = new UserInfoResource();
        GetTributesFeed objtribute = new GetTributesFeed();
        Users objUser = new Users();

        if (Request.QueryString["userid"] != null)
        {
            #region Feed on UserId
            int.TryParse(Request.QueryString["userid"].Trim(), out userId);
            objtribute.UserId = userId;

            if (userId > 0)
            {
                objUser = _presenter.GetUserDetailsOnUserId(userId);
            }
            if ((objUser.UserType == 2) && (objUser.AtomEnabled.Equals(true)))
            {
                object[] param = { objtribute, 1, 1, 1000 };
                if (objtribute.CustomError == null)
                {
                    _presenter.GetTributesFeed(param);
                    foreach (GetTributesFeed tribute in _objTributeList)
                    {
                        //DateTime TempModifiedDate = new DateTime();
                        if (tribute.ModifiedDate != null)
                        {
                            if (tribute.ModifiedDate > FeedUpdatedDate)
                                FeedUpdatedDate = tribute.ModifiedDate;
                        }
                    }
                    //objTributeList = objUserInfo.GetMyTributes(param);
                }
                GenerateFeed(_businessUserId ,userId, ObjTributeList);
            }
            #endregion
        }
        else
        {
            // for YourTributeFeed
            #region YourTributeFeed
            //fetching TributeName from Query string for search
            if (Request.QueryString["Search"] != null)
            {
                //to send null in case of no bussiness user id in url.
                int? BussUserId = null;
                if (Request.QueryString["BusinessUserId"] != null)
                    int.TryParse(Request.QueryString["BusinessUserId"].ToString(), out _businessUserId);
                if (_businessUserId == 0 || _businessUserId < 0)
                    _businessUserId = 0;
                else
                    BussUserId = _businessUserId;
                //fetching CurrentPage from Query string for search
                if (Request.QueryString["Start"] != null)
                    int.TryParse(Request.QueryString["Start"].ToString(), out _currentPage);
                if (_currentPage < 0)
                    _currentPage = 0;

                //fetching PageSize from Query string for search
                if (Request.QueryString["PageSize"] != null)
                    int.TryParse(Request.QueryString["PageSize"].ToString(), out _pageSize);
                if (_pageSize < 0)
                    _pageSize = 0;

            //lhk: convert full text search into keyword search.
                _tributeName = "%" + Request.QueryString["Search"].ToString() + "%";
                object[] objprm = { _tributeName, _tributeTypeId, BussUserId, _currentPage, _pageSize };
                _presenter.GetYourTributeFeedOnTributeName(objprm);
                GenerateFeed(_businessUserId,userId, ObjTributeList);
            }
            else
            {

                //fetching BusinessUserId from Query string for search
                if (Request.QueryString["BusinessUserId"] != null)
                    int.TryParse(Request.QueryString["BusinessUserId"].ToString(), out _businessUserId);
                if (_businessUserId == 0 || _businessUserId<0 )
                    _businessUserId = 0;

                //fetching CurrentPage from Query string for search
                if (Request.QueryString["Start"] != null)
                    int.TryParse(Request.QueryString["Start"].ToString(), out _currentPage);
                //if (_currentPage == 0)
                //    _currentPage = 0;
                if (_currentPage < 0)
                    _currentPage = 0;

                //fetching PageSize from Query string for search
                if (Request.QueryString["PageSize"] != null)
                    int.TryParse(Request.QueryString["PageSize"].ToString(), out _pageSize);
                //if (_pageSize == 0 )
                //    _pageSize = 0;
                if ( _pageSize < 0 )
                    _pageSize = 0;

                object[] objparam = { _businessUserId, _currentPage, _pageSize };
                _presenter.GetYourTributesFeed(objparam);
                GenerateFeed(_businessUserId, userId, ObjTributeList);
            }

            #endregion
        }
    }
        /// <summary>
        /// Method to get my tributes for Rss Feed.
        /// Added By: Laxman Hari Kulshrestha
        /// </summary>
        /// <param name="objUserAdmin">GetMyTributes containing UserId</param>
        /// <returns>List<GetMyTributes></returns>
        public List<GetTributesFeed> GetTributesFeed(object[] objValue)
        {
            int _packageId;
            GetTributesFeed objUserReg = (GetTributesFeed)objValue[0];
            List<GetTributesFeed> lstTributes = new List<GetTributesFeed>();
            try
            {
                object[] objParam = { objUserReg.UserId, int.Parse(objValue[1].ToString()), int.Parse(objValue[2].ToString()), int.Parse(objValue[3].ToString()) };
                DataSet _objDataSet = GetDataSet("usp_GetTributesFeed", objParam);
                if (_objDataSet.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in _objDataSet.Tables[0].Rows)
                    {
                        GetTributesFeed objMyTributes = new GetTributesFeed();
                        objMyTributes.TributeId = int.Parse(dr["TributeId"].ToString());
                        objMyTributes.TributeName = dr["TributeName"].ToString();
                        objMyTributes.TributeImage = dr["TributeImage"].ToString();
                        if (dr["Date1"].ToString() != null)
                            objMyTributes.DOB = dr["Date1"].ToString();
                        objMyTributes.DOD = dr["Date2"].ToString();
                        objMyTributes.MessageWithoutHtml = dr["MessageWithoutHtml"].ToString();
                        if (!(string.IsNullOrEmpty(dr["ModifiedDate"].ToString())))
                            objMyTributes.ModifiedDate = DateTime.Parse(dr["ModifiedDate"].ToString());
                        objMyTributes.TypeDescription = dr["TypeDescription"].ToString();
                        objMyTributes.StartDate = DateTime.Parse(dr["StartDate"].ToString());
                        if (dr["PackageId"] != null)
                        {
                            if (dr["Enddate"].ToString().Equals("Never"))
                            {
                                //LHK: 12/19/2011 Yt speedup Issue
                                int.TryParse(dr["PackageId"].ToString(), out _packageId);
                                switch (_packageId)
                                {
                                    case 1:
                                        if (dr["TypeDescription"].ToString().ToLower().Equals("video"))
                                            objMyTributes.Enddate = "Video Tribute" + " (" + dr["Enddate"].ToString() + ")";
                                        else
                                            objMyTributes.Enddate = "Memorial Tribute" + " (" + dr["Enddate"].ToString() + ")";// updated in yt phase 1
                                        break;
                                    case 4:
                                        objMyTributes.Enddate = "Memorial Tribute" + " (" + dr["Enddate"].ToString() + ")";// updated in yt phase 1
                                        break;
                                    case 6:
                                        objMyTributes.Enddate = "Premium Obituary" + " (" + dr["Enddate"].ToString() + ")"; //"Photo Tribute" + " (" + dr["Enddate"].ToString() + ")"; updated in phase 1
                                        break;
                                    case 11:
                                        if (dr["TypeDescription"].ToString().ToLower().Equals("video"))
                                            objMyTributes.Enddate = "Video " + " (" + dr["Enddate"].ToString() + ")";
                                        break;
                                    default:
                                        objMyTributes.Enddate = "Celebrate" + " (" + dr["Enddate"].ToString() + ")";
                                        break;
                                }
                            }
                            else
                            {
                                string[] date = dr["Enddate"].ToString().Split('/');
                                DateTime date2 = new DateTime(int.Parse(date[2]), int.Parse(date[0]), int.Parse(date[1]));
                                if (date2 < DateTime.Now)
                                {
                                    //LHK: 12/19/2011 Yt speedup Issue
                                    int.TryParse(dr["PackageId"].ToString(), out _packageId);
                                    switch (_packageId)
                                    {
                                        case 2:
                                            if (dr["TypeDescription"].ToString().ToLower().Equals("video"))
                                                objMyTributes.Enddate = "Video Tribute (Expired)";
                                            else
                                                objMyTributes.Enddate = "Memorial Tribute (Expired)"; //Tribute (Expired)"; updated in yt phase 1
                                            break;
                                        case 3:
                                            objMyTributes.Enddate = "Obituary (Lifetime)";// "Announce (Free)"; updated in yt phase 1
                                            break;
                                        case 5:
                                            objMyTributes.Enddate = "Memorial Tribute (Expired)"; //Tribute (Expired)"; updated in yt phase 1
                                            break;
                                        case 7:
                                            objMyTributes.Enddate = "Premium Obituary (Expired)"; //"Photo Tribute (Expired)"; updates in yt phase 1
                                            break;
                                        case 8:
                                            objMyTributes.Enddate = "Obituary (Lifetime)";// "Announce (Free)"; updated in yt phase 1
                                            break;
                                        case 9:
                                            if (dr["TypeDescription"].ToString().ToLower().Equals("video"))
                                                objMyTributes.Enddate = "Video Tribute (Expired)";
                                           break;
                                        case 10:
                                           if (dr["TypeDescription"].ToString().ToLower().Equals("video"))
                                               objMyTributes.Enddate = "Video Tribute (Expired)";
                                           break;
                                        case 12:
                                           if (dr["TypeDescription"].ToString().ToLower().Equals("video"))
                                               objMyTributes.Enddate = "Video (Expired)";
                                           break;
                                        case 13:
                                           if (dr["TypeDescription"].ToString().ToLower().Equals("video"))
                                               objMyTributes.Enddate = "Video (Expired)";
                                           break;
                                        case 14:
                                           if (dr["TypeDescription"].ToString().ToLower().Equals("video"))
                                               objMyTributes.Enddate = "Video (Expired)";
                                           break;
                                        default:
                                            objMyTributes.ExpiredOn = date2.ToString("MMMM dd, yyyy");
                                            break;
                                    }

                                }
                                else
                                {
                                    //LHK: 12/19/2011 Yt speedup Issue
                                    int.TryParse(dr["PackageId"].ToString(), out _packageId);
                                    switch (_packageId)
                                    {
                                        case 2:
                                            if (dr["TypeDescription"].ToString().ToLower().Equals("video"))
                                                objMyTributes.Enddate = "Video Tribute" + " (" + dr["Enddate"].ToString() + ")";
                                            else
                                                objMyTributes.Enddate = "Memorial Tribute" + " (" + dr["Enddate"].ToString() + ")"; // updated in yt phase 1
                                            break;
                                        case 3:
                                            objMyTributes.Enddate = "Obituary (Lifetime)";// "Tribute Free Trial" + " (" + dr["Enddate"].ToString() + ")"; updated for phase 1
                                            break;
                                        case 5:
                                            objMyTributes.Enddate = "Memorial Tribute" + " (" + dr["Enddate"].ToString() + ")";// updated in yt phase 1
                                            break;
                                        case 7:
                                            objMyTributes.Enddate = "Premium Obituary" + " (" + dr["Enddate"].ToString() + ")"; //"Photo Tribute" + " (" + dr["Enddate"].ToString() + ")"; updated in phase 1
                                            break;
                                        case 8:
                                            objMyTributes.Enddate = "Obituary (Lifetime)";// "Tribute Free Trial" + " (" + dr["Enddate"].ToString() + ")"; updated for phase 1
                                            break;
                                        case 9:
                                            if (dr["TypeDescription"].ToString().ToLower().Equals("video"))
                                                objMyTributes.Enddate = "Video Tribute" + " (" + dr["Enddate"].ToString() + ")";
                                            break;
                                        case 10:
                                            if (dr["TypeDescription"].ToString().ToLower().Equals("video"))
                                                objMyTributes.Enddate = "Video Tribute" + " (" + dr["Enddate"].ToString() + ")";
                                            break;
                                        case 12:
                                            if (dr["TypeDescription"].ToString().ToLower().Equals("video"))
                                                objMyTributes.Enddate = "Video " + " (" + dr["Enddate"].ToString() + ")";
                                            break;
                                        case 13:
                                            if (dr["TypeDescription"].ToString().ToLower().Equals("video"))
                                                objMyTributes.Enddate = "Video " + " (" + dr["Enddate"].ToString() + ")";
                                            break;
                                        case 14:
                                            if (dr["TypeDescription"].ToString().ToLower().Equals("video"))
                                                objMyTributes.Enddate = "Video " + " (" + dr["Enddate"].ToString() + ")";
                                            break;
                                        default:
                                            objMyTributes.ExpiredOn = date2.ToString("MMMM dd, yyyy");
                                            break;
                                    }

                                }
                            }

                        }
                        objMyTributes.Visit = int.Parse(dr["Visit"].ToString());
                        objMyTributes.EmailAlert = bool.Parse(dr["EmailAlert"].ToString());
                        objMyTributes.Renewaldate = DateTime.Parse(dr["Renewaldate"].ToString());
                        objMyTributes.TributeUrl = dr["TributeUrl"].ToString();
                        lstTributes.Add(objMyTributes);
                        objMyTributes = null;
                    }
                }
                return lstTributes;

            }
            catch (System.Data.SqlClient.SqlException sqlEx)
            {
                if (sqlEx.Number >= 50000)
                {
                    Errors objError = new Errors();
                    objError.ErrorMessage = sqlEx.Message;
                    GetTributesFeed objMyTributes = new GetTributesFeed();
                    objMyTributes.CustomError = objError;
                    lstTributes.Add(objMyTributes);
                    objMyTributes = null;
                }
                return lstTributes;
            }
        }