148 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			148 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using Model; | |||
|  | using Model.HJGL; | |||
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.Linq; | |||
|  | using System.Web; | |||
|  | using System.Web.Http; | |||
|  | 
 | |||
|  | namespace WebAPI.Controllers.HJGL | |||
|  | { | |||
|  |     public class PersonEntranceController : ApiController | |||
|  |     { // | |||
|  |         // 质量巡检 | |||
|  |         // GET: /Draw/ | |||
|  |         [HttpGet] | |||
|  |         public ResponseData<List<WelderEntrance>> Index(string projectId, int index, int page, string name) | |||
|  |         { | |||
|  |             ResponseData<List<WelderEntrance>> res = new ResponseData<List<WelderEntrance>>(); | |||
|  |             try | |||
|  |             {if (string.IsNullOrEmpty(name)) | |||
|  |                     name = ""; | |||
|  |                 res.successful = true; | |||
|  |                 res.resultValue = BLL.APIWelderEntranceService.GetWelderList(projectId, index, page, name); | |||
|  | 
 | |||
|  |             } | |||
|  |             catch (Exception e) | |||
|  |             { | |||
|  |                 res.successful = false; | |||
|  | 
 | |||
|  |             } | |||
|  | 
 | |||
|  |             return res; | |||
|  |         } | |||
|  |         [HttpGet] | |||
|  |         public ResponseData<WelderEntrance> GetWelderById(string welderId) | |||
|  |         { | |||
|  |             ResponseData<WelderEntrance> res = new ResponseData<WelderEntrance>(); | |||
|  |             try | |||
|  |             { | |||
|  |                 res.successful = true; | |||
|  |                 res.resultValue = BLL.APIWelderEntranceService.GetWelderById(welderId); | |||
|  | 
 | |||
|  |             } | |||
|  |             catch (Exception e) | |||
|  |             { | |||
|  |                 res.successful = false; | |||
|  | 
 | |||
|  |             } | |||
|  | 
 | |||
|  |             return res; | |||
|  |         } | |||
|  |         [HttpGet] | |||
|  |         public ResponseData<bool> IsExistWEDName(string WED_Name, string projectId) | |||
|  |         { | |||
|  |             ResponseData<bool> res = new ResponseData<bool>(); | |||
|  |             try | |||
|  |             { | |||
|  |                 res.successful = true; | |||
|  |                 res.resultValue = BLL.APIWelderEntranceService.IsExistWEDName( WED_Name,  projectId); | |||
|  | 
 | |||
|  |             } | |||
|  |             catch (Exception e) | |||
|  |             { | |||
|  |                 res.successful = false; | |||
|  | 
 | |||
|  |             } | |||
|  | 
 | |||
|  |             return res; | |||
|  |         } | |||
|  |         [HttpGet] | |||
|  |         public ResponseData<bool> IsExistWEDCode(string WED_Code, string projectId) | |||
|  |         { | |||
|  |             ResponseData<bool> res = new ResponseData<bool>(); | |||
|  |             try | |||
|  |             { | |||
|  |                 res.successful = true; | |||
|  |                 res.resultValue = BLL.APIWelderEntranceService.IsExistWEDCode(WED_Code, projectId); | |||
|  | 
 | |||
|  |             } | |||
|  |             catch (Exception e) | |||
|  |             { | |||
|  |                 res.successful = false; | |||
|  | 
 | |||
|  |             } | |||
|  | 
 | |||
|  |             return res; | |||
|  |         } | |||
|  |         [HttpGet] | |||
|  |         public ResponseData<bool> DeleteBSWelder(string  WED_ID) | |||
|  |         { | |||
|  |             ResponseData<bool> res = new ResponseData<bool>(); | |||
|  |             try | |||
|  |             { | |||
|  |                 res.successful = true; | |||
|  |                  BLL.APIWelderEntranceService.DeleteBSWelder(WED_ID); | |||
|  | 
 | |||
|  |             } | |||
|  |             catch (Exception e) | |||
|  |             { | |||
|  |                 res.successful = false; | |||
|  | 
 | |||
|  |             } | |||
|  | 
 | |||
|  |             return res; | |||
|  |         } | |||
|  | 
 | |||
|  |          | |||
|  |         [HttpPost] | |||
|  |         public ResponseData<string> Add([FromBody]WelderEntrance welder) | |||
|  |         { | |||
|  |             ResponseData<string> res = new ResponseData<string>(); | |||
|  |             try | |||
|  |             { | |||
|  |                 res.successful = true; | |||
|  |                 BLL.APIWelderEntranceService.AddBSWelder(welder); | |||
|  | 
 | |||
|  |             } | |||
|  |             catch (Exception e) | |||
|  |             { | |||
|  |                 res.successful = false; | |||
|  | 
 | |||
|  |             } | |||
|  | 
 | |||
|  |             return res; | |||
|  |         } | |||
|  |         [HttpPost] | |||
|  |         public ResponseData<string> update([FromBody]WelderEntrance welder) | |||
|  |         { | |||
|  |             ResponseData<string> res = new ResponseData<string>(); | |||
|  |             try | |||
|  |             { | |||
|  |                 res.successful = true; | |||
|  |                 BLL.APIWelderEntranceService.UpdateBSWelder(welder); | |||
|  | 
 | |||
|  |             } | |||
|  |             catch (Exception e) | |||
|  |             { | |||
|  |                 res.successful = false; | |||
|  | 
 | |||
|  |             } | |||
|  | 
 | |||
|  |             return res; | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  |     } | |||
|  | } |