Exemple #1
0
 /// <summary>
 /// 获取消息列表作者身份
 /// </summary>
 /// <param name="shopId">门店ID 0为总后台,</param>
 /// <param name="AuthorIdentity">0总后台,1总店,2分店</param>
 /// <param name="model">The model.</param>
 /// <returns>ResultPageModel.</returns>
 /// <exception cref="NotImplementedException"></exception>
 public static ResultPageModel GetMessageList(int shopId, int AuthorIdentity, SearchModel model)
 {
     using (var dal = FactoryDispatcher.MessageFactory())
     {
         return(dal.GetMessageList(shopId, AuthorIdentity, model));
     }
 }
Exemple #2
0
 /// <summary>
 /// 删除消息
 /// </summary>
 /// <param name="messageId">The message identifier.</param>
 /// <param name="shopId">The shop identifier.</param>
 /// <param name="type">The type.</param>
 /// <returns>System.Int32.</returns>
 /// <exception cref="NotImplementedException"></exception>
 public static bool DeleteMessageInfo(int messageId, int shopId, int type)
 {
     using (var dal = FactoryDispatcher.MessageFactory())
     {
         return(dal.DeleteMessageInfo(messageId, shopId, type));
     }
 }
Exemple #3
0
 /// <summary>
 /// 修改总后台阅读状态
 /// </summary>
 /// <param name="messageId">The message identifier.</param>
 /// <returns>true if XXXX, false otherwise.</returns>
 public static bool UpdateReadStatus(int messageId)
 {
     using (var dal = FactoryDispatcher.MessageFactory())
     {
         return(dal.UpdateReadStatus(messageId));
     }
 }
Exemple #4
0
 /// <summary>
 /// 获取消息信息
 /// </summary>
 /// <param name="messageId">The message identifier.</param>
 /// <returns>MessageModel.</returns>
 /// <exception cref="NotImplementedException"></exception>
 public static MessageModel GetModel(int messageId)
 {
     using (var dal = FactoryDispatcher.MessageFactory())
     {
         return(dal.GetModel(messageId));
     }
 }
Exemple #5
0
 /// <summary>
 /// 添加消息
 /// </summary>
 /// <param name="model">The model.</param>
 /// <returns>System.Int32.</returns>
 /// <exception cref="NotImplementedException"></exception>
 public static int AddMessageInfo(MessageModel model)
 {
     using (var dal = FactoryDispatcher.MessageFactory())
     {
         return(dal.AddMessageInfo(model));
     }
 }
Exemple #6
0
 /// <summary>
 /// 修改消息
 /// </summary>
 /// <param name="model">The model.</param>
 /// <returns>true if XXXX, false otherwise.</returns>
 /// <exception cref="NotImplementedException"></exception>
 public static bool UpdateMessageInfo(MessageModel model)
 {
     using (var dal = FactoryDispatcher.MessageFactory())
     {
         return(dal.UpdateMessageInfo(model));
     }
 }
Exemple #7
0
        /// <summary>
        /// 编辑信息
        /// </summary>
        /// <param name="userIdentity">0集团,1总店,2分店</param>
        /// <param name="ShopBelongId">门店所属总店ID</param>
        /// <param name="model">The model.</param>
        /// <returns>true if XXXX, false otherwise.</returns>
        public static bool EditMessage(int userIdentity, int ShopBelongId, MessageModel model)
        {
            using (var dal = FactoryDispatcher.MessageFactory())
            {
                if (userIdentity == 2)
                {
                    model.SendTargetIds = ShopBelongId.ToString();
                }
                if (model.ID > 0)
                {
                    using (TransactionScope scope = new TransactionScope())
                    {
                        int messageId = model.ID;

                        var data = dal.GetModel(model.ID);

                        bool flag = dal.UpdateMessageInfo(model);

                        if (flag && model.IsSend == 1 && data.IsSend == 0)
                        {
                            // TODO;添加门店记录
                            //如果给总后台发布消息通知
                            if (userIdentity == 1 && model.IsSendBelongShopId == 1)
                            {
                                dal.AddMessageSendTarget(messageId, -1);
                            }

                            if (userIdentity == 1 || userIdentity == 0)
                            {
                                if (model.IsSendBelongShopId == 0 || !string.IsNullOrEmpty(model.SendTargetIds))
                                {
                                    if (string.IsNullOrEmpty(model.SendTargetIds))
                                    {
                                        return(false);
                                    }
                                    string[] targetIds = model.SendTargetIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                                    if (targetIds == null || targetIds.Count() == 0)
                                    {
                                        return(false);
                                    }

                                    foreach (var targetid in targetIds)
                                    {
                                        dal.AddMessageSendTarget(messageId, Convert.ToInt32(targetid));
                                    }
                                }
                            }
                            else
                            {
                                dal.AddMessageSendTarget(messageId, ShopBelongId);
                            }
                        }
                        scope.Complete();
                        return(true);
                    }
                }
                else
                {
                    using (TransactionScope scope = new TransactionScope())
                    {
                        int messageId = dal.AddMessageInfo(model);
                        if (messageId > 0 && model.IsSend == 1)
                        {
                            // TODO;添加门店记录
                            //如果给总后台发布消息通知
                            if (userIdentity == 1 && model.IsSendBelongShopId == 1)
                            {
                                dal.AddMessageSendTarget(messageId, -1);
                            }
                            if (userIdentity == 1 || userIdentity == 0)
                            {
                                if (model.IsSendBelongShopId == 0 || !string.IsNullOrEmpty(model.SendTargetIds))
                                {
                                    if (string.IsNullOrEmpty(model.SendTargetIds))
                                    {
                                        return(false);
                                    }
                                    string[] targetIds = model.SendTargetIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                                    if (targetIds == null || targetIds.Count() == 0)
                                    {
                                        return(false);
                                    }

                                    foreach (var targetid in targetIds)
                                    {
                                        dal.AddMessageSendTarget(messageId, Convert.ToInt32(targetid));
                                    }
                                }
                            }
                            else
                            {
                                dal.AddMessageSendTarget(messageId, ShopBelongId);
                            }
                        }
                        scope.Complete();
                        return(true);
                    }
                }
            }
        }