Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="phone"></param>
        /// <param name="clientName"></param>
        /// <returns></returns>
        static ChatUserBE GetChatUser(string phoneNumber, String clientName)
        {
            bool needUpdate = false;
            //String id = String.Concat(clientName, "$", phone);
            ChatUserBE userBE = ChatUserDAC.GetByParams(phoneNumber);


            if (userBE != null)
            {
                //Si esta en null directamtente le seteamos el clientName (este caso no deberia existir pero fisicamente es posible)
                //if (String.IsNullOrEmpty(userBE.ChatUserPhone))
                //{
                //    userBE.ChatUserPhone = phoneNumber;
                //    needUpdate = true;
                //}
                //Actualiza el nombre del cliente si es necesario
                if (!String.IsNullOrEmpty(clientName))
                {
                    if (userBE.ChatUserName.Trim().CompareTo(clientName.Trim()) != 0)
                    {
                        userBE.ChatUserName = clientName;
                        needUpdate          = true;
                    }
                }

                if (needUpdate)
                {
                    ChatUserDAC.Update(userBE);
                }

                return(userBE);
            }
            else
            {
                return(null);
            }
        }
 public static ChatUserBE GetChatUserByParams(int?pChatUserId, string pClientPhone)
 {
     return(ChatUserDAC.GetByParams(pClientPhone));
 }