public static int getCommentCount(int id) { DataTable dataTable = UpdateData.UpdateBySql("SELECT Comment_ID FROM tbl_Comment WHERE Comment_Status=1 AND Content_ID=" + id).Tables[0]; DataRowCollection rows = dataTable.Rows; return(rows.Count); }
public static string LoadTitleAdm(string f, string strPosition) { HttpContext current = HttpContext.Current; DataSet dataSet = UpdateData.UpdateBySql(string.Concat(new object[] { "SELECT Title_Name FROM tbl_Title where Title_Mod='", f, "' and Title_Pos='", strPosition, "' and lang=", current.Session["lang"] })); DataRowCollection rows = dataSet.Tables[0].Rows; string result; if (rows.Count > 0) { result = rows[0]["Title_Name"].ToString(); } else { result = ""; } return(result); }
public static string GetName(string tb, string id) { DataSet dataSet = UpdateData.UpdateBySql(string.Concat(new string[] { "SELECT ", tb, "_Name FROM tbl_", tb, " WHERE ", tb, "_ID=", id })); DataRowCollection rows = dataSet.Tables[0].Rows; string result; if (rows.Count > 0) { result = rows[0][tb + "_Name"].ToString(); } else { result = ""; } return(result); }
public static int GetID_From_Url(int p, string link) { int result; if (link.Length > 2) { HttpContext current = HttpContext.Current; DataSet dataSet = UpdateData.UpdateBySql(string.Concat(new object[] { "SELECT Content_ID FROM tbl_Content WHERE Lower(Content_Url)='", link.ToLower(), "' AND Mod_ID=", p })); DataRowCollection rows = dataSet.Tables[0].Rows; if (rows.Count > 0) { result = Convert.ToInt32(rows[0][0]); } else { result = 0; } } else { result = 0; } return(result); }
public static string GetMnFooter() { HttpContext current = HttpContext.Current; string text = "SELECT * FROM tbl_Mod WHERE lang=" + current.Session["vlang"] + " AND Mod_Status=1"; text += " AND Mod_ID in (SELECT Mod_ID FROM tbl_ModBox WHERE"; object obj = text; text = string.Concat(new object[] { obj, " Box_ID in(SELECT Box_ID FROM tbl_Box WHERE Box_Code='Menufooter' AND lang=", current.Session["vlang"], "))" }); text += " ORDER BY Mod_Pos"; DataSet dataSet = UpdateData.UpdateBySql(text); DataRowCollection rows = dataSet.Tables[0].Rows; StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < rows.Count; i++) { int num = Convert.ToInt32(rows[i]["Mod_ID"]); string text2 = rows[i]["Mod_Name"].ToString(); string text3 = rows[i]["Mod_Code"].ToString(); string text4 = CMSfunc.VietnameseConvert.ChuyenTVKhongDau(CMSfunc._Replate(text2)); string text5; if (text3 == "Home") { text5 = VirtualPathUtility.ToAbsolute("~/Default.aspx"); } else { text5 = VirtualPathUtility.ToAbsolute(string.Concat(new string[] { "~/", text3, "/", text4, ".aspx" })) + "?p=" + num; } stringBuilder.Append(string.Concat(new string[] { "<a title=\"", text2, "\" href='", text5, "'>", text2, "</a>" })); if (i < rows.Count - 1) { stringBuilder.Append(" <a href='#'>|</a> "); } } return(stringBuilder.ToString()); }
public static void LoadDropdown(string title, string sql, DropDownList ddl) { DataSet dataSet = UpdateData.UpdateBySql(sql); DataRowCollection rows = dataSet.Tables[0].Rows; ddl.Items.Add(new ListItem(title, "0")); for (int i = 0; i < rows.Count; i++) { ddl.Items.Add(new ListItem(rows[i][0].ToString(), rows[i][1].ToString())); } }
public static string LoadSkin(string code, int p) { HttpContext current = HttpContext.Current; StringBuilder stringBuilder = new StringBuilder(); DataSet dataSet = UpdateData.UpdateBySql("SELECT Skintype_ID,Skintype_Viewtype,Skintype_Vspace,Skintype_Hspace,Skintype_Height,Skintype_Width,Skintype_Limit,Skintype_Target FROM tbl_Skintype WHERE Skintype_Status=1 AND Skintype_Code='" + code + "'"); DataRowCollection rows = dataSet.Tables[0].Rows; if (rows.Count > 0) { string text = rows[0]["Skintype_ID"].ToString(); bool flag = Convert.ToBoolean(rows[0]["Skintype_Viewtype"]); string text2 = rows[0]["Skintype_Vspace"].ToString(); string text3 = rows[0]["Skintype_Hspace"].ToString(); int num = Convert.ToInt32(rows[0]["Skintype_Limit"]); string ta = rows[0]["Skintype_Target"].ToString().Trim(); string text4 = string.Concat(new object[] { "SELECT top ", num, " Mod_ID,Skin_ID,Skin_Name,Skin_Url,Skin_Height,Skin_Width,Skin_Link FROM tbl_Skin WHERE lang=", current.Session["vlang"], " AND Skin_Status=1 AND Skintype_ID=", text }); text4 += " ORDER BY Skin_Pos"; string vtype = flag ? "<br />" : ""; DataSet dataSet2 = UpdateData.UpdateBySql(text4); DataRowCollection rows2 = dataSet2.Tables[0].Rows; for (int i = 0; i < rows2.Count; i++) { int id = Convert.ToInt32(rows2[0]["Skin_ID"]); int num2 = Convert.ToInt32(rows2[0]["Mod_ID"]); string n = rows2[i]["Skin_Name"].ToString(); string img = ApplicationSetting.URLRoot + rows2[i]["Skin_Url"].ToString(); string h = rows2[i]["Skin_Height"].ToString(); string w = rows2[i]["Skin_Width"].ToString(); string url = rows2[i]["Skin_Link"].ToString(); if (num2 == -1) { stringBuilder.Append(CMSfunc._adv(ta, img, id, url, vtype, w, h, n)); } else if (num2 == p || ModControl.GetOldP(p) == num2) { stringBuilder.Append(CMSfunc._adv(ta, img, id, url, vtype, w, h, n)); } } } else { stringBuilder.Append(CMSfunc.LoadOther(code)); } return(stringBuilder.ToString()); }
public static bool CheckGroupContent(int p) { bool result = false; DataSet dataSet = UpdateData.UpdateBySql("SELECT Mod_ID FROM tbl_Content WHERE Mod_ID=" + p); DataRowCollection rows = dataSet.Tables[0].Rows; if (rows.Count >= 1) { result = true; } return(result); }
public static string GetListID(int p) { DataSet dataSet = UpdateData.UpdateBySql("SELECT Mod_ID FROM tbl_Mod WHERE Mod_Parent=" + p + " AND Mod_Status=1"); DataRowCollection rows = dataSet.Tables[0].Rows; string text = ""; for (int i = 0; i < rows.Count; i++) { text = text + rows[i]["Mod_ID"] + " "; } return(text.ToString()); }
public static void GetRole(int uid) { HttpContext current = HttpContext.Current; DataSet dataSet = UpdateData.UpdateBySql("SELECT RU.Role_ID,Role_Name FROM tbl_RoleUser as RU,tbl_Role as R WHERE RU.User_ID=" + uid + " AND RU.Role_ID=R.Role_ID"); DataRowCollection rows = dataSet.Tables[0].Rows; string text = ""; for (int i = 0; i < rows.Count; i++) { text = text + rows[i][1] + ","; } SessionUtil.SetKey("RoleID", text.ToString()); }
public static string ModImage(int p, string w, string h) { HttpContext current = HttpContext.Current; StringBuilder stringBuilder = new StringBuilder(); string sql; if (p != 0) { sql = "SELECT Mod_Img FROM tbl_Mod WHERE Mod_ID=" + p; } else { sql = "SELECT Mod_Img FROM tbl_Mod WHERE Mod_Code='Home'"; } DataSet dataSet = UpdateData.UpdateBySql(sql); DataRowCollection rows = dataSet.Tables[0].Rows; if (rows.Count > 0) { string text = rows[0]["Mod_Img"].ToString(); if (Path.GetExtension(text) == ".swf") { stringBuilder.Append(string.Concat(new string[] { "<div class=\"ModImg\"><script type=\"text/javascript\">swf('", ApplicationSetting.URLRoot, text, "','", w, "','", h, "');</script></div>" })); } else { stringBuilder.Append(string.Concat(new string[] { "<div class=\"ModImg\"><img src='", ApplicationSetting.URLRoot, text, "' width=", w, " height=", h, " border ='0'></div>" })); } } return(stringBuilder.ToString()); }
public static string GetMnLeft(string f, int cp) { HttpContext current = HttpContext.Current; StringBuilder stringBuilder = new StringBuilder(); string text = "SELECT * FROM tbl_Mod WHERE lang=" + current.Session["vlang"] + " AND Mod_Status=1"; text += " AND Mod_ID in (SELECT Mod_ID FROM tbl_ModBox WHERE "; object obj = text; text = string.Concat(new object[] { obj, "Box_ID in(SELECT Box_ID FROM tbl_Box WHERE Box_Code='Menuleft' AND lang=", current.Session["vlang"], ")) ORDER BY Mod_Pos" }); DataSet dataSet = UpdateData.UpdateBySql(text); DataRowCollection rows = dataSet.Tables[0].Rows; for (int i = 0; i < rows.Count; i++) { int num = Convert.ToInt32(rows[i]["Mod_ID"]); string text2 = rows[i]["Mod_Name"].ToString(); string text3 = rows[i]["Mod_Code"].ToString(); string text4 = CMSfunc.VietnameseConvert.ChuyenTVKhongDau(text2.Replace(" ", "-")); string text5 = VirtualPathUtility.ToAbsolute(string.Concat(new object[] { "~/", text3, "/", num, "/", num, "/", text4, ".aspx" })); stringBuilder.Append("<div class='Menuleft' onMouseOut=\"this.className='Menuleft';\" onmouseover=\"this.className='Menuleftov';\" " + text5 + ">"); stringBuilder.Append(string.Concat(new string[] { "<a title=\"", text2, "\" href='", text5, "'>", text2, "</a></div>" })); } return(stringBuilder.ToString()); }
public static bool CheckPermission(int ModID, int UserID) { string sql = "select * from tbl_ModsiteUser where User_ID=" + UserID + "and Mod_ID=" + ModID; DataTable ds = UpdateData.UpdateBySql(sql).Tables[0]; DataRowCollection rows = ds.Rows; if (rows.Count > 0) { return(true); } else { return(false); } }
public static string GetModType(int p) { DataSet dataSet = UpdateData.UpdateBySql("SELECT Modtype_Code FROM tbl_Modtype MT, tbl_Mod M WHERE MT.Modtype_ID=M.Modtype_ID AND Mod_ID=" + p); DataRowCollection rows = dataSet.Tables[0].Rows; string result; if (rows.Count > 0) { result = rows[0]["Modtype_Code"].ToString().Trim(); } else { result = ""; } return(result); }
public static int GetAdminID() { DataSet dataSet = UpdateData.UpdateBySql("SELECT User_ID FROM tbl_User WHERE username='******'"); DataRowCollection rows = dataSet.Tables[0].Rows; int result; if (rows.Count > 0) { result = Convert.ToInt32(rows[0]["User_ID"]); } else { result = 0; } return(result); }
public static int GetOldP(int p) { DataSet dataSet = UpdateData.UpdateBySql("SELECT Mod_Parent FROM tbl_Mod WHERE Mod_ID=" + p); DataRowCollection rows = dataSet.Tables[0].Rows; int result; if (rows.Count > 0) { result = Convert.ToInt32(rows[0][0]); } else { result = 0; } return(result); }
public static int GetModtype(string code) { DataSet dataSet = UpdateData.UpdateBySql("SELECT Modtype_ID FROM tbl_Modtype WHERE Modtype_Code='" + code + "'"); DataRowCollection rows = dataSet.Tables[0].Rows; int result; if (rows.Count > 0) { result = Convert.ToInt32(rows[0][0]); } else { result = 0; } return(result); }
public static string GetModImg(string code) { DataSet dataSet = UpdateData.UpdateBySql("SELECT Mod_Img FROM tbl_Mod WHERE Mod_Code='" + code + "'"); DataRowCollection rows = dataSet.Tables[0].Rows; string result; if (rows.Count > 0) { result = rows[0][0].ToString(); } else { result = ""; } return(result); }
public static string GetModCode(int p) { DataSet dataSet = UpdateData.UpdateBySql("SELECT Mod_Code FROM tbl_Mod WHERE Mod_ID=" + p); DataRowCollection rows = dataSet.Tables[0].Rows; string result; if (rows.Count > 0) { result = rows[0][0].ToString(); } else { result = ""; } return(result); }
public static string _GetConst(string strCode) { DataSet dataSet = UpdateData.UpdateBySql("SELECT Config_Values FROM tbl_Config WHERE Config_Code='" + strCode + "'"); DataRowCollection rows = dataSet.Tables[0].Rows; string result; if (rows.Count > 0) { result = rows[0][0].ToString(); } else { result = ""; } return(result); }
public static int GetP_From_ID(int id) { HttpContext current = HttpContext.Current; DataSet dataSet = UpdateData.UpdateBySql("SELECT Mod_ID FROM tbl_Content WHERE Content_ID=" + id); DataRowCollection rows = dataSet.Tables[0].Rows; int result; if (rows.Count > 0) { result = Convert.ToInt32(rows[0][0]); } else { result = 0; } return(result); }
public static string _LoadControl(int p) { string text = "SELECT Modtype_Code FROM tbl_Modtype as MT, tbl_Mod as M"; text = text + " WHERE MT.Modtype_ID=M.Modtype_ID AND Mod_ID=" + p; DataSet dataSet = UpdateData.UpdateBySql(text); DataRowCollection rows = dataSet.Tables[0].Rows; string result; if (rows.Count > 0) { result = rows[0][0].ToString().Trim(); } else { result = ""; } return(result); }
public static string GetFieldByCode(string field, string Code) { DataSet dataSet = UpdateData.UpdateBySql(string.Concat(new object[] { "SELECT Content_", field, " FROM tbl_Content WHERE Content_Code='", Code + "'" })); DataRowCollection rows = dataSet.Tables[0].Rows; string result; if (rows.Count > 0) { result = rows[0][0].ToString(); } else { result = ""; } return(result); }
public static string GetLocField(string field, int p) { DataSet dataSet = UpdateData.UpdateBySql(string.Concat(new object[] { "SELECT Location_", field, " FROM tbl_Location WHERE Location_ID=", p })); DataRowCollection rows = dataSet.Tables[0].Rows; string result; if (rows.Count > 0) { result = rows[0][0].ToString(); } else { result = ""; } return(result); }
public static string GetName_From_Code(string code) { HttpContext current = HttpContext.Current; DataSet dataSet = UpdateData.UpdateBySql(string.Concat(new object[] { "SELECT Mod_Name FROM tbl_Mod WHERE Mod_Code='", code, "' AND lang=", current.Session["vlang"] })); DataRowCollection rows = dataSet.Tables[0].Rows; string result; if (rows.Count > 0) { result = rows[0][0].ToString(); } else { result = ""; } return(result); }
public static int Get_ID_From_Code(string code) { HttpContext current = HttpContext.Current; DataSet dataSet = UpdateData.UpdateBySql(string.Concat(new object[] { "SELECT Mod_ID FROM tbl_Mod WHERE Mod_Code='", code, "' AND lang=", current.Session["lang"] })); DataRowCollection rows = dataSet.Tables[0].Rows; int result; if (rows.Count > 0) { result = Convert.ToInt32(rows[0]["Mod_ID"]); } else { result = 0; } return(result); }
public static string LoadOtherAdm(string f) { HttpContext current = HttpContext.Current; DataSet dataSet = UpdateData.UpdateBySql(string.Concat(new object[] { "SELECT Other_Content FROM tbl_Other where Other_Mod='", f, "' and lang=", current.Session["lang"] })); DataRowCollection rows = dataSet.Tables[0].Rows; string result; if (rows.Count > 0) { result = rows[0]["Other_Content"].ToString(); } else { result = ""; } return(result); }
public static int GetLichID_From_Url(string link) { int result; if (link.Length > 2) { HttpContext current = HttpContext.Current; DataSet dataSet = UpdateData.UpdateBySql("SELECT Lichhoc_ID FROM tbl_Lichhoc WHERE Lower(Lichhoc_Code)='" + link.ToLower() + "'"); DataRowCollection rows = dataSet.Tables[0].Rows; if (rows.Count > 0) { result = Convert.ToInt32(rows[0][0]); } else { result = 0; } } else { result = 0; } return(result); }
public static string GetField(string field, string tb, string wh) { DataSet dataSet = UpdateData.UpdateBySql(string.Concat(new string[] { "SELECT ", field, " FROM ", tb, " WHERE ", wh })); DataRowCollection rows = dataSet.Tables[0].Rows; string result; if (rows.Count > 0) { result = rows[0][0].ToString(); } else { result = ""; } return(result); }
public static void RaovatCount(int id) { UpdateData.UpdateBySql("UPDATE tbl_Raovat SET Raovat_Count=Raovat_Count+1 WHERE Raovat_ID=" + id); }