Exemplo 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);
        }
Exemplo 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);
        }
Exemplo n.º 3
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);
     });
 }
Exemplo n.º 4
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);
        }