public void CargarUsuario(int id)
        {
            Controller_Usuario controlu = new Controller_Usuario();
            Usuario            user     = controlu.BuscarUsuario_ID(id);

            if (user.NombreCompleto != null)
            {
                lblUsuario.Text = user.NombreCompleto;

                Image1.AlternateText = user.Empresa;
                if (user.Empresa.ToUpper() == "AIMPRESORES")
                {
                    Image1.ImageUrl = "~/Estructura/Image/LOGO%20A.png";
                    Image1.Width    = 200;
                }
                else
                {
                    Image1.ImageUrl = "~/Estructura/Image/logo_copesa.jpg";
                }
            }
            else
            {
                Response.Redirect("../../index.aspx");
            }
        }
        public Cotizador BuscarPresupuestoxID(int id)
        {
            Cotizador  cot = new Cotizador();
            Conexion   con = new Conexion();
            SqlCommand cmd = con.AbrirConexionPPTO();

            if (cmd != null)
            {
                try
                {
                    cmd.CommandText = "PPTO_BuscarPPTO_ID";
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@IDPPTO", id);
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        cot.ID_Presupuesto    = Convert.ToInt32(reader["id_Presupuestos"].ToString());
                        cot.NombrePresupuesto = reader["Nombre_Presupuesto"].ToString();
                        cot.Formato           = reader["Formato"].ToString();
                        cot.PaginasInt        = Convert.ToInt32(reader["PaginasInt"].ToString());
                        cot.PapelInterior     = reader["PapelInt"].ToString();
                        cot.GramajeInterior   = reader["GramajeInt"].ToString();
                        cot.PaginasTap        = (reader["PaginasTap"].ToString() != "") ? Convert.ToInt32(reader["PaginasTap"].ToString()) : 0;
                        cot.PapelTap          = reader["PapelTap"].ToString();
                        cot.GramajeTapas      = reader["GramajeTap"].ToString();
                        cot.Empresa           = reader["Empresa"].ToString();
                        cot.Encuadernacion    = reader["Encuadernacion"].ToString();
                        cot.FechaCreacion     = Convert.ToDateTime(reader["FechaCreacion"].ToString());
                        cot.EstadoPPTO        = Convert.ToInt32(reader["Estado"].ToString());
                        cot.Usuario_Creador   = reader["Usuario"].ToString();
                        cot.EntradasxFormatos = Convert.ToInt32(reader["EntradasxFormatos"].ToString());
                        cot.Tiraje            = Convert.ToInt32(reader["Tiraje"].ToString());
                        cot.BarnizAcuosoTap   = reader["BarnizAcuosoTap"].ToString();
                        cot.QuintoColor       = reader["QuintoColorTap"].ToString();
                        cot.BarnizUV          = reader["BarnizUVTap"].ToString();
                        cot.Laminado          = reader["LaminadoTap"].ToString();
                        cot.TotalNeto         = Convert.ToInt32(reader["TotalNeto"].ToString());
                        cot.PrecioUnitario    = Convert.ToDouble(reader["PrecioUnitario"].ToString());

                        Controller_Usuario controlUser = new Controller_Usuario();
                        Usuario            personal    = controlUser.BuscarPersonalComercial_Empresa(cot.Empresa);
                        cot.PersonalComercial = personal;

                        cot.ValorUFActual = new ValorUF()
                        {
                            Valor = Convert.ToDouble(reader["ValorUF"].ToString())
                        };
                    }
                }
                catch
                {
                }
            }
            con.CerrarConexion();
            return(cot);
        }
        public static string Iniciar(string password, string Correo)
        {
            Controller_Usuario controluser = new Controller_Usuario();
            Usuario            user        = controluser.IniciarSession(Correo, password);

            if (user.NombreCompleto != "" && user.NombreCompleto != null)
            {
                return(user.IDUsuario.ToString());
            }
            else
            {
                return("Error");
            }
        }
        public void CargarUsuario(int id)
        {
            Controller_Usuario controlu = new Controller_Usuario();
            Usuario            user     = controlu.BuscarUsuario_ID(id);

            if (user.NombreCompleto != null)
            {
                ValorUF();
                if (user.Perfil != "Admin")
                {
                    LabelPrimerPrecio.Visible = false;
                    DIVPrecio.Visible         = false;
                }
                CargarPapeles(user.Empresa);
            }
            else
            {
                Response.Redirect("../../index.aspx");
            }
        }
示例#5
0
        public void CargarUsuario(int id)
        {
            Controller_Usuario controlu = new Controller_Usuario();
            Usuario            user     = controlu.BuscarUsuario_ID(id);

            if (user.NombreCompleto != null)
            {
                if (user.Perfil != "Admin")
                {
                    LabelPrimerPrecio.Visible  = false;
                    LabelSegundoPrecio.Visible = false;
                    LabelTercerPrecio.Visible  = false;
                    DIVPrecio.Visible          = false;
                }
                CargarPapeles("Cencosud");//se debe cambiar por la empresa
            }
            else
            {
                Response.Redirect("../../index.aspx");
            }
        }
        public Cotizador BuscarPresupuestoxID(int id)
        {
            Cotizador  cot = new Cotizador();
            Conexion   con = new Conexion();
            SqlCommand cmd = con.AbrirConexionPPTO();

            if (cmd != null)
            {
                try
                {
                    cmd.CommandText = "PPTO_BuscarPPTO_ID";
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@IDPPTO", id);
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        cot.ID_Presupuesto    = Convert.ToInt32(reader["id_Presupuestos"].ToString());
                        cot.NombrePresupuesto = reader["Nombre_Presupuesto"].ToString();
                        cot.Formato           = reader["Formato"].ToString();
                        cot.PaginasInt        = Convert.ToInt32(reader["PaginasInt"].ToString());
                        cot.PapelInterior     = reader["PapelInt"].ToString();
                        cot.GramajeInterior   = reader["GramajeInt"].ToString();
                        cot.PaginasTap        = Convert.ToInt32(reader["PaginasTap"].ToString());
                        cot.PapelTap          = reader["PapelTap"].ToString();
                        cot.GramajeTapas      = reader["GramajeTap"].ToString();
                        cot.Empresa           = reader["Empresa"].ToString();
                        cot.Encuadernacion    = reader["Encuadernacion"].ToString();
                        cot.FechaCreacion     = Convert.ToDateTime(reader["FechaCreacion"].ToString());
                        cot.EstadoPPTO        = Convert.ToInt32(reader["Estado"].ToString());

                        Controller_Usuario controlUser = new Controller_Usuario();
                        Usuario            personal    = controlUser.BuscarPersonalComercial_Empresa(cot.Empresa);
                        cot.PersonalComercial = personal;

                        Controller_ValorTrimestre controlDolar = new Controller_ValorTrimestre();
                        ValorDolar_Trimestral     dolar        = controlDolar.BuscarDolar_ID(Convert.ToInt32(reader["Trimestre_ID".ToString()]));
                        cot.ValorDolar = dolar;

                        Controller_Tirajes  controlTiraje = new Controller_Tirajes();
                        List <PPTO_Tirajes> lista         = controlTiraje.ListarTirajes_ID(cot.ID_Presupuesto);
                        int count = 0;
                        foreach (PPTO_Tirajes t in lista)
                        {
                            if (t.NombreTiraje == "Tiraje 1")
                            {
                                cot.Tiraje1 = t;
                            }
                            else if (t.NombreTiraje == "Tiraje 2")
                            {
                                cot.Tiraje2 = t;
                            }
                            else
                            {
                                cot.Tiraje3 = t;
                            }
                            count++;
                        }
                    }
                }
                catch
                {
                }
            }
            return(cot);
        }