Beispiel #1
0
        public static void SendMsg(string title, string content, string link, string attachFileID, string receiverIDs, string receiverNames, MsgReceiverType receiverType = MsgReceiverType.UserType, MsgType msgType = MsgType.Normal, bool isReadReceipt = false, bool isImportant = false)
        {
            var sendUser = UserService.GetUserInfoBySysName(UserService.GetCurrentUserLoginName());

            SendMsg(title, content, link, attachFileID, receiverIDs, receiverNames, sendUser, receiverType, msgType, isReadReceipt, isImportant);
        }
Beispiel #2
0
 public void SendMsg(string title, string content, string link, string attachFileID, string receiverIDs, string receiverNames, UserInfo sendUser, MsgReceiverType receiverType = MsgReceiverType.UserType, MsgType msgType = MsgType.Normal, bool isReadReceipt = false, bool isImportant = false)
 {
     Config.Logic.MessageService.SendMsg(title, content, link, attachFileID, receiverIDs, receiverNames, sendUser, receiverType, msgType, isReadReceipt, isImportant);
 }
Beispiel #3
0
        public static void SendMsg(string title, string content, string link, string attachFileID, string receiverIDs, string receiverNames, UserInfo sendUser, MsgReceiverType receiverType = MsgReceiverType.UserType, MsgType msgType = MsgType.Normal, bool isReadReceipt = false, bool isImportant = false)
        {
            title   = title.Replace("'", "''");
            content = content.Replace("'", "''");

            string msgBodyID = GuidHelper.CreateGuid();

            string userID   = "";
            string userName = "******";

            if (sendUser != null)
            {
                userID   = sendUser.UserID;
                userName = sendUser.UserName;
            }

            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(msgBodySql
                            , msgBodyID
                            , title
                            , content
                            , attachFileID
                            , link
                            , 1
                            , DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                            , userID
                            , userName
                            , receiverIDs
                            , receiverNames
                            , (isReadReceipt ? "1" : "0")
                            , (isImportant ? "1" : "0"));

            var receiverIDArr   = receiverIDs.Split(',');
            var receiverNameArr = receiverNames.Split(',');

            for (int i = 0; i < receiverIDArr.Length; i++)
            {
                sb.AppendFormat(msgReceiverSql
                                , GuidHelper.CreateGuid()
                                , msgBodyID
                                , receiverIDArr[i]
                                , receiverNameArr[i]
                                , 0);
            }

            SQLHelper sqlHelper = SQLHelper.CreateSqlHelper(ConnEnum.Base);

            if (Config.Constant.IsOracleDb)
            {
                string sql = sb.ToString();
                sql = sql.Replace("\r\n", "").Replace("\n", "");
                sql = "begin " + sql + " end;";
                sqlHelper.ExecuteNonQuery(sql);
            }
            else
            {
                sqlHelper.ExecuteNonQuery(sb.ToString());
            }
        }