public static OperationTicketHistorySH ToDbHistoryModel(this TwoTickets item) { if (item == null) { return(null); } OperationTicketHistorySH db = new OperationTicketHistorySH(); db.Abutment_Id = item.id; db.fromOrder = item.fromOrder; db.ticketCode = item.ticketCode; db.type = item.type; db.state = item.state; string createT = item.createTime; db.createTime = Convert.ToDateTime(createT); string startT = item.startTime; db.startTime = Convert.ToDateTime(startT); string endT = item.endTime; db.endTime = Convert.ToDateTime(endT); db.detail = item.detail; db.ticketName = item.ticketName; return(db); }
public TwoTickets GetEntity(string id) { try { JsonSerializerSettings setting = new JsonSerializerSettings(); setting.NullValueHandling = NullValueHandling.Ignore; TwoTickets ticket = db.OperationTicketSHs.Find(i => i.Abutment_Id.ToString() == id).ToTModel(); string results = ticket.detail; Details details = JsonConvert.DeserializeObject <Details>(results, setting); ticket.detail = ""; DetailsSet detalsSet = new DetailsSet(); detalsSet.optTicket = details.optTicket; List <LinesSet> lineSet = new List <LinesSet>(); List <LinesGet> lineList = details.lines; //循环,给LineSet赋值 if (lineList != null) { foreach (LinesGet line in lineList) { LinesSet setline = new LinesSet(); setline.name = line.name; List <Dictionary <string, string> > dicList = line.lineContentList; List <LineContent> contentList = new List <LineContent>(); if (dicList != null) { foreach (Dictionary <string, string> dic in dicList) { LineContent linecontent = new LineContent(); List <KeyValue> keyList = new List <KeyValue>(); if (dic != null) { foreach (KeyValuePair <string, string> kv in dic) { KeyValue keyValue = new KeyValue(); keyValue.key = kv.Key; keyValue.value = kv.Value; keyList.Add(keyValue); } linecontent.Content = keyList; contentList.Add(linecontent); } } setline.lineContentList = contentList; lineSet.Add(setline); } } detalsSet.lines = lineSet; ticket.detailsSet = detalsSet; } return(ticket); } catch (Exception ex) { Log.Error("TicketsService.GetEntity:" + ex.ToString()); return(null); } }
public List <TwoTickets> GetList() { List <OperationTicketSH> dbTable = db.OperationTicketSHs.ToList(); List <TwoTickets> list = new List <TwoTickets>(); foreach (OperationTicketSH ticketSH in dbTable) { TwoTickets ticket = ticketSH.ToTModel(); ticket.detail = ""; ticket.detailsSet = null; list.Add(ticket); } return(list); }
public static List <TwoTickets> ToTModelList(this List <OperationTicketHistorySH> dList) { if (dList == null) { return(null); } List <TwoTickets> tList = new List <TwoTickets>(); foreach (OperationTicketHistorySH operationHis in dList) { TwoTickets ticket = operationHis.ToTModel(); ticket.detailsSet = null; ticket.detail = ""; tList.Add(ticket); } return(tList); }
/// <summary> /// 获取历史操作票 /// </summary> /// <param name="value"></param> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <returns></returns> public List <TwoTickets> GetHistoryListByCondition(string value, DateTime startTime, DateTime endTime) { if (startTime == null || endTime == null) { return(null); } List <TwoTickets> tickets = new List <TwoTickets>(); List <OperationTicketHistorySH> dHisList = db.OperationTicketHistorySHs.GetListByCondition(value, startTime, endTime); foreach (OperationTicketHistorySH hisDb in dHisList) { TwoTickets ticket = hisDb.ToTModel(); ticket.detail = ""; ticket.detailsSet = null; tickets.Add(ticket); } return(tickets); }
public static TwoTickets ToTModel(this OperationTicketSH item) { if (item == null) { return(null); } TwoTickets ticket = new TwoTickets(); ticket.id = item.Abutment_Id; ticket.fromOrder = item.fromOrder; ticket.ticketCode = item.ticketCode; ticket.type = item.type; ticket.state = item.state; ticket.createTime = item.createTime.ToString(); ticket.startTime = item.startTime.ToString(); ticket.endTime = item.endTime.ToString(); ticket.detail = item.detail; ticket.ticketName = item.ticketName; return(ticket); }
public TwoTickets Post(TwoTickets item) { throw new NotImplementedException(); }