public PagedListModel <GL_QATargetYieldDTO> QueryGLQAYields(GL_QATargetYieldDTO searchModel, Page page) { int totalcount; var result = gL_QATargetYieldRepository.QueryGLQAYields(searchModel, page, out totalcount).ToList(); var bd = new PagedListModel <GL_QATargetYieldDTO>(totalcount, result); return(bd); }
public string AddOrEditGLQAYield(GL_QATargetYieldDTO dto) { string errorMessage = string.Empty; try { GL_QATargetYield entityContext; if (dto.GLQATargetYieldID == 0) { //新增要判断是否已存在数据 var GLQATargetYieldDTO = gL_QATargetYieldRepository.GetGLQATargetYieldDTO(dto.StationID, dto.Tag, dto.TargetYieldDate); if (GLQATargetYieldDTO != null) { return(string.Format(@"已添加此工站日期为{0}的{1}目标良率。", dto.TargetYieldDate, dto.Tag == 1 ? "一次" : "二次")); } else { entityContext = new GL_QATargetYield(); entityContext.StationID = dto.StationID; entityContext.TargetYieldDate = dto.TargetYieldDate; entityContext.TargetYield = dto.TargetYield; entityContext.Tag = dto.Tag; entityContext.Modified_UID = dto.Modified_UID; entityContext.Modified_Date = dto.Modified_Date; gL_QATargetYieldRepository.Add(entityContext); unitOfWork.Commit(); } } else { entityContext = gL_QATargetYieldRepository.GetById(dto.GLQATargetYieldID); entityContext.StationID = dto.StationID; entityContext.TargetYieldDate = dto.TargetYieldDate; entityContext.TargetYield = dto.TargetYield; entityContext.Tag = dto.Tag; entityContext.Modified_UID = dto.Modified_UID; entityContext.Modified_Date = dto.Modified_Date; gL_QATargetYieldRepository.Update(entityContext); unitOfWork.Commit(); } return("0"); } catch (Exception ex) { errorMessage = ex.Message; return(ex.Message); } }
public IQueryable <GL_QATargetYieldDTO> QueryGLQAYields(GL_QATargetYieldDTO searchModel, Page page, out int totalcount) { var query = from M in DataContext.GL_QATargetYield select new GL_QATargetYieldDTO { GLQATargetYieldID = M.GLQATargetYieldID, StationID = M.StationID, TargetYieldDate = M.TargetYieldDate, TargetYield = M.TargetYield, Tag = M.Tag, Modified_UID = M.Modified_UID, Modified_Date = M.Modified_Date, StationName = M.GL_Station.StationName, Modifieder = M.System_Users.User_Name }; if (searchModel.StationID != 0) { query = query.Where(m => m.StationID == searchModel.StationID); } if (searchModel.TargetYield != 0) { query = query.Where(m => m.TargetYield == searchModel.TargetYield); } if (searchModel.Tag != 0) { query = query.Where(m => m.Tag == searchModel.Tag); } if (!string.IsNullOrWhiteSpace(searchModel.TargetYieldDate)) { query = query.Where(m => m.TargetYieldDate == searchModel.TargetYieldDate); } totalcount = query.Count(); query = query.OrderByDescending(m => m.Modified_Date).GetPage(page); return(query); }
public string AddOrEditGLQAYieldAPI(GL_QATargetYieldDTO dto) { var result = _IPQCQualityServer.AddOrEditGLQAYield(dto); return(result); }