public HttpResponseMessage AddRelation(QM_INFRA_ABNORMALITY_CATEGORY param) { try { if (param.Category == "产品过程" && String.IsNullOrEmpty(param.SubCategory)) { return(Request.CreateResponse(HttpStatusCode.OK, "请选择二级分类")); } else { IList <QM_INFRA_ABNORMALITY_CATEGORY> entities = qM_INFRA_ABNORMALITY_CATEGORYBO.GetByParam(param); if (entities.Count < 1) { param.CreatedOn = SSGlobalConfig.Now; qM_INFRA_ABNORMALITY_CATEGORYBO.Insert(param); return(Request.CreateResponse(HttpStatusCode.OK, "新增成功1条")); } else { return(Request.CreateResponse(HttpStatusCode.OK, "新增出错:该关系已存在")); } } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.OK, "新增出错:" + ex.Message)); } }
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_ABNORMALITY_CATEGORY qM_INFRA_ABNORMALITY_CATEGORY = new QM_INFRA_ABNORMALITY_CATEGORY() { Category = param.Category, SubCategory = param.SubCategory }; IList <QM_INFRA_ABNORMALITY_CATEGORY> list = qM_INFRA_ABNORMALITY_CATEGORYBO.GetByParam(qM_INFRA_ABNORMALITY_CATEGORY); foreach (QM_INFRA_ABNORMALITY_CATEGORY e in list) { qM_INFRA_ABNORMALITY_CATEGORYBO.Delete((int)e.PK); } return(Request.CreateResponse(HttpStatusCode.OK, "删除成功")); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "删除出错:" + ex.Message)); } }
public HttpResponseMessage RemoveAbnormality(int pk) { try { QM_INFRA_ABNORMALITY entity = qM_INFRA_ABNORMALITYBO.GetEntity(pk); entity.IsDeleted = true; qM_INFRA_ABNORMALITYBO.UpdateSome(entity); QM_INFRA_ABNORMALITY_CATEGORY qM_INFRA_ABNORMALITY_CATEGORY = new QM_INFRA_ABNORMALITY_CATEGORY() { AbnormalityCode = entity.AbnormalityCode }; IList <QM_INFRA_ABNORMALITY_CATEGORY> list = qM_INFRA_ABNORMALITY_CATEGORYBO.GetByParam(qM_INFRA_ABNORMALITY_CATEGORY); foreach (QM_INFRA_ABNORMALITY_CATEGORY e in list) { qM_INFRA_ABNORMALITY_CATEGORYBO.Delete((int)e.PK); } return(Request.CreateResponse(HttpStatusCode.OK, "删除成功!")); } catch (Exception e) { return(Request.CreateResponse(HttpStatusCode.OK, "删除失败:" + e.Message)); } }