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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }