Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            { //Esto ocurre solo la primera vez que se carga tu página
                string user = "", pass = "";
                bool rta = false;
                if (Session["user"] != null)
                    user = Session["user"].ToString();
                else
                    user = "";
                if (Session["pass"] != null)
                    pass = Session["pass"].ToString();
                else
                    pass = "";

                Seguridad login = new Seguridad();
                rta = login.login(user, pass);
                if (rta)
                {
                    if (Session["datos"] != null)
                    {
                        Carro = Session["datos"] as DataTable;
                        DT_Carro.DataSourceID = null;
                        DT_Carro.DataSource = Carro;
                        DT_Carro.DataBind();
                    }

                    if (Session["ctd"] != null)
                    {
                        Master.LbCantiad = Session["ctd"].ToString();
                    }

                }
                else
                { Response.Redirect("Error.aspx"); }
            }
            else
            {
                if (!string.IsNullOrEmpty(Session["user"].ToString()) || !string.IsNullOrEmpty(Session["pass"].ToString()))//si se salio y quiere volver con el boto atras
                {
                    if (Session["datos"] != null)
                    {
                        Carro = Session["datos"] as DataTable;
                        DT_Carro.DataSourceID = null;
                        DT_Carro.DataSource = Carro;
                        DT_Carro.DataBind();
                    }

                    if (Session["ctd"] != null)
                    {
                        Master.LbCantiad = Session["ctd"].ToString();
                    }
                }
                else
                {
                    Response.Redirect("Error.aspx");
                }
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string user = "", pass = "";
            bool rta = false;
            if (Session["user"] != null)
                user = Session["user"].ToString();
            else
                user = "";
            if (Session["pass"] != null)
                pass = Session["pass"].ToString();
            else
                pass = "";

            Seguridad login = new Seguridad();
            rta = login.login(user,pass);
            if (rta)
            { }
            else
            { Response.Redirect("Error.aspx"); }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            { //Esto ocurre solo la primera vez que se carga tu página
                string user = "", pass = "";
                bool rta = false;
                if (Session["user"] != null)
                    user = Session["user"].ToString();
                else
                    user = "";
                if (Session["pass"] != null)
                    pass = Session["pass"].ToString();
                else
                    pass = "";

                Seguridad login = new Seguridad();
                rta = login.login(user, pass);
                if (rta)
                {
                    SqlConnection myConnection;
                    SqlDataAdapter myCommand;
                    String Base = "Data Source= .\\SQLEXPRESS;Initial Catalog=Boromir;Integrated Security=True";
                    myConnection = new SqlConnection(Base);

                    string consulta = "select ncodigo_produ Codigo, cnombre_produ Producto,nprecio_venta_produ Precio, nimpuesto_produ IVA,(nprecio_venta_produ + (nprecio_venta_produ * nimpuesto_produ / 100)) Total from tbl_productos";

                    string flt = "", obj = "", scr = "";

                    if (Request.QueryString["Flt"] != null)
                        flt = Request.QueryString["Flt"];

                    if (Request.QueryString["Obj"] != null)
                    {
                        obj = Request.QueryString["Obj"];
                        switch (obj)
                        {
                            case "marca":
                                consulta = consulta + " where ccod_marca_produ = '" + flt + "'";
                                break;
                            case "categ":
                                consulta = consulta + " where ccod_categ_produ = '" + flt + "'";
                                break;

                        }
                    }
                    if (Request.QueryString["scr"] != null)
                    {
                        scr = Request.QueryString["scr"];
                        if (string.IsNullOrEmpty(scr))
                            consulta = "select ncodigo_produ Codigo, cnombre_produ Producto from tbl_productos";
                        else
                            consulta = consulta + " where cnombre_produ like '%" + scr.Trim() + "%'";
                    }
                    myCommand = new SqlDataAdapter(consulta, myConnection);
                    DataSet ds = new DataSet();
                    myCommand.Fill(ds);
                    Dt_productos.DataSourceID = null;
                    Dt_productos.DataSource = ds;
                    Dt_productos.DataBind();

                }
                else
                { Response.Redirect("Error.aspx"); }
            }
            else
            {
                if (string.IsNullOrEmpty(Session["user"].ToString()) || string.IsNullOrEmpty(Session["pass"].ToString()))
                    Response.Redirect("Error.aspx");
            }
        }