예제 #1
0
    /// <summary>Page's load event</summary>
    /// <param name="sender">Loaded page</param>
    /// <param name="e">Event's arguments</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.Session["User"] == null || this.Session["UniqueSessionId"] == null)
        {
            this.Response.Redirect("Default.aspx", Constant.EndResponse);
        }
        else
        {
            int test = 0;
            this.user = this.Session["User"] as ApplicationUser;
            var token = new Guid(this.Session["UniqueSessionId"].ToString());
            if (!UniqueSession.Exists(token, this.user.Id))
            {
                this.Response.Redirect("MultipleSession.aspx", Constant.EndResponse);
            }
            else if (this.Request.QueryString["id"] == null)
            {
                this.Response.Redirect("NoAccesible.aspx", Constant.EndResponse);
            }
            else if (!int.TryParse(this.Request.QueryString["id"], out test))
            {
                this.Response.Redirect("NoAccesible.aspx", Constant.EndResponse);
            }
            else
            {
                this.Go();
            }

            Context.ApplicationInstance.CompleteRequest();
        }
    }
예제 #2
0
        public ActionResult GetLogin(string email, string password, string ip)
        {
            var res = ApplicationLogOn.GetApplicationAccess(email, password, ip);

            if (res.Success)
            {
                var logon  = res.ReturnValue as LogOnObject;
                int userId = logon.Id;
                HttpContext.Current.Session["UniqueSessionId"] = UniqueSession.SetSession(userId, ip);
            }

            return(res);
        }
예제 #3
0
 /// <summary>Page's load event</summary>
 /// <param name="sender">Loaded page</param>
 /// <param name="e">Event's arguments</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.Session["User"] == null || this.Session["UniqueSessionId"] == null)
     {
         this.Response.Redirect("Default.aspx", Constant.EndResponse);
         Context.ApplicationInstance.CompleteRequest();
     }
     else
     {
         this.ApplicationUser = this.Session["User"] as ApplicationUser;
         var token = new Guid(this.Session["UniqueSessionId"].ToString());
         if (!UniqueSession.Exists(token, this.ApplicationUser.Id))
         {
             this.Response.Redirect("MultipleSession.aspx", Constant.EndResponse);
             Context.ApplicationInstance.CompleteRequest();
         }
         else
         {
             this.Go();
         }
     }
 }
예제 #4
0
    /// <summary>Page's load event</summary>
    /// <param name="sender">Loaded page</param>
    /// <param name="e">Event's arguments</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        this.active       = true;
        this.Incident     = Incident.Empty;
        this.BusinessRisk = BusinessRisk.Empty;
        this.Objetivo     = Objetivo.Empty;
        this.Oportunity   = Oportunity.Empty;
        this.Auditory     = Auditory.Empty;

        if (this.Session["User"] == null || this.Session["UniqueSessionId"] == null)
        {
            this.Response.Redirect("Default.aspx", Constant.EndResponse);
        }
        else
        {
            int test = 0;
            this.ApplicationUser = this.Session["User"] as ApplicationUser;
            var token = new Guid(this.Session["UniqueSessionId"].ToString());
            if (!UniqueSession.Exists(token, this.ApplicationUser.Id))
            {
                this.Response.Redirect("MultipleSession.aspx", Constant.EndResponse);
            }
            else if (this.Request.QueryString["id"] == null)
            {
                this.Response.Redirect("NoAccesible.aspx", Constant.EndResponse);
            }
            else if (!int.TryParse(this.Request.QueryString["id"], out test))
            {
                this.Response.Redirect("NoAccesible.aspx", Constant.EndResponse);
            }
            else
            {
                this.Go();
            }
        }

        Context.ApplicationInstance.CompleteRequest();
    }
예제 #5
0
    /// <summary>Page's load event</summary>
    /// <param name="sender">Loaded page</param>
    /// <param name="e">Event's arguments</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Session["UserId"]    = this.Request.Form["UserId"];
        this.Session["CompanyId"] = this.Request.Form["CompanyId"];
        var company = new Company(Convert.ToInt32(this.Request.Form["CompanyId"]));

        this.Session["Company"] = company;

        // Filtros predeterminado
        this.Session["TasksFilter"]        = @"{""Owners"":true,""Others"":true,""Passed"": false}";
        this.Session["BusinessRiskFilter"] = @"{""companyId"": 0,""from"": null,""to"": null,""rulesId"": 0,""processId"": 0,""itemType"": 0,""type"": 0}";
        this.Session["AuditoryFilter"]     = @"{""companyId"": 0, ""externa"": true, ""from"": null, ""interna"": true, ""provider"": true, ""status0"": true, ""status1"": true, ""status2"": true, ""status3"": true, ""status4"": true, ""status5"": false, ""to"": null }";
        this.Session["QuestionaryFilter"]  = @"{""apartadoNorma"": ""-1"", ""companyId"": 0,""processId"": -1,""ruleId"": -1}";
        this.Session["ProcessFilter"]      = @"AI";
        this.Session["EquipmentFilter"]    = @"CVM|1";
        this.Session["LearningFilter"]     = @"0123||";
        var user = new ApplicationUser(Convert.ToInt32(this.Request.Form["UserId"]));

        if (user.CompanyId == 0)
        {
            user.CompanyId = Convert.ToInt32(this.Request.Form["CompanyId"]);
        }


        int loginId = 0;

        if (this.Request.Form["LoginId"] != null)
        {
            loginId = Convert.ToInt32(this.Request.Form["LoginId"]);
            this.Session["UniqueSessionId"] = UniqueSession.ReplaceUser(loginId, user.Id);
        }
        else
        {
            this.Session["UniqueSessionId"] = UniqueSession.SetSession(user.Id, string.Empty);
        }

        this.Session["User"]       = user;
        this.Session["Navigation"] = new List <string>();

        var dictionary = ApplicationDictionary.Load("ca");

        if (user.Language != "ca")
        {
            dictionary = ApplicationDictionary.LoadNewLanguage(user.Language);
        }

        this.Session["AlertsDefinition"] = AlertDefinition.GetFromDisk;
        this.Session["Menu"]             = MenuOption.GetMenu(user.Id, user.Admin);

        if (user.Grants.Count == 0)
        {
            this.Session["home"] = "NoGrants.aspx";
            this.Response.Redirect("NoGrants.aspx", Constant.EndResponse);
        }
        else
        {
            string landPage = user.Grants[0].Item.Page;
            if (!company.Agreement)
            {
                if (user.PrimaryUser)
                {
                    landPage = "/Agreement.aspx";
                }
                else
                {
                    landPage = "/AgreementNotice.aspx";
                }
            }
            else //if (true || user.HasGrantToRead(ApplicationGrant.CompanyProfile))
            {
                landPage = "/DashBoard.aspx";
            }

            Session["home"] = landPage;
            Response.Redirect(landPage, Constant.EndResponse);
        }

        Context.ApplicationInstance.CompleteRequest();
    }