Beispiel #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="puserId"></param>
        /// <param name="chatRoomStatusFromEtl">Estado del recodr id </param>
        /// <returns></returns>
        internal static GetRecordIdBE GetRecordId(int messageId, out int? chatRoomStatusFromEtl)
        {
            chatRoomStatusFromEtl = null;
            Database database = null;
            int? recordId = null;
            GetRecordIdBE wGetRecordId = new GetRecordIdBE();
            //try
            //{
            database = DatabaseFactory.CreateDatabase(Common.Common.EpironChat_CnnStringName);
            using (DbCommand cmd = database.GetStoredProcCommand("[chat].[Record_s_bySourceChatMessageId]"))
            {
                database.AddInParameter(cmd, "ChatMessageId", DbType.Int32, messageId);
                using (IDataReader reader = database.ExecuteReader(cmd))
                {
                    while (reader.Read())
                    {
                        if (reader["recordId"] != DBNull.Value)
                            wGetRecordId.RecordId = Convert.ToInt32(reader["recordId"]);

                        if (reader["PCRecordActionResultType"] != DBNull.Value)
                            chatRoomStatusFromEtl = Convert.ToInt32(reader["PCRecordActionResultType"]);

                        if (reader["FirstName"] != DBNull.Value)
                            wGetRecordId.UserFirstName = Convert.ToString(reader["FirstName"]);

                        if (reader["LastName"] != DBNull.Value)
                            wGetRecordId.UserLastName = Convert.ToString(reader["LastName"]);

                        if (reader["Name"] != DBNull.Value)
                            wGetRecordId.UserName = Convert.ToString(reader["Name"]);
                    }
                }
            }
            return wGetRecordId;
            //}
            //catch (Exception ex)
            //{
            //    throw SecPortalException.ProcessException(ex, typeof(EpironChatDAC), Common.Common.EpironChat_CnnStringName);
            //}




        }
Beispiel #2
0
        public JsonResult GetRecordId(int userId, int roomId, int messageId)
        {
            //int? recordId = -1;
            GetRecordIdBE wGetRecordId = new GetRecordIdBE();
            int? chatRoomStatusFromEtl = null;
            try
            {
                wGetRecordId = EpironChatDAC.GetRecordId(messageId, out chatRoomStatusFromEtl);
                if (wGetRecordId.RecordId != null)
                    EpironChatBC.ChatRoom_UpdateStatus(roomId, wGetRecordId.RecordId.Value, WebChat.Common.Enumerations.ChatRoomStatus.Active);

                return Json(new { Result = "OK", recordId = wGetRecordId.RecordId, userName = wGetRecordId.UserName });
            }
            catch (Exception ex)
            {
                Helper.Log(ex.Message);
                return Json(new { Result = "ERROR", Message = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(ex) });
            }
        }