コード例 #1
0
        public PagedListModel <GL_MeetingTypeInfoDTO> QueryGL_MeetingTypeInfo(GL_MeetingTypeInfoDTO serchModel, Page page)
        {
            var query = from meetTypeInfo in DataContext.GL_MeetingTypeInfo
                        select new GL_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 <GL_MeetingTypeInfoDTO>(totalCount, query.ToList()));
        }
コード例 #2
0
 public string UpdateGL_MeetingTypeInfo(GL_MeetingTypeInfoDTO updateModel)
 {
     try
     {
         var entityContext = GL_MeetingTypeInfoRepository.GetById(updateModel.MeetingType_UID);
         entityContext.MeetingType_ID   = updateModel.MeetingType_ID;
         entityContext.MeetingType_Name = updateModel.MeetingType_Name;
         GL_MeetingTypeInfoRepository.Update(entityContext);
         _unitOfWork.Commit();
         return("SUCCESS");
     }
     catch (Exception ex)
     {
         return("修改失败,错误信息" + ex.Message.ToString());
     }
 }
コード例 #3
0
 public string AddGL_MeetingTypeInfo(GL_MeetingTypeInfoDTO addModel)
 {
     try
     {
         var sql = @"  INSERT INTO
                          [dbo].[GL_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.HasValue ? addModel.Modified_Date.Value.ToString("yyyy-MM-dd HH:mm:ss.fff") : "");
         var result = DataContext.Database.ExecuteSqlCommand(sql.ToString());
         if (result > 0)
         {
             return("SUCCESS");
         }
         else
         {
             return("添加失败");
         }
     }
     catch (Exception ex)
     {
         return("添加失败: 错误信息" + ex.Message.ToString());
     }
 }
コード例 #4
0
        public string AddGL_MeetingTypeInfo(GL_MeetingTypeInfoDTO serchModel)
        {
            //判断是否重复
            var isExist = GL_MeetingTypeInfoRepository.GetMany(
                p => p.Plant_Organization_UID == serchModel.Plant_Organization_UID &&
                p.BG_Organization_UID == serchModel.BG_Organization_UID &&
                p.FunPlant_Organization_UID == serchModel.FunPlant_Organization_UID &&
                p.MeetingType_ID == serchModel.MeetingType_ID &&
                p.MeetingType_Name == serchModel.MeetingType_Name
                );

            if (isExist.Count() > 0)
            {
                return("添加的数据已经存在,请检查!");
            }
            else
            {
                var result = GL_MeetingTypeInfoRepository.AddGL_MeetingTypeInfo(serchModel);
                return(result);
            }
        }
コード例 #5
0
        public PagedListModel <GL_MeetingTypeInfoDTO> QueryGL_MeetingTypeInfo(GL_MeetingTypeInfoDTO serchModel, Page page)
        {
            var result = GL_MeetingTypeInfoRepository.QueryGL_MeetingTypeInfo(serchModel, page);

            return(result);
        }
コード例 #6
0
        public IHttpActionResult AddGL_MeetingTypeInfoAPI(GL_MeetingTypeInfoDTO updateModel)
        {
            var result = gL_Service.AddGL_MeetingTypeInfo(updateModel);

            return(Ok(result));
        }
コード例 #7
0
        public IHttpActionResult UpdateGL_MeetingTypeInfoAPI(GL_MeetingTypeInfoDTO addModel)
        {
            var result = gL_Service.UpdateGL_MeetingTypeInfo(addModel);

            return(Ok(result));
        }