示例#1
0
    void master_Page_PreLoad(object sender, EventArgs e)
    {
        Usuario            funcion = new Usuario();
        Infousuario        usuario = funcion.Info;
        HtmlGenericControl span    = new HtmlGenericControl("span")
        {
            InnerHtml = usuario.Nombre
        };
        HtmlGenericControl a;
        var divuser  = loginview.FindControl("DivUsuario");
        var DropMenu = loginview.FindControl("DropMenu");

        divuser.Controls.Add(span);



        if (!IsPostBack)
        {
            // Establecer token Anti-XSRF
            ViewState[AntiXsrfTokenKey]    = Page.ViewStateUserKey;
            ViewState[AntiXsrfUserNameKey] = Context.User.Identity.Name ?? String.Empty;
        }
        else
        {
            // Validar el token Anti-XSRF
            if ((string)ViewState[AntiXsrfTokenKey] != _antiXsrfTokenValue ||
                (string)ViewState[AntiXsrfUserNameKey] != (Context.User.Identity.Name ?? String.Empty))
            {
                throw new InvalidOperationException("Error de validación del token Anti-XSRF.");
            }
        }

        rut = Request.QueryString["RUT"];

        Ainicio.Attributes.Clear();
        Ainicio.Attributes.Add("class", "nav-link text-white");
        Ainicio.Attributes.Add("id", "Ainicio");

        if (!string.IsNullOrEmpty(rut))
        {
            Ainicio.Attributes.Add("onclick", "Loading();");
            Ainicio.Attributes.Add("href", "~/View/Cliente/Default.aspx?RUT=" + rut);
        }
        else
        {
            DUser = new nsCliente.Usuario(Page.User.Identity.Name);
            Cli   = DUser.InfoEmpresas.First();
            rut   = Cli.Rut;
        }
        Ainicio.Attributes.Add("onclick", "Loading();");
        Ainicio.Attributes.Add("href", "~/View/Cliente/");
        a = new HtmlGenericControl("a")
        {
            InnerHtml = "Información de la Empresa"
        };
        a.Attributes.Add("class", "dropdown-item dropdown-item-nav text-white");
        a.Attributes.Add("href", ResolveUrl("~/View/Cliente/Usuario/Info-empresa/Empresa.aspx") + "?RUT=" + rut);
        DropMenu.Controls.Add(a);
    }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string User = Page.User.Identity.Name;

        DUser = new nsCliente.Usuario(User);


        if (DUser.HasEmpresa)
        {
            if (DUser.InfoEmpresas.Count > 1)
            {
                PnlBtnToMdlChangeCli.Visible = true;
            }
            else
            {
                PnlBtnToMdlChangeCli.Visible = false;
            }
            if (!IsPostBack)
            {
                rut = Request.QueryString["RUT"];
                if (!string.IsNullOrEmpty(rut))
                {
                    Cli = new DatosCliente(rut);
                }
                else
                {
                    Cli = DUser.InfoEmpresas.First();
                }
                HdnRutCli.Value = Cli.Rut;
                FillInformation(Cli);
            }
            else
            {
            }
        }
        else
        {
            Response.Redirect(Error404.Redireccion(MasterPageFile, User + ", no tienes empresa asignada :(. Por favor comuníquese con el administrador."));
        }



        Thread.CurrentThread.CurrentCulture = new CultureInfo("es-CL");
        FunDetPed    Funcion           = new FunDetPed();
        PlazoEntrega Plazoentregatermo = Funcion.PlazoEntrega("Termo");

        diastermo.Text  = "(" + Plazoentregatermo.Dias.ToString() + " días hábiles)";
        FechaTermo.Text = "Entrega el " + Plazoentregatermo.Fecha.ToShortDateString();
        PlazoEntrega Plazolamina = Funcion.PlazoEntrega("Lamina");

        DiasLaminas.Text  = "(" + Plazolamina.Dias.ToString() + " días hábiles)";
        FechaLaminas.Text = "Entrega el " + Plazolamina.Fecha.ToShortDateString();
        PlazoEntrega Plazoarq = Funcion.PlazoEntrega("Arq");

        DiasArq.Text  = "(" + Plazoarq.Dias.ToString() + " días hábiles)";
        FechaArq.Text = "Entrega el " + Plazoarq.Fecha.ToShortDateString();
    }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string User = Page.User.Identity.Name;

        DUser = new nsCliente.Usuario(User);


        if (DUser.HasEmpresa)
        {
            if (DUser.InfoEmpresas.Count > 1)
            {
                PnlBtnToMdlChangeCli.Visible = true;
            }
            else
            {
                PnlBtnToMdlChangeCli.Visible = false;
            }
            rut = Request.QueryString["RUT"];
            if (!string.IsNullOrEmpty(rut))
            {
                Cli         = new DatosCliente(rut);
                ClienteEcom = new GetInfoClienteEcomm(rut);
            }
            else
            {
                Cli         = DUser.InfoEmpresas.First();
                ClienteEcom = new GetInfoClienteEcomm(Cli.Rut);
            }
            if (!IsPostBack)
            {
                HdnRutCli.Value = Cli.Rut;
                FillInformation(Cli);
                Thread.CurrentThread.CurrentCulture = new CultureInfo("es-CL");
                FechasExpress.Get get;
                get               = new FechasExpress.Get("TER", ClienteEcom.DiasDeTrato, 7);
                diastermo.Text    = "(" + get.DiasEntrega.ToString() + " días hábiles)";
                FechaTermo.Text   = "Entrega el " + get.FechaCorte.ToShortDateString();
                get               = new FechasExpress.Get("LAMINA", 7);
                DiasLaminas.Text  = "(" + get.DiasEntrega.ToString() + " días hábiles)";
                FechaLaminas.Text = "Entrega el " + get.FechaCorte.ToShortDateString();
                get               = new FechasExpress.Get("ARQ", 0, 7);
                DiasArq.Text      = "(" + get.DiasEntrega.ToString() + " días hábiles)";
                FechaArq.Text     = "Entrega el " + get.FechaCorte.ToShortDateString();
            }
            else
            {
            }
        }
        else
        {
            Response.Redirect(Error404.Redireccion(MasterPageFile, User + ", no tienes empresa asignada :(. Por favor comuníquese con el administrador."));
        }
    }
示例#4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string rut = Request.QueryString["RUT"];

        if (!string.IsNullOrEmpty(rut))
        {
            HdnRutCli.Value = rut;
            string User = Page.User.Identity.Name;
            DUser = new nsCliente.Usuario(User);
            Cli   = DUser.InfoEmpresas.Where(it => it.Rut == rut).First();
        }
        else
        {
            Response.Redirect(Error404.Redireccion(MasterPageFile, "Hubo un error al tratar de buscar la empresa, intentelo en otro momento."));
        }
    }