public void AddReport(report report) { try { using (var db = new CoinTradeDBEntities()) { db.report.Add(report); db.SaveChanges(); } } catch (Exception e) { throw (e); } }
public void AddOrder(order order) { try { using (var db = new CoinTradeDBEntities()) { db.order.Add(order); db.SaveChanges(); } } catch (Exception e) { throw (e); } }
public void AddError(string title, Exception e) { try { var err = new error(); err.id = Utils.GetUtcTimeDec(); err.date = DateTime.Now.ToString("yyyyMMddHHmmss"); err.errmessage = e.Message; err.errtitle = title; err.errtext = Utils.Exception2String(e); using (var db = new CoinTradeDBEntities()) { db.error.Add(err); db.SaveChanges(); } } catch (Exception ex) { throw (ex); } }
public void AddUpdateOrder(order order) { try { using (var db = new CoinTradeDBEntities()) { var orderdb = db.order.FirstOrDefault(a => a.orderid == order.orderid); if (orderdb != null) { //orderdb.amount = Math.Round((decimal)(order.amount ?? 0), 4); ////orderdb.createdate = order.createdate; //orderdb.fees = order.fees; ////orderdb.platform = order.platform; //orderdb.price = Math.Round((decimal)(order.price ?? 0), 4); //orderdb.side = order.type; //orderdb.status = order.status; ////orderdb.symbol = order.symbol; ////orderdb.date = DateTime.Now.ToString("yyyyMMddHHmmss"); } else { if (string.IsNullOrEmpty(order.date)) { order.date = DateTime.Now.ToString("yyyyMMddHHmmss"); } order.createdate = order.createdate ?? 0; db.order.Add(order); db.SaveChanges(); } } } catch (Exception e) { throw (e); } }