/// <summary> /// 增加一条数据 /// </summary> public static bool Add(FoodSafety.Model.Sys_client_sysdept model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into sys_client_sysdept("); strSql.Append("deptId,deptName,deptLevel,fkDeptId,province,city,country,address,contacter,contacterphone,supplierId,maintypes,town,principal,principalphone,depttype)"); strSql.Append(" values ("); strSql.Append("@deptId,@deptName,@deptLevel,@fkDeptId,@province,@city,@country,@address,@contacter,@contacterphone,@supplierId,@maintypes,@town,@principal,@principalphone,@depttype)"); MySqlParameter[] parameters = { new MySqlParameter("@deptId", MySqlDbType.VarChar, 50), new MySqlParameter("@deptName", MySqlDbType.VarChar, 50), new MySqlParameter("@deptLevel", MySqlDbType.VarChar, 1), new MySqlParameter("@fkDeptId", MySqlDbType.VarChar, 50), new MySqlParameter("@province", MySqlDbType.VarChar, 50), new MySqlParameter("@city", MySqlDbType.VarChar, 50), new MySqlParameter("@country", MySqlDbType.VarChar, 50), new MySqlParameter("@address", MySqlDbType.VarChar, 50), new MySqlParameter("@contacter", MySqlDbType.VarChar, 50), new MySqlParameter("@contacterphone", MySqlDbType.VarChar, 50), new MySqlParameter("@supplierId", MySqlDbType.VarChar, 50), new MySqlParameter("@maintypes", MySqlDbType.VarChar, 50), new MySqlParameter("@town", MySqlDbType.VarChar, 50), new MySqlParameter("@principal", MySqlDbType.VarChar, 50), new MySqlParameter("@principalphone", MySqlDbType.VarChar, 50), new MySqlParameter("@depttype", MySqlDbType.VarChar, 50) }; parameters[0].Value = model.deptId; parameters[1].Value = model.deptName; parameters[2].Value = model.deptLevel; parameters[3].Value = model.fkDeptId; parameters[4].Value = model.province; parameters[5].Value = model.city; parameters[6].Value = model.country; parameters[7].Value = model.address; parameters[8].Value = model.contacter; parameters[9].Value = model.contacterphone; parameters[10].Value = model.supplierId; parameters[11].Value = model.maintypes; parameters[12].Value = model.town; parameters[13].Value = model.principal; parameters[14].Value = model.principalphone; parameters[15].Value = model.depttype; int rows = DbHelperMySQL.CreateDbHelper().ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
public static bool Update(FoodSafety.Model.Sys_client_sysdept model) { return(Sys_client_sysdeptDal.Update(model)); }
public static bool Add(FoodSafety.Model.Sys_client_sysdept model) { return(Sys_client_sysdeptDal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public static bool Update(FoodSafety.Model.Sys_client_sysdept model) { StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE sys_client_sysdept set "); strSql.Append("deptName=@deptName,"); strSql.Append("address=@address,"); strSql.Append("depttype=@depttype,"); strSql.Append("contacter=@contacter,"); strSql.Append("contacterphone=@contacterphone,"); strSql.Append("supplierId=@supplierId,"); strSql.Append("province=@province,"); strSql.Append("city=@city,"); strSql.Append("country=@country,"); strSql.Append("town=@town,"); strSql.Append("maintypes=@maintypes,"); strSql.Append("principal=@principal,"); strSql.Append("principalphone=@principalphone "); strSql.Append(" where deptId=@deptId "); MySqlParameter[] parameters = { new MySqlParameter("@deptName", MySqlDbType.VarChar, 50), new MySqlParameter("@address", MySqlDbType.VarChar, 50), new MySqlParameter("@depttype", MySqlDbType.VarChar, 50), new MySqlParameter("@contacter", MySqlDbType.VarChar, 50), new MySqlParameter("@contacterphone", MySqlDbType.VarChar, 50), new MySqlParameter("@supplierId", MySqlDbType.VarChar, 50), new MySqlParameter("@province", MySqlDbType.VarChar, 50), new MySqlParameter("@city", MySqlDbType.VarChar, 50), new MySqlParameter("@country", MySqlDbType.VarChar, 50), new MySqlParameter("@town", MySqlDbType.VarChar, 50), new MySqlParameter("@maintypes", MySqlDbType.VarChar, 50), new MySqlParameter("@principal", MySqlDbType.VarChar, 50), new MySqlParameter("@principalphone", MySqlDbType.VarChar, 50), new MySqlParameter("@deptId", MySqlDbType.VarChar, 50) }; parameters[0].Value = model.deptName; parameters[1].Value = model.address; parameters[2].Value = model.depttype; parameters[3].Value = model.contacter; parameters[4].Value = model.contacterphone; parameters[5].Value = model.supplierId; parameters[6].Value = model.province; parameters[7].Value = model.city; parameters[8].Value = model.country; parameters[9].Value = model.town; parameters[10].Value = model.maintypes; parameters[11].Value = model.principal; parameters[12].Value = model.principalphone; parameters[13].Value = model.deptId; int rows = DbHelperMySQL.CreateDbHelper().ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }