You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
2.2 KiB
C#

10 months ago
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 BookingDB(string connstr) : base(connstr)
{
}
public DbSet<OP_SEAE_ORDER> Orders { get; set; }
public DbSet<OP_STATUS_LOG> StatusLogs { get; set; }
public DbSet<OP_SEAE_SI> 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<OP_LOG> 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;
}
}
}