/// <summary>
        /// 注销会员
        /// </summary>
        /// <param name="phonetail"></param>
        /// <returns></returns>
        public IActionResult DeleteByOneString(string phonetail)
        {
            using var context = new SupermarketDbContext();

            var members = context.Member.FirstOrDefault(x => x.Phone.Contains(phonetail));
            var id      = members.Id;
            var mem2    = context.MemberLevelMapping.FirstOrDefault(x => x.MemberId.Equals(id));
            var mem3    = context.Statistics.FirstOrDefault(x => x.MemberId.Equals(id));

            context.Remove(mem2);
            context.Remove(mem3);
            context.Remove(members);
            context.SaveChanges();

            return(View());
        }
示例#2
0
 public IActionResult DeleteGoodsKind(long id)
 {
     try
     {
         var GoodInfo = _context.GoodsKinds.Where(x => x.GoodsKindId == id).FirstOrDefault();
         _context.Remove(GoodInfo);
         _context.SaveChanges();
         return(Ok("删除成功"));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, ex.Message));
     }
 }
示例#3
0
 public IActionResult DelSysUser(long id)
 {
     try
     {
         var sysUserinfo = _context.SysUsers.Where(x => x.SysUserId == id).FirstOrDefault();
         _context.Remove(sysUserinfo);
         _context.SaveChanges();
         return(Ok("删除成功"));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, ex.Message));
     }
 }
示例#4
0
        public IActionResult OrderReceiving([FromBody] OrderDto model)
        {
            try
            {
                var OrderInfo = _context.Orders.Where(x => x.OrderId == model.OrderId).FirstOrDefault();
                OrderInfo.PayState = model.PayState;

                if (model.PayState == PayState.已接单)
                {
                    var      SysTem = _context.SysUsers.Where(x => x.SysUserId == OrderInfo.SysUserId).FirstOrDefault();
                    var      Addrs  = _context.Addresss.Where(x => x.AddressId == model.AddressId).FirstOrDefault();
                    AppToken Text   = new AppToken(_context);

                    var Fom = _context.FormIds.Where(x => x.UserId == model.UserId).FirstOrDefault();


                    var TDN       = new TemDto();
                    var data2     = new Data1();
                    var first1    = new Keyword();
                    var keyword11 = new Keyword();
                    var keyword21 = new Keyword();
                    var keyword31 = new Keyword();
                    var keyword41 = new Keyword();
                    var keyword51 = new Keyword();
                    var keyword61 = new Keyword();
                    TDN.data          = data2;
                    TDN.data.keyword1 = keyword11;
                    TDN.data.keyword2 = keyword21;
                    TDN.data.keyword3 = keyword31;



                    TDN.touser              = model.OpenId;
                    TDN.template_id         = SysTem.TemIdAccept;
                    TDN.form_id             = Fom.FormIds;
                    TDN.data.keyword1.value = model.OrderNo;
                    TDN.data.keyword2.value = "已接单";
                    TDN.data.keyword3.value = Addrs.ContactPhone;

                    Text.GetAppToken(TDN);

                    var Time1 = DateTime.Now.AddDays(-7);
                    var y     = _context.FormIds.Where(x => x.CreatDate < Time1).ToList();
                    _context.FormIds.RemoveRange(y);
                    _context.Remove(Fom);

                    _context.SaveChanges();
                    return(Ok("修改成功"));
                }
                else if (model.PayState == PayState.已发货)
                {
                    var      SysTem = _context.SysUsers.Where(x => x.SysUserId == OrderInfo.SysUserId).FirstOrDefault();
                    var      Addrs  = _context.Addresss.Where(x => x.AddressId == model.AddressId).FirstOrDefault();
                    AppToken Text   = new AppToken(_context);

                    var Fom = _context.FormIds.Where(x => x.UserId == model.UserId).FirstOrDefault();


                    var TDN       = new TemDto();
                    var data2     = new Data1();
                    var first1    = new Keyword();
                    var keyword11 = new Keyword();
                    var keyword21 = new Keyword();
                    var keyword31 = new Keyword();
                    var keyword41 = new Keyword();
                    var keyword51 = new Keyword();
                    var keyword61 = new Keyword();
                    TDN.data          = data2;
                    TDN.data.keyword1 = keyword11;
                    TDN.data.keyword2 = keyword21;
                    TDN.data.keyword3 = keyword31;



                    TDN.touser              = model.OpenId;
                    TDN.template_id         = SysTem.TemIdSend;
                    TDN.form_id             = Fom.FormIds;
                    TDN.data.keyword1.value = model.OrderNo;
                    TDN.data.keyword2.value = "已发货";
                    TDN.data.keyword3.value = model.Price.ToString();

                    Text.GetAppToken(TDN);

                    var Time1 = DateTime.Now.AddDays(-7);
                    var y     = _context.FormIds.Where(x => x.CreatDate < Time1).ToList();
                    _context.FormIds.RemoveRange(y);
                    _context.Remove(Fom);

                    _context.SaveChanges();
                    return(Ok("修改成功"));
                }

                else if (model.PayState == PayState.已拒绝)
                {
                    var      SysTem = _context.SysUsers.Where(x => x.SysUserId == OrderInfo.SysUserId).FirstOrDefault();
                    var      Addrs  = _context.Addresss.Where(x => x.AddressId == model.AddressId).FirstOrDefault();
                    AppToken Text   = new AppToken(_context);

                    var Fom = _context.FormIds.Where(x => x.UserId == model.UserId).FirstOrDefault();


                    var TDN       = new TemDto();
                    var data2     = new Data1();
                    var first1    = new Keyword();
                    var keyword11 = new Keyword();
                    var keyword21 = new Keyword();
                    var keyword31 = new Keyword();
                    var keyword41 = new Keyword();
                    var keyword51 = new Keyword();
                    var keyword61 = new Keyword();
                    TDN.data          = data2;
                    TDN.data.keyword1 = keyword11;
                    TDN.data.keyword2 = keyword21;
                    TDN.data.keyword3 = keyword31;



                    TDN.touser              = model.OpenId;
                    TDN.template_id         = SysTem.TemIdRefuse;
                    TDN.form_id             = Fom.FormIds;
                    TDN.data.keyword1.value = model.OrderNo;
                    TDN.data.keyword2.value = "超出配送范围";
                    // TDN.data.keyword3.value = model.Price.ToString();

                    Text.GetAppToken(TDN);

                    var Time1 = DateTime.Now.AddDays(-7);
                    var y     = _context.FormIds.Where(x => x.CreatDate < Time1).ToList();
                    _context.FormIds.RemoveRange(y);
                    _context.Remove(Fom);

                    _context.SaveChanges();
                    return(Ok("修改成功"));
                }

                return(Ok(""));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }