public static void insertTagtt(string tag, string maTin) { openConnect(); SqlCommand cmd = new SqlCommand("sp_insert_TagTT", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@tag", XuLiChuoi.xoaKhoangTrang(tag.Trim())); cmd.Parameters.AddWithValue("@tintuc", maTin.Trim()); cmd.ExecuteNonQuery(); closeConnect(); }
public static void update(Areas.Models.PhongBan tin) { openConnect(); SqlCommand cmd = new SqlCommand("sp_insert_DanhMuc", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Ten", tin.TenDM); cmd.Parameters.AddWithValue("@DanhMucCha", tin.Dsnv); cmd.Parameters.AddWithValue("@MetaTitle", XuLiChuoi.xoaKhoangTrang(tin.Email.Trim())); cmd.ExecuteNonQuery(); closeConnect(); }
public static void insert(Areas.Models.DanhMuc tin) { openConnect(); SqlCommand cmd = new SqlCommand("sp_insert_DanhMuc", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Ten", tin.Ten.Trim()); cmd.Parameters.AddWithValue("@DanhMucCha", tin.DanhMucCha); cmd.Parameters.AddWithValue("@MetaTitle", XuLiChuoi.xoaKhoangTrang(tin.MetaTitle.Trim())); cmd.Parameters.AddWithValue("@HienThi", tin.HienThi); cmd.ExecuteNonQuery(); closeConnect(); }
public static int checkTag(string tag) { int kq = 1; if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("select count(tag) from tag where tag = @tag", con); cmd.Parameters.AddWithValue("@tag", XuLiChuoi.xoaKhoangTrang(tag.Trim())); kq = (int)cmd.ExecuteScalar(); con.Close(); return(kq); }
public static void update(Areas.Models.TinTuc tin) { openConnect(); SqlCommand cmd = new SqlCommand("sp_update_TinTuc", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@TieuDe", tin.TieuDe1.Trim()); cmd.Parameters.AddWithValue("@Tag", XuLiChuoi.xoaKhoangTrang(tin.Tag1.Trim())); cmd.Parameters.AddWithValue("@NoiDung", tin.NoiDung1.Trim()); cmd.Parameters.AddWithValue("@TuKhoa", XuLiChuoi.xoaKhoangTrang(tin.TuKhoa1.Trim())); cmd.Parameters.AddWithValue("@Anh", tin.Anh1.Trim()); cmd.Parameters.AddWithValue("@MetaTitle", XuLiChuoi.xoaKhoangTrang(tin.TieuDe1.Trim())); cmd.Parameters.AddWithValue("@Id", tin.Id1); cmd.Parameters.AddWithValue("@DanhMuc", tin.DanhMuc1); cmd.ExecuteNonQuery(); closeConnect(); }
public static void update(string tag, string url) { openConnect(); SqlCommand cmd = new SqlCommand("sp_update_Tag ", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@tag", XuLiChuoi.xoaKhoangTrang(tag.Trim())); if (url != null) { cmd.Parameters.AddWithValue("@url", XuLiChuoi.xoaKhoangTrang(url.Trim())); } else { cmd.Parameters.AddWithValue("@url", " "); } cmd.ExecuteNonQuery(); closeConnect(); }