コード例 #1
0
ファイル: RecentlyViewed.cs プロジェクト: vinay1988/Ang6API
        private static RecentlyViewed PopulateFromDBDetailsObject(RecentlyViewedDetails obj)
        {
            RecentlyViewed objNew = new RecentlyViewed();

            objNew.RecentlyViewedId = obj.RecentlyViewedId;
            objNew.LoginNo          = obj.LoginNo;
            objNew.PageTitle        = obj.PageTitle;
            objNew.PageURL          = obj.PageURL;
            objNew.DateAdded        = obj.DateAdded;
            objNew.Locked           = obj.Locked;
            objNew.RowNum           = obj.RowNum;
            return(objNew);
        }
コード例 #2
0
        /// <summary>
        /// GetListForUser
        /// Calls [usp_selectAll_RecentlyViewed_for_User]
        /// </summary>
        public override List <RecentlyViewedDetails> GetListForUser(System.Int32?loginNo)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_selectAll_RecentlyViewed_for_User", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@LoginNo", SqlDbType.Int).Value = loginNo;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd);
                List <RecentlyViewedDetails> lst = new List <RecentlyViewedDetails>();
                while (reader.Read())
                {
                    RecentlyViewedDetails obj = new RecentlyViewedDetails();
                    obj.RecentlyViewedId = GetReaderValue_Int32(reader, "RecentlyViewedId", 0);
                    obj.LoginNo          = GetReaderValue_NullableInt32(reader, "LoginNo", null);
                    obj.PageTitle        = GetReaderValue_String(reader, "PageTitle", "");
                    obj.PageURL          = GetReaderValue_String(reader, "PageURL", "");
                    obj.DateAdded        = GetReaderValue_NullableDateTime(reader, "DateAdded", null);
                    obj.Locked           = GetReaderValue_NullableBoolean(reader, "Locked", null);
                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get RecentlyVieweds", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }