// public dynamic GetModel(int Id) { try { dynamic model = null; StringBuilder strSql = new StringBuilder(); strSql.Append(" select top 1 Id,FK_BidId,BidPlacardTitle,BidPlacardContent,Publisher,ReleaseTime,fujian from T_BidPlacard "); strSql.Append(" where FK_BidId=@FK_BidId"); SqlParameter[] parameters = { new SqlParameter("@FK_BidId", SqlDbType.Int, 4) }; parameters[0].Value = Id; using (dynamic read = DbHelperSQL.ExecuteReader(strSql.ToString(), parameters)) { if (read.Read()) { model = new BidPlacard(); model.Id = int.Parse(read["Id"].ToString()); model.FK_BidId = int.Parse(read["FK_BidId"].ToString()); model.BidPlacardTitle = read["BidPlacardTitle"].ToString(); model.BidPlacardContent = read["BidPlacardContent"].ToString(); model.Publisher = read["Publisher"].ToString(); model.ReleaseTime = DateTime.Parse(read["ReleaseTime"].ToString()); } read.Dispose(); } return(model); } catch { throw; } }
private dynamic GetModels(HttpContext context) { dynamic model = new BidPlacard(); model.FK_BidId = int.Parse(context.Request.QueryString["FK_BidId"].ToString()); model.BidPlacardTitle = context.Request.QueryString["BidPlacardTitle"].ToString(); model.BidPlacardContent = context.Request.QueryString["BidPlacardContent"].ToString(); model.ReleaseTime = DateTime.Now; model.Publisher = adminUser.AdminName; try { model.fujian = context.Request["fujian"]; } catch { } try { model.Id = int.Parse(context.Request.QueryString["Id"].ToString()); } catch { model.Id = 0; } return(model); }
// public bool Create(BidPlacard model) { try { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into T_BidPlacard("); strSql.Append("FK_BidId,BidPlacardTitle,BidPlacardContent,Publisher,ReleaseTime,fujian)"); strSql.Append(" values ("); strSql.Append("@FK_BidId,@BidPlacardTitle,@BidPlacardContent,@Publisher,@ReleaseTime,@fujian)"); if (DbHelperSQL.ExecuteSql(strSql.ToString(), GetSqlParameter(model)) > 0) { return(true); } else { return(false); } } catch { throw; } }
// public bool Update(BidPlacard model) { try { StringBuilder strSql = new StringBuilder(); strSql.Append("update T_BidPlacard set "); strSql.Append("BidPlacardTitle=@BidPlacardTitle,"); strSql.Append("BidPlacardContent=@BidPlacardContent,"); strSql.Append("Publisher=@Publisher,"); strSql.Append("fujian=@fujian,"); strSql.Append("ReleaseTime=@ReleaseTime"); strSql.Append(" where FK_BidId=@FK_BidId"); if (DbHelperSQL.ExecuteSql(strSql.ToString(), GetSqlParameter(model)) > 0) { return(true); } else { return(false); } } catch { throw; } }