예제 #1
0
    } // End of the Initialize method

    #endregion

    #region Add methods

    /// <summary>
    /// Create an uninitialized item
    /// </summary>
    public override void CreateUninitializedItem(HttpContext context, string id, int timeout)
    {
        // Create a webshop session post
        WebshopSession webshopSession = new WebshopSession();
        webshopSession.id = id;
        webshopSession.application_name = this.applicationName;
        webshopSession.created_date = DateTime.UtcNow;
        webshopSession.expires_date = DateTime.UtcNow.AddMinutes((Double)timeout);
        webshopSession.lock_date = DateTime.UtcNow;
        webshopSession.lock_id = 0;
        webshopSession.timeout_limit = timeout;
        webshopSession.locked = false;
        webshopSession.session_items = "";
        webshopSession.flags = 1;

        // Add the session
        WebshopSession.Add(webshopSession);

    } // End of the CreateUninitializedItem method
예제 #2
0
    } // End of the SetItemExpireCallback method

    /// <summary>
    /// Set and realease a session post
    /// </summary>
    public override void SetAndReleaseItemExclusive(HttpContext context, string id, SessionStateStoreData item, object lockId, bool newItem)
    {
        // Serialize the SessionStateItemCollection as a string.
        string sessItems = Serialize((SessionStateItemCollection)item.Items);

        // Create a webshop session
        WebshopSession webshopSession = new WebshopSession();
        webshopSession.id = id;
        webshopSession.application_name = this.applicationName;
        webshopSession.created_date = DateTime.UtcNow;
        webshopSession.expires_date = DateTime.UtcNow.AddMinutes((Double)item.Timeout);
        webshopSession.lock_date = DateTime.UtcNow;
        webshopSession.lock_id = 0;
        webshopSession.timeout_limit = item.Timeout;
        webshopSession.locked = false;
        webshopSession.session_items = sessItems;
        webshopSession.flags = 0;

        if (newItem == true)
        {
            // Delete the session if it exists
            WebshopSession.DeleteOnId(id, this.applicationName);

            // Add the session
            WebshopSession.Add(webshopSession);

        }
        else
        {
            // Update session values
            webshopSession.lock_id = (Int32)lockId;

            // Update the session
            WebshopSession.UpdateWithLockId(webshopSession);
        }

    } // End of the SetAndReleaseItemExclusive method