示例#1
0
    void UpdateDataView()
    {
        HyperCatalog.Business.Role role = HyperCatalog.Business.Role.GetByKey(roleId);
        if (role != null)
        {
            HyperCatalog.Business.UserList users = role.Users;

            if (users != null)
            {
                dg.DataSource = users;
                Utils.InitGridSort(ref dg, true);
                dg.DataBind();

                if (dg.Rows.Count > 0)
                {
                    dg.Visible          = true;
                    lbNoresults.Visible = false;
                }
                else
                {
                    if (txtFilter.Text.Length > 0)
                    {
                        lbNoresults.Text = "No record match your search (" + txtFilter.Text + ")";
                    }
                    dg.Visible          = false;
                    lbNoresults.Visible = true;
                }
            }
        }
    }
示例#2
0
    //public static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
    //log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
    protected void Page_Load(object sender, EventArgs e)
    {
        // log4net.Config.XmlConfigurator.Configure();
        LogNet.log.Info("Login_debug: Page_Load : Start Time=" + DateTime.Now);
        string headerName    = "CL_Header";
        string headerValue   = "c_u";
        string decodedString = null;
        //  string headerValue = "=?UTF-8?B?cHJlZmVycmVkbGFuZ3VhZ2U9RU58aHBjbG5hbWU9cmF2aW5kZXItcmVkZHl8aHBjbGlkbnVtYmVyPTFiYjcxMDk2MzQyYzVjMTEyZDQwMmE2MDU0MGE5ZjA4fGhwcmVzaWRlbnRjb3VudHJ5Y29kZT1VU3xzbj1BbGxfUHVifGdpdmVubmFtZT1EY2N8ZW1haWw9QWxsUHViQGhwLmNvbXxjcmVhdGV0aW1lc3RhbXA9MjAwNy0wNy0yNSAwNzoyNTo1Nnxtb2RpZnl0aW1lc3RhbXA9MjAwNy0wNy0yNSAwNzoyNTo1NnxjbGFuZz1VUy1FTg==?=";
        //string headerValue = null;
        //string headerValue = "?UTF-8?B?cHJlZmVycmVkbGFuZ3VhZ2U9ZW58aHBjbG5hbWU9ZGNjX2FsbF9wdWJ8aHBjbGlkbnVtYmVyPTFiYjcxMDk2MzQyYzVjMTEyZDQwMmE2MDU0MGE5ZjA4fGhwcmVzaWRlbnRjb3VudHJ5Y29kZT1VU3xzbj1hbGxfcHVifGdpdmVubmFtZT1kY2N8ZW1haWw9QWxsUHViQGhwLmNvbXxjcmVhdGV0aW1lc3RhbXA9MjAwNy0wNy0yNSAwNzoyNTo1Nnxtb2RpZnl0aW1lc3RhbXA9MjAwOS0wMS0xOSAwNjozOTo0NnxjbGFuZz1VUy1lbg==?=";

        //Response.Write("<br>Header vars: ");
        NameValueCollection headerVariables = Request.Headers;

        String[] headerKeys = headerVariables.AllKeys;
        //Response.Write(((0 == headerKeys.Length) ? "(none)" : "" + headerKeys.Length) + "<br>");
        for (int i = 0; i < headerKeys.Length; ++i)
        {
            if (headerKeys[i].ToString() == headerName)
            {
                headerValue = headerVariables[headerKeys[i]];
                //Response.Write("Header Value is " + headerVariables[headerKeys[i]]);
            }
        }
        string actualdecodedString = "a";


        //Response.Cookies["CL_Cookie"].Value = "patrick";
        //Response.Cookies["CL_Cookie"].Expires = DateTime.Now.AddDays(1);


        if (headerValue == null)
        {
            if (Request.Cookies["CL_Cookie"] != null)
            {
                HttpCookie aCookie = Request.Cookies["CL_Cookie"];
                headerValue = aCookie.Value;
            }
        }
        if (headerValue != null)
        {
            actualdecodedString = headerValue;
        }
        int    index1           = actualdecodedString.LastIndexOf("?=");
        string newdecodedString = null;;
        int    pos;

        try
        {
            pos = headerValue.IndexOf("?UTF-8?B?");



            if (pos == 0 || pos == 1)
            {
                char c  = actualdecodedString[actualdecodedString.Length - 1];
                char c1 = actualdecodedString[actualdecodedString.Length - 2];


                if (c == '=' && c1 == '?')
                {
                    int l = actualdecodedString.IndexOf("?=");

                    newdecodedString = actualdecodedString.Substring(pos + 9, l - pos - 9);
                }
                else
                {
                    newdecodedString = actualdecodedString.Substring(pos + 9, actualdecodedString.Length - 9);
                }
            }
            else
            {
                newdecodedString = actualdecodedString;
            }


            try
            {
                decodedString = base64Decode(newdecodedString);
            }
            catch (Exception notBase64)
            {
                decodedString = newdecodedString;
            }

            //     Response.Write("<br>");
            //Response.Write("Decoded header is :" + decodedString);
            //    Response.Write("<br>");

            string   strData     = decodedString;
            char[]   separator   = new char[] { '|' };
            string[] strSplitArr = strData.Split(separator);
            //string userId = strSplitArr[0];
            //Response.Write(userId);

            Dictionary <string, string> dict = new Dictionary <string, string>();
            foreach (string arrStr in strSplitArr)
            {
                //Response.Write(arrStr + "\n");
                switch (arrStr.Split('=')[0])
                {
                case "hpclname":
                    dict.Add("Pseudo", arrStr.Split('=')[1]);
                    break;

                case "email":
                    dict.Add("Email", arrStr.Split('=')[1]);
                    break;

                case "modifytimestamp":
                    dict.Add("ModifyDate", arrStr.Split('=')[1]);
                    break;

                case "sn":
                    dict.Add("LastName", arrStr.Split('=')[1]);
                    break;

                case "givenname":
                    dict.Add("FirstName", arrStr.Split('=')[1]);
                    break;

                default:
                    //Response.Write("");
                    break;
                }
            }


            /*Response.Write("Pseudo : "+dict["Pseudo"]);
             * Response.Write("<br>");
             * Response.Write("Email : "+ dict["Email"]);
             * Response.Write("<br>");
             * Response.Write("ModifyDate : " + dict["ModifyDate"]);
             * Response.Write ("<br>");
             * Response.Write("LastName : " + dict["LastName"]);
             * Response.Write ("<br>");
             * Response.Write("FirstName : " + dict["FirstName"]);
             * Response.Write ("<br>");*/


            //Pseudo = "balaji_prism";
            //Email = "*****@*****.**";
            //FirstName = "Balaji";
            //LastName = "Viswanath";
            //ModifyDate = Convert.ToDateTime(DateTime.Now);

            //Pseudo = "harishprabhubg";
            //Email = "*****@*****.**";
            //FirstName = "Harish";
            //LastName = "Prabhu";
            //ModifyDate = Convert.ToDateTime(DateTime.Now);

            //Pseudo = "*****@*****.**";
            //Email = "*****@*****.**";
            //FirstName = "Venkata";
            //LastName = "Jayanth";

            //Company = "HPE";


            //Pseudo = "maheshl";
            //Email = "*****@*****.**";
            //FirstName = "Mahesh";
            //LastName = "L";
            //ModifyDate = Convert.ToDateTime(DateTime.Now);


            //  Response.Write("<br>");
            //        Response.Write("Psedo is :" + Pseudo);
            //Response.Write("<br>");
            //Pseudo = "ravinder-reddy";
            // Label1.Text = Pseudo;
            Pseudo     = dict["Pseudo"];
            Email      = dict["Email"];
            FirstName  = dict["FirstName"];
            LastName   = dict["LastName"];
            ModifyDate = Convert.ToDateTime(dict["ModifyDate"]);

            Company = GetOrganizationbyPsuedo(Pseudo);
            SessionState.CompanyName = Company;

            try
            {
                if (!SessionState.CheckVersion())
                {
                    lbError.Text    = "Sorry, but it is impossible to enter the application. This release of the application cannot be ran with that version of database.";
                    lbError.Visible = true;
                }

                appName = SessionState.CacheParams["AppName"].Value.ToString();
                Page.DataBind();

                if (!Page.IsPostBack)
                {
                    //Pseudo = "dcc_all_pub";
                    using (HyperCatalog.Business.UserList users = HyperCatalog.Business.User.GetByKeyList(Pseudo))
                    {
                        // Response.Write("Users count is :" + users.Count);


                        if (users.Count > 1)
                        {
                            Roleselect.Visible  = true;
                            validateBtn.Visible = true;
                            lblRole.Visible     = true;

                            for (int i = 0; i < users.Count; i++)
                            {
                                Roleselect.Items.Add(new ListItem(users[i].RoleName, users[i].Id.ToString()));
                                //Response.Write("user id is " + users[i].Id.ToString());
                            }
                        }
                        else
                        {
                            if (users.Count == 1)
                            {
                                UserId = users[0].Id;
                                validateuser();
                                //Response.Write("user id is " + users[0].Id.ToString());
                            }
                        }
                    }
                }
            }


            catch (Exception us)
            {
                //lbError.Text = "You cannot have access to the " + appName + ". Your account may not have been affected to a group. Please contact an PRISM support administrator.";

                lbError.Text    = us.Message;
                lbError.Visible = true;
                lblRole.Visible = false;

                // throw new Exception("Error in user retreival" + us.Message);
            }


            //validateuser();
        }

        catch (Exception ex)
        {
            string str = ex.ToString();
            // throw new Exception("Error in header" + ee.Message);
        }
        LogNet.log.Info("Login_debug: Page_Load : End Time=" + DateTime.Now);
    }