public string IfEntryExists(int userId, QuerySchemaEntryModel inputModel) { var entries = dal.GetSchemaEntryByUserIdAndType(userId, inputModel.IsConditionOut); var item = entries.FirstOrDefault(m => m.OrgId == inputModel.OrgId && m.Label == inputModel.Label && m.BatchNo == inputModel.BatchNo && m.ProductionModel == inputModel.ProductionModel && m.BtnN == inputModel.SchemaId); if (item != null) { return("条件已存在"); } return(null); }
public int AddQuerySchemaEntry(QuerySchemaEntryModel model) { return(SqlHelper.ExecuteNonQuery(@" insert into SJUserQuerySchemaEntry (SchemaId,OrgId,Label,BatchNo,ProductionModel,IsConditionOut,SafeCode,SpecificationValueBegin,SpecificationValueEnd) values(@SchemaId,@OrgId,@Label,@BatchNo,@ProductionModel,@IsConditionOut,@SafeCode,@SpecificationValueBegin,@SpecificationValueEnd);", new SqlParameter[] { new SqlParameter("@SchemaId", model.SchemaId), new SqlParameter("@OrgId", model.OrgId), new SqlParameter("@Label", model.Label), new SqlParameter("@BatchNo", model.BatchNo), new SqlParameter("@ProductionModel", model.ProductionModel), new SqlParameter("@IsConditionOut", model.IsConditionOut), new SqlParameter("@SafeCode", model.SafeCode), new SqlParameter("@SpecificationValueBegin", model.SpecificationValueBegin), new SqlParameter("@SpecificationValueEnd", model.SpecificationValueEnd) })); }
public string AddQuerySchemaEntry(QuerySchemaEntryModel model) { return(dal.AddQuerySchemaEntry(model) == 1 ? null : "插入失败"); }