public bool ExistName(string catename) { bool ExistName; BaseDAO baseDAO = new BaseDAO(); using (SqlConnection connection = baseDAO.GetConnection()) { SqlCommand command = new SqlCommand("_AlbumsCateCheck", connection) { CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@AlbumsCateName", catename); connection.Open(); using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection)) { ExistName= reader.HasRows; } } return ExistName; }
public DataTable getCateClient(int iCate) { BaseDAO baseDAO = new BaseDAO(); DataTable table = new DataTable(); using (SqlConnection connection = baseDAO.GetConnection()) { SqlCommand command = new SqlCommand("_MenuLinksGetClient", connection) { CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@MenuLinksParent", iCate); connection.Open(); using (SqlDataAdapter adapter = new SqlDataAdapter(command)) { adapter.Fill(table); command.Dispose(); } } return table; }
public DataTable GetNewsActive(int num, string approval) { DataTable datatable = new DataTable(); DAO.BaseDAO bs = new BaseDAO(); using (SqlConnection connection = bs.GetConnection()) { string SQL = "select top " + Convert.ToString(num) + " * from tblNewsGroup Where status = 1 AND IsApproval = " + approval + " AND GroupCate = " + num + " order by NewsGroupID Desc"; SqlCommand command = new SqlCommand(SQL, connection) { CommandText = SQL }; connection.Open(); using (SqlDataAdapter adapter = new SqlDataAdapter(command)) { adapter.Fill(datatable); command.Dispose(); } } return datatable; }
public DataTable PageGetGroup(string group, string lang) { DataTable datatable = new DataTable(); BaseDAO baseDAO = new BaseDAO(); using (SqlConnection connection = baseDAO.GetConnection()) { SqlCommand command = new SqlCommand("_PageGetGroup", connection) { CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@Group", group); command.Parameters.AddWithValue("@Language", lang); connection.Open(); using (SqlDataAdapter adapter = new SqlDataAdapter(command)) { adapter.Fill(datatable); command.Dispose(); } } return datatable; }
public void MenuProduct(Menu menu, int iCate, string lang) { DataTable table = new DataTable(); BaseDAO baseDAO = new BaseDAO(); using (SqlConnection connection = baseDAO.GetConnection()) { SqlCommand command = new SqlCommand("_CateProductGetClient", connection) { CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@CateProductID", iCate); command.Parameters.AddWithValue("@Language", lang); connection.Open(); using (SqlDataAdapter adapter = new SqlDataAdapter(command)) { adapter.Fill(table); command.Dispose(); } } if (table.Rows.Count > 0) { foreach (DataRow row in table.Rows) { MenuItem menuitem = new MenuItem(row["CateProductName"].ToString()) { NavigateUrl = "~/Default.aspx?go=list&id=" + row["CateProductID"].ToString() }; this.GetSubCategory(menuitem, Convert.ToInt32(row["CateProductID"].ToString()), lang, ""); menu.Items.Add(menuitem); } } }
private void GetSubCategory(MenuItem _parentNote, int iCate_ID, string language, string sSpace) { string str = HttpUtility.HtmlDecode(" "); sSpace = sSpace + str; BaseDAO baseDAO = new BaseDAO(); DataTable datatable = new DataTable(); using (SqlConnection connection = baseDAO.GetConnection()) { SqlCommand command = new SqlCommand("_CateProductGetClient", connection) { CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@CateProductID", iCate_ID); command.Parameters.AddWithValue("@Language", language); connection.Open(); using (SqlDataAdapter adapter = new SqlDataAdapter(command)) { adapter.Fill(datatable); command.Dispose(); } } if (datatable.Rows.Count > 0) { foreach (DataRow row in datatable.Rows) { string Name = row["CateProductName"].ToString(); if (Name.Contains("-")) { Name = Name.Replace(" ", "").Replace("-", ""); Name = "<b>" + Name + "</b>"; } else { Name = sSpace + row["CateProductName"].ToString(); } MenuItem _childNote = new MenuItem(Name) { NavigateUrl = "~/Default.aspx?go=list&id=" + row["CateProductID"].ToString() }; _parentNote.ChildItems.Add(_childNote); this.GetSubCategory(_childNote, Convert.ToInt32(row["CateProductID"].ToString()), language, ""); } } }
public DataTable getCateProductLevel(int iCate, string lang) { DataTable table = new DataTable(); BaseDAO baseDAO = new BaseDAO(); using (SqlConnection connection = baseDAO.GetConnection()) { SqlCommand command = new SqlCommand("_CateProductGet", connection) { CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@CateProductID", iCate); command.Parameters.AddWithValue("@Language", lang); connection.Open(); using (SqlDataAdapter adapter = new SqlDataAdapter(command)) { adapter.Fill(table); command.Dispose(); } } return table; }
private void SubMenuNews(MenuItem _parentNote, int iCate_ID, string language) { try { BaseDAO baseDAO = new BaseDAO(); DataTable datatable = new DataTable(); using (SqlConnection connection = baseDAO.GetConnection()) { SqlCommand command = new SqlCommand("_CateNewsGetClient", connection) { CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@CateNewsID", iCate_ID); command.Parameters.AddWithValue("@Language", language); command.Parameters.AddWithValue("@GroupCate", 1); connection.Open(); using (SqlDataAdapter adapter = new SqlDataAdapter(command)) { adapter.Fill(datatable); command.Dispose(); } } if (datatable.Rows.Count > 0) { foreach (DataRow row in datatable.Rows) { MenuItem _childNote = new MenuItem(row["CateNewsName"].ToString()) { NavigateUrl = "~/Default.aspx?go=catenews&id=" + row["CateNewsID"].ToString() }; _parentNote.ChildItems.Add(_childNote); this.SubMenuNews(_childNote, Convert.ToInt32(row["CateNewsID"]), language); } } } catch (Exception ex) { throw new DataAccessException(ex.Message.ToString()); } }
public void MenuNews(Menu menu, int iParentID, string lang) { try { DataTable table = new DataTable(); BaseDAO baseDAO = new BaseDAO(); using (SqlConnection connection = baseDAO.GetConnection()) { SqlCommand command = new SqlCommand("_CateNewsGetClient", connection) { CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@CateNewsID", iParentID); command.Parameters.AddWithValue("@Language", lang); command.Parameters.AddWithValue("@GroupCate", 1); connection.Open(); using (SqlDataAdapter adapter = new SqlDataAdapter(command)) { adapter.Fill(table); command.Dispose(); } } if (table.Rows.Count > 0) { foreach (DataRow row in table.Rows) { MenuItem menuitem = new MenuItem(row["CateNewsName"].ToString()) { NavigateUrl = "~/Default.aspx?go=catenews&id=" + row["CateNewsID"].ToString() }; this.SubMenuNews(menuitem, Convert.ToInt32(row["CateNewsID"]), lang); menu.Items.Add(menuitem); } } } catch (Exception ex) { throw new DataAccessException(ex.Message.ToString()); } }
public DataTable getCateClientGroupUrl(int iCate, string lang, int group, int n) { BaseDAO baseDAO = new BaseDAO(); DataTable table = new DataTable(); using (SqlConnection connection = baseDAO.GetConnection()) { string SQL = "select top " + n + " * from tblCateNews where ParentNewsID = @CateNewsID and Language = @Language and GroupCate = @GroupCate order by CateNewsOrder ASC"; SqlCommand command = new SqlCommand(SQL, connection) { CommandText = SQL }; command.Parameters.AddWithValue("@CateNewsID", iCate); command.Parameters.AddWithValue("@Language", lang); command.Parameters.AddWithValue("@GroupCate", group); connection.Open(); using (SqlDataAdapter adapter = new SqlDataAdapter(command)) { adapter.Fill(table); command.Dispose(); } } return table; }
public DataTable getCateClientGroupUrl(int iCate, string lang, int group) { BaseDAO baseDAO = new BaseDAO(); DataTable table = new DataTable(); using (SqlConnection connection = baseDAO.GetConnection()) { SqlCommand command = new SqlCommand("_CateNewsGetClientUrl", connection) { CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@CateNewsID", iCate); command.Parameters.AddWithValue("@Language", lang); command.Parameters.AddWithValue("@GroupCate", group); connection.Open(); using (SqlDataAdapter adapter = new SqlDataAdapter(command)) { adapter.Fill(table); command.Dispose(); } } return table; }
public DataTable getAlbumsCateLevel(int iCate) { DataTable table = new DataTable(); BaseDAO baseDAO = new BaseDAO(); using (SqlConnection connection = baseDAO.GetConnection()) { SqlCommand command = new SqlCommand("_AlbumsCateGet", connection) { CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@AlbumsCateID", iCate); connection.Open(); using (SqlDataAdapter adapter = new SqlDataAdapter(command)) { adapter.Fill(table); command.Dispose(); } } return table; }
public DataTable PageGetGroupArticleHome(int group, string lang, int num, string approval) { DataTable datatable = new DataTable(); BaseDAO baseDAO = new BaseDAO(); using (SqlConnection connection = baseDAO.GetConnection()) { string SQL = string.Concat(new object[] { "select top ", Convert.ToString(num), " * from tblPage where icon=", group, " and Language='", lang, "' and Isview = 1 and isapproval =", approval, " order by PageID Desc" }); SqlCommand command = new SqlCommand(SQL, connection) { CommandText = SQL }; connection.Open(); using (SqlDataAdapter adapter = new SqlDataAdapter(command)) { adapter.Fill(datatable); command.Dispose(); } } return datatable; }