示例#1
0
        private void LoadFromDB()
        {
            using (var dbconn = DB.dbConn())
            {
                dbconn.Open();
                using (var rs = DB.GetRS("aspdnsf_SessionGetByCustomerID " + m_CustomerID.ToString(), dbconn))
                {
                    if (rs.Read())
                    {
                        m_CustomerID   = DB.RSFieldInt(rs, "CustomerID");
                        m_SessionID    = DB.RSFieldInt(rs, "CustomerSessionID");
                        m_LastActivity = DB.RSFieldDateTime(rs, "LastActivity");
                        string sessionparams = DB.RSField(rs, "SessionValue");
                        DeserializeParams(sessionparams);
                    }
                    else
                    {
                        var sessionid = CustomerSession.createSession(m_CustomerID, "", "", CommonLogic.CustomerIpAddress());

                        using (var dbconn2 = DB.dbConn())
                        {
                            dbconn2.Open();
                            using (var rs2 = DB.GetRS("aspdnsf_SessionGetByID " + sessionid.ToString(), dbconn2))
                            {
                                if (rs2.Read())
                                {
                                    m_CustomerID   = DB.RSFieldInt(rs2, "CustomerID");
                                    m_SessionID    = sessionid;
                                    m_LastActivity = DB.RSFieldDateTime(rs2, "LastActivity");
                                    var sessionparams = DB.RSField(rs2, "SessionValue");
                                    DeserializeParams(sessionparams);
                                }
                            }
                        }
                    }
                }
            }
        }