75 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			75 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using BLL.API.HJGL; | |||
|  | using Model; | |||
|  | using Model.APIItem.HJGL; | |||
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.Linq; | |||
|  | using System.Web; | |||
|  | using System.Web.Http; | |||
|  | 
 | |||
|  | namespace WebAPI.Controllers.HJGL | |||
|  | { | |||
|  |     public class ElectrodeRecoveryController : ApiController | |||
|  |     { // | |||
|  |         // GET: /Draw/ | |||
|  |         [HttpGet] | |||
|  |         public ResponseData<List<ElectrodeRecoveryItem>> Index(string projectId, int index, int page,  string name) | |||
|  |         { | |||
|  |             ResponseData<List<ElectrodeRecoveryItem>> res = new ResponseData<List<ElectrodeRecoveryItem>>(); | |||
|  |             try | |||
|  |             { | |||
|  |                 res.successful = true; | |||
|  |                 if (string.IsNullOrEmpty(name)) | |||
|  |                     name = ""; | |||
|  |                 res.resultValue = APIElectrodeRecoveryService.GetListData(projectId, index, page,  name); | |||
|  | 
 | |||
|  |             } | |||
|  |             catch (Exception e) | |||
|  |             { | |||
|  |                 res.successful = false; | |||
|  | 
 | |||
|  |             } | |||
|  | 
 | |||
|  |             return res; | |||
|  |         } | |||
|  | 
 | |||
|  |         [HttpPost] | |||
|  |         public ResponseData<string> AddElectrodeRecovery([FromBody]ElectrodeRecoveryItem ElectrodeRecovery) | |||
|  |         { | |||
|  |             ResponseData<string> res = new ResponseData<string>(); | |||
|  |             try | |||
|  |             { | |||
|  |                 ElectrodeRecovery.RecoveryDate = DateTime.Now; | |||
|  |                 if (string.IsNullOrEmpty(ElectrodeRecovery.RecoveryId)) | |||
|  |                 { | |||
|  |                     if (string.IsNullOrEmpty(ElectrodeRecovery.RecoveryCode)) | |||
|  |                     { | |||
|  |                         string prefix = BLL.ProjectService.GetProjectByProjectId(ElectrodeRecovery.ProjectId).ProjectCode + "-HJ-TCC-LL-"; | |||
|  |                         ElectrodeRecovery.RecoveryCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.HJGL_ElectrodeRecovery", "RecoveryCode", ElectrodeRecovery.ProjectId, prefix); | |||
|  |                     } | |||
|  |                     ElectrodeRecovery.RecoveryId = Guid.NewGuid().ToString(); | |||
|  |                     APIElectrodeRecoveryService.AddElectrodeRecovery(ElectrodeRecovery); | |||
|  |                       | |||
|  |                     res.resultValue = ElectrodeRecovery.RecoveryId; | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     APIElectrodeRecoveryService.UpdateElectrodeRecovery(ElectrodeRecovery); | |||
|  |                        | |||
|  |                     res.resultValue = ElectrodeRecovery.RecoveryId; | |||
|  |                 } | |||
|  | 
 | |||
|  |                 res.successful = true; | |||
|  | 
 | |||
|  |             } | |||
|  |             catch (Exception e) | |||
|  |             { | |||
|  |                 res.resultHint = e.StackTrace; | |||
|  |                 res.successful = false; | |||
|  |             } | |||
|  |             return res; | |||
|  | 
 | |||
|  |         } | |||
|  | 
 | |||
|  |     } | |||
|  | } |