public bool Update(FishEntity.ingredientsEntity model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update t_ingredients set "); strSql.Append("code=@code,"); strSql.Append("ProductionDate=@ProductionDate,"); strSql.Append("Outoftime=@Outoftime,"); strSql.Append("Brand=@Brand,"); strSql.Append("tlabel=@tlabel,"); strSql.Append("quality=@quality,"); strSql.Append("Remarks=@Remarks,"); strSql.Append("modifytime=@modifytime,"); strSql.Append("modifyman=@modifyman "); strSql.Append("where id=@id"); MySqlParameter[] parameters = { new MySqlParameter("@code", MySqlDbType.VarChar, 45), new MySqlParameter("@ProductionDate", MySqlDbType.DateTime), new MySqlParameter("@Outoftime", MySqlDbType.DateTime), new MySqlParameter("@Brand", MySqlDbType.VarChar, 45), new MySqlParameter("@tlabel", MySqlDbType.VarChar, 45), new MySqlParameter("@quality", MySqlDbType.VarChar, 45), new MySqlParameter("@Remarks", MySqlDbType.VarChar, 45), new MySqlParameter("@modifytime", MySqlDbType.Timestamp), new MySqlParameter("@modifyman", MySqlDbType.VarChar, 45), new MySqlParameter("@id", MySqlDbType.Int32, 11) }; parameters[0].Value = model.Code; parameters[1].Value = model.ProductionDate; parameters[2].Value = model.Outoftime; parameters[3].Value = model.Brand; parameters[4].Value = model.Tlabel; parameters[5].Value = model.Quality; parameters[6].Value = model.Remarks; parameters[7].Value = model.Modifytime; parameters[8].Value = model.Modifyman; parameters[9].Value = model.Id; int rows = MySqlHelper.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
public FishEntity.ingredientsEntity DataRowToModel1(DataRow row) { FishEntity.ingredientsEntity model = new FishEntity.ingredientsEntity(); if (row != null) { if (row["id"] != null && row["id"].ToString() != "") { model.Id = int.Parse(row["id"].ToString()); } if (row["code"] != null && row["code"].ToString() != "") { model.Code = row["code"].ToString(); } if (row["ProductionDate"] != null && row["ProductionDate"].ToString() != "") { model.ProductionDate = DateTime.Parse(row["ProductionDate"].ToString()); } if (row["Outoftime"] != null && row["Outoftime"].ToString() != "") { model.Outoftime = DateTime.Parse(row["Outoftime"].ToString()); } if (row["Brand"] != null && row["Brand"].ToString() != "") { model.Brand = row["Brand"].ToString(); } if (row["tlabel"] != null && row["tlabel"].ToString() != "") { model.Tlabel = row["tlabel"].ToString(); } if (row["quality"] != null && row["quality"].ToString() != "") { model.Quality = row["quality"].ToString(); } if (row["Remarks"] != null && row["Remarks"].ToString() != "") { model.Remarks = row["Remarks"].ToString(); } } return(model); }
public int Add(FishEntity.ingredientsEntity model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into t_ingredients(code,ProductionDate,Outoftime,Brand,tlabel,quality,Remarks,modifytime,modifyman,createtime,createman)"); strSql.Append("values(@code,@ProductionDate,@Outoftime,@Brand,@tlabel,@quality,@Remarks,@modifytime,@modifyman,@createtime,@createman);"); strSql.Append("select LAST_INSERT_ID();"); MySqlParameter[] Parameters = { new MySqlParameter("@code", MySqlDbType.VarChar, 45), new MySqlParameter("@ProductionDate", MySqlDbType.DateTime), new MySqlParameter("@Outoftime", MySqlDbType.DateTime), new MySqlParameter("@Brand", MySqlDbType.VarChar, 45), new MySqlParameter("@tlabel", MySqlDbType.VarChar, 45), new MySqlParameter("@quality", MySqlDbType.VarChar, 45), new MySqlParameter("@Remarks", MySqlDbType.VarChar, 45), new MySqlParameter("@createtime", MySqlDbType.Timestamp), new MySqlParameter("@createman", MySqlDbType.VarChar, 45), new MySqlParameter("@modifytime", MySqlDbType.Timestamp), new MySqlParameter("@modifyman", MySqlDbType.VarChar, 50) }; Parameters[0].Value = model.Code; Parameters[1].Value = model.ProductionDate; Parameters[2].Value = model.Outoftime; Parameters[3].Value = model.Brand; Parameters[4].Value = model.Tlabel; Parameters[5].Value = model.Quality; Parameters[6].Value = model.Remarks; Parameters[7].Value = model.Createtime; Parameters[8].Value = model.Createman; Parameters[9].Value = model.Modifytime; Parameters[10].Value = model.Modifyman; int id = MySqlHelper.ExecuteSqlReturnId(strSql.ToString(), Parameters); return(id); }
public bool Update(FishEntity.ingredientsEntity model) { return(dal.Update(model)); }
public int Add(FishEntity.ingredientsEntity model) { return(dal.Add(model)); }