Esempio n. 1
0
        private void frmOP_ListadoVisita_Load(object sender, EventArgs e)
        {
            this.btnAgregar.Visible = balUSUARIO.TieneRegla(SharedData.Instance().getPermiso("VISITA_MODIFICAR"), (SharedData.Instance().Reglas ?? ""));
            cargarGrillaVisita();

            // Add the events to listen for
            //dgvListado.CellValueChanged +=
            //     new DataGridViewCellEventHandler(dgvListado_CellValueChanged);
            //dgvListado.CurrentCellDirtyStateChanged +=
            //     new EventHandler(dgvListado_CurrentCellDirtyStateChanged);
        }
Esempio n. 2
0
        private void dgvListado_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            // My combobox column is the second one so I hard coded a 1, flavor to taste
            if (balUSUARIO.TieneRegla(SharedData.Instance().getPermiso("VISITA_MODIFICAR"), (SharedData.Instance().Reglas ?? "")))
            {
                if (dgvListado.RowCount > 0 && e.ColumnIndex == 2)
                {
                    //MessageBox.Show(dgvListado.Rows[e.RowIndex].Cells["VIS_dia_semana"].Value.ToString());
                    try
                    {
                        eVISITA oeVISITA = new eVISITA();
                        oeVISITA.ZON_codigo     = Convert.ToInt32(dgvListado.Rows[e.RowIndex].Cells["ZON_codigo"].Value.ToString());
                        oeVISITA.VEN_codigo     = Convert.ToInt32(this.cmbVendedor.SelectedValue.ToString());
                        oeVISITA.VIS_dia_semana = dgvListado.Rows[e.RowIndex].Cells["VIS_dia_semana"].Value.ToString();
                        oeVISITA.VIS_cantidad_clientes_activos = 0;
                        oeVISITA.VIS_estado = "A";

                        if (balVISITA.actualizarRegistro(oeVISITA))
                        {
                            MessageBox.Show("El registro fue actualizado correctamente.", "SICO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            cargarComboZona();
                            cargarGrillaVisita();
                        }
                    }
                    catch (CustomException ex)
                    {
                        MessageBox.Show(ex.Message, "SICO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Ocurrió un error inesperado:\r\n" + ex.Message, "SICO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
        }
Esempio n. 3
0
        private void eliminarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (balUSUARIO.TieneRegla(SharedData.Instance().getPermiso("VISITA_MODIFICAR"), (SharedData.Instance().Reglas ?? "")))
            {
                if (!this.dgvListado.Rows[this.rowIndex].IsNewRow)
                {
                    try
                    {
                        eVISITA oeVISITA = new eVISITA();
                        oeVISITA.ZON_codigo = Convert.ToInt32(dgvListado.Rows[rowIndex].Cells["ZON_codigo"].Value.ToString());
                        oeVISITA.VEN_codigo = Convert.ToInt32(this.cmbVendedor.SelectedValue.ToString());

                        if (balVISITA.eliminarRegistro(oeVISITA))
                        {
                            MessageBox.Show("El registro fue eliminado correctamente.", "SICO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            cargarComboZona();
                            cargarGrillaVisita();
                        }
                    }
                    catch (CustomException ex)
                    {
                        MessageBox.Show(ex.Message, "SICO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Ocurrió un error inesperado:\r\n" + ex.Message, "SICO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            else
            {
                MessageBox.Show("Su usuario no tiene permiso para realizar esta operación.", "SICO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Esempio n. 4
0
 private void frmOP_ListadoVisita_VisibleChanged(object sender, EventArgs e)
 {
     i++;
     if (!balUSUARIO.TieneRegla(SharedData.Instance().getPermiso("VISITA_VER"), (SharedData.Instance().Reglas ?? "")) && (i == 1))
     {
         this.Close();
         MessageBox.Show("Su usuario no tiene permiso para ver este formulario.", "SICO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Esempio n. 5
0
 private void _frmBaseRPT_VisibleChanged(object sender, EventArgs e)
 {
     i++;
     //MessageBox.Show(i.ToString());
     if (tabla.Length > 0)
     {
         if (!balUSUARIO.TieneRegla(SharedData.Instance().getPermiso((tabla ?? "") + "_VER"), (SharedData.Instance().Reglas ?? "")) && (i == 1))
         {
             this.Close();
             MessageBox.Show("Su usuario no tiene permiso para ver este formulario.", "SICO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }
Esempio n. 6
0
 private void frmOP_GeneracionDocumentos_Load(object sender, EventArgs e)
 {
     this.btnGenerar.Visible   = balUSUARIO.TieneRegla(SharedData.Instance().getPermiso("PEDIDO_GENERAR"), (SharedData.Instance().Reglas ?? ""));
     this.dgvOrigen.DataSource = dataOrigen();
     cargarDataDestino();
 }
Esempio n. 7
0
 private void verificarPermisos()
 {
     this.btnNuevo.Visible       = balUSUARIO.TieneRegla(SharedData.Instance().getPermiso(tabla + "_CREAR"), (SharedData.Instance().Reglas ?? ""));
     this.btnActualizar.Visible  = balUSUARIO.TieneRegla(SharedData.Instance().getPermiso(tabla + "_MODIFICAR"), (SharedData.Instance().Reglas ?? ""));
     this.btnEliminar.Visible    = balUSUARIO.TieneRegla(SharedData.Instance().getPermiso(tabla + "_ELIMINAR"), (SharedData.Instance().Reglas ?? ""));
     this.lblInfoSistema.Visible = balUSUARIO.TieneRegla(SharedData.Instance().getPermiso("INFOSISTEMA"), (SharedData.Instance().Reglas ?? ""));
     this.lblInfoControl.Visible = balUSUARIO.TieneRegla(SharedData.Instance().getPermiso("INFOSISTEMA"), (SharedData.Instance().Reglas ?? ""));
 }
Esempio n. 8
0
        private void verificarPermisos()
        {
            if (!balUSUARIO.TieneRegla(SharedData.Instance().getPermiso("DESCUENTO_VER"), (SharedData.Instance().Reglas ?? "")))
            {
                this.tabDescuentos.TabPages.Remove(Grupal);
            }

            if (!balUSUARIO.TieneRegla(SharedData.Instance().getPermiso("DESCUENTO_P_VER"), (SharedData.Instance().Reglas ?? "")))
            {
                this.tabDescuentos.TabPages.Remove(PorSocio);
            }

            if (tabDescuentos.SelectedTab == tabDescuentos.TabPages["Grupal"])
            {
                this.btnGuardar.Visible = balUSUARIO.TieneRegla(SharedData.Instance().getPermiso("DESCUENTO_MODIFICAR"), (SharedData.Instance().Reglas ?? ""));
            }
            else
            {
                this.btnGuardar.Visible = balUSUARIO.TieneRegla(SharedData.Instance().getPermiso("DESCUENTO_P_MODIFICAR"), (SharedData.Instance().Reglas ?? ""));
            }
        }
Esempio n. 9
0
 private void verificarPermisos()
 {
     if (tabla.Length > 0)
     {
         this.btnGuardar.Visible = balUSUARIO.TieneRegla(SharedData.Instance().getPermiso(tabla + "_MODIFICAR"), (SharedData.Instance().Reglas ?? ""));
     }
 }
Esempio n. 10
0
 private void frmOP_ImportarPedidos_Load(object sender, EventArgs e)
 {
     this.btnImportar.Visible = balUSUARIO.TieneRegla(SharedData.Instance().getPermiso("PEDIDO_IMPORTAR"), (SharedData.Instance().Reglas ?? ""));
 }
Esempio n. 11
0
        public static void ExportarPdf(DataGridView dgv, String referencia, string parametros)
        {
            bool isImprimir = true;

            if (dgv.RowCount == 0)
            {
                DialogResult dialogResult = MessageBox.Show("La grilla no contiene filas, aún así ¿Desea exportarla?", "SICO", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialogResult == DialogResult.No)
                {
                    isImprimir = false;
                }
            }

            if (isImprimir)
            {
                string    strPdfPath = "";
                DataTable dtblTable  = (DataTable)(dgv.DataSource);

                SaveFileDialog sfd = new SaveFileDialog();
                sfd.FileName = referencia;
                sfd.Filter   = "Archivo PDF (*.pdf)|*.pdf";

                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    strPdfPath = sfd.FileName;
                    //
                    System.IO.FileStream fs       = new FileStream(strPdfPath, FileMode.Create, FileAccess.Write, FileShare.None);
                    Document             document = new Document();
                    document.SetPageSize(iTextSharp.text.PageSize.A4);
                    PdfWriter writer = PdfWriter.GetInstance(document, fs);
                    document.Open();

                    //Report Header
                    BaseFont             bfntHead   = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
                    iTextSharp.text.Font fntHead    = new iTextSharp.text.Font(bfntHead, 16, 1, iTextSharp.text.Color.GRAY);
                    Paragraph            prgHeading = new Paragraph();
                    prgHeading.Alignment = Element.ALIGN_CENTER;
                    prgHeading.Add(new Chunk(referencia.ToUpper(), fntHead));
                    document.Add(prgHeading);

                    //Author
                    Paragraph            prgAuthor = new Paragraph();
                    BaseFont             btnAuthor = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
                    iTextSharp.text.Font fntAuthor = new iTextSharp.text.Font(btnAuthor, 8, 2, iTextSharp.text.Color.GRAY);
                    prgAuthor.Alignment = Element.ALIGN_RIGHT;
                    prgAuthor.Add(new Chunk("Sistema de gestión comercial SICO", fntAuthor));

                    if (parametros.Length > 0)
                    {
                        prgAuthor.Add(new Chunk("\n" + parametros, fntAuthor));
                    }

                    prgAuthor.Add(new Chunk("\nAutor : " + SharedData.Instance().USU_nombre_completo, fntAuthor));
                    prgAuthor.Add(new Chunk("\nFecha : " + DateTime.Now, fntAuthor));
                    document.Add(prgAuthor);

                    //Add a line seperation
                    Paragraph p = new Paragraph(new Chunk(new iTextSharp.text.pdf.draw.LineSeparator(0.0F, 100.0F, iTextSharp.text.Color.BLACK, Element.ALIGN_LEFT, 1)));
                    document.Add(p);

                    //Add line break
                    document.Add(new Chunk("\n", fntHead));

                    //Write the table
                    PdfPTable table = new PdfPTable(dtblTable.Columns.Count);
                    //Table header
                    BaseFont             btnColumnHeader = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
                    iTextSharp.text.Font fntColumnHeader = new iTextSharp.text.Font(btnColumnHeader, 10, 1, iTextSharp.text.Color.WHITE);
                    for (int i = 0; i < dtblTable.Columns.Count; i++)
                    {
                        PdfPCell cell = new PdfPCell();
                        cell.BackgroundColor = iTextSharp.text.Color.GRAY;
                        cell.AddElement(new Chunk(dtblTable.Columns[i].ColumnName.ToUpper(), fntColumnHeader));
                        table.AddCell(cell);
                    }
                    //table Data
                    for (int i = 0; i < dtblTable.Rows.Count; i++)
                    {
                        for (int j = 0; j < dtblTable.Columns.Count; j++)
                        {
                            table.AddCell(dtblTable.Rows[i][j].ToString());
                        }
                    }
                    //
                    table.WidthPercentage = 100;
                    //
                    document.Add(table);

                    document.Close();
                    writer.Close();
                    fs.Close();

                    //
                    DialogResult dialogResult2 = MessageBox.Show("El archivo fue exportado satisfactoriamente en la ruta: " + sfd.FileName + "\r\n\r\n¿Desea abrirlo?", "SICO", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dialogResult2 == DialogResult.Yes)
                    {
                        System.Diagnostics.Process.Start(sfd.FileName);
                    }
                }
            }
        }
Esempio n. 12
0
 private void verificarPermisos()
 {
     this._principal.toolStripButton1.Visible = balUSUARIO.TieneRegla(SharedData.Instance().getPermiso("SOCIO_VER"), (SharedData.Instance().Reglas ?? ""));
     this._principal.toolStripButton2.Visible = balUSUARIO.TieneRegla(SharedData.Instance().getPermiso("PRODUCTO_VER"), (SharedData.Instance().Reglas ?? ""));
     this._principal.toolStripButton3.Visible = balUSUARIO.TieneRegla(SharedData.Instance().getPermiso("VENTA_VER"), (SharedData.Instance().Reglas ?? ""));
     this._principal.toolStripButton4.Visible = balUSUARIO.TieneRegla(SharedData.Instance().getPermiso("DETALLE_LISTA_PRECIO_VER"), (SharedData.Instance().Reglas ?? ""));
 }
Esempio n. 13
0
 private void verificarPermisos()
 {
     this.btnCrear.Visible      = balUSUARIO.TieneRegla(SharedData.Instance().getPermiso(tabla + "_CREAR"), (SharedData.Instance().Reglas ?? ""));
     this.btnActualizar.Visible = balUSUARIO.TieneRegla(SharedData.Instance().getPermiso(tabla + "_MODIFICAR"), (SharedData.Instance().Reglas ?? ""));
     this.btnAnular.Visible     = balUSUARIO.TieneRegla(SharedData.Instance().getPermiso(tabla + "_ANULAR"), (SharedData.Instance().Reglas ?? ""));
 }