Exemplo n.º 1
0
        public void TestMethod1()
        {
            #region 短信统计
            //新增
            MessageSearchDTO searchdto = new MessageSearchDTO();
            searchdto.page = 1;
            searchdto.rows = 1;
            testservice.GetMessageStatList(searchdto);

            List <MessageOperateDTO> dtolist = new List <MessageOperateDTO>();
            dtolist.Add(new MessageOperateDTO
            {
                MessageType = -1,
                SendTime    = DateTime.Now,
                UserID      = 1
            });
            var addresult = testservice.AddMessageStat(dtolist);

            searchdto.rows = 20;
            var resultlist1 = testservice.GetMessageStatList(searchdto);
            var target      = resultlist1.Where(m => m.MessageType == -1).FirstOrDefault();
            Assert.IsNotNull(target);
            //删除
            MessageResultDTO deletedto = new MessageResultDTO();
            deletedto.MessageStatID = target.MessageStatID;
            var deleteresult = testservice.DeleteMessageStat(deletedto);
            var resultlist3  = testservice.GetMessageStatList(searchdto);
            target = resultlist3.Where(m => m.MessageStatID == target.MessageStatID).FirstOrDefault();
            Assert.IsNull(target);
            #endregion
        }
Exemplo n.º 2
0
        /// <summary>
        /// 删除短信统计
        /// </summary>
        /// <returns></returns>
        public ActionResult DeleteMessageStat(MessageResultDTO dto)
        {
            ResultData <object> result = new ResultData <object>();

            try
            {
                result = SystemProvider.DeleteMessageStat(dto);
            }
            catch (Exception ex)
            {
                result.SubmitResult = false;
                result.Message      = ex.Message;
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 删除短信
        /// </summary>
        /// <returns></returns>
        public bool DeleteMessageStat(MessageResultDTO dto)
        {
            bool result = false;

            using (var tcdmse = new Entities.TCDMS_MasterDataEntities())
            {
                var pp = tcdmse.master_MessageStat.Where(p => p.MessageStatID == dto.MessageStatID).FirstOrDefault();
                if (pp == null)
                {
                    throw new Exception("此条信息不存在!");
                }
                tcdmse.master_MessageStat.Remove(pp);

                result = tcdmse.SaveChanges() > 0;
            }

            return(result);
        }
Exemplo n.º 4
0
        public void TestMethod1()
        {
            //短信统计
            //新增
            MessageSearchDTO searchdto = new MessageSearchDTO();

            searchdto.page = 1;
            searchdto.rows = 1;
            var searchdtostr = TransformHelper.ConvertDTOTOBase64JsonString(searchdto);

            testcontroller.GetMessageStatList(searchdtostr);
            List <MessageOperateDTO> dtolist = new List <MessageOperateDTO>();

            dtolist.Add(new MessageOperateDTO
            {
                MessageType = -1,
                SendTime    = DateTime.Now,
                UserID      = 1
            });
            var addresult = testcontroller.AddMessageStat(dtolist);

            searchdto.rows = 20;
            var resultlist1 = JsonConvert.DeserializeObject <ResultDTO <List <MessageResultDTO> > >(testcontroller.GetMessageStatList(searchdtostr).Content.ReadAsStringAsync().Result).Object;
            var target      = resultlist1.Where(m => m.MessageType == -1).FirstOrDefault();

            Assert.IsNotNull(target);

            //删除
            MessageResultDTO deletedto = new MessageResultDTO();

            deletedto.MessageStatID = target.MessageStatID;
            var deletedtostr = TransformHelper.ConvertDTOTOBase64JsonString(deletedto);
            var deleteresult = testcontroller.DeleteMessageStat(deletedtostr);
            var resultlist3  = JsonConvert.DeserializeObject <ResultDTO <List <MessageResultDTO> > >(testcontroller.GetMessageStatList(searchdtostr).Content.ReadAsStringAsync().Result).Object;

            target = resultlist3.Where(m => m.MessageStatID == target.MessageStatID).FirstOrDefault();
            Assert.IsNull(target);
        }
Exemplo n.º 5
0
        public HttpResponseMessage DeleteMessageStat(string MessageResultDTO)
        {
            ResultDTO <object> actionresult = new ResultDTO <object>();

            try
            {
                MessageResultDTO dto = TransformHelper.ConvertBase64JsonStringToDTO <MessageResultDTO>(MessageResultDTO);
                actionresult.SubmitResult = _ISystemServices.DeleteMessageStat(dto);
            }
            catch (Exception e)
            {
                actionresult.SubmitResult = false;
                actionresult.Message      = e.Message;
            }

            HttpResponseMessage result = new HttpResponseMessage
            {
                Content = new StringContent(JsonConvert.SerializeObject(actionresult),
                                            System.Text.Encoding.GetEncoding("UTF-8"),
                                            "application/json")
            };

            return(result);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 删除短信统计
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public static ResultData <object> DeleteMessageStat(MessageResultDTO dto)
        {
            ResultData <object> blResult = DeleteAPI <ResultData <object> >(WebConfiger.MasterDataServicesUrl + "MessageStat?MessageResultDTO=" + TransformHelper.ConvertDTOTOBase64JsonString(dto));

            return(blResult);
        }