public IHttpActionResult RunCloudMiner(RunCloudMinerModelGet_ modelGet) { try { DateTime dateTime = DateTime.Now; string dtBegin = dateTime.ToString("yyyy-MM-dd HH:mm:ss"); string dtEnd = dateTime.AddMinutes(30).ToString("yyyy-MM-dd HH:mm:ss"); SystemMaintenanceId = _systemMaintenanceDal.InsertSystemMaintenance(dtBegin, dtEnd, modelGet.EmployeeId); SystemMaintenance.Add(dateTime, dateTime.AddMinutes(30)); CloudMinerServer.Single.StartListenServer(); return(Json(new ResultDataModel <IList <CloudMinerInfoModelResult> > { Code = 0 })); } catch (Exception e) { if (SystemMaintenanceId != 0) { _systemMaintenanceDal.UpdateSystemMaintenance(SystemMaintenanceId, modelGet.EmployeeId); } return(Json(new ResultDataModel <IList <CloudMinerInfoModelResult> > { Code = -1, Messages = e.Message })); } }
public IHttpActionResult InsertSystemMaintenanceRecord(SystemMaintenanceModelGet_ modelGet) { try { Convert.ToDateTime(modelGet.MaintenanceTimeBegin); Convert.ToDateTime(modelGet.MaintenanceTimeEnd); } catch (Exception) { return(Json(new ResultDataModel <IList <SystemMaintenanceModelResult_> > { Code = -1, Messages = "请求参数有误" })); } int result = _systemMaintenanceDal.InsertSystemMaintenance(modelGet.MaintenanceTimeBegin, modelGet.MaintenanceTimeEnd, modelGet.EmployeeId); if (result > 0) { SystemMaintenance.Add(Convert.ToDateTime(modelGet.MaintenanceTimeBegin), Convert.ToDateTime(modelGet.MaintenanceTimeEnd)); } return(Json(new ResultDataModel <IList <SystemMaintenanceModelResult_> > { Code = result > 0 ? 0 : -1, Messages = result > 0 ? "" : "修改维护记录失败" })); }