public string VerificarUsuarioExiste(string dni)
        {
            string sql, result = "";
            int    cont = 0;

            sql = "SELECT count(*) n_count FROM TBC_USUARIO where v_dni = '" + dni + "'";
            SqlConnection cn = con.conexion();

            cn.Open();
            SqlDataAdapter dap = new SqlDataAdapter(sql, cn);
            DataTable      dt  = new DataTable();

            dap.SelectCommand.CommandType = CommandType.Text;
            dap.Fill(dt);
            cn.Close();

            if (dt != null)
            {
                cont = Convert.ToInt32(dt.Rows[0]["n_count"]);
            }
            if (cont == 0)
            {
                result = "OK";
            }
            else if (cont > 0)
            {
                result = "NO";
            }

            return(result);
        }
        public string VerificarCatalogo(string sfilro)
        {
            string   resul = "N";
            Conexion con   = new Conexion();
            // String BodyHtml = "", HeadHtml = "", FotHtml = "";
            SqlConnection cn = con.conexion();

            cn.Open();
            SqlDataAdapter dap = new SqlDataAdapter("UP_MVE_CATALOGOLYS", cn);
            DataTable      dt  = new DataTable();

            dap.SelectCommand.CommandType = CommandType.StoredProcedure;
            dap.SelectCommand.Parameters.AddWithValue("@Item", sfilro);

            dap.Fill(dt);
            cn.Close();

            if (dt == null)
            {
                resul = "N";
            }
            else if (dt.Rows.Count <= 0)
            {
                resul = "N";
            }
            else if (dt.Rows.Count > 0)
            {
                resul = "S";
                return(resul);
            }

            return(resul);
        }
        public ItemFactor[] GetItemsFactor(string Dni)
        {
            Conexion          con      = new Conexion();
            List <ItemFactor> listItem = new List <ItemFactor>();
            // String BodyHtml = "", HeadHtml = "", FotHtml = "";
            SqlConnection cn = con.conexion();

            cn.Open();
            SqlDataAdapter dap = new SqlDataAdapter("UP_MVE_FACTORITEM", cn);
            DataTable      dt  = new DataTable();

            dap.SelectCommand.CommandType = CommandType.StoredProcedure;
            dap.SelectCommand.Parameters.AddWithValue("@Dni", Dni);

            dap.Fill(dt);
            cn.Close();

            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ItemFactor it = new ItemFactor();
                    it.Item         = dt.Rows[i]["c_item"].ToString();
                    it.Flagcontador = dt.Rows[i]["c_flagactcontador"].ToString();
                    it.Propaganda   = dt.Rows[i]["c_propaganda"].ToString();
                    it.Segundos     = Convert.ToInt32(dt.Rows[i]["n_segundosTot"]);
                    it.DescPromo    = dt.Rows[i]["c_htmlDesc"].ToString();
                    listItem.Add(it);
                }
            }

            return(listItem.ToArray());
        }
Exemple #4
0
        public void LoadPortal()
        {
            Conexion con = new Conexion();
            // String BodyHtml = "", HeadHtml = "", FotHtml = "";
            SqlConnection cn = con.conexion();

            cn.Open();
            SqlDataAdapter dap = new SqlDataAdapter("SP_CO_MVL_LISTAPAGEINICIO", cn);
            DataTable      dt  = new DataTable();

            dap.SelectCommand.CommandType = CommandType.StoredProcedure;
            //dap.SelectCommand.Parameters.AddWithValue("@Dni", dni);

            dap.Fill(dt);
            cn.Close();

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string HtmlSeccion = "";

                    string imgBase64 = "";
                    string stittulo  = "";
                    string sdetalle  = "";
                    string rutaimg   = "";


                    stittulo = dt.Rows[i]["c_htmlTit"].ToString();
                    sdetalle = dt.Rows[i]["c_htmlDesc"].ToString();
                    rutaimg  = dt.Rows[i]["c_foto1"].ToString();
                    stittulo = stittulo.ToUpper();
                    sdetalle = sdetalle.ToUpper();
                    //  Bitmap b = new Bitmap(@"\\Ibserver_1\servidor de archivos\Fotos\LWP2040P-web.jpg");
                    Bitmap b = new Bitmap(rutaimg);
                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
                    b.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                    byte[] byteImage = ms.ToArray();
                    imgBase64 = Convert.ToBase64String(byteImage);

                    dt.Rows[i][11] = "data:image/jpeg;base64," + imgBase64;
                    dt.AcceptChanges();

                    /*HtmlSeccion = " <td><tr >  <p style='font-weight: bold' >" + stittulo + "</p> </tr> </td>";
                     * HtmlSeccion = HtmlSeccion + "<td><tr >  " + sdetalle + "</tr></td>";
                     * HtmlSeccion = HtmlSeccion + "<td> <tr ><img  style='height: 100%; width: 100%; object-fit: contain' src='data:image/jpeg;base64," + imgBase64 + "' /></tr></td>";
                     * BodyHtml = BodyHtml + HtmlSeccion;*/
                }

                //  lblHeader.Text = "PROMOCIONES DEL DÍA " + DateTime.Now.ToShortDateString();
                repeatHtml.DataSource = dt;
                repeatHtml.DataBind();
            }
        }
        public void LoadPremios(string dni)
        {
            Conexion con = new Conexion();
            // String BodyHtml = "", HeadHtml = "", FotHtml = "";
            SqlConnection cn = con.conexion();

            cn.Open();
            SqlDataAdapter dap = new SqlDataAdapter("UP_MVE_PREMIOLYS", cn);
            DataTable      dt  = new DataTable();

            dap.SelectCommand.CommandType = CommandType.StoredProcedure;
            dap.SelectCommand.Parameters.AddWithValue("@Dni", dni);

            dap.Fill(dt);
            cn.Close();

            if (dt != null)
            {
                //   Fdt = dt;

                /*for (int i = 0; i < dt.Rows.Count; i++)
                 * {
                 *
                 *  string imgBase64 = "";
                 *  string rutaimg = "";
                 *
                 *  rutaimg = dt.Rows[i]["c_rutafoto"].ToString();
                 * // rutaimg = @"\\100.100.100.1\\spring\\Planillas\\ROYALOGO.BMP";
                 *  //rutaimg = @Constantes.CarpetaFotos+sfilro+".jpg";
                 * rutaimg = Server.MapPath("~/Fotos") + "\\" + sfilro + ".jpg";
                 *  //rutaimg = Constantes.CarpetaFotos+sfilro+".jpg";
                 * // CopyFile(rutaimg);
                 *  if (System.IO.File.Exists(@rutaimg))
                 *  {
                 *      // Bitmap b = new Bitmap(@"\\IBSERVER_1\\Servidor de Archivos\\Fotos\\L50.jpg");
                 *      Bitmap b = new Bitmap(rutaimg);
                 *     // Bitmap b = new Bitmap(@"E:\Fotos\L50.jpg");
                 *      System.IO.MemoryStream ms = new System.IO.MemoryStream();
                 *      b.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                 *      byte[] byteImage = ms.ToArray();
                 *      imgBase64 = Convert.ToBase64String(byteImage);
                 *
                 *      dt.Rows[i][35] = "data:image/jpeg;base64," + imgBase64;
                 *      dt.AcceptChanges();
                 *  }
                 *
                 *
                 * }*/

                rptPremios.DataSource = dt;
                rptPremios.DataBind();
            }
        }
Exemple #6
0
        public string  RegistrarCupon()
        {
            string res = "OK";
            int    sqlrows;

            //string opcion = "INS";
            string   codProm  = txtCodPromocion.Text;
            string   dni      = txtDni.Text;
            string   nomb     = txtNombre.Text;
            string   apellido = txtApellidos.Text;
            string   telefono = txtTelefono.Text;
            DateTime fechanac = Convert.ToDateTime(txtFechaNacimiento.Text);
            string   correo   = txtCorreo.Text;



            try
            {
                Conexion      con    = new Conexion();
                SqlConnection cn     = con.conexion();
                SqlCommand    sqlcmd = new SqlCommand("UP_MWE_GANACONLYS", cn);
                sqlcmd.Connection  = cn;
                sqlcmd.CommandType = CommandType.StoredProcedure;
                cn.Open();

                // sqlcmd.Parameters.AddWithValue("@Opcion", opcion);

                sqlcmd.Parameters.AddWithValue("@Dni", dni.Trim().ToUpper());
                sqlcmd.Parameters.AddWithValue("@Nombre", nomb);
                sqlcmd.Parameters.AddWithValue("@Apellido", apellido);
                sqlcmd.Parameters.AddWithValue("@Telefono", telefono);
                sqlcmd.Parameters.AddWithValue("@FecNac", fechanac);
                sqlcmd.Parameters.AddWithValue("@Correo", correo);
                sqlcmd.Parameters.AddWithValue("@Cupon", codProm.Trim().ToUpper());
                SqlParameter par = new SqlParameter("@Mensaje", SqlDbType.VarChar);
                par.Size      = 500;
                par.Direction = ParameterDirection.Output;
                sqlcmd.Parameters.Add(par);
                sqlrows = sqlcmd.ExecuteNonQuery();


                res = Convert.ToString(sqlcmd.Parameters["@Mensaje"].Value);
            }
            catch (Exception e)
            {
                //      res = e.Message;
                res = e.Message;
            }

            return(res);
        }
        public void LoadCatalogo(string sfilro)

        {
            Conexion con = new Conexion();
            // String BodyHtml = "", HeadHtml = "", FotHtml = "";
            SqlConnection cn = con.conexion();

            cn.Open();
            SqlDataAdapter dap = new SqlDataAdapter("SP_CO_MVE_CATALOGOLYS", cn);
            DataTable      dt  = new DataTable();

            dap.SelectCommand.CommandType = CommandType.StoredProcedure;
            dap.SelectCommand.Parameters.AddWithValue("@Item", sfilro);

            dap.Fill(dt);
            cn.Close();

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string imgBase64 = "";
                    string rutaimg   = "";

                    rutaimg = dt.Rows[i]["c_rutafoto"].ToString();
                    if (System.IO.File.Exists(rutaimg))
                    {
                        //  Bitmap b = new Bitmap(@"\\Ibserver_1\servidor de archivos\Fotos\LWP2040P-web.jpg");
                        Bitmap b = new Bitmap(rutaimg);
                        System.IO.MemoryStream ms = new System.IO.MemoryStream();
                        b.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                        byte[] byteImage = ms.ToArray();
                        imgBase64 = Convert.ToBase64String(byteImage);

                        dt.Rows[i][35] = "data:image/jpeg;base64," + imgBase64;
                        dt.AcceptChanges();
                    }
                }

                rptCatalogo.DataSource = dt;
                rptCatalogo.DataBind();
            }
        }
        public void LoadReglas(string dni)
        {
            Conexion con = new Conexion();
            // String BodyHtml = "", HeadHtml = "", FotHtml = "";
            SqlConnection cn = con.conexion();

            cn.Open();
            SqlDataAdapter dap = new SqlDataAdapter("UP_MVE_REGLAMENTOLYS", cn);
            DataTable      dt  = new DataTable();

            dap.SelectCommand.CommandType = CommandType.StoredProcedure;
            dap.SelectCommand.Parameters.AddWithValue("@Dni", dni);

            dap.Fill(dt);
            cn.Close();

            if (dt != null)
            {
                rptReglas.DataSource = dt;
                rptReglas.DataBind();
            }
        }
        public void LoadFactores(string Dni)
        {
            Conexion con = new Conexion();
            // String BodyHtml = "", HeadHtml = "", FotHtml = "";
            SqlConnection cn = con.conexion();

            cn.Open();
            SqlDataAdapter dap = new SqlDataAdapter("UP_MVE_FACTORITEM", cn);
            DataTable      dt  = new DataTable();

            dap.SelectCommand.CommandType = CommandType.StoredProcedure;
            dap.SelectCommand.Parameters.AddWithValue("@Dni", Dni);

            dap.Fill(dt);
            cn.Close();

            if (dt != null)
            {
                rptFactorItem.DataSource = dt;
                rptFactorItem.DataBind();
            }

            ExecScript(dt);
        }
        public string InsertarUsuario(string dni, string nombre, string apellido, string fechanac, string mail,
                                      string telefono, string empruc, string empnom)
        {
            string res = "-1";
            int    sqlrows;

            if (dni == "" || String.IsNullOrEmpty(dni) == true)
            {
                return("-1");
            }

            try
            {
                SqlConnection cn     = con.conexion();
                SqlCommand    sqlcmd = new SqlCommand("UP_MVE_INSERTUSERAPP", cn);
                sqlcmd.Connection  = cn;
                sqlcmd.CommandType = CommandType.StoredProcedure;
                cn.Open();

                sqlcmd.Parameters.AddWithValue("@dni", dni);
                sqlcmd.Parameters.AddWithValue("@nombre", nombre.Trim().ToUpper());
                sqlcmd.Parameters.AddWithValue("@apellido", apellido.Trim().ToUpper());
                sqlcmd.Parameters.AddWithValue("@fechaNac", Convert.ToDateTime(fechanac));
                sqlcmd.Parameters.AddWithValue("@mail", mail);
                sqlcmd.Parameters.AddWithValue("@telefono", telefono);
                sqlcmd.Parameters.AddWithValue("@empruc", empruc);
                sqlcmd.Parameters.AddWithValue("@empnom", empnom);
                SqlParameter par = new SqlParameter("@IdReg", SqlDbType.Int);
                par.Direction = ParameterDirection.Output;
                sqlcmd.Parameters.Add(par);
                sqlrows = sqlcmd.ExecuteNonQuery();


                res = Convert.ToString(sqlcmd.Parameters["@IdReg"].Value);
            }
            catch (Exception e)
            {
                //      res = e.Message;
                res = "-1";
            }

            return(res);
        }
Exemple #11
0
        public void LoadPortal(string dni)
        {
            string   flagconteotiempo = "";
            int      hora = 0, minuto = 0, segundo = 0;
            string   factvence = "";
            Conexion con = new Conexion();
            // String BodyHtml = "", HeadHtml = "", FotHtml = "";
            SqlConnection cn = con.conexion();

            cn.Open();
            SqlDataAdapter dap = new SqlDataAdapter("UP_MVE_LISTAPAGEINICIO", cn);
            DataTable      dt  = new DataTable();

            dap.SelectCommand.CommandType = CommandType.StoredProcedure;
            dap.SelectCommand.Parameters.AddWithValue("@Dni", dni);

            dap.Fill(dt);
            cn.Close();

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string HtmlSeccion = "";

                    string imgBase64 = "";
                    string stittulo  = "";
                    string sdetalle  = "";
                    string rutaimg   = "";
                    // string flagconteotiempo;
                    // int hora, minuto, segundo;



                    stittulo = dt.Rows[i]["c_htmlTit"].ToString();
                    sdetalle = dt.Rows[i]["c_htmlDesc"].ToString();
                    rutaimg  = dt.Rows[i]["c_foto1"].ToString();


                    stittulo = stittulo.ToUpper();
                    sdetalle = sdetalle.ToUpper();

                    flagconteotiempo = dt.Rows[i]["c_flagactcontador"].ToString();
                    factvence        = dt.Rows[i]["c_piemaxvenc"].ToString();

                    if (String.IsNullOrEmpty(factvence) == false)
                    {
                        hora    = Convert.ToInt32(dt.Rows[i]["n_horaRes"]);
                        minuto  = Convert.ToInt32(dt.Rows[i]["n_minuRes"]);
                        segundo = Convert.ToInt32(dt.Rows[i]["n_seguRes"]);
                    }
                    //  Bitmap b = new Bitmap(@"\\IBSERVER_1\Servidor de Archivos\Fotos\L17.jpg");
                    if (System.IO.File.Exists(@rutaimg))
                    {
                        Bitmap b = new Bitmap(rutaimg);
                        System.IO.MemoryStream ms = new System.IO.MemoryStream();
                        b.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                        byte[] byteImage = ms.ToArray();
                        imgBase64 = Convert.ToBase64String(byteImage);

                        dt.Rows[i][11] = "data:image/jpeg;base64," + imgBase64;
                        dt.AcceptChanges();
                    }

                    /*HtmlSeccion = " <td><tr >  <p style='font-weight: bold' >" + stittulo + "</p> </tr> </td>";
                     * HtmlSeccion = HtmlSeccion + "<td><tr >  " + sdetalle + "</tr></td>";
                     * HtmlSeccion = HtmlSeccion + "<td> <tr ><img  style='height: 100%; width: 100%; object-fit: contain' src='data:image/jpeg;base64," + imgBase64 + "' /></tr></td>";
                     * BodyHtml = BodyHtml + HtmlSeccion;*/
                }

                //  lblHeader.Text = "PROMOCIONES DEL DÍA " + DateTime.Now.ToShortDateString();
                repeatHtml.DataSource = dt;
                repeatHtml.DataBind();

                if (String.IsNullOrEmpty(factvence) == true || factvence == "")
                {
                    divConteo.Visible = false;
                }
                else
                {
                    lblfchavcto.InnerText = factvence + " ";
                }


                if (flagconteotiempo == "S")
                {
                    int tiempoTotal = (hora * 3600) + (minuto * 60) + segundo;
                    ClientScript.RegisterStartupScript(typeof(Page), "Script", "Activate(" + tiempoTotal + ")", true);
                }
            }
        }