public static List<T_ad_news> user_se_news(int ShowRows, string where) { string sql = "select " + (ShowRows > 0 ? " top " + ShowRows.ToString() : "") + " a.id aid, a.type_id, new_title, new_Summary,b.type_name,new_info, new_img, new_time, new_admin, new_num from t_ad_news a left join t_ad_type b on a.type_id=b.id " + where + " order by a.id desc"; using (SqlDataReader dr = a.data.mssql.ExecuteReader(0, sql)) { List<T_ad_news> list = new List<T_ad_news>(); while (dr.Read()) { T_ad_news model = new T_ad_news(); model.Id = a.normal.toInt(dr["aid"]); model.Type_id = a.normal.toInt(dr["type_id"]); model.New_title = a.normal.toString(dr["new_title"]); model.New_Summary = a.normal.toString(dr["new_Summary"]); model.Type_name = a.normal.toString(dr["type_name"]); model.New_img = a.normal.toString(dr["new_img"]); model.New_time = a.normal.toDateTime(dr["new_time"]).ToString("yyyy-MM-dd"); model.New_admin = a.normal.toString(dr["new_admin"]); model.New_info = a.normal.toString(dr["new_info"]); model.New_num = a.normal.toInt(dr["new_num"]); list.Add(model); } dr.Close(); dr.Dispose(); return list; } }
public static int admin_up_new(T_ad_news model) { return a.data.mssql.ExecuteNonQuery(1, "[p-sys-up-new]", new SqlParameter[]{ new SqlParameter("@id",model.Id), new SqlParameter("@type_id",model.Type_id), new SqlParameter("@title",model.New_title), new SqlParameter("@summary",model.New_Summary), new SqlParameter("@info",model.New_info), new SqlParameter("@img",model.New_img), new SqlParameter("@num",model.New_num) }); }
public static T_ad_news admin_sel_new_id(int id) { using (SqlDataReader dr = a.data.mssql.ExecuteReader(1, "[p-sel-new-id]", new SqlParameter[] { new SqlParameter("@id", id) })) { T_ad_news model = null; while (dr.Read()) { model = new T_ad_news(); model.Id = a.normal.toInt(dr["id"]); model.New_img = a.normal.toString(dr["new_img"]); model.New_info = a.normal.toString(dr["new_info"]); model.New_num = a.normal.toInt(dr["new_num"]); model.New_time = a.normal.toDateTime(dr["new_time"]).ToString("yyyy-MM-dd"); model.New_title = a.normal.toString(dr["new_title"]); model.Type_id = a.normal.toInt(dr["type_id"]); } dr.Close(); dr.Dispose(); return model; } }
public static List<T_ad_news> admin_new_all(string tblName, string fldName, int PageSize, int PageIndex, string OrderType, string strWhere, out int Count) { SqlParameter[] parameters = { new SqlParameter("@tblName", SqlDbType.VarChar, 255), new SqlParameter("@strGetFields", SqlDbType.VarChar, 1000), new SqlParameter("@fldName", SqlDbType.VarChar, 255), new SqlParameter("@PageSize", SqlDbType.Int), new SqlParameter("@PageIndex", SqlDbType.Int), new SqlParameter("@strOrder", SqlDbType.VarChar,100), new SqlParameter("@strWhere", SqlDbType.VarChar,1500), new SqlParameter("@Count", SqlDbType.Int), }; parameters[0].Value = tblName; parameters[1].Value = "*"; parameters[2].Value = fldName; parameters[3].Value = PageSize; parameters[4].Value = PageIndex; parameters[5].Value = OrderType; parameters[6].Value = strWhere; parameters[7].Direction = ParameterDirection.Output; using (SqlDataReader dr = a.data.mssql.ExecuteReader(1, "[UP_PaginationAnyOrderCount]", parameters)) { List<T_ad_news> list = new List<T_ad_news>(); while (dr.Read()) { T_ad_news model = new T_ad_news(); model.Id = a.normal.toInt(dr["aid"]); model.New_admin = a.normal.toString(dr["new_admin"]); model.New_img = a.normal.toString(dr["new_img"]); model.New_info = a.normal.toString(dr["new_info"]); model.New_num = a.normal.toInt(dr["new_num"]); model.New_Summary = a.normal.toString(dr["new_summary"]); model.New_time = a.normal.toDateTime(dr["new_time"]).ToString("yyyy-MM-dd") ; model.New_title = a.normal.toString(dr["new_title"]); model.Type_name = a.normal.toString(dr["type_name"]); list.Add(model); } dr.Close(); dr.Dispose(); Count = a.normal.toInt(parameters[7].Value); return list; } }
protected void butsubmint_Click(object sender, EventArgs e) { T_ad_news model = new T_ad_news(); model.Id = a.query.toInt("aid"); model.Type_id = a.normal.toInt(ddltype.SelectedValue); model.New_info = Server.HtmlEncode(content1.InnerHtml); model.New_Summary = str(); model.New_admin = "东方广告"; model.New_info = content1.InnerHtml; model.New_num = a.normal.toInt(txtnum.Text); model.New_title = txttitle.Text.Trim(); if (Radiotrue.Checked) { if (path != "") { File.Delete(Server.MapPath(path)); } model.New_img = img(File1); } else { model.New_img = ""; } if (ad_main.admin_up_new(model) > 0) { MessShowBox.show("修改成功", this); Response.Redirect("ad_new.aspx"); } else { MessShowBox.show("网络链接错误,修改失败",this); } }