public HttpResponseMessage RemoveCategory(string pk, string user) { //return Request.CreateResponse(HttpStatusCode.OK, "删除成功"); try { QM_INFRA_CATEGORIES param = qM_INFRA_CATEGORIESBO.GetEntity(int.Parse(pk)); param.IsDeleted = true; param.Last_update_by = user; param.Last_update_date = SSGlobalConfig.Now; qM_INFRA_CATEGORIESBO.UpdateSome(param); QM_INFRA_CAUSE_CATEGORY qM_INFRA_CAUSE_CATEGORY = new QM_INFRA_CAUSE_CATEGORY() { Category = param.Category }; IList <QM_INFRA_CAUSE_CATEGORY> list = qM_INFRA_CAUSE_CATEGORYBO.GetByParam(qM_INFRA_CAUSE_CATEGORY); foreach (QM_INFRA_CAUSE_CATEGORY e in list) { qM_INFRA_CAUSE_CATEGORYBO.Delete((int)e.PK); } return(Request.CreateResponse(HttpStatusCode.OK, "删除成功")); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "删除出错:" + ex.Message)); } }
public HttpResponseMessage SaveRelation(QM_INFRA_CAUSE_CATEGORY param) { try { IList <QM_INFRA_CAUSE_CATEGORY> entities = qM_INFRA_CAUSE_CATEGORYBO.GetByParam(param); if (entities.Count < 1) { param.CreatedOn = SSGlobalConfig.Now; qM_INFRA_CAUSE_CATEGORYBO.Insert(param); return(Request.CreateResponse(HttpStatusCode.OK, "新增成功!")); } else { return(Request.CreateResponse(HttpStatusCode.OK, "新增失败:该关系已存在!")); } } catch (Exception e) { return(Request.CreateResponse(HttpStatusCode.OK, "新增失败:" + e.Message)); } }
public HttpResponseMessage RemoveCause(int pk) { try { QM_INFRA_CAUSE entity = qM_INFRA_CAUSEBO.GetEntity(pk); entity.IsDeleted = true; qM_INFRA_CAUSEBO.UpdateSome(entity); QM_INFRA_CAUSE_CATEGORY qM_INFRA_CAUSE_CATEGORY = new QM_INFRA_CAUSE_CATEGORY() { CauseCode = entity.CauseCode }; IList <QM_INFRA_CAUSE_CATEGORY> list = qM_INFRA_CAUSE_CATEGORYBO.GetByParam(qM_INFRA_CAUSE_CATEGORY); foreach (QM_INFRA_CAUSE_CATEGORY e in list) { qM_INFRA_CAUSE_CATEGORYBO.Delete((int)e.PK); } return(Request.CreateResponse(HttpStatusCode.OK, "删除成功!")); } catch (Exception e) { return(Request.CreateResponse(HttpStatusCode.OK, "删除失败:" + e.Message)); } }