Click here to Skip to main content
Click here to Skip to main content
Articles » Database » Database » General » Downloads
 
Add your own
alternative version

Tagged as

Display/Store and Retrieve Image Data from Database to Gridview, and also on Mouse Over

, 15 Oct 2011 CPOL
How to Display/Store and Retrieve Image Data from Database to Gridview, and also on mouse over
UserSample.zip
UserSample
~$gemArticle.docx
AlgemArticle.docx
Sample
App_Code
App_Data
Bin
AjaxControlToolkit.dll
AjaxControlToolkit.dll.refresh
Utils.dll
Utils.dll.refresh
Utils.pdb
css
Images
accordionHeaderIcon.png
BlackLoadingBar.gif
btn_delete.gif
btn_edit.gif
Calendar.png
close.gif
Copy of gridheader.gif
del.png
downarrow.gif
excel_icon.gif
gridfooter.gif
gridfooter.JPG
gridheader.gif
headermenu.jpg
headerpanel.jpg
lock.png
loginbg.jpg
LoginPanelBG.png
minniloader.gif
pdf.jpg
print-button.gif
scan.gif
spicture.gif
spicture.jpg
Thumbs.db
txt.png
view.gif
js
arrowdown.gif
arrowup.gif
Members.JPG
Sample (3).suo
Show
Algem_G_Mojedo.jpg
Asds_A_Asdasd.jpg
Firstname_M_Lastname.jpg
Sdfdfsdf_S_Sdfsdf.jpg
Test_T_Test.jpg
Test1_T_Resr1.jpg
Thumbs.db
Zxdzx_Z_Zxzx.jpg
upload
UsersControl
Utils
Utils
bin
Debug
Utils.dll
Utils.pdb
obj
Debug
Refactor
TempPE
Utils.dll
Utils.pdb
Properties
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace Utils
{
    public class SessionManager
    {
        private const string CD = "UserId";
        private const string USER_NAME = "UserName";
        private const string ACCESS_LEVEL = "AccessLevel";
        private const string SCHEMA = "Schema";
        private const string SITE_CODE = "SiteCode";
        private const string PAYOR_NANE = "PayorName";
        private const string CACHING = "Caching";
        private const string CLIENT_KEY = "ClientKey";
        private const string USER_GRP_CD = "CorporateCode";
        //============================
        private const string KEY_PRIMARY = "KeyPrimary";
        private const string PAGE_INDEX = "PageIndex";
        //====================

        public static string PageIndex
        {
            get
            {
                if (HttpContext.Current.Session[PAGE_INDEX] == null)
                {
                    return string.Empty;
                }
                else
                {
                    return HttpContext.Current.Session[PAGE_INDEX].ToString();
                }

            }
            set
            {
                HttpContext.Current.Session[PAGE_INDEX] = value;
            }
        }

        public static string KeyPrimary
        {
            get
            {
                if (HttpContext.Current.Session[KEY_PRIMARY] == null)
                {
                    return string.Empty;
                }
                else
                {
                    return HttpContext.Current.Session[KEY_PRIMARY].ToString();
                }

            }
            set
            {
                HttpContext.Current.Session[KEY_PRIMARY] = value;
            }
        }


        public static string UserId
        {
            get
            {
                if (HttpContext.Current.Session[CD] == null)
                {
                    //Make sure that the user will be redirected to Login Page
                    //when the sesion expires
                    //Logout();
                    return string.Empty;
                }
                else
                {
                    return HttpContext.Current.Session[CD].ToString();
                }

            }
            set
            {
                HttpContext.Current.Session[CD] = value;
            }
        }

        public static string CorporateCode
        {
            get
            {
                if (HttpContext.Current.Session[USER_GRP_CD] == null)
                {
                    //Make sure that the user will be redirected to Login Page
                    //when the sesion expires
                    //Logout();
                    return string.Empty;
                }
                else
                {
                    return HttpContext.Current.Session[USER_GRP_CD].ToString();
                }

            }
            set
            {
                HttpContext.Current.Session[USER_GRP_CD] = value;
            }
        }


        public static string UserName
        {
            get
            {
                if (HttpContext.Current.Session[USER_NAME] == null)
                {
                    //Logout();
                    return string.Empty;
                }
                else
                {
                    return HttpContext.Current.Session[USER_NAME].ToString();
                }

            }
            set
            {
                HttpContext.Current.Session[USER_NAME] = value;
            }
        }


        public static string AccessLevel
        {
            get
            {
                if (HttpContext.Current.Session[ACCESS_LEVEL] == null)
                {
                    //Logout();
                    return string.Empty;
                }
                else
                {
                    return HttpContext.Current.Session[ACCESS_LEVEL].ToString();
                }

            }
            set
            {
                HttpContext.Current.Session[ACCESS_LEVEL] = value;
            }
        }


        public static string Schema
        {
            get
            {
                if (HttpContext.Current.Session[SCHEMA] == null)
                {
                    //Logout();
                    return string.Empty;
                }
                else
                {
                    return HttpContext.Current.Session[SCHEMA].ToString();
                }

            }
            set
            {
                HttpContext.Current.Session[SCHEMA] = value;
            }
        }

        public static string SiteCode
        {
            get
            {
                if (HttpContext.Current.Session[SITE_CODE] == null)
                {
                    //Logout();
                    return string.Empty;
                }
                else
                {
                    return HttpContext.Current.Session[SITE_CODE].ToString();
                }

            }
            set
            {
                HttpContext.Current.Session[SITE_CODE] = value;
            }
        }

        public static string PayorName
        {
            get
            {
                if (HttpContext.Current.Session[PAYOR_NANE] == null)
                {
                    //Logout();
                    return string.Empty;
                }
                else
                {
                    return HttpContext.Current.Session[PAYOR_NANE].ToString();
                }

            }
            set
            {
                HttpContext.Current.Session[PAYOR_NANE] = value;
            }
        }

        public static bool Caching
        {
            get
            {
                if (HttpContext.Current.Session[CACHING] == null)
                {
                    //Logout();
                    return false;
                }
                else
                {
                    return (bool)HttpContext.Current.Session[CACHING];
                }

            }
            set
            {
                HttpContext.Current.Session[CACHING] = value;
            }
        }


        public static string XPClient
        {
            get
            {
                if (HttpContext.Current.Session[CLIENT_KEY] == null)
                {
                    //Logout();
                    return string.Empty;
                }
                else
                {
                    return HttpContext.Current.Session[CLIENT_KEY].ToString();
                }

            }
            set
            {
                HttpContext.Current.Session[CLIENT_KEY] = value;
            }
        }


        //private static void Logout()
        //{
        //    ErrorHandler errorHandler = new ErrorHandler();
        //    errorHandler.CatchError(ErrorType.SESSION, "");
        //}

        public static string SetSession(string sessionName, string sessionValue)
        {
            HttpContext.Current.Session[sessionName] = sessionValue;

            return HttpContext.Current.Session[sessionName].ToString();
        }


        public static string GetSession(string sessionName)
        {
            if (HttpContext.Current.Session[sessionName] != null)
            {
                return HttpContext.Current.Session[sessionName].ToString();
            }
            else
            {
                //Logout();
                return string.Empty;
            }


        }

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Al Moje
Software Developer (Senior) ***
Philippines Philippines
MCTS - Microsoft Certified Technology Specialist.
An Accountant.
Had been developed Payroll Accounting System Application
Live in: Quezon City, Metro Manila Philippines
Could reached at email address: ag_mojedo@live.com

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141220.1 | Last Updated 15 Oct 2011
Article Copyright 2011 by Al Moje
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid