using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class MasterPages_NoMenu : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["uid"] == null)
            Response.Redirect("../Security/Login.aspx");


        string[] temp;
        string response = "", message = "";
        temp = Request.Url.ToString().Split('/');

        string path = temp[temp.Length - 2] + "/" + temp[temp.Length - 1];
        if (path.Contains("?"))
        {
            path = path.Substring(0, path.IndexOf('?'));

            if (path.Contains("SettlSearch.aspx"))
            {
                string cs = Request.QueryString["cs"] as string;
                path = path.Replace("SettlSearch.aspx", cs + "SettlSearch.aspx");

            }
        }
        string userID = Session["uid"].ToString();
        DataSet ds = new DataSet();
        ds = SecurityAgent.authenticateUserPage(userID, path, ref response, ref message);

        if (!response.Equals("0"))
        {
            Response.Redirect("../Business/default.aspx?err=1");
        }

        //applySecurity(ds);


        if (!IsPostBack)
        {
            //Label2.Text = DateTime.Now.Date.ToString("dd-MM-yyyy");
            //Label3.Text = DateTime.Now.TimeOfDay.ToString().Split('.')[0];
            //lblName.Text = Session["username"].ToString();
            //LabelVersion.Text = Helper.App_Version;


            //string appUserName = System.Security.Principal.WindowsIdentity.GetCurrent().Name.Substring(System.Security.Principal.WindowsIdentity.GetCurrent().Name.Length - 3);
            //if (appUserName.ToUpper ().Contains("SIT"))
            //    lblApplicationUserName.Text = "System Integration Testing";
            //else if (appUserName.ToUpper ().Contains("DEV"))
            //    lblApplicationUserName.Text = "Development";
            //else if (appUserName.ToUpper ().Contains("UAT"))
            //    lblApplicationUserName.Text = "User Acceptance Testing";
            //else
            //    lblApplicationUserName.Text = "Unknown";

        }
    }
}
