Example #1
0
 /// <summary>
 /// 获取最新一条消息 GL 2015-10-10
 /// </summary>
 /// <param name="DoctorId"></param>
 /// <param name="PatientId"></param>
 /// <returns></returns>
 public Message GetLatestSMS(DataConnection pclsCache, string DoctorId, string PatientId)
 {
     try
     {
         Message Meg = new Message();
         if (!pclsCache.Connect())
         {
             return null;
         }
         InterSystems.Data.CacheTypes.CacheSysList list = null;
         list = Mb.MessageRecord.GetLatestSMS(pclsCache.CacheConnectionObject, DoctorId, PatientId);
         if (list != null)
         {
             Meg.MessageNo = list[0];
             Meg.Content = list[1];
             Meg.SendDateTime = list[2];
             Meg.SendByName = list[3];
             Meg.Flag = list[4];
         }
         return Meg;
     }
     catch (Exception ex)
     {
         HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "MessageMethod.GetLatestSMS", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
         return null;
     }
     finally
     {
         pclsCache.DisConnect();
     }
 }
Example #2
0
 /// <summary>
 /// 将消息写入数据库并获取发送时间与显示时间 GL 2015-10-10(修改2015-10-26)
 /// </summary>
 /// <param name="SendBy"></param>
 /// <param name="Reciever"></param>
 /// <param name="Content"></param>
 /// <param name="piUserId"></param>
 /// <param name="piTerminalName"></param>
 /// <param name="piTerminalIP"></param>
 /// <param name="piDeviceType"></param>
 /// <returns></returns>
 public Message SetSMS(DataConnection pclsCache, string SendBy, string Reciever, string Content, string piUserId, string piTerminalName, string piTerminalIP, int piDeviceType)
 {
     try
     {
         Message Meg = new Message();
         if (!pclsCache.Connect())
         {
             return null;
         }
         InterSystems.Data.CacheTypes.CacheSysList list = null;
         list = Mb.MessageRecord.SetSMS(pclsCache.CacheConnectionObject, SendBy, Reciever, Content, piUserId, piTerminalName, piTerminalIP, piDeviceType);
         if (list != null)
         {
             Meg.Flag = list[0];
             Meg.SendDateTime = list[1];
             Meg.Time = list[2];
         }
         return Meg;
     }
     catch (Exception ex)
     {
         HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "MessageMethod.SetSMS", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
         return null;
     }
     finally
     {
         pclsCache.DisConnect();
     }           
 }
Example #3
0
        /// <summary>
        /// 获取消息对话 GL 2015-10-10
        /// </summary>
        /// <param name="Reciever"></param>
        /// <param name="SendBy"></param>
        /// <returns></returns>
        public List<Message> GetSMSDialogue(DataConnection pclsCache, string Reciever, string SendBy)
        {
            List<Message> items = new List<Message>();
            CacheCommand cmd = null;
            CacheDataReader cdr = null;
            try
            {
                if (!pclsCache.Connect())
                {
                    return null;
                }
                cmd = Mb.MessageRecord.GetSMSDialogue(pclsCache.CacheConnectionObject);
                cmd.Parameters.Add("Reciever", CacheDbType.NVarChar).Value = Reciever;
                cmd.Parameters.Add("SendBy", CacheDbType.NVarChar).Value = SendBy;
                cdr = cmd.ExecuteReader();
                while (cdr.Read())
                {
                    Message item = new Message();
                    item.Time = cdr["Time"].ToString();
                    item.Content = cdr["Content"].ToString();
                    item.IDFlag = cdr["IDFlag"].ToString();
                    item.SendDateTime = cdr["SendDateTime"].ToString().Replace("-","/");
                    items.Add(item);
                }
                return items;
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "MessageMethod.GetSMSDialogue", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return null;
            }
            finally
            {

                if ((cdr != null))
                {
                    cdr.Close();
                    cdr.Dispose(true);
                    cdr = null;
                }
                if ((cmd != null))
                {
                    cmd.Parameters.Clear();
                    cmd.Dispose();
                    cmd = null;
                }
                pclsCache.DisConnect();
            }
        }
 public Message PostSMS(Message item)
 {
     return repository.SetSMS(pclsCache, item.SendBy, item.Receiver, item.Content, item.piUserId, item.piTerminalName, new CommonFunction().getRemoteIPAddress(), item.piDeviceType);
 }
 public HttpResponseMessage PutSMSRead(Message item)
 {
     int ret = repository.SetSMSRead(pclsCache, item.Receiver, item.SendBy, item.piUserId, item.piTerminalName, new CommonFunction().getRemoteIPAddress(), item.piDeviceType);
     return new ExceptionHandler().SetData(Request,ret);
 }
Example #6
0
        /// <summary>
        /// 获取消息联系人列表 GL 2015-10-10
        /// </summary>
        /// <param name="DoctorId"></param>
        /// <param name="CategoryCode"></param>
        /// <returns></returns>
        public List<Message> GetSMSList(DataConnection pclsCache, string DoctorId, string CategoryCode)
        {
            List<Message> items = new List<Message>();
            CacheCommand cmd = null;
            CacheDataReader cdr = null;
            try
            {
                if (!pclsCache.Connect())
                {
                    return null;
                }
                cmd = Mb.MessageRecord.GetSMSList(pclsCache.CacheConnectionObject);
                cmd.Parameters.Add("DoctorId", CacheDbType.NVarChar).Value = DoctorId;
                cmd.Parameters.Add("CategoryCode", CacheDbType.NVarChar).Value = CategoryCode;
                cdr = cmd.ExecuteReader();
                while (cdr.Read())
                {
                    //PatientId, PatientName, Count, Content, SendDateTime
                    Message item = new Message();
                    item.SendBy = cdr["PatientId"].ToString();
                    item.SendByName = cdr["PatientName"].ToString();
                    item.Count = cdr["Count"].ToString();
                    item.Content = cdr["Content"].ToString();
                    item.SendDateTime = cdr["SendDateTime"].ToString();
                    items.Add(item);
                }
                return items;
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "MessageMethod.GetSMSDialogue", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return null;
            }
            finally
            {

                if ((cdr != null))
                {
                    cdr.Close();
                    cdr.Dispose(true);
                    cdr = null;
                }
                if ((cmd != null))
                {
                    cmd.Parameters.Clear();
                    cmd.Dispose();
                    cmd = null;
                }
                pclsCache.DisConnect();
            }
        }