Exemplo n.º 1
0
 public List <Order> GetOrderToCharge(Func <Order, bool> seleWhere)
 {
     try
     {
         List <Order> order = new List <Order>();
         using (DCLEntities dcl = new DCLEntities())
         {
             foreach (Order item in dcl.Order.Where(seleWhere).ToList())
             {
                 item.RechargeStatus   = (int)OrderRechargeStatus.processing;
                 dcl.Entry(item).State = System.Data.Entity.EntityState.Modified;
                 if (dcl.SaveChanges() > 0)
                 {
                     order.Add(item);
                 }
             }
         }
         return(order);
     }
     catch (Exception ex)
     {
         WriteLog.Write("异常场信息[GetOrderToCharge]:" + ex.Message + ex.Source, LogPathFile.Exception);
         return(null);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="CardNo">卡号</param>
        /// <param name="startTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <param name="isUse">是否查询使用时间</param>
        /// <param name="type">卡类型</param>
        /// <param name="Status">充值状态</param>
        /// <returns></returns>
        public static List <Cards> GetCards(string CardNo, DateTime startTime, DateTime endTime, bool isUse = false, int type = -1, int Status = -1)
        {
            try
            {
                using (DCLEntities dcl = new DCLEntities())
                {
                    var result = dcl.Cards.Where(p => p.CardNumber.Contains(CardNo));

                    if (isUse)
                    {
                        result = result.Where(p => p.UseTime >= startTime && p.UseTime <= endTime);
                    }
                    else
                    {
                        result = result.Where(p => p.CreatTime >= startTime && p.CreatTime <= endTime);
                    }
                    if (type != -1)
                    {
                        result = result.Where(p => p.ChargeAccountTypeID == type);
                    }
                    if (Status != -1)
                    {
                        result = result.Where(p => (p.ReChargeStatus != null && p.ReChargeStatus == Status));
                    }

                    return(result.ToList());
                }
            }
            catch (Exception)
            {
                return(null);
            }
        }
Exemplo n.º 3
0
 public static List <ChargeAccountType> GetChargeAccountType(Func <ChargeAccountType, bool> seleWhere)
 {
     try
     {
         using (DCLEntities dcl = new DCLEntities())
         {
             return(dcl.ChargeAccountType.Where(seleWhere).ToList());
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemplo n.º 4
0
 public static List <ProductInfo> GetProductInfos(Func <ProductInfo, bool> seleWhere)
 {
     try
     {
         using (DCLEntities dcl = new DCLEntities())
         {
             return(dcl.ProductInfo.Where(seleWhere).ToList());
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemplo n.º 5
0
 public static List <OrderChargeAccount> GetOrderChargeAccount(Func <OrderChargeAccount, bool> seleWhere)
 {
     try
     {
         using (DCLEntities dcl = new DCLEntities())
         {
             return(dcl.OrderChargeAccount.Where(seleWhere).ToList());
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemplo n.º 6
0
 public static List <Cards> GetCards(Func <Cards, bool> seleWhere)
 {
     try
     {
         using (DCLEntities dcl = new DCLEntities())
         {
             return(dcl.Cards.Where(seleWhere).ToList());
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemplo n.º 7
0
 public static List <ClientConfig> GetClientConfig(Func <ClientConfig, bool> seleWhere)
 {
     try
     {
         using (DCLEntities dcl = new DCLEntities())
         {
             return(dcl.ClientConfig.Where(seleWhere).ToList());
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemplo n.º 8
0
 public static bool AddListCards(List <Cards> cardsSet)
 {
     try
     {
         using (DCLEntities dcl = new DCLEntities())
         {
             dcl.Cards.AddRange(cardsSet);
             return(dcl.SaveChanges() > 0);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 9
0
 public static bool AddOrderChargeAccount(OrderChargeAccount orderChargeAccount)
 {
     try
     {
         using (DCLEntities dcl = new DCLEntities())
         {
             orderChargeAccount = dcl.OrderChargeAccount.Add(orderChargeAccount);
             return(dcl.SaveChanges() > 0);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 10
0
 public static bool UpdateOrderChargeAccount(OrderChargeAccount orderChargeAccount)
 {
     try
     {
         using (DCLEntities dcl = new DCLEntities())
         {
             dcl.Entry(orderChargeAccount).State = System.Data.Entity.EntityState.Modified;
             return(dcl.SaveChanges() > 0);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 11
0
 public static bool AddCards(Cards cards)
 {
     try
     {
         using (DCLEntities dcl = new DCLEntities())
         {
             cards = dcl.Cards.Add(cards);
             return(dcl.SaveChanges() > 0);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 12
0
 public static bool  AddClientConfig(ClientConfig clientConfig)
 {
     try
     {
         using (DCLEntities dcl = new DCLEntities())
         {
             clientConfig = dcl.ClientConfig.Add(clientConfig);
             return(dcl.SaveChanges() > 0);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 13
0
 public static bool AddChargeAccountType(ChargeAccountType chargeAccountType)
 {
     try
     {
         using (DCLEntities dcl = new DCLEntities())
         {
             chargeAccountType = dcl.ChargeAccountType.Add(chargeAccountType);
             return(dcl.SaveChanges() > 0);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 14
0
 public static bool UpdateCards(Cards cards)
 {
     try
     {
         using (DCLEntities dcl = new DCLEntities())
         {
             dcl.Entry(cards).State = System.Data.Entity.EntityState.Modified;
             return(dcl.SaveChanges() > 0);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 15
0
 public static bool AddOrder(Order order)
 {
     try
     {
         using (DCLEntities dcl = new DCLEntities())
         {
             order = dcl.Order.Add(order);
             return(dcl.SaveChanges() > 0);
         }
     }
     catch (Exception ex)
     {
         WriteLog.Write("系统订单号:" + order.OrderInsideID + ",商户订单号:" + order.OrderExternalID + ",异常场信息[AddOrder]:" + ex.Message + ex.Source, LogPathFile.Exception);
         return(false);
     }
 }
Exemplo n.º 16
0
 public static bool DeleteClientConfig(ClientConfig clientConfig)
 {
     try
     {
         using (DCLEntities dcl = new DCLEntities())
         {
             dcl.ClientConfig.Attach(clientConfig);
             dcl.ClientConfig.Remove(clientConfig);
             return(dcl.SaveChanges() > 0);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 17
0
 public static bool DeleteOrderChargeAccount(OrderChargeAccount orderChargeAccount)
 {
     try
     {
         using (DCLEntities dcl = new DCLEntities())
         {
             dcl.OrderChargeAccount.Attach(orderChargeAccount);
             dcl.OrderChargeAccount.Remove(orderChargeAccount);
             return(dcl.SaveChanges() > 0);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 18
0
 public static bool DeleteCards(Cards cards)
 {
     try
     {
         using (DCLEntities dcl = new DCLEntities())
         {
             dcl.Cards.Attach(cards);
             dcl.Cards.Remove(cards);
             return(dcl.SaveChanges() > 0);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 19
0
 public static bool DeleteChargeAccountType(ChargeAccountType chargeAccountType)
 {
     try
     {
         using (DCLEntities dcl = new DCLEntities())
         {
             dcl.ChargeAccountType.Attach(chargeAccountType);
             dcl.ChargeAccountType.Remove(chargeAccountType);
             return(dcl.SaveChanges() > 0);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 20
0
 public List <Order> GetOrder(Func <Order, bool> seleWhere)
 {
     try
     {
         using (DCLEntities dcl = new DCLEntities())
         {
             List <Order> order = dcl.Order.Where(seleWhere).ToList();
             return(order);
         }
     }
     catch (Exception ex)
     {
         WriteLog.Write("异常场信息[GetOrder]:" + ex.Message + ex.Source, LogPathFile.Exception);
         return(null);
     }
 }
Exemplo n.º 21
0
        public bool IsOrders(Func <Order, bool> seleWhere)
        {
            try
            {
                using (DCLEntities dcl = new DCLEntities())
                {
                    int count = dcl.Order.AsNoTracking().Where(seleWhere).Count();

                    return(count > 0 ? true : false);
                }
            }
            catch (Exception ex)
            {
                WriteLog.Write("异常场信息[IsOrders]:" + ex.Message + ex.Source, LogPathFile.Exception);
                return(true);
            }
        }
Exemplo n.º 22
0
        public bool UpdateOrder(Order order)
        {
            try
            {
                using (DCLEntities dcl = new DCLEntities())
                {
                    dcl.Entry(order).State = System.Data.Entity.EntityState.Modified;
                    return(dcl.SaveChanges() > 0);
                }
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException ex)
            {
                WriteLog.Write("系统订单号:" + order.OrderInsideID + ",商户订单号:" + order.OrderExternalID + ",异常场信息[UpdateOrder]:" + ex.Message + ex.Source, LogPathFile.Exception);

                return(false);
            }
        }
Exemplo n.º 23
0
 public static bool UpdateCards(Cards cards, int cardStatus, string msg)
 {
     try
     {
         using (DCLEntities dcl = new DCLEntities())
         {
             cards.ReChargeStatus   = cardStatus;
             cards.UseTime          = DateTime.Now;
             cards.ReChargeMsg      = msg;
             dcl.Entry(cards).State = System.Data.Entity.EntityState.Modified;
             return(dcl.SaveChanges() > 0);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 24
0
 public static bool AddOrder(List <Order> orderList)
 {
     try
     {
         using (DCLEntities dcl = new DCLEntities())
         {
             foreach (var item in orderList)
             {
                 dcl.Order.Add(item);
             }
             return(dcl.SaveChanges() > 0);
         }
     }
     catch (Exception ex)
     {
         WriteLog.Write("批量插入订单,异常场信息[AddOrder]:" + ex.Message + ex.Source, LogPathFile.Exception);
         return(false);
     }
 }
Exemplo n.º 25
0
        public List <Order> GetOrder_top1000()
        {
            try
            {
                using (DCLEntities dcl = new DCLEntities())
                {
                    List <Order> orderExternalIDlist = dcl.Order.AsNoTracking().OrderByDescending(p => p.OrderID)
                                                       .Select(p => new { p.OrderExternalID }).Take(1000).ToList().Select(a => new Order {
                        OrderExternalID = a.OrderExternalID
                    }).ToList();

                    return(orderExternalIDlist);
                }
            }
            catch (Exception ex)
            {
                WriteLog.Write("异常场信息[GetOrder_top1000]:" + ex.Message + ex.Source, LogPathFile.Exception);
                return(null);
            }
        }
Exemplo n.º 26
0
        public static List <Order> GetOrder(string orderInsideID, string orderExternalID, string productID, string productName, string targetAccount, string reChargeAccount, DateTime startTime, DateTime endTime, int Status = -1)
        {
            try
            {
                using (DCLEntities dcl = new DCLEntities())
                {
                    var result = dcl.Order.Where(p => p.OrderInsideID.Contains(orderInsideID) && p.OrderExternalID.Contains(orderExternalID) &&
                                                 p.ProductID.Contains(productID) && p.ProductName.Contains(productName) && p.TargetAccount.Contains(targetAccount) &&
                                                 p.ChargeAccountInfo.Contains(reChargeAccount) && p.StartDatetime > startTime && p.StartDatetime < endTime);
                    if (Status != -1)
                    {
                        result = result.Where(p => (p.RechargeStatus != null && p.RechargeStatus == Status));
                    }

                    return(result.ToList());
                }
            }
            catch (Exception ex)
            {
                WriteLog.Write("系统订单号:" + orderInsideID + ",商户订单号:" + orderExternalID + ",异常场信息[GetOrder]:" + ex.Message + ex.Source, LogPathFile.Exception);

                return(null);
            }
        }