protected void butsubmint_Click(object sender, EventArgs e) { if (tyep.Equals("i")) { T_ad_case model = new T_ad_case(); model.Case_name = txttitle.Text.Trim(); if (img(File1) == "" || img(File2) == "") { MessShowBox.show("图片不能为空", this); return; } else { model.Post_summary = img(File2); model.Post_job = img(File1); } string s_v = ""; for (int i = 0; i < DropDownList1.Items.Count; i++) { if (DropDownList1.Items[i].Selected) { s_v += DropDownList1.Items[i].Value + ","; } } if (s_v == "") { MessShowBox.show("服务类型还没选择,你可以按住Ctrl键实现多选", this); return; } model.Type_id = s_v; model.Post_info = content1.InnerHtml; if (ad_main.admin_in_case(model)) { txttitle.Text = ""; content1.InnerHtml = ""; DropDownList1.SelectedIndex = 0; MessShowBox.show("添加成功", this); } else { MessShowBox.show("网络链接错误,添加失败", this); } } else if (tyep.Equals("u")) { T_ad_case model = new T_ad_case(); model.Case_name = txttitle.Text.Trim(); string s_v = ""; for (int i = 0; i < DropDownList1.Items.Count; i++) { if (DropDownList1.Items[i].Selected) { s_v += DropDownList1.Items[i].Value + ","; } } if (s_v == "") { MessShowBox.show("服务类型还没选择,你可以按住Ctrl键实现多选", this); return; } model.Type_id = s_v; model.Post_info = content1.InnerHtml; model.Id = id; if (File1.FileName == "" || File2.FileName == "") { model.Post_job = xiao; model.Post_summary = da; } else { File.Delete(Server.MapPath(xiao)); File.Delete(Server.MapPath(da)); model.Post_summary = img(File2); model.Post_job = img(File1); } if (ad_main.admin_up_case(model)) { MessShowBox.show("修改成功", this); Response.Redirect("ad_case.aspx"); } else { MessShowBox.show("网络链接失败,修改失败", this); } } else { Response.Redirect("ad_case.aspx"); } }
public static bool admin_up_case(T_ad_case model) { string sql = "update t_ad_case set type_id=@type_id,case_name=@case_name,post_job=@post_job,post_summary=@post_summary,post_info=@post_info,post_time=getdate() where id=@id"; return a.data.mssql.ExecuteNonQuery(0, sql, new SqlParameter[]{ new SqlParameter("@type_id",model.Type_id), new SqlParameter("@case_name",model.Case_name), new SqlParameter("@post_job",model.Post_job), new SqlParameter("@post_summary",model.Post_summary), new SqlParameter("@post_info",model.Post_info), new SqlParameter("@id",model.Id) }) > 0; }
public static List<T_ad_case> admin_select_case(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_case> list = new List<T_ad_case>(); while (dr.Read()) { T_ad_case model = new T_ad_case(); model.Id = a.normal.toInt(dr["id"]); model.Case_name = a.normal.toString(dr["Case_name"]); model.Post_info = a.normal.toString(dr["Post_info"]); model.Post_job = a.normal.toString(dr["Post_job"]); model.Post_summary = a.normal.toString(dr["Post_summary"]); model.Post_time = a.normal.toDateTime(dr["Post_time"]).ToString("yyyy-MM-dd"); model.Type_id = a.normal.toString(dr["Type_id"]); list.Add(model); } dr.Close(); dr.Dispose(); Count = a.normal.toInt(parameters[7].Value); return list; } }
public static T_ad_case admin_se_case(int id) { string sql = "select * from t_ad_case where id=@id"; using (SqlDataReader dr = a.data.mssql.ExecuteReader(0, sql, new SqlParameter[] { new SqlParameter("@id", id) })) { T_ad_case model = null; if (dr.Read()) { model = new T_ad_case(); model.Id = a.normal.toInt(dr["id"]); model.Post_info = a.normal.toString(dr["Post_info"]); model.Post_job = a.normal.toString(dr["Post_job"]); model.Post_summary = a.normal.toString(dr["Post_summary"]); model.Post_time = a.normal.toDateTime(dr["Post_time"]).ToString("yyyy-MM-dd"); model.Type_id = a.normal.toString(dr["Type_id"]); model.Case_name = a.normal.toString(dr["Case_name"]); } dr.Close(); dr.Dispose(); return model; } }
public static bool admin_in_case(T_ad_case model) { string sql = "insert into t_ad_case (type_id,case_name,post_job,post_summary,post_info,post_time) values(@type_id,@case_name,@post_job,@post_summary,@post_info,default)"; return a.data.mssql.ExecuteNonQuery(0, sql, new SqlParameter[]{ new SqlParameter("@type_id",model.Type_id), new SqlParameter("@case_name",model.Case_name), new SqlParameter("@post_job",model.Post_job), new SqlParameter("@post_summary",model.Post_summary), new SqlParameter("@post_info",model.Post_info) }) > 0; }