예제 #1
0
 public abstract void NewSession(VisitSession session);//保存一条新访客会话
예제 #2
0
        //保存一条新访客会话
        public override void NewSession(VisitSession session)
        {
            SqlConnection sqlC = new SqlConnection(connectionString);
            string sql = string.Format("insert into LiveChat_VisitSession values('{0}','{1}','{2}','{3}','{4}','{5}',{6},'{7}','{8}','{9}','{10}','{11}',{12},'{13}','{14}','{15}','{16}')", session.SessionId, session.VisitorId, session.IP, session.Browser, session.Status, session.Location, session.Operator, session.VisitingTime, session.LeaveTime, session.ChatRequestTime, session.ChatingTime, session.WaitingDuring, session.ChattingDuring, session.PageRequestCount, session.DomainRequested, session.PageRequested, session.Referrer);
            SqlCommand cmd = new SqlCommand(sql, sqlC);
            try
            {
                sqlC.Open();
                cmd.ExecuteNonQuery;
                cmd.Dispose();
                sqlC.Close();
            }
            catch
            {
                throw;
            }
            finally
            {
                if (sqlC != null)
                {
                    if (sqlC.State == ConnectionState.Open)
                        sqlC.Close();

                    sqlC.Dispose();
                    sqlC = null;
                }
            }
        }