/// <summary> /// 获取所有送货单 /// </summary> /// <returns></returns> public List <Enterprise> GetAllDeliveryNote() { try { List <Enterprise> eplist = new List <Enterprise>(); List <DeliveryNote> dlvrList = dao.GetAllDeliveryNote(); if (dlvrList == null || dlvrList.Count == 0) { return(null); } Enterprise ep = new Enterprise(); ep.EName = dlvrList[0].EName; ep.EID = dlvrList[0].EID; string currentEName = dlvrList[0].EName; foreach (DeliveryNote dn in dlvrList) { if (dn.EName == currentEName) { Department dp = new Department(); dp.DName = dn.DName; dp.OID = dn.OID; ep.DepList.Add(dp); } else { eplist.Add(ep); currentEName = dn.EName; ep = new Enterprise(); ep.EName = dn.EName; ep.EID = dn.EID; Department dp = new Department(); dp.DName = dn.DName; dp.OID = dn.OID; ep.DepList.Add(dp); } } eplist.Add(ep); return(eplist); } catch (Exception ex) { XphpTool.CreateErrorLog(ex.ToString()); return(null); } }