using BookingWeb.DB.Model; using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Web; namespace BookingWeb.DB { public class BookingDB : DbContext { public BookingDB():base("BookingDB") { } public DbSet Orders { get; set; } public DbSet StatusLogs { get; set; } public DbSet Confirms { get; set; } } //订舱状态 public enum OrderStatus { Create, Submit, Confirm, Back } //提单确认状态 public enum OrderConfirmStatus { None, Create, Submit, Confirm, Reject } public enum OpLogModule { //订舱 Order, //截单 Confirm } public enum OpLogType { //保存 Save, //提交 Submit, //取消 Cancel } public enum OrderLogStatus { OrderSave, OrderSubmit, OrderConfirm, ConfirmSave, ConfirmSubmit, ConfirmConfirm } public class InfoDB : DbContext { public InfoDB() : base("BookingDB") { } public DbSet Logs { get; set; } } public static class LogHelper { private static InfoDB infoDB = new InfoDB(); public static bool Log(OpLogModule module, OpLogType type, string billNO, string mblno,string corpid,string corpname, string json) { OP_LOG log = new OP_LOG(); log.OpTime = DateTime.Now; log.OpUserId = ""; log.OpUserName = ""; log.OpCompanyId = corpid; log.OpCompanyName = corpname; log.Module = module.ToString(); log.Type = type.ToString(); log.BillNO = billNO; log.MBLNO = mblno; log.JsonValue = json; infoDB.Logs.Add(log); infoDB.SaveChanges(); return true; } } }