public void SincronizaOrden()
        {
            VGlobales.WsqlE_My = "";
            try
            {
                string reff = "";
                for (int i = 0; i <= vsp_categorias.ActiveSheet.RowCount - 1; i++)
                {
                    VGlobales.WsqlE_My += "\n\r";;
                    VGlobales.WsqlE_My += " Call App_Crud_Categorias('" + VGlobales.PEmpresa_Cod + "','','" + vsp_categorias.ActiveSheet.Cells[i, 1].Text.ToString() + "','','',''," + i.ToString() + ",'','','S');";
                }


                if (VGlobales.WsqlE_My.ToString().Trim() != "")
                {
                    Conexion_Mysql.Ejecutar2_Mysql(VGlobales.WsqlE_My, ref reff);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "Opcion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                VGlobales.WsqlE_My = "";
            }
            VGlobales.WsqlE_My = "";
        }
Example #2
0
        public static void SizesImg()
        {
            WsqlE_My = "select * from TAB_IMG_SIZES";
            DataTable dnt_img = new DataTable();

            Conexion_Mysql.LlenarTabla_Mysql(ref dnt_img, WsqlE_My);

            if (dnt_img.Rows.Count > 0)
            {
                for (int k = 0; k <= dnt_img.Rows.Count - 1; k++)
                {
                    switch (dnt_img.Rows[k]["Nombre"].ToString().Trim())
                    {
                    case "Categorias":
                        ancho_c    = int.Parse(dnt_img.Rows[k]["ancho"].ToString());
                        alto_c     = int.Parse(dnt_img.Rows[k]["alto"].ToString());
                        ACategoria = (dnt_img.Rows[k]["AjustarTamano"].ToString() == "0" ? false : true);
                        break;

                    case "SubCategorias":
                        ancho_s       = int.Parse(dnt_img.Rows[k]["ancho"].ToString());
                        alto_s        = int.Parse(dnt_img.Rows[k]["alto"].ToString());
                        ASubcategoria = (dnt_img.Rows[k]["AjustarTamano"].ToString() == "0" ? false : true);
                        break;

                    case "Productos 1":
                        ancho_p1    = int.Parse(dnt_img.Rows[k]["ancho"].ToString());
                        alto_p1     = int.Parse(dnt_img.Rows[k]["alto"].ToString());
                        AProductos1 = (dnt_img.Rows[k]["AjustarTamano"].ToString() == "0" ? false : true);
                        break;

                    case "Productos 2":
                        ancho_p2    = int.Parse(dnt_img.Rows[k]["ancho"].ToString());
                        alto_p2     = int.Parse(dnt_img.Rows[k]["alto"].ToString());
                        AProductos2 = (dnt_img.Rows[k]["AjustarTamano"].ToString() == "0" ? false : true);
                        break;

                    case "Logo":
                        ancho_logo = int.Parse(dnt_img.Rows[k]["ancho"].ToString());
                        alto_logo  = int.Parse(dnt_img.Rows[k]["alto"].ToString());
                        break;

                    case "Imagen Bienvenida":
                        ancho_bienve = int.Parse(dnt_img.Rows[k]["ancho"].ToString());
                        alto_bienve  = int.Parse(dnt_img.Rows[k]["alto"].ToString());
                        break;

                    case "Onboarding":
                        ancho_onboar = int.Parse(dnt_img.Rows[k]["ancho"].ToString());
                        alto_onboard = int.Parse(dnt_img.Rows[k]["alto"].ToString());
                        break;

                    case "Banner":
                        ancho_banner = int.Parse(dnt_img.Rows[k]["ancho"].ToString());
                        alto_banner  = int.Parse(dnt_img.Rows[k]["alto"].ToString());
                        break;
                    }
                }
            }
        }
        private void Btn_Reactivar_Click(object sender, EventArgs e)
        {
            try
            {
                string reff = "";
                int    fila = vsp_categorias.ActiveSheet.ActiveRowIndex;
                if (vsp_categorias.ActiveSheet.RowCount > 0)
                {
                    if (vsp_categorias.ActiveSheet.Cells[fila, 6].Text.ToString().Trim() == "S")
                    {
                        MessageBox.Show("Unicamente Categorias Inactivas pueden Reactivarse, Revise", "Opcion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }

                    if (MessageBox.Show("Esta Seguro de Desactivar la Categoria: " + vsp_categorias.ActiveSheet.Cells[fila, 2].Text.ToString() + "", "Opcion", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        VGlobales.WsqlE_My = " Call App_Crud_Categorias('" + VGlobales.PEmpresa_Cod + "','','" + vsp_categorias.ActiveSheet.Cells[fila, 1].Text.ToString() + "','','','',0,'','','N');";
                        Conexion_Mysql.Ejecutar2_Mysql(VGlobales.WsqlE_My, ref reff);
                        MessageBox.Show("Categoria Reactivada Sastifactoriamente", "Opcion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        ExtraerMov();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "Opcion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Example #4
0
        private void MDI_Load(object sender, EventArgs e)
        {
            //VGlobales.WslqE_My = " Call App_GetEmpresas('','N'); ";
            Cbo_Empresas.DropDownStyle = ComboBoxStyle.DropDownList;

            Conexion_Mysql.CargaCombo(" Call App_GetEmpresas('','N'); ", Cbo_Empresas, "EMPRESA", "CODEMPRESA", false, false);

            VGlobales.PEmpresa_Cod   = Cbo_Empresas.SelectedValue.ToString().Trim();
            VGlobales.NOMBRE_EMPRESA = Cbo_Empresas.Text.ToString().Trim();
            VGlobales.FTPSettings();
            VGlobales.SizesImg();

            Cbo_Empresas.Enabled = false;


            this.Text = Cbo_Empresas.Text.ToString().Trim();
        }
Example #5
0
        public static void FTPSettings()
        {
            DataTable dnt_ftp = new DataTable();

            WsqlE_My = "select * from TAB_CONFIG_FTP; ";
            Conexion_Mysql.LlenarTabla_Mysql(ref dnt_ftp, WsqlE_My);

            if (dnt_ftp.Rows.Count > 0)
            {
                Server_FTP        = dnt_ftp.Rows[0]["Servidor"].ToString().Trim();
                Usuario_FTP       = dnt_ftp.Rows[0]["Usuario"].ToString().Trim();
                Contraseña_FTP    = dnt_ftp.Rows[0]["Contraseña"].ToString().Trim();
                SubDirectorio_FTP = dnt_ftp.Rows[0]["SubDirectorio"].ToString().Trim();

                Dominio_FTP = dnt_ftp.Rows[0]["Dominio"].ToString().Trim();
            }
        }
        public string Consecutivo()
        {
            string    Conse   = "";
            DataTable dtconse = new DataTable();

            VGlobales.WsqlE_My = " SELECT IFNULL(MAX(CODCATEGORIA),0)+1 AS CODIGO FROM TCATEGORIA; ";
            Conexion_Mysql.LlenarTabla_Mysql(ref dtconse, VGlobales.WsqlE_My);

            if (dtconse.Rows.Count > 0)
            {
                Conse = Utilities.ZtrCero(dtconse.Rows[0]["CODIGO"].ToString().Trim(), 8);
            }
            else
            {
                Conse = "1";
            }

            return(Conse);
        }
        public void CargarTodos()
        {
            try
            {
                Grp_Datos.Visible = false;
                DataTable dtnt = new DataTable();
                VGlobales.WsqlE_My = " Call App_Crud_Categorias('" + VGlobales.PEmpresa_Cod + "','','','','','',0,'','" + XActivo + "','R');";
                Conexion_Mysql.LlenarTabla_Mysql(ref dtnt, VGlobales.WsqlE_My);

                if (dtnt.Rows.Count > 0)
                {
                    vsp_categorias.ActiveSheet.Rows.Count = dtnt.Rows.Count;

                    for (int i = 0; i <= vsp_categorias.ActiveSheet.Rows.Count - 1; i++)
                    {
                        vsp_categorias.ActiveSheet.Cells[i, 0].Text      = dtnt.Rows[i]["Marca"].ToString().Trim();
                        vsp_categorias.ActiveSheet.Cells[i, 0].Tag       = dtnt.Rows[i]["CodigoMarca"].ToString().Trim();
                        vsp_categorias.ActiveSheet.Cells[i, 1].Text      = dtnt.Rows[i]["Codigo"].ToString().Trim();
                        vsp_categorias.ActiveSheet.Cells[i, 2].Text      = dtnt.Rows[i]["Categoria"].ToString().Trim();
                        vsp_categorias.ActiveSheet.Cells[i, 2].BackColor = md.Hexa_a_Color(dtnt.Rows[i]["Color"].ToString());
                        vsp_categorias.ActiveSheet.Cells[i, 3].Tag       = dtnt.Rows[i]["Color"].ToString().Trim();
                        vsp_categorias.ActiveSheet.Cells[i, 3].Text      = md.GetColourName(dtnt.Rows[i]["Color"].ToString().Trim());
                        vsp_categorias.ActiveSheet.Cells[i, 4].Text      = dtnt.Rows[i]["Url"].ToString().Trim();
                        vsp_categorias.ActiveSheet.Cells[i, 5].Text      = dtnt.Rows[i]["Referencia"].ToString().Trim();
                        vsp_categorias.ActiveSheet.Cells[i, 6].Text      = dtnt.Rows[i]["Activo"].ToString().Trim();
                    }
                }
                else
                {
                    vsp_categorias.ActiveSheet.Rows.Count = 0;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "Opcion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            Grp_Datos.Visible = true;
        }
        private void Btn_Marca_Click(object sender, EventArgs e)
        {
            DataTable dtncat  = new DataTable();
            DataTable dtncatc = new DataTable();

            VGlobales.WsqlE_My = " SELECT CODMARCA as CODIGO,NOMBRE AS DESCRIPCION FROM CAT_DATOMARCA WHERE ACTIVO='S' AND CODMARCA IN (SELECT CODMARCA FROM REL_SEGMENTO_EMPRESA_MARCA WHERE CODEMPRESA='" + VGlobales.PEmpresa_Cod.ToString() + "');";

            Conexion_Mysql.LlenarTabla_Mysql(ref dtncat, VGlobales.WsqlE_My);

            PCGUtility.FrmBusqueda frm = new PCGUtility.FrmBusqueda(dtncat, "Codigo", "Marca", "Listado de Marcas");

            frm.ShowDialog();

            if (frm.RCodigo.ToString().Trim() != "")
            {
                txtMarca.Text = frm.RDesc.ToString().Trim();
                txtMarca.Tag  = frm.RCodigo.ToString().Trim();
                Conexion_Mysql.LlenarTabla_Mysql(ref dtncatc, "select APLICA_ERP from CAT_DATOMARCA where CODMARCA=" + txtMarca.Tag.ToString() + "");

                Btn_Marca.Tag = dtncatc.Rows[0]["APLICA_ERP"].ToString().Trim();
            }
        }
        private void Btn_Guardar_Click(object sender, EventArgs e)
        {
            try
            {
                Guid   g;
                string nombre_carpeta = "categorias", nombre_archivo = "", path_archivo = "", url_img = "", result = "", colorHex = "";

                DataTable dtnresp = new DataTable();
                if (txtDescripcion.Text.ToString().Trim() == "")
                {
                    MessageBox.Show("El nombre de la categoria no puede ser vacio, Revise", "Opcion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    return;
                }


                if (txtMarca.Tag.ToString().Trim() == "")
                {
                    MessageBox.Show("Se requiere una marca valida, Revise", "Opcion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    return;
                }


                Btn_Guardar.Enabled = false;
                nombre_archivo      = txtCodigo.Text;
                path_archivo        = pb_categorias.Tag.ToString();

                if (path_archivo != "")
                {
                    g = Guid.NewGuid();

                    url_img = VGlobales.Dominio_FTP + VGlobales.SubDirectorio_FTP + "/" + nombre_carpeta.ToLower() + "/" + nombre_archivo.Trim() + ".png" + "?time=" + g.ToString().Replace("-", "").Trim() + "";
                }


                VGlobales.WsqlE_My = " Call App_Crud_Categorias('" + VGlobales.PEmpresa_Cod + "','" + txtMarca.Tag.ToString() + "','" + txtCodigo.Text.ToString().Trim() + "','" + txtDescripcion.Text.ToString().Trim().Replace("'", "") + "','" + lblColor.Text.ToString() + "','" + url_img + "',0,'" + txtReferencia.Text.ToString().Trim().Replace("'", "") + "','S','C');";

                Conexion_Mysql.LlenarTabla_Mysql(ref dtnresp, VGlobales.WsqlE_My);



                if (dtnresp.Rows[0]["Resp"].ToString().Trim() == "N")
                {
                    MessageBox.Show(dtnresp.Rows[0]["Mensaje"].ToString().Trim(), "Opcion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    Btn_Guardar.Enabled = true;
                    return;
                }
                else
                {
                    if (path_archivo != "")
                    {
                        md.Crear_Carpeta(VGlobales.Server_FTP, nombre_carpeta.ToLower(), VGlobales.Usuario_FTP, VGlobales.Contraseña_FTP, null, null);
                        md.Envio_ArchivoFTP_ImgB64(nombre_carpeta, nombre_archivo, path_archivo);
                    }
                    MessageBox.Show(dtnresp.Rows[0]["Mensaje"].ToString().Trim(), "Opcion", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    if (Flag == "A")
                    {
                        Limpiar();
                    }
                    else
                    {
                        this.Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "Opcion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                Btn_Guardar.Enabled = true;
            }
        }