/// <summary> /// 得到用户的采购单列表 /// </summary> /// <param name="UserId">用户编号</param> /// <returns></returns> public DataTable GetOrders(string UserId) { var area = _assPurchaseOrderRepository.GetAll(); if (!string.IsNullOrEmpty(UserId)) { area = area.Where(a => a.PURCHASER == UserId); } var list = from assPurchaseOrder in area join user in SMOWMSDbContext.coreUsers on assPurchaseOrder.PURCHASER equals user.USER_ID orderby assPurchaseOrder.CREATEDATE descending select new AssPOListOutputDto() { REALID = assPurchaseOrder.REALID, POID = assPurchaseOrder.POID, NAME = assPurchaseOrder.NAME, PURCHASER = assPurchaseOrder.PURCHASER, PURCHASERNAME = user.USER_NAME, STATUS = assPurchaseOrder.STATUS, STATUSNAME = "", CREATEDATE = assPurchaseOrder.CREATEDATE, Time = "" }; var temTable = LINQToDataTable.ToDataTable(list); foreach (DataRow row in temTable.Rows) { AssPurchaseOrderRow assPurchaseOrderRow = _assPoRowRepository.GetByPOID(row["POID"].ToString()).FirstOrDefault(); AssTemplate assTemplate = _assTemplateRepository.GetById(assPurchaseOrderRow.TEMPLATEID).FirstOrDefault(); row["Image"] = assTemplate.IMAGE; int status = int.Parse(row["STATUS"].ToString()); row["STATUSNAME"] = Enum.GetName(typeof(PurchaseOrderStatus), status); row["Time"] = DateTime.Parse(row["CREATEDATE"].ToString()).ToShortDateString(); } return(temTable); }
/// <summary> /// 根据模板编号得到信息 /// </summary> /// <param name="templateId">模板编号</param> /// <returns></returns> public AssTemplate GetAtbyId(string templateId) { return(_assTemplateRepository.GetById(templateId).AsNoTracking().FirstOrDefault()); }