public string GetRoles(int cateID)
 {
     CateNewsPermissionDAO cateNewsPermissionDAO = new CateNewsPermissionDAO();
     return cateNewsPermissionDAO.GetRoles(cateID);
 }
 public bool CheckExitPermission(int rolesID, int cateNewsID)
 {
     CateNewsPermissionDAO cateNewsPermissionDAO = new CateNewsPermissionDAO();
     return cateNewsPermissionDAO.CheckExitPermission(rolesID, cateNewsID);
 }
 public DataTable GetCateNewsPermissionByRoles(int rolesID)
 {
     CateNewsPermissionDAO cateNewsPermissionDAO = new CateNewsPermissionDAO();
     return cateNewsPermissionDAO.GetCateNewsPermissionByRoles(rolesID);
 }
 public string GetPermission(int rolesID, int cateNewsID)
 {
     CateNewsPermissionDAO cateNewsPermissionDAO = new CateNewsPermissionDAO();
     return cateNewsPermissionDAO.GetPermission(rolesID, cateNewsID);
 }
 public DataTable GetCateNewsPermissionByCateID(int cateID)
 {
     CateNewsPermissionDAO cateNewsPermissionDAO = new CateNewsPermissionDAO();
     return cateNewsPermissionDAO.GetCateNewsPermissionByCateID(cateID);
 }
 public CateNewsPermission GetCateNewsPermissionById(int Id)
 {
     CateNewsPermissionDAO cateNewsPermissionDAO = new CateNewsPermissionDAO();
     return cateNewsPermissionDAO.GetCateNewsPermissionById(Id);
 }
 public DataTable GetCateNewsPermissionAll()
 {
     CateNewsPermissionDAO cateNewsPermissionDAO = new CateNewsPermissionDAO();
     return cateNewsPermissionDAO.GetCateNewsPermissionAll();
 }
 public CateNewsPermission GetCateNewsPermission(int rolesId, int cateNewsID)
 {
     CateNewsPermissionDAO cateNewsPermissionDAO = new CateNewsPermissionDAO();
     return cateNewsPermissionDAO.GetCateNewsPermission(rolesId, cateNewsID);
 }
 public string GetCateNewsID(string strRoles)
 {
     CateNewsPermissionDAO cateNewsPermissionDAO = new CateNewsPermissionDAO();
     return cateNewsPermissionDAO.GetCateNewsID(strRoles);
 }
Example #10
0
 private void GetParentGroupRolesUrl(DataTable table, int cID, string language, int level, string sSpace, int group, string username)
 {
     SqlConnection connection;
     SqlCommand command;
     SqlDataAdapter adapter;
     string sStr = "";
     if (level > 0)
     {
         sSpace = HttpUtility.HtmlDecode(sSpace);
         for (int m = 0; m < level; m++)
         {
             sStr = sStr + sSpace;
         }
     }
     DataTable subtable = new DataTable();
     if (username.Equals("administrator"))
     {
         using (connection = base.GetConnection())
         {
             command = new SqlCommand {
                 CommandText = "_CateGetGroupUrl",
                 Connection = connection,
                 CommandType = CommandType.StoredProcedure
             };
             command.Parameters.AddWithValue("@CateNewsID", cID);
             command.Parameters.AddWithValue("@Language", language);
             command.Parameters.AddWithValue("@GroupCate", group);
             connection.Open();
             using (adapter = new SqlDataAdapter(command))
             {
                 adapter.Fill(subtable);
                 command.Dispose();
             }
         }
     }
     else
     {
         string strRoles = new AdminRolesDAO().GetRoles(username);
         string strCateID = new CateNewsPermissionDAO().GetCateNewsID(strRoles);
         using (connection = base.GetConnection())
         {
             string SQL = "SELECT * FROM tblCateNews WHERE [ParentNewsID] = @CateNewsID AND [Language] = @Language  AND [GroupCate]=@GroupCate AND [CateNewsID] in('" + strCateID + "') ORDER BY CateNewsOrder ASC";
             command = new SqlCommand(SQL, connection) {
                 CommandText = SQL
             };
             command.Parameters.AddWithValue("@CateNewsID", cID);
             command.Parameters.AddWithValue("@Language", language);
             command.Parameters.AddWithValue("@GroupCate", group);
             connection.Open();
             using (adapter = new SqlDataAdapter(command))
             {
                 adapter.Fill(subtable);
                 command.Dispose();
             }
         }
     }
     if (subtable.Rows.Count > 0)
     {
         foreach (DataRow subrow in subtable.Rows)
         {
             DataRow rs = table.NewRow();
             rs["CateNewsID"] = subrow["CateNewsID"].ToString();
             rs["ParentNewsID"] = subrow["ParentNewsID"].ToString();
             rs["CateNewsName"] = sStr + subrow["CateNewsName"].ToString();
             rs["CateNewsTotal"] = subrow["CateNewsTotal"].ToString();
             rs["CateNewsOrder"] = subrow["CateNewsOrder"].ToString();
             rs["Language"] = subrow["Language"].ToString();
             rs["GroupCate"] = subrow["GroupCate"].ToString();
             rs["Icon"] = subrow["Icon"].ToString();
             rs["Slogan"] = subrow["Slogan"].ToString();
             rs["Roles"] = subrow["Roles"].ToString();
             rs["UserName"] = subrow["UserName"].ToString();
             rs["Created"] = subrow["Created"].ToString();
             rs["IsUrl"] = subrow["IsUrl"].ToString();
             rs["Url"] = subrow["Url"].ToString();
             table.Rows.Add(rs);
             this.GetParentGroupRoles(table, Convert.ToInt32(rs["CateNewsID"]), language, level + 1, sSpace, group, username);
         }
     }
 }
Example #11
0
 public DataTable GetCateNewsName(string lang, string username)
 {
     SqlConnection connection;
     SqlCommand command;
     SqlDataAdapter adapter;
     DataTable datatable = new DataTable();
     datatable.Columns.Add("CateNewsID");
     datatable.Columns.Add("ParentNewsID");
     datatable.Columns.Add("CateNewsName");
     datatable.Columns.Add("CateNewsTotal");
     datatable.Columns.Add("CateNewsOrder");
     datatable.Columns.Add("Language");
     datatable.Columns.Add("GroupCate");
     datatable.Columns.Add("Icon");
     datatable.Columns.Add("Slogan");
     datatable.Columns.Add("Roles");
     datatable.Columns.Add("UserName");
     datatable.Columns.Add("Created");
     datatable.Columns.Add("GroupCateName");
     DataTable table = new DataTable();
     if (username.Equals("administrator"))
     {
         using (connection = base.GetConnection())
         {
             command = new SqlCommand("_CateNewsGetNameDB", connection) {
                 CommandType = CommandType.StoredProcedure
             };
             command.Parameters.AddWithValue("@CateNewsID", 0);
             command.Parameters.AddWithValue("@Language", lang);
             connection.Open();
             using (adapter = new SqlDataAdapter(command))
             {
                 adapter.Fill(table);
                 command.Dispose();
             }
         }
     }
     else
     {
         string strRoles = new AdminRolesDAO().GetRoles(username);
         string strCateID = new CateNewsPermissionDAO().GetCateNewsID(strRoles);
         using (connection = base.GetConnection())
         {
             string SQL = "SELECT tblCateNews.*,tblCateNewsGroup.CateNewsGroupName AS GroupCateName FROM tblCateNews INNER JOIN tblCateNewsGroup ON tblCateNews.GroupCate = tblCateNewsGroup.GroupCate WHERE [ParentNewsID] = @CateNewsID AND [Language] = @Language  AND [CateNewsID] in('" + strCateID + "') AND tblCateNews.IsUrl=0 ORDER BY CateNewsOrder ASC";
             command = new SqlCommand(SQL, connection) {
                 CommandText = SQL
             };
             command.Parameters.AddWithValue("@CateNewsID", 0);
             command.Parameters.AddWithValue("@Language", lang);
             connection.Open();
             using (adapter = new SqlDataAdapter(command))
             {
                 adapter.Fill(table);
                 command.Dispose();
             }
         }
     }
     if (table.Rows.Count > 0)
     {
         foreach (DataRow row in table.Rows)
         {
             DataRow datarow = datatable.NewRow();
             datarow["CateNewsID"] = row["CateNewsID"].ToString();
             datarow["ParentNewsID"] = row["ParentNewsID"].ToString();
             datarow["CateNewsName"] = row["CateNewsName"].ToString();
             datarow["CateNewsTotal"] = row["CateNewsTotal"].ToString();
             datarow["CateNewsOrder"] = row["CateNewsOrder"].ToString();
             datarow["Language"] = row["Language"].ToString();
             datarow["GroupCate"] = row["GroupCate"].ToString();
             datarow["Icon"] = row["Icon"].ToString();
             datarow["Slogan"] = row["Slogan"].ToString();
             datarow["Roles"] = row["Roles"].ToString();
             datarow["UserName"] = row["UserName"].ToString();
             datarow["Created"] = row["Created"].ToString();
             datarow["GroupCateName"] = row["GroupCateName"].ToString();
             datatable.Rows.Add(datarow);
             this.GetParentNewsName(datatable, Convert.ToInt32(datarow["CateNewsID"]), lang, 1, "&nbsp;&nbsp;&nbsp;&nbsp;", username);
         }
     }
     return datatable;
 }