public static WebChatSession GetOne(long webChatSessionNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <WebChatSession>(MethodBase.GetCurrentMethod(), webChatSessionNum));
            }
            WebChatSession session = null;

            WebChatMisc.DbAction(delegate() {
                session = Crud.WebChatSessionCrud.SelectOne(webChatSessionNum);
            });
            return(session);
        }
 ///<summary>Also sets primary key and DateTcreated.</summary>
 public static long Insert(WebChatSession webChatSession)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         webChatSession.WebChatSessionNum = Meth.GetLong(MethodBase.GetCurrentMethod(), webChatSession);
         return(webChatSession.WebChatSessionNum);
     }
     WebChatMisc.DbAction(delegate() {
         Crud.WebChatSessionCrud.Insert(webChatSession);
     });
     WebChatMisc.DbAction(delegate() {
         Signalods.SetInvalid(InvalidType.WebChatSessions);                //Signal OD HQ to refresh sessions.
     }, false);
     return(webChatSession.WebChatSessionNum);
 }
        public static WebChatSession GetActiveSessionsForEmployee(string techName)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <WebChatSession>(MethodBase.GetCurrentMethod(), techName));
            }
            WebChatSession webChatSession = null;

            WebChatMisc.DbAction(() => {
                string command = "SELECT * FROM webchatsession WHERE DateTend < " + POut.DateT(new DateTime(1880, 1, 1))
                                 + " AND webchatsession.TechName = '" + POut.String(techName) + "'"
                                 + " ORDER BY webchatsession.DateTcreated ";
                webChatSession = Crud.WebChatSessionCrud.SelectOne(command);
            });
            return(webChatSession);
        }
 public static void Update(WebChatSession webChatSession, WebChatSession oldWebChatSession, bool hasSignal = true)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         Meth.GetVoid(MethodBase.GetCurrentMethod(), webChatSession, oldWebChatSession, hasSignal);
         return;
     }
     WebChatMisc.DbAction(delegate() {
         Crud.WebChatSessionCrud.Update(webChatSession, oldWebChatSession);
     });
     if (hasSignal)
     {
         WebChatMisc.DbAction(delegate() {
             Signalods.SetInvalid(InvalidType.WebChatSessions);                    //Signal OD HQ to refresh sessions.
         }, false);
     }
 }