public bool UpdateProductFeedbacks(ProductFeedbacksInfo model) { DbParameter[] parms = { GenerateInParam("@CityName", SqlDbType.NVarChar, 50, model.CityName), GenerateInParam("@ProductName", SqlDbType.NVarChar, 50, model.ProductName), GenerateInParam("@ProductModel", SqlDbType.NVarChar, 50, model.ProductModel), GenerateInParam("@CustomerName", SqlDbType.NVarChar, 50, model.CustomerName), GenerateInParam("@Contact", SqlDbType.NVarChar, 50, model.Contact), GenerateInParam("@Address", SqlDbType.NVarChar, 250, model.Address), GenerateInParam("@Body", SqlDbType.NText, 0, model.Body), GenerateInParam("@State", SqlDbType.Int, 4, model.State), GenerateInParam("@CreateTime", SqlDbType.DateTime, 8, model.CreateTime), GenerateInParam("@WeChatName", SqlDbType.NVarChar, 250, model.WeChatName), GenerateInParam("@WeChatOpenId", SqlDbType.NVarChar, 50, model.WeChatOpenId), GenerateInParam("@Imgs", SqlDbType.NVarChar, 1000, model.Imgs), GenerateInParam("@id", SqlDbType.Int, 4, model.Id) }; string commandText = string.Format("update {0}ProductFeedbacks set CityName=@CityName,ProductName=@ProductName,ProductModel=@ProductModel,CustomerName=@CustomerName,Contact=@Contact,Address=@Address,sBody=@Body,CreateTime=@CreateTime,State=@State,WeChatName=@WeChatName,weChatOpenId=@weChatOpenId,Imgs=@Imgs where id=@id ", RDBSHelper.RDBSTablePre); if (RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms) > 0) { return(true); } else { return(false); } }
/// <summary> /// 获得产品售后反馈 /// </summary> /// <param name="newsId">新闻id</param> /// <returns></returns> public static ProductFeedbacksInfo GetModelById(int id) { ProductFeedbacksInfo model = null; IDataReader reader = BonSite.Core.BSData.RDBS.GetProductFeedbacksInfoById(id); if (reader.Read()) { model = BuildFromReader(reader); } reader.Close(); return(model); }
public int CreateProductFeedbacks(ProductFeedbacksInfo model) { DbParameter[] parms = { GenerateInParam("@CityName", SqlDbType.NVarChar, 50, model.CityName), GenerateInParam("@ProductName", SqlDbType.NVarChar, 50, model.ProductName), GenerateInParam("@ProductModel", SqlDbType.NVarChar, 50, model.ProductModel), GenerateInParam("@CustomerName", SqlDbType.NVarChar, 50, model.CustomerName), GenerateInParam("@Contact", SqlDbType.NVarChar, 50, model.Contact), GenerateInParam("@Address", SqlDbType.NVarChar, 250, model.Address), GenerateInParam("@Body", SqlDbType.NText, 0, model.Body), GenerateInParam("@State", SqlDbType.Int, 4, model.State), GenerateInParam("@CreateTime", SqlDbType.DateTime, 8, model.CreateTime), GenerateInParam("@WeChatName", SqlDbType.NVarChar, 250, model.WeChatName), GenerateInParam("@WeChatOpenId", SqlDbType.NVarChar, 50, model.WeChatOpenId), GenerateInParam("@Imgs", SqlDbType.NVarChar, 1000, model.Imgs) }; string commandText = string.Format("insert into {0}ProductFeedbacks(CityName,ProductName,ProductModel,CustomerName,Contact,Address,Body,CreateTime,State,WeChatName,weChatOpenId,imgs) values (@CityName,@ProductName,@ProductModel,@CustomerName,@Contact,@Address,@Body,@CreateTime,@State,@WeChatName,@weChatOpenId,@imgs) ;select @@IDENTITY;", RDBSHelper.RDBSTablePre); return(TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms), -1)); }
/// <summary> /// 通过IDataReader创建ProductFeedbacksInfo /// </summary> public static ProductFeedbacksInfo BuildFromReader(IDataReader reader) { ProductFeedbacksInfo model = new ProductFeedbacksInfo(); model.Id = TypeHelper.ObjectToInt(reader["Id"]); if (reader["CityName"] != null) { model.CityName = reader["CityName"].ToString(); } else { model.CityName = ""; } if (reader["ProductName"] != null) { model.ProductName = reader["ProductName"].ToString(); } else { model.ProductName = ""; } if (reader["ProductModel"] != null) { model.ProductModel = reader["ProductModel"].ToString(); } else { model.ProductModel = ""; } if (reader["CustomerName"] != null) { model.CustomerName = reader["CustomerName"].ToString(); } else { model.CustomerName = ""; } if (reader["Contact"] != null) { model.Contact = reader["Contact"].ToString(); } else { model.Contact = ""; } if (reader["Address"] != null) { model.Address = reader["Address"].ToString(); } else { model.Address = ""; } if (reader["Body"] != null) { model.Body = reader["Body"].ToString(); } else { model.Body = ""; } model.State = TypeHelper.ObjectToInt(reader["State"]); model.CreateTime = TypeHelper.ObjectToDateTime(reader["CreateTime"]); if (reader["WeChatName"] != null) { model.WeChatName = reader["WeChatName"].ToString(); } else { model.WeChatName = ""; } if (reader["WeChatOpenId"] != null) { model.WeChatOpenId = reader["WeChatOpenId"].ToString(); } else { model.WeChatOpenId = ""; } if (reader["Imgs"] != null) { model.Imgs = reader["Imgs"].ToString(); } else { model.Imgs = ""; } return(model); }
/// <summary> /// 更新产品售后反馈 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool Update(ProductFeedbacksInfo model) { return(BonSite.Core.BSData.RDBS.UpdateProductFeedbacks(model)); }
/// <summary> /// 创建产品售后反馈 /// </summary> /// <param name="model"></param> /// <returns></returns> public static int Create(ProductFeedbacksInfo model) { return(BonSite.Core.BSData.RDBS.CreateProductFeedbacks(model)); }
/// <summary> /// 更新 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool Update(ProductFeedbacksInfo model) { return(BonSite.Data.ProductFeedBacks.Update(model)); }
/// <summary> /// 新加 /// </summary> /// <param name="model"></param> /// <returns></returns> public static int Create(ProductFeedbacksInfo model) { return(BonSite.Data.ProductFeedBacks.Create(model)); }