using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CodeCafe.Web;
public partial class Admin : System.Web.UI.MasterPage
{
/**********************************************************************************************************/
///
/// Handles the Load event of the Page control.
///
/// The source of the event.
/// The instance containing the event data.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
clsValidate valid = new clsValidate();
pnlContent.Visible = valid.isAdminUser();
pnlLogin.Visible = !pnlContent.Visible;
}
SetAdminMenu();
}
/**********************************************************************************************************/
///
/// Logins the specified user.
///
/// The sender.
/// The instance containing the event data.
protected void Login(object sender, EventArgs e)
{
clsValidate valid = new clsValidate();
if ((tbUsername.Text.ToLower().CompareTo("admin") == 0) && (tbPassword.Text.CompareTo("DannyTessJoe") == 0))
valid.AdminID = 1;
else
lbLogError.Visible = true;
pnlContent.Visible = valid.isAdminUser();
pnlLogin.Visible = !pnlContent.Visible;
if (pnlContent.Visible)
SetAdminMenu();
}
/**********************************************************************************************************/
///
/// Sets the admin menu.
///
private void SetAdminMenu()
{
clsValidate valid = new clsValidate();
AdminMenu.MenuItems.Clear();
AdminMenu.AddMenuItem("Blog", "Admin-Blog.aspx", "Admin-Blog-Vetting.aspx,Admin-Blog-Editing.aspx");
AdminMenu.AddMenuItem("News", "Admin-News.aspx");
AdminMenu.AddMenuItem("FAQs", "Admin-FAQs.aspx");
AdminMenu.AddMenuItem("Orders", "Admin-Orders.aspx", "Admin-Users.aspx");
AdminMenu.AddMenuItem("Back to Site", "Default.aspx");
AdminMenu.SelectedFile = Utils.GetWebFilename(Request.Url.AbsolutePath.ToString());
AdminMenu.RenderMenu();
}
/**********************************************************************************************************/
}