public object GetEntity(string groupPK) { IList <PM_ACT_JOB_GROUP> list = new List <PM_ACT_JOB_GROUP>(); IList <PM_ACT_JOB> listJob = new List <PM_ACT_JOB>(); try { list = jgBO.GetEntity(groupPK); for (int i = 0; i < list.Count; i++) { PM_ACT_JOB job = new PM_ACT_JOB(); job = jobBO.GetEntity(Convert.ToInt32(list[i].JobPK)); if (job != null) { listJob.Add(job); } } return(listJob); } catch (Exception e) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "addJobGroup失败:" + e.Message)); } }
public HttpResponseMessage UpdateJob(PM_ACT_JOB Job) { try { Job.UpdatedOn = SSGlobalConfig.Now; jobBO.UpdateSome(Job); return(Request.CreateResponse(HttpStatusCode.OK, "更新成功")); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "更新出错:" + ex.Message)); } }
public object addJob(PM_ACT_JOB entity) { if (entity == null) { return(null); } else { entity.IsDeleted = false; entity.CreatedOn = SSGlobalConfig.Now; entity.UpdatedOn = entity.CreatedOn; entity.UpdatedBy = entity.CreatedBy; PM_ACT_JOB result = new PM_ACT_JOB(); IList <PM_ACT_JOB> pM_JOBList = new List <PM_ACT_JOB>(); try { PM_ACT_JOB qp = new PM_ACT_JOB() { JobName = entity.JobName }; IList <PM_ACT_JOB> list = jobBO.GetEntites(qp); if (list == null || list.Count == 0) { result = jobBO.Insert(entity); //return Request.CreateResponse(HttpStatusCode.OK, "新增成功"); IList <PM_ACT_JOB> list2 = jobBO.GetEntites(qp); return(list2[0]); } else { //throw new Exception("新增失败:动作名称已经存在"); return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "新增失败:动作名称已经存在")); } } catch (Exception e) { //throw e; return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "新增失败:" + e.Message)); } } }
public string deleteJob(PM_ACT_JOB entity) { if (entity == null) { return("false"); } else { entity.IsDeleted = true; //TODO 时间 try { jobBO.Update(entity); return("true"); } catch (Exception e) { return("getJobs查询失败:" + e.Message); } } }
public object getJobs(PM_ACT_JOB entity) { if (entity == null) { return(null); } else { IList <PM_ACT_JOB> list = new List <PM_ACT_JOB>(); try { list = jobBO.GetEntites(entity); return(list); } catch (Exception ex) { //throw ex; return(Request.CreateResponse(HttpStatusCode.InternalServerError, "getJobs查询失败:" + ex.Message)); } } }