Ejemplo n.º 1
0
        public static void SendWelcomeMessage(long webChatSessionNum)
        {
            //No need to check RemotingRole; no call to db.
            WebChatMessage welcomeMessage = new WebChatMessage();

            welcomeMessage.WebChatSessionNum = webChatSessionNum;
            welcomeMessage.UserName          = WebChatPrefs.GetString(WebChatPrefName.SystemName);
            welcomeMessage.MessageText       = WebChatPrefs.GetString(WebChatPrefName.SystemWelcomeMessage);
            welcomeMessage.MessageType       = WebChatMessageType.System;
            WebChatMessages.Insert(welcomeMessage);
        }
Ejemplo n.º 2
0
        public static void SendTechMessage(long webChatSessionNum, string messageText)
        {
            //No need to check RemotingRole; no call to db.
            if (String.IsNullOrEmpty(messageText))
            {
                return;                //No blank messages allowed.
            }
            WebChatMessage techMessage = new WebChatMessage();

            techMessage.WebChatSessionNum = webChatSessionNum;
            techMessage.UserName          = Security.CurUser.UserName;
            techMessage.MessageText       = messageText;
            techMessage.MessageType       = WebChatMessageType.Technician;
            WebChatMessages.Insert(techMessage);
        }
Ejemplo n.º 3
0
 ///<summary>Sets PK as well as DateT.</summary>
 public static long Insert(WebChatMessage webChatMessage)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         webChatMessage.WebChatMessageNum = Meth.GetLong(MethodBase.GetCurrentMethod(), webChatMessage);
         return(webChatMessage.WebChatMessageNum);
     }
     WebChatMisc.DbAction(delegate() {
         Crud.WebChatMessageCrud.Insert(webChatMessage);
     });
     WebChatMisc.DbAction(delegate() {
         Signalod signalSession = new Signalod();
         signalSession.IType    = InvalidType.WebChatSessions;
         signalSession.FKey     = webChatMessage.WebChatSessionNum;
         Signalods.Insert(signalSession);
     }, false);
     return(webChatMessage.WebChatMessageNum);
 }
Ejemplo n.º 4
0
 ///<summary>Sets the DateTend field to now and inserts a message into the chat so all users can see the session has ended.</summary>
 public static void EndSession(long webChatSessionNum)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         Meth.GetVoid(MethodBase.GetCurrentMethod(), webChatSessionNum);
         return;
     }
     WebChatMisc.DbAction(delegate() {
         string command = "UPDATE webchatsession SET DateTend=NOW() WHERE WebChatSessionNum=" + POut.Long(webChatSessionNum);
         DataCore.NonQ(command);
         //Last message just after session ended, in case someone types another message into the thread just as the thread is ending.
         //This way the end session message is guaranteed to be last, since the timestamp on it is after the session technically ended.
         WebChatMessage endSessionMessage    = new WebChatMessage();
         endSessionMessage.WebChatSessionNum = webChatSessionNum;
         endSessionMessage.UserName          = WebChatPrefs.GetString(WebChatPrefName.SystemName);
         endSessionMessage.MessageText       = WebChatPrefs.GetString(WebChatPrefName.SystemSessionEndMessage);
         endSessionMessage.MessageType       = WebChatMessageType.EndSession;
         WebChatMessages.Insert(endSessionMessage);
     });
 }
Ejemplo n.º 5
0
        public static void SendCustomerMessage(long webChatSessionNum, string userName, string messageText)
        {
            //No need to check RemotingRole; no call to db.
            if (String.IsNullOrEmpty(messageText))
            {
                return;                //No blank messages allowed.
            }
            WebChatMessage customerMessage = new WebChatMessage();

            customerMessage.WebChatSessionNum = webChatSessionNum;
            if (String.IsNullOrEmpty(userName))
            {
                customerMessage.UserName = "******";
            }
            else
            {
                customerMessage.UserName = userName;
            }
            customerMessage.MessageText = messageText;
            customerMessage.MessageType = WebChatMessageType.Customer;
            WebChatMessages.Insert(customerMessage);
        }