public PagedListModel <OEE_MeetingTypeInfoDTO> QueryOEE_MeetingTypeInfo(OEE_MeetingTypeInfoDTO serchModel, Page page) { var query = from meetTypeInfo in DataContext.OEE_MeetingTypeInfo select new OEE_MeetingTypeInfoDTO { MeetingType_UID = meetTypeInfo.MeetingType_UID, Plant_Organization_UID = meetTypeInfo.Plant_Organization_UID, Plant_Organization_Name = meetTypeInfo.System_Organization2.Organization_Name, BG_Organization_UID = meetTypeInfo.BG_Organization_UID, BG_Organization_Name = meetTypeInfo.System_Organization1.Organization_Name, FunPlant_Organization_UID = meetTypeInfo.FunPlant_Organization_UID, FunPlant_Organization_Name = meetTypeInfo.System_Organization.Organization_Name, MeetingType_ID = meetTypeInfo.MeetingType_ID, MeetingType_Name = meetTypeInfo.MeetingType_Name, Modified_UID = meetTypeInfo.Modified_UID, Modified_Date = meetTypeInfo.Modified_Date, }; //厂区 if (serchModel.Plant_Organization_UID != 0) { query = query.Where(p => p.Plant_Organization_UID == serchModel.Plant_Organization_UID); } //OP if (serchModel.BG_Organization_UID != 0) { query = query.Where(p => p.BG_Organization_UID == serchModel.BG_Organization_UID); } //功能厂 if (serchModel.FunPlant_Organization_UID != 0 && serchModel.FunPlant_Organization_UID != null) { query = query.Where(p => p.FunPlant_Organization_UID == serchModel.FunPlant_Organization_UID); } //会议ID if (!string.IsNullOrEmpty(serchModel.MeetingType_ID)) { query = query.Where(p => p.MeetingType_ID == serchModel.MeetingType_ID); } //会议名称 if (!string.IsNullOrEmpty(serchModel.MeetingType_Name)) { query = query.Where(p => p.MeetingType_Name == serchModel.MeetingType_Name); } var totalCount = query.Count(); query = query.OrderByDescending(m => m.Modified_Date).GetPage(page); return(new PagedListModel <OEE_MeetingTypeInfoDTO>(totalCount, query.ToList())); }
public string AddOEE_MeetingTypeInfo(OEE_MeetingTypeInfoDTO addModel) { try { var sql = @" INSERT INTO [dbo].[OEE_MeetingTypeInfo] ([Plant_Organization_UID] ,[BG_Organization_UID] ,[FunPlant_Organization_UID] ,[MeetingType_ID] ,[MeetingType_Name] ,[Modified_UID] ,[Modified_Date]) VALUES ( {0} , {1} , {2} , N'{3}' , N'{4}' , {5} , '{6}' )"; sql = string.Format(sql, addModel.Plant_Organization_UID, addModel.BG_Organization_UID, addModel.FunPlant_Organization_UID, addModel.MeetingType_ID, addModel.MeetingType_Name, addModel.Modified_UID, addModel.Modified_Date); var result = DataContext.Database.ExecuteSqlCommand(sql.ToString()); if (result > 0) { return("SUCCESS"); } else { return("添加失败"); } } catch (Exception ex) { return("添加失败: 错误信息" + ex.Message.ToString()); } }
public IHttpActionResult AddOEE_MeetingTypeInfoAPI(OEE_MeetingTypeInfoDTO updateModel) { var result = _OEE_Service.AddOEE_MeetingTypeInfo(updateModel); return(Ok(result)); }
public IHttpActionResult UpdateOEE_MeetingTypeInfoAPI(OEE_MeetingTypeInfoDTO addModel) { var result = _OEE_Service.UpdateOEE_MeetingTypeInfo(addModel); return(Ok(result)); }