public Model.MessageShow EditSaveMethod(Model.PlantStockBin data) { MessageShow msg = new MessageShow(); if (data.id <= 0)//The current user already exists { if (this.SqlCount(string.Format("SELECT COUNT(1) FROM plant WHERE plantCode='{0}'", data.numberCode), null) > 0) { msg.success = false; msg.message = "此Bin已存在"; } else { string insertStr = "INSERT INTO plant(plantCode) VALUES(@numberCode)"; msg.success = this.SqlExecute <int>(insertStr, data) > 0; msg.message = msg.success ? "添加成功" : "添加失败"; } } else { msg.success = this.SqlExecute <int>("UPDATE plant SET plantCode=@numberCode WHERE id=@id", data) > 0; msg.message = msg.success ? "编辑成功" : "编辑失败"; } return(msg); }
public Model.MessageShow EditSaveMethod(Model.PlantStockBin data) { return(dal.EditSaveMethod(data)); }