Esempio n. 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            TelnetData.TelnetData td = new TelnetData.TelnetData();
            TelnetData.ClassParametrosTelnetData cp = new TelnetData.ClassParametrosTelnetData();
            NameValueCollection appSettings         = ConfigurationManager.AppSettings;

            cp.Archivo  = appSettings["Archivo"].ToString();
            cp.Archivo2 = appSettings["Archivo2"].ToString();
            cp.CantidadCamposxRegistro       = appSettings["CantidadCamposxRegistro"].ToString();
            cp.CnnStringSqlServerSinPassword = appSettings["CnnStringSqlServerSinPassword"].ToString();
            cp.CuentaUniverse = appSettings["CuentaUniverse"].ToString();
            cp.IVA            = appSettings["IVA"].ToString();
            cp.PasswordSqlServerEncriptado = appSettings["PasswordSqlServerEncriptado"].ToString();
            cp.PasswordUniverseEncriptado  = appSettings["PasswordUniverseEncriptado"].ToString();
            cp.Path            = appSettings["Path"].ToString();
            cp.Path2           = appSettings["Path2"].ToString();
            cp.ServerUniverse  = appSettings["ServerUniverse"].ToString();
            cp.UsuarioUniverse = appSettings["UsuarioUniverse"].ToString();
        }
        protected void ButtonAgregar_Click(object sender, EventArgs e)
        {
            string   user = (string)HttpContext.Current.Session["User"].ToString();
            string   sEmpresa;
            DateTime fechaTomorrow = DateTime.Now.AddDays(1);
            DateTime fechaCargada  = DateTime.Parse(TextBoxFecha.Text);

            TelnetData.TelnetData td = new TelnetData.TelnetData();
            TelnetData.ClassParametrosTelnetData cp = new TelnetData.ClassParametrosTelnetData();
            NameValueCollection appSettings         = ConfigurationManager.AppSettings;

            cp.Archivo  = appSettings["Archivo"].ToString();
            cp.Archivo2 = appSettings["Archivo2"].ToString();
            cp.CantidadCamposxRegistro       = appSettings["CantidadCamposxRegistro"].ToString();
            cp.CnnStringSqlServerSinPassword = appSettings["CnnStringSqlServerSinPassword"].ToString();
            cp.CuentaUniverse = appSettings["CuentaUniverse"].ToString();
            cp.IVA            = appSettings["IVA"].ToString();
            cp.PasswordSqlServerEncriptado = appSettings["PasswordSqlServerEncriptado"].ToString();
            cp.PasswordUniverseEncriptado  = appSettings["PasswordUniverseEncriptado"].ToString();
            cp.Path            = appSettings["Path"].ToString();
            cp.Path2           = appSettings["Path2"].ToString();
            cp.ServerUniverse  = appSettings["ServerUniverse"].ToString();
            cp.UsuarioUniverse = appSettings["UsuarioUniverse"].ToString();
            string filePath = appSettings["ImageRouteTelnetPdf"].ToString();


            bool          subida         = false;
            List <string> listaResultado = new List <string>();

            if (this.RadioButtonListEmpresa.SelectedValue == "Telcom")
            {
                sEmpresa = "1";
            }
            else
            {
                sEmpresa = "2";
            }

            List <ListItem> selectedSalida = this.CheckBoxListSalida.Items.Cast <ListItem>()
                                             .Where(li => li.Selected)
                                             .ToList();

            List <ListItem> selectedLetra = this.CheckBoxListLetra.Items.Cast <ListItem>()
                                            .Where(li => li.Selected)
                                            .ToList();

            List <ListItem> selectedTipo = this.CheckBoxListTipo.Items.Cast <ListItem>()
                                           .Where(li => li.Selected)
                                           .ToList();

            List <ListItem> selectedEmail = this.CheckBoxListEmail.Items.Cast <ListItem>()
                                            .Where(li => li.Selected)
                                            .ToList();

            List <ListItem> selectedAdhesion = this.CheckBoxListAdhesion.Items.Cast <ListItem>()
                                               .Where(li => li.Selected)
                                               .ToList();


            int oImagen = System.Convert.ToInt32(this.CheckBoxListNumImagen.SelectedValue);


            foreach (ListItem oListItem in selectedSalida)
            {
                foreach (ListItem oListLetra in selectedLetra)
                {
                    foreach (ListItem oListTipo in selectedTipo)
                    {
                        foreach (ListItem oListEmail in selectedEmail)
                        {
                            foreach (ListItem oListAdhesion in selectedAdhesion)
                            {
                                int    oSalida   = System.Convert.ToInt32(oListItem.Value);
                                string oLetra    = oListLetra.Value;
                                int    oTipo     = System.Convert.ToInt32(oListTipo.Value);
                                int    oEmail    = System.Convert.ToInt32(oListEmail.Value);
                                int    oAdhesion = System.Convert.ToInt32(oListAdhesion.Value);

                                ClassSqlserver cs = new ClassSqlserver();
                                if (this.FileUpload1.HasFile)
                                {
                                    string filename = this.GuidName();
                                    string sfile    = this.SaveFile(this.FileUpload1.PostedFile, filename);
                                    subida = td.InsertaImagenesSQL(oImagen, this.TextBoxFecha.Text, filename, oSalida, oTipo, oLetra, oEmail, oAdhesion, sEmpresa, user);
                                }
                                else
                                {
                                    subida = false;
                                }

                                string email    = (oEmail == 1) ? "Tiene email " : "No tiene Email";
                                string adherido = (oAdhesion == 1) ? "Adherido Email " : "No Adherido Email ";
                                string imagen   = "Fecha : " + this.TextBoxFecha.Text + " Salida: " + this.CategoriaComprobante(oSalida) + " " + this.TipoComprobante(oTipo) + " " + oLetra + " " + email + " " + adherido;
                                string mensaje  = (subida == false) ? " La imagen ya estaba subida " + imagen : "Imagen subida correctamente " + imagen;
                                listaResultado.Add(mensaje);
                            }
                        }
                    }
                }
            }
            this.DisplayMembers(listaResultado);
            this.BlanquearCampos();
        }
        protected void ButtonBuscar_Click(object sender, EventArgs e)
        {
            TelnetData.TelnetData td = new TelnetData.TelnetData();
            TelnetData.ClassParametrosTelnetData cp = new TelnetData.ClassParametrosTelnetData();
            NameValueCollection appSettings         = ConfigurationManager.AppSettings;

            cp.Archivo  = appSettings["Archivo"].ToString();
            cp.Archivo2 = appSettings["Archivo2"].ToString();
            cp.CantidadCamposxRegistro       = appSettings["CantidadCamposxRegistro"].ToString();
            cp.CnnStringSqlServerSinPassword = appSettings["CnnStringSqlServerSinPassword"].ToString();
            cp.CuentaUniverse = appSettings["CuentaUniverse"].ToString();
            cp.IVA            = appSettings["IVA"].ToString();
            cp.PasswordSqlServerEncriptado = appSettings["PasswordSqlServerEncriptado"].ToString();
            cp.PasswordUniverseEncriptado  = appSettings["PasswordUniverseEncriptado"].ToString();
            cp.Path            = appSettings["Path"].ToString();
            cp.Path2           = appSettings["Path2"].ToString();
            cp.ServerUniverse  = appSettings["ServerUniverse"].ToString();
            cp.UsuarioUniverse = appSettings["UsuarioUniverse"].ToString();



            // IList<string> l1 = td.fGetImagenesComprobante(cp, "1", "A", "1", "1", "1", "02/02/2005");


            //  ClassSqlserver cs = new ClassSqlserver();
            //  DataSet ds = cs.DatosBusqueda(TextBoxFechaDesde.Text,TextBoxFechaHasta.Text,1);

            string fecha    = TextBoxFechaHasta.Text;
            string salida   = CheckBoxListSalida.SelectedValue;
            string letra    = CheckBoxListLetra.SelectedValue;
            string tipo     = CheckBoxListTipo.SelectedValue;
            string email    = CheckBoxListEmail.SelectedValue;
            string adhesion = CheckBoxListAdhesion.SelectedValue;
            string sEmpresa;

            if (RadioButtonListEmpresa.SelectedValue == "Telcom")
            {
                sEmpresa = "1";
            }
            else
            {
                sEmpresa = "2";
            }

            GridView1.DataSource = td.fGetDataTableComprobante(cp, salida, letra, tipo, email, adhesion, fecha, sEmpresa);
            GridView1.DataBind();

            Image2.Width  = 280;
            Image2.Height = 450;
            switch (salida)
            {
            case "1":
                Image2.Visible  = true;
                Image2.ImageUrl = "ImageCSharp.aspx?FileName=f_sal1.jpg";
                Image2.DataBind();
                break;

            case "2":
            case "3":
            case "5":
            case "6":
            case "7":
                Image2.Visible  = true;
                Image2.ImageUrl = "ImageCSharp.aspx?FileName=f_sal2.jpg";
                Image2.DataBind();
                break;

            case "4":
                Image2.Visible = false;
                break;
            }
        }
Esempio n. 4
0
        protected void ButtonAgregar_Click(object sender, EventArgs e)
        {
            string   User = (string)HttpContext.Current.Session["User"].ToString();
            string   sEmpresa;
            DateTime fechaTomorrow = DateTime.Now.AddDays(1);
            DateTime fechaCargada  = DateTime.Parse(TextBoxFecha.Text);

            //    if (fechaCargada <= fechaTomorrow)
            // {
            //     RequiredFieldValidator2.Visible = true;
            //      ErrorSummary.AddError("La fecha no puede ser menor al dia de Mañana", this);

            //  }
            //    else
            //  {


            TelnetData.TelnetData td = new TelnetData.TelnetData();
            TelnetData.ClassParametrosTelnetData cp = new TelnetData.ClassParametrosTelnetData();
            NameValueCollection appSettings         = ConfigurationManager.AppSettings;

            cp.Archivo  = appSettings["Archivo"].ToString();
            cp.Archivo2 = appSettings["Archivo2"].ToString();
            cp.CantidadCamposxRegistro       = appSettings["CantidadCamposxRegistro"].ToString();
            cp.CnnStringSqlServerSinPassword = appSettings["CnnStringSqlServerSinPassword"].ToString();
            cp.CuentaUniverse = appSettings["CuentaUniverse"].ToString();
            cp.IVA            = appSettings["IVA"].ToString();
            cp.PasswordSqlServerEncriptado = appSettings["PasswordSqlServerEncriptado"].ToString();
            cp.PasswordUniverseEncriptado  = appSettings["PasswordUniverseEncriptado"].ToString();
            cp.Path            = appSettings["Path"].ToString();
            cp.Path2           = appSettings["Path2"].ToString();
            cp.ServerUniverse  = appSettings["ServerUniverse"].ToString();
            cp.UsuarioUniverse = appSettings["UsuarioUniverse"].ToString();
            string filePath = appSettings["ImageRouteTelnetPdf"].ToString();


            bool          subida         = false;
            List <string> listaResultado = new List <string>();

            if (RadioButtonListEmpresa.SelectedValue == "Telcom")
            {
                sEmpresa = "1";
            }
            else
            {
                sEmpresa = "2";
            }

            // if (sEmpresa == "Telcom")
            //  {
            List <ListItem> selectedSalida = CheckBoxListSalida.Items.Cast <ListItem>()
                                             .Where(li => li.Selected)
                                             .ToList();

            List <ListItem> selectedLetra = CheckBoxListLetra.Items.Cast <ListItem>()
                                            .Where(li => li.Selected)
                                            .ToList();

            List <ListItem> selectedTipo = CheckBoxListTipo.Items.Cast <ListItem>()
                                           .Where(li => li.Selected)
                                           .ToList();

            List <ListItem> selectedEmail = CheckBoxListEmail.Items.Cast <ListItem>()
                                            .Where(li => li.Selected)
                                            .ToList();

            List <ListItem> selectedAdhesion = CheckBoxListAdhesion.Items.Cast <ListItem>()
                                               .Where(li => li.Selected)
                                               .ToList();


            int oImagen = System.Convert.ToInt32(CheckBoxListNumImagen.SelectedValue);


            foreach (ListItem oListItem in selectedSalida)
            {
                foreach (ListItem oListLetra in selectedLetra)
                {
                    foreach (ListItem oListTipo in selectedTipo)
                    {
                        foreach (ListItem oListEmail in selectedEmail)
                        {
                            foreach (ListItem oListAdhesion in selectedAdhesion)
                            {
                                int    oSalida   = System.Convert.ToInt32(oListItem.Value);
                                string oLetra    = oListLetra.Value;
                                int    oTipo     = System.Convert.ToInt32(oListTipo.Value);
                                int    oEmail    = System.Convert.ToInt32(oListEmail.Value);
                                int    oAdhesion = System.Convert.ToInt32(oListAdhesion.Value);


                                ClassSqlserver cs = new ClassSqlserver();
                                if (FileUpload1.HasFile)
                                {
                                    //if (cs.VerificarRegistro(TextBoxFecha.Text, oSalida, oTipo, oLetra, oEmail, oAdhesion) == false)
                                    //{
                                    string filename = sGuidName();
                                    string sfile    = SaveFile(FileUpload1.PostedFile, filename);
                                    subida = td.InsertaImagenesSQL(cp, oImagen, TextBoxFecha.Text, filename, oSalida, oTipo, oLetra, oEmail, oAdhesion, sEmpresa, User);
                                    //     , filename, oSalida, oTipo, oLetra, oEmail, oAdhesion);
                                    // cs.InsertarRegistro(TextBoxFecha.Text, sfile, oSalida, "Telcom", oTipo, oLetra, oEmail, oAdhesion);


                                    // }
                                }
                                else
                                {
                                    subida = false;
                                }

                                string semail    = (oEmail == 1) ? "Tiene email " : "No tiene Email";
                                string sAdherido = (oAdhesion == 1) ? "Adherido Email " : "No Adherido Email ";
                                string sImagen   = "Fecha : " + TextBoxFecha.Text + " Salida: " + fSalida(oSalida) + " " + fTipo(oTipo) + " " + oLetra + " " + semail + " " + sAdherido;
                                string smensaje  = (subida == false) ? " La imagen ya estaba subida " + sImagen : "Imagen subida correctamente " + sImagen;
                                listaResultado.Add(smensaje);
                            }
                        }
                    }
                }
            }
            displayMembers(listaResultado);
            BlanquearCampos();
            // }

            //if fecha  }
        }