示例#1
0
 public IList <PayNotifyInfo> Get(Func <PayNotifyInfo, bool> condition)
 {
     using (var db = new WXDBContext())
     {
         return(db.PayNotifyInfo.Where(condition).ToList());
     }
 }
示例#2
0
 /// <summary>
 ///  根据条件获取结果
 /// </summary>
 /// <param name="condition">
 /// The condition.
 /// </param>
 /// <returns>
 /// The <see cref="IList"/>.
 /// </returns>
 public IList <RefundmentInfo> Get(Func <RefundmentInfo, bool> condition)
 {
     using (var db = new WXDBContext())
     {
         return(db.RefundmentInfo.Where(condition).ToList());
     }
 }
示例#3
0
        public static bool AddIdentifyingCode(IdentifyingCodeInfo code)
        {
            if (code != null)
            {
                var addResult = false;
                code.IdentifyingCode = Utils.Number(12);

                using (var context = new WXDBContext())
                {
                    addResult = new IdentifyingCodeRepository(context).AddIdentifyingCode(code);
                }

                // 如果IdentifyingCode在数据库中存在,则递归执行此方法重新获取编号
                if (!addResult)
                {
                    AddIdentifyingCode(code);
                }
                else
                {
                    return(true);
                }
            }

            return(false);
        }
示例#4
0
        public static bool ModifyIdentifyingCodeInfoStatus(string orderCode, int status)
        {
            if (string.IsNullOrEmpty(orderCode))
            {
                return(false);
            }

            using (var context = new WXDBContext())
            {
                var repository = new IdentifyingCodeRepository(context);

                var identifyingCode = repository.Get(item => item.OrderCode.Equals(orderCode));
                if (identifyingCode.Any())
                {
                    foreach (var item in identifyingCode)
                    {
                        item.Status     = status;
                        item.ModifyTime = DateTime.Now;
                    }

                    return(repository.Update(identifyingCode));
                }
            }

            return(false);
        }
示例#5
0
        public IList <IdentifyingCodeDetailSearchDTO> GetIdentifyingCodeDetailById(IdentifyingCodeInfo code)
        {
            var strSql = new StringBuilder();

            if (code == null)
            {
                return(null);
            }

            if (code.ModuleName.Equals("restaurant"))
            {
                strSql.Append("select a.id AS ProductId,b.OrderId AS OrderId,a.cpName as ProductName,c.price as Price,b.status as Status FROM wx_diancai_caipin_manage a INNER join ");
                strSql.Append("(select IdentifyingCodeId,CAST(ProductId AS INT) AS ProductId,CAST(OrderId AS INT) AS OrderId,");
                strSql.Append("Status FROM [wx_Verification_IdentifyingCodeInfo] WHERE IdentifyingCodeId='" + code.IdentifyingCodeId + "') as b");
                strSql.Append(" ON a.id=b.ProductId INNER JOIN (SELECT price,caiId,dingId FROM dbo.wx_diancai_dingdan_caiping)c");
                strSql.Append(" ON b.ProductId= c.caiId AND c.dingId= b.OrderId");
            }
            else if (code.ModuleName.Equals("hotel"))
            {
                strSql.Append("select a.id AS OrderId,a.roomid AS ProductId,a.roomType as ProductName,a.price as Price,b.status as Status,a.orderNum AS Number,");
                strSql.Append("CONVERT(varchar(10),a.arriveTime,120) as ArriveTime,CONVERT(varchar(10),a.leaveTime,120) as LeaveTime, CAST(DATEDIFF(DAY,a.arriveTime,a.leaveTime)*a.price*a.orderNum as FLOAT) as TotelPrice ");
                strSql.Append("FROM dbo.wx_hotel_dingdan a INNER join (select IdentifyingCodeId,CAST(OrderId AS INT) AS OrderId,Status FROM [wx_Verification_IdentifyingCodeInfo] ");
                strSql.Append("WHERE IdentifyingCodeId='" + code.IdentifyingCodeId + "') as b ON a.id=b.OrderId ");
            }

            using (var db = new WXDBContext())
            {
                return(db.Database.SqlQuery <IdentifyingCodeDetailSearchDTO>(strSql.ToString()).ToList());
            }
        }
示例#6
0
 public void Add()
 {
     using (var db = new WXDBContext())
     {
         db.PayNotifyInfo.Add(this);
         db.SaveChanges();
     }
 }
示例#7
0
        public ShortMsgService()
        {
            var context = new WXDBContext();

            _msgRepository = new ShortMsgRepository(context);
            _userService   = new UserManagerService();
            CreateMapping();
        }
示例#8
0
 public void Add()
 {
     using (var db = new WXDBContext())
     {
         db.RefundmentInfo.Add(this);
         db.SaveChanges();
     }
 }
示例#9
0
 public void SearchIdentifyingCodeDetailForSearch_IdentifyingCode_ReturnDTO()
 {
     var db  = new WXDBContext();
     var obj = new IdentifyingCodeInfo()
     {
         ModuleName = "restaurant", IdentifyingCodeId = Guid.Parse("15EB49FB-B41D-4101-B882-29DDF746F0B0")
     };
     var result = new IdentifyingCodeRepository(db).GetIdentifyingCodeDetailById(obj);
 }
示例#10
0
 public void Modify()
 {
     using (var db = new WXDBContext())
     {
         db.PayNotifyInfo.Attach(this);
         db.Entry(this).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
示例#11
0
 /// <summary>
 /// 防止存在相同参数
 /// </summary>
 /// <param name="moudleName"></param>
 /// <param name="out_trade_No"></param>
 /// <returns></returns>
 public bool ContainPayNotufy(string moudleName, string out_trade_No)
 {
     using (var db = new WXDBContext())
     {
         return
             (db.PayNotifyInfo.Any(
                  item =>
                  string.Equals(item.ModuleName, moudleName) && string.Equals(out_trade_no, item.out_trade_no)));
     }
 }
示例#12
0
 public static IList <IdentifyingCodeInfo> GetIdentifyingCodeInfoByOrderId(int shopId, string moduleName, string orderId, int wid)
 {
     using (var db = new WXDBContext())
     {
         return(new IdentifyingCodeRepository(db).Get(
                    item =>
                    item.ModuleName.Equals(moduleName) &&
                    item.ShopId.Equals(shopId.ToString()) &&
                    item.OrderId.Equals(orderId) &&
                    item.Wid.Equals(wid)).ToList());
     }
 }
示例#13
0
        public static bool ModifyIdentifyingCodeInfo(IdentifyingCodeInfo code)
        {
            if (code == null)
            {
                return(false);
            }

            using (var context = new WXDBContext())
            {
                return(new IdentifyingCodeRepository(context).Update(code));
            }
        }
示例#14
0
        public static IdentifyingCodeInfo GetIdentifyingCodeInfoByIdentifyingCodeId(Guid identifyingCodeId, string moduleName, int wid)
        {
            if (identifyingCodeId == null || Guid.Empty.Equals(identifyingCodeId))
            {
                return(null);
            }

            using (var context = new WXDBContext())
            {
                return
                    (new IdentifyingCodeRepository(context).Get(
                         item => item.IdentifyingCodeId.Equals(identifyingCodeId) &&
                         item.ModuleName.Equals(moduleName) &&
                         item.Wid.Equals(wid)).FirstOrDefault());
            }
        }
示例#15
0
        public static IdentifyingCodeInfo GetConfirmIdentifyingCodeInfo(int shopId, string identifyingCode, string moduleName, int wid)
        {
            if (shopId == 0 || string.IsNullOrEmpty(identifyingCode) || string.IsNullOrEmpty(moduleName))
            {
                return(null);
            }

            using (var context = new WXDBContext())
            {
                return
                    (new IdentifyingCodeRepository(context).Get(
                         item =>
                         item.ShopId == shopId.ToString(CultureInfo.InvariantCulture) &&
                         item.IdentifyingCode.Equals(identifyingCode) &&
                         item.ModuleName.Equals(moduleName) &&
                         item.Wid.Equals(wid)).FirstOrDefault());
            }
        }
示例#16
0
 public ShortMsgRepository(WXDBContext context)
 {
     _context = context;
 }