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> Index(string projectId, int index, int page, string name) { ResponseData> res = new ResponseData>(); 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 AddElectrodeRecovery([FromBody]ElectrodeRecoveryItem ElectrodeRecovery) { ResponseData res = new ResponseData(); try { ElectrodeRecovery.RecoveryDate = DateTime.Now; if (string.IsNullOrEmpty(ElectrodeRecovery.RecoveryId)) { if (string.IsNullOrEmpty(ElectrodeRecovery.RecoveryCode)) { string prefix = BLL.ProjectService.GetProjectByProjectId(ElectrodeRecovery.ProjectId).ProjectCode + "-HJ-CD-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; } } }