示例#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);
     }
 }
示例#2
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);
     }
 }
示例#3
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);
     }
 }
示例#4
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);
     }
 }
示例#5
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);
     }
 }
示例#6
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);
     }
 }
示例#7
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);
     }
 }
示例#8
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);
     }
 }
示例#9
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);
     }
 }
示例#10
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);
     }
 }
示例#11
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);
     }
 }
示例#12
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);
     }
 }
示例#13
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);
     }
 }
示例#14
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);
            }
        }
示例#15
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);
     }
 }
示例#16
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);
     }
 }