private string getOrderNumberJson(IList <OrderRecordInfo> orders) { int[,] result = new int[10, 2]; for (int i = 0; i < 10; i++) { result.SetValue(i + 1, i, 0); result.SetValue(0, i, 1); } for (int i = 0; i < orders.Count; i++) { OrderRecordInfo o = orders[i]; int off = DateTime.Now.Day - o.Ord_Time.Day; if (off >= 10 | off == 0) { continue; } result.SetValue(Int32.Parse(result.GetValue(off - 1, 1).ToString()) + 1, off - 1, 1); } System.Text.StringBuilder str = new System.Text.StringBuilder("["); for (int i = 0; i < 10; i++) { str.Append("["); for (int j = 0; j < 2; j++) { str.Append(result.GetValue(i, j) + ","); } str.Append("],"); } str.Append("]"); return(str.ToString()); }
void IBLL.IOrderRecord.Modify(OrderRecordInfo orderRecord) { if (orderRecord == null) { throw new Exception(); } dal.Modify(orderRecord); }
void IBLL.IOrderRecord.Remove(OrderRecordInfo orderRecord) { if (orderRecord == null) { throw new Exception(); } dal.Remove(orderRecord); }
void IDAL.IOrderRecord.Add(OrderRecordInfo orderRecord) { try { DataContext ctx = new DataContext(connection); ITable orderRecords = ctx.GetTable <OrderRecordInfo>(); orderRecords.InsertOnSubmit(orderRecord); ctx.SubmitChanges(); } finally { } }
void IDAL.IOrderRecord.Remove(OrderRecordInfo orderRecord) { try { DataContext ctx = new DataContext(connection); ITable orderRecords = ctx.GetTable <OrderRecordInfo>(); orderRecords.Attach(orderRecord); orderRecords.DeleteOnSubmit(orderRecord); ctx.SubmitChanges(); } finally { } }
void IDAL.IOrderRecord.Modify(OrderRecordInfo orderRecord) { try { DataContext ctx = new DataContext(connection); ITable <OrderRecordInfo> orderRecords = ctx.GetTable <OrderRecordInfo>(); IQueryable <OrderRecordInfo> query = from o in orderRecords where o.Ord_ID == orderRecord.Ord_ID select o; foreach (OrderRecordInfo o in query) { o.Ord_Plan = orderRecord.Ord_Plan; o.Ord_Time = orderRecord.Ord_Time; o.Stu_ID = orderRecord.Stu_ID; o.Tea_ID = orderRecord.Tea_ID; } ctx.SubmitChanges(); } finally { } }