public void AddTopartner(string id, string groupid) { try { DbTask db = new DbTask(); string Sql = string.Empty; Sql = "UPDATE " + TableName + " SET idx = idx + 1"; db.ExecuteNonQuery(Sql); DateTime sStartDate = DateTime.Now; DateTime dt = DateTime.Now; int nYear = dt.Year + 1; dt = new DateTime(nYear, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second); Sql = "INSERT INTO " + TableName + "(groupid, id, startdate, enddate, idx) "; Sql += " VALUES(?groupid, ?id, ?startdate, ?enddate, ?idx)"; DataTable datatable = null; db.AddParameters(ref datatable, "groupid", DbType.NVarChar, groupid); db.AddParameters(ref datatable, "id", DbType.NVarChar, id); db.AddParameters(ref datatable, "startdate", DbType.Datetime, sStartDate); db.AddParameters(ref datatable, "enddate", DbType.Datetime, dt); db.AddParameters(ref datatable, "idx", DbType.Int32, 1); db.ExecuteNonQuery(Sql, datatable); } catch (Exception ae) { string error = ae.ToString(); } }
public void Delete(string id) { DbTask db = new DbTask(); Publish publish = null; Menus menu = null; News news = null; string Sql = string.Empty; DataTable dt = GetChild(id); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { string vparentid = dr["pparentid"].ToString(); string vid = dr["pid"].ToString(); bool kiemtra = CheckChild(id); if (kiemtra) { Delete(vid); } else { Sql = "DELETE FROM " + TableName + " WHERE parentid = '" + vparentid + "'"; db.ExecuteNonQuery(Sql); } //Xoa menu for (int i = 1; i <= 9; i++) { menu = new Menus(i); menu.RemoveFromMenu(vid); } //Xoa Tin news = new News(); news.DeleteGroup(vid); //xoa publish publish = new Publish(); publish.DeletePublish(id); } } Sql = "DELETE FROM " + TableName + " WHERE id = '" + id.Trim() + "'"; db.ExecuteNonQuery(Sql); //Xoa menu for (int i = 1; i <= 9; i++) { menu = new Menus(i); menu.RemoveFromMenu(id); } //Xoa Tin news = new News(); news.DeleteGroup(id); //xoa publish publish = new Publish(); publish.DeletePublish(id); }
public void RemoveFromMenu(string id) { DbTask db = new DbTask(); int idx = GetIndex(id); string Sql = " DELETE FROM " + _TableName + " "; Sql += " WHERE groupid = " + _GroupID + " "; Sql += " AND id = '" + id.Trim() + "'"; db.ExecuteNonQuery(Sql); Sql = " UPDATE " + _TableName + " SET idx = idx -1 "; Sql += " WHERE groupid = '" + _GroupID + "' "; Sql += " AND idx > '" + idx + "'"; db.ExecuteNonQuery(Sql); }
public void AddToPublish_NoiBat(string id) { try { DbTask db = new DbTask(); string Sql = string.Empty; Sql = "UPDATE " + TableName_MoiNhat + " SET idx = idx +1 "; db.ExecuteNonQuery(Sql); Sql = "INSERT INTO " + TableName_MoiNhat + "(groupid, id,idx) "; Sql += "VALUES ('0','" + id + "',1)"; db.ExecuteNonQuery(Sql); } catch { } }
public void AddToMenu(string id) { try { DbTask db = new DbTask(); string Sql = string.Empty; Sql = " UPDATE " + _TableName + " SET idx = idx +1"; db.ExecuteNonQuery(Sql); Sql = " INSERT INTO " + _TableName + "(groupid,id,idx) "; Sql += " VALUES (" + _GroupID + ",'" + id + "',1)"; db.ExecuteNonQuery(Sql); } catch { } }
public void Delete(string id) { DbTask db = new DbTask(); string Sql = "DELETE FROM " + TableName + " WHERE id = '" + id.Trim() + "'"; db.ExecuteNonQuery(Sql); }
public void Delete(string id, string TenBang) { DbTask db = new DbTask(); string SQL = "Delete from " + TenBang + " where id = '" + id + "'"; db.ExecuteNonQuery(SQL); }
public void Update(string id, string title, string linkurl, string summary, string filename, string sWidth, string sHeight) { string Sql = "UPDATE " + TableName + " SET "; Sql += " title = ?title, "; Sql += " linkurl = ?linkurl, "; Sql += " summary = ?summary, "; Sql += " created = ?created, "; Sql += " filename = ?filename, "; Sql += " fwidth = ?fwidth, "; Sql += " fHeight = ?fheight, "; Sql += " userid = ?userid "; Sql += " WHERE id=?id"; DbTask db = new DbTask(); DataTable dt = null; db.AddParameters(ref dt, "id", DbType.NVarChar, id); db.AddParameters(ref dt, "title", DbType.NVarChar, title); db.AddParameters(ref dt, "summary", DbType.NVarChar, summary); db.AddParameters(ref dt, "fwidth", DbType.NVarChar, sWidth); db.AddParameters(ref dt, "fheight", DbType.NVarChar, sHeight); db.AddParameters(ref dt, "linkurl", DbType.NVarChar, linkurl); db.AddParameters(ref dt, "created", DbType.Datetime, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); db.AddParameters(ref dt, "filename", DbType.NVarChar, filename); db.AddParameters(ref dt, "userid", DbType.NVarChar, Membertask.Name); db.ExecuteNonQuery(Sql, dt); }
public void Update(string id, DateTime startdate, DateTime enddate, int idx) { try { string Sql = "UPDATE " + _TableName + " SET "; Sql += " idx = ?idx, "; Sql += " startdate = ?startdate, "; Sql += " enddate = ?enddate "; Sql += "WHERE groupid = '" + _GroupID + "' "; Sql += "AND id = '" + id + "' "; Sql += "AND col = '" + _Col + "' "; DbTask db = new DbTask(); DataTable dt = null; db.AddParameters(ref dt, "groupid", DbType.NVarChar, _GroupID); db.AddParameters(ref dt, "id", DbType.NVarChar, id); db.AddParameters(ref dt, "col", DbType.NVarChar, _Col); db.AddParameters(ref dt, "startdate", DbType.Datetime, startdate); db.AddParameters(ref dt, "enddate", DbType.Datetime, enddate); db.AddParameters(ref dt, "idx", DbType.Int32, idx); db.ExecuteNonQuery(Sql, dt); } catch (Exception ae) { string error = ae.ToString(); } }
public void SetStatus(string id) { DbTask db = new DbTask(); DataRow dr = GetInfoKeyWord(id); if (dr == null) { return; } int status; if (Convert.ToInt32(dr["status"].ToString()) == 0) { status = 1; } else { status = 0; } string Sql = "UPDATE " + TableName + " SET "; Sql += " status = " + status + " "; Sql += " WHERE id = '" + id.Trim() + "' "; db.ExecuteNonQuery(Sql); }
public void Update(string vid, string mailcontact, string backend, string frontend, string keywords, string Description, string diachi, string contact, string SEOH1, string tencongty, string slogan) { int id = Convert.ToInt32(vid); string Sql = "UPDATE " + TableName + " SET "; Sql += " mailcontact = ?mailcontact, "; Sql += " backend = ?backend, "; Sql += " frontend = ?frontend, "; Sql += " keywords = ?keywords, "; Sql += " Diachi = ?Diachi, "; Sql += " contact = ?contact, "; Sql += " SEOH1 = ?SEOH1, "; Sql += " tencongty = ?tencongty, "; Sql += " slogan = ?slogan, "; Sql += " Description = ?Description "; Sql += "WHERE ?id = id "; DbTask db = new DbTask(); DataTable dt = null; db.AddParameters(ref dt, "id", DbType.Int32, id); db.AddParameters(ref dt, "mailcontact", DbType.NVarChar, mailcontact); db.AddParameters(ref dt, "backend", DbType.NVarChar, backend); db.AddParameters(ref dt, "frontend", DbType.NVarChar, frontend); db.AddParameters(ref dt, "keywords", DbType.NVarChar, keywords); db.AddParameters(ref dt, "Diachi", DbType.Ntext, diachi); db.AddParameters(ref dt, "contact", DbType.Ntext, contact); db.AddParameters(ref dt, "SEOH1", DbType.Ntext, SEOH1); db.AddParameters(ref dt, "tencongty", DbType.Ntext, tencongty); db.AddParameters(ref dt, "slogan", DbType.Ntext, slogan); db.AddParameters(ref dt, "Description", DbType.NVarChar, Description); db.ExecuteNonQuery(Sql, dt); }
public string InsertHoiVien(string groupid, string title, string summary, string created, int status, string logo, string capbac, string content) { string Sql = string.Empty; Sql += " INSERT INTO " + TableHoiVien + "(groupid, title, summary, created, status, logo, capbac, Content)"; Sql += " VALUES(?groupid, ?title, ?summary, ?created, ?status, ?logo, ?capbac, ?Content )"; DbTask db = new DbTask(); DataTable dt = null; db.AddParameters(ref dt, "groupid", DbType.NVarChar, groupid); db.AddParameters(ref dt, "title", DbType.NVarChar, title); db.AddParameters(ref dt, "summary", DbType.NVarChar, summary); db.AddParameters(ref dt, "created", DbType.NVarChar, created); db.AddParameters(ref dt, "status", DbType.Int32, status); db.AddParameters(ref dt, "logo", DbType.NVarChar, logo); db.AddParameters(ref dt, "Content", DbType.Ntext, content); db.AddParameters(ref dt, "capbac", DbType.NVarChar, capbac); db.ExecuteNonQuery(Sql, dt); Sql = "select * from " + TableHoiVien + " order by created DESC"; DataTable dtGetID = db.GetData(Sql); if (dtGetID == null || dtGetID.Rows.Count == 0) { return(string.Empty); } string ID = dtGetID.Rows[0]["id"].ToString(); // return(ID); }
public void Setthucdon(string id) { DataRow dr = this.GetInfo(id); if (dr == null) { return; } int thucdon = 0; if (Convert.ToInt32(dr["thucdon"]) == 0) { thucdon = 1; } else { thucdon = 0; } string Sql = "UPDATE " + TableName + " SET "; Sql += " thucdon = ?thucdon "; Sql += " WHERE id = ?id "; DbTask db = new DbTask(); DataTable dt = null; db.AddParameters(ref dt, "id", DbType.NVarChar, id); db.AddParameters(ref dt, "thucdon", DbType.Int32, thucdon); db.ExecuteNonQuery(Sql, dt); }
public void Delete(string id) { DbTask db = new DbTask(); string sql = "Delete from " + TableName + " where id = " + id + ""; db.ExecuteNonQuery(sql); }
public void DeleteLog(string vLogId) { DbTask db = new DbTask(); string Sql = "DELETE FROM " + TableName + " WHERE LogId = '" + vLogId.Trim() + "' "; db.ExecuteNonQuery(Sql); }
public Member() { if (Globals.CheckExist) { try { string Sql = "CREATE TABLE " + TableName + " ("; Sql += "id nvarchar(10) NOT NULL default '', "; Sql += "username nvarchar(255) default NULL, "; Sql += "password nvarchar(100) default NULL, "; Sql += "fullname nvarchar(255) default NULL, "; Sql += "tel nvarchar(15) default NULL, "; Sql += "email nvarchar(255) default NULL, "; Sql += "address nvarchar(255) default NULL, "; Sql += "jobtitle nvarchar(255) default NULL, "; Sql += "status int(4) default 0, "; Sql += "PRIMARY KEY (id))"; Sql += "ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;"; DbTask db = new DbTask(); db.ExecuteNonQuery(Sql); } catch { } } }
public void Delete(string id) { DbTask db = new DbTask(); string Sql = "DELETE FROM " + TableName + " WHERE id = '" + id.Trim() + "'"; db.ExecuteNonQuery(Sql); this.DeleteHtmlFile(id); ////xóa tin trong publish trang chủ TableName_NewsTrangChu //Sql = ""; //Sql = "DELETE FROM " + TableName_NewsTrangChu + " WHERE id = '" + id.Trim() + "'"; //db.ExecuteNonQuery(Sql); ////xóa tin trong publish tổ chức tin tức- sự kiện //Sql = ""; //Sql = "DELETE FROM " + TableName_TinTucSuKien + " WHERE id = '" + id.Trim() + "'"; //db.ExecuteNonQuery(Sql); ////xóa publish //Sql = ""; //Sql = "DELETE FROM " + TablePublish + " WHERE id = '" + id.Trim() + "'"; //db.ExecuteNonQuery(Sql); ////xóa trong publish tổ chức news bảng tbl_publish_noibat //Sql = ""; //Sql = "DELETE FROM " + TableNoiBat + " WHERE id = '" + id.Trim() + "'"; //db.ExecuteNonQuery(Sql); }
//het cua tin moi nhat -------------------------------end--------------------------- /// <summary> /// xóa publish /// </summary> /// <param name="groupid"></param> public void DeletePublish(string groupid) { DbTask db = new DbTask(); string Sql = "delete from " + _TableName + " WHERE groupid='" + groupid + "'"; db.ExecuteNonQuery(Sql); }
public void SetStatus_notok(string id) { DataRow dr = this.GetInfo(id); if (dr == null) { return; } int status = 0; if (Convert.ToInt32(dr["status"]) == 4) { status = 3;//Bientap } string Sql = "UPDATE " + TableName + " SET "; Sql += " status = ?status "; Sql += " WHERE id = ?id "; DbTask db = new DbTask(); DataTable dt = null; db.AddParameters(ref dt, "id", DbType.NVarChar, id); db.AddParameters(ref dt, "status", DbType.Int32, status); db.ExecuteNonQuery(Sql, dt); }
public void UpdateSanpham(string id, string groupid, string title, string summary, string content, string created, string fimage, string fimagekhac, string shortlink, string titlemeta, string keyword, string description) { string Sql = "UPDATE " + TableName + " SET "; Sql += " title = ?title, "; Sql += " groupid = ?groupid, "; Sql += " summary = ?summary, "; Sql += " created = ?created,"; Sql += " fimage = ?fimage, "; Sql += " fimagekhac = ?fimagekhac, "; Sql += " shortlink = ?shortlink, "; Sql += " titlemeta = ?titlemeta, "; Sql += " keywords = ?keywords, "; Sql += " Description = ?Description "; Sql += " WHERE id=?id"; DbTask db = new DbTask(); DataTable dt = null; db.AddParameters(ref dt, "id", DbType.NVarChar, id); db.AddParameters(ref dt, "groupid", DbType.NVarChar, groupid); db.AddParameters(ref dt, "title", DbType.NVarChar, title); db.AddParameters(ref dt, "summary", DbType.NVarChar, summary); db.AddParameters(ref dt, "created", DbType.Datetime, created); db.AddParameters(ref dt, "fimage", DbType.NVarChar, fimage); db.AddParameters(ref dt, "fimagekhac", DbType.NVarChar, fimagekhac); db.AddParameters(ref dt, "shortlink", DbType.NVarChar, shortlink); db.AddParameters(ref dt, "titlemeta", DbType.NVarChar, titlemeta); db.AddParameters(ref dt, "keywords", DbType.NVarChar, keyword); db.AddParameters(ref dt, "Description", DbType.NVarChar, description); db.ExecuteNonQuery(Sql, dt); this.WriteContentToHtml(id, content); }
public void Update(string id, string title, string groupid, string summary, string content, string fimage, string sTitleMeta, string KeywordMeta, string DescriptionMeta, string sShortLink) { string Sql = "UPDATE " + TableName + " SET "; Sql += " title = ?title, "; Sql += " groupid = ?groupid, "; Sql += " summary = ?summary, "; Sql += " fimage = ?fimage, "; Sql += " titlemeta = ?titlemeta, "; Sql += " Description = ?Description, "; Sql += " keywords = ?keywords, "; Sql += " shortlink = ?shortlink "; // sử dung linkurl thay cho trường sokyhieu để đỡ đổi db Sql += " WHERE id=?id"; DbTask db = new DbTask(); DataTable dt = null; db.AddParameters(ref dt, "id", DbType.NVarChar, id); db.AddParameters(ref dt, "title", DbType.NVarChar, title); db.AddParameters(ref dt, "summary", DbType.NVarChar, summary); db.AddParameters(ref dt, "groupid", DbType.NVarChar, groupid); db.AddParameters(ref dt, "fimage", DbType.NVarChar, fimage); db.AddParameters(ref dt, "titlemeta", DbType.NVarChar, sTitleMeta); db.AddParameters(ref dt, "Description", DbType.NVarChar, DescriptionMeta); db.AddParameters(ref dt, "shortlink", DbType.NVarChar, sShortLink); db.AddParameters(ref dt, "keywords", DbType.NVarChar, KeywordMeta); db.ExecuteNonQuery(Sql, dt); this.WriteContentToHtml(id, content); }
public void CreateTable() { string Sql = string.Empty; Sql += "CREATE TABLE IF NOT EXISTS " + tbl_name + "( "; Sql += "id tinyint(4) NOT NULL, "; Sql += "title nvarchar(500) default NULL, "; Sql += "dbname nvarchar(255) NOT NULL default '', "; Sql += "servername nvarchar(255) NOT NULL default '', "; Sql += "userid nvarchar(255) NOT NULL default '', "; Sql += "password nvarchar(255) default '', "; Sql += "PRIMARY KEY (id)) "; Sql += "ENGINE=MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin;"; dbtask.ExecuteNonQuery(Sql); return; }
public void SetAnh(string id) { DataRow dr = this.GetInfo(id); if (dr == null) { return; } int status = 0; if (Convert.ToInt32(dr["anh"]) == 0) { status = 1; } else { status = 0; } string Sql = "UPDATE " + TableName + " SET "; Sql += " anh = ?anh "; Sql += " WHERE id = ?id "; DbTask db = new DbTask(); DataTable dt = null; db.AddParameters(ref dt, "id", DbType.NVarChar, id); db.AddParameters(ref dt, "anh", DbType.Int32, status); db.ExecuteNonQuery(Sql, dt); }
public void Insert(string parentid, string title, string link, string summary, string fimages, string fwidth, string fheight, string keywords, string Description, int Kind, string shortlink, string titlemeta, int sluongtin) { string parent = (parentid == null || parentid == string.Empty || parentid == "") ? "00" : parentid; string Sql = "INSERT INTO " + TableName + "(id, parentid, title, link, summary, status, idx, fimages, fwidth, fheight,keywords,Description,kind ,shortlink, titlemeta,sluongtin)"; Sql += " VALUES(?id, ?parentid, ?title, ?link, ?summary, ?status, ?idx, ?fimages, ?fwidth, ?fheight,?keywords,?Description,?kind, ?shortlink, ?titlemeta, ?sluongtin)"; DbTask db = new DbTask(); string id = db.GetNewKey(TableName, "id", parentid); DataTable dt = null; db.AddParameters(ref dt, "id", DbType.NVarChar, id); db.AddParameters(ref dt, "parentid", DbType.NVarChar, parent); db.AddParameters(ref dt, "title", DbType.NVarChar, title); db.AddParameters(ref dt, "link", DbType.NVarChar, link); db.AddParameters(ref dt, "summary", DbType.NVarChar, summary); db.AddParameters(ref dt, "status", DbType.Int32, 0); db.AddParameters(ref dt, "idx", DbType.Int32, Convert.ToInt32(id.Substring(id.Length - _nLength, _nLength))); db.AddParameters(ref dt, "fimages", DbType.NVarChar, fimages); db.AddParameters(ref dt, "fwidth", DbType.NVarChar, fwidth); db.AddParameters(ref dt, "fheight", DbType.NVarChar, fheight); db.AddParameters(ref dt, "shortlink", DbType.NVarChar, shortlink); db.AddParameters(ref dt, "titlemeta", DbType.NVarChar, titlemeta); db.AddParameters(ref dt, "keywords", DbType.NVarChar, keywords); db.AddParameters(ref dt, "Description", DbType.NVarChar, Description); db.AddParameters(ref dt, "kind", DbType.Int32, Kind); db.AddParameters(ref dt, "sluongtin", DbType.Int32, sluongtin); db.ExecuteNonQuery(Sql, dt); }
/// <summary> /// Delete nick Yahoo theo id /// </summary> /// <param name="id"></param> public void DeleteYahooforID(string id) { DbTask db = new DbTask(); string sql = "Delete From " + TableName + " where id = '" + id + "'"; db.ExecuteNonQuery(sql); }
public void Delete(string id) { string Sql = "DELETE FROM " + TableName + " WHERE id = " + Convert.ToInt32(id) + " "; DbTask db = new DbTask(); db.ExecuteNonQuery(Sql); }
public clsHoivien() { // // TODO: Add constructor logic here // if (Globals.CheckExist) { try { //Create Table string Sql = "CREATE TABLE IF NOT EXISTS " + TableHoiVien + "("; Sql += "id nvarchar(255) NOT NULL default '', "; Sql += "title nvarchar(500) default NULL, "; Sql += "summary mediumtext, "; Sql += "status tinyint(4) default 0, "; Sql += "inquiry tinyint(4) default 0, "; Sql += "idx tinyint(4) default 0, "; Sql += "PRIMARY KEY (id)) "; Sql += "ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;"; DbTask db = new DbTask(); db.ExecuteNonQuery(Sql); } catch { } } if (!Membertask.IsAdministrator()) { _mIdAllow = Membertask.IsChuyenmuc(); } else { _mIdAllow = string.Empty; } }
public void SetStatusDefault(string id) { DbTask db = new DbTask(); DataRow dr = this.GetInfoStatusDefault(id); if (dr == null) { return; } int status; if (Convert.ToInt32(dr["status"].ToString()) == 0) { status = 1; } else { status = 0; } int vid = Convert.ToInt32(id); string Sql = "UPDATE " + TableNameDefault + " SET "; Sql += " status = " + status + " "; Sql += " WHERE id = " + vid + " "; db.ExecuteNonQuery(Sql); }
public void RemoveFromPublish_NoiBat(string id) { try { DbTask db = new DbTask(); int idx = GetIndex(id); string Sql = "DELETE FROM " + TableName_MoiNhat + " "; Sql += "WHERE id = '" + id + "' "; db.ExecuteNonQuery(Sql); Sql = "UPDATE " + TableName_MoiNhat + " SET idx = idx -1 "; Sql += "WHERE id = '" + id + "' "; Sql += "AND idx > '" + idx + "'"; db.ExecuteNonQuery(Sql); } catch { } }
public void SetSTT(string id, int idx) { DbTask db = new DbTask(); string Sql = "Update " + TableName + " SET "; Sql += " idx='" + idx + "' WHERE "; Sql += " id='" + id + "'"; db.ExecuteNonQuery(Sql); }