コード例 #1
0
ファイル: FrmUploadEntryList.cs プロジェクト: hcarra90/SgpApp
        private void ExportarDatos(List <EntryList> datos)
        {
            string nombreArchivo = "";

            var            book            = FuncionesExcel.ExportaDetalleEntryList(datos);
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.InitialDirectory = @"C:\";
            saveFileDialog1.Title            = "Save Excel Files";
            saveFileDialog1.DefaultExt       = "xlsx";
            saveFileDialog1.Filter           = "Excel files (*.xlsx)|*.xlsx";
            saveFileDialog1.FilterIndex      = 2;
            saveFileDialog1.RestoreDirectory = true;

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                nombreArchivo = saveFileDialog1.FileName;
                try
                {
                    book.SaveAs(nombreArchivo);
                    MessageBox.Show("Archivo Creado!", "Módulo Carga", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: ", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
            }
        }
コード例 #2
0
        private void ExportarData()
        {
            if (listData.Count > 0)
            {
                string nombreArchivo = "";

                var            book            = FuncionesExcel.ExportaTemplateInfoFieldBook(listData);
                SaveFileDialog saveFileDialog1 = new SaveFileDialog();
                saveFileDialog1.InitialDirectory = @"C:\";
                saveFileDialog1.Title            = "Save Excel Files";
                saveFileDialog1.DefaultExt       = "xlsx";
                saveFileDialog1.Filter           = "Excel files (*.xlsx)|*.xlsx";
                saveFileDialog1.FilterIndex      = 2;
                saveFileDialog1.RestoreDirectory = true;

                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    nombreArchivo = saveFileDialog1.FileName;
                    try
                    {
                        book.SaveAs(nombreArchivo);
                        MessageBox.Show("Archivo Creado!", "Módulo Split", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Error: ", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    }
                }
            }
            else
            {
                MessageBox.Show("NO Existe Información Para Exportar!", "Módulo Split", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
コード例 #3
0
        private void ProcesaDatos()
        {
            if (datos.Count > 0)
            {
                string mensaje = "";

                var resultado = FuncionesExcel.SaveExcelData(datos);
                lblTotalFilas.Text  = resultado.TotalRows.ToString();
                lblModificadas.Text = resultado.NumeroActualizados.ToString();
                lblInsertadas.Text  = resultado.NumeroInsertados.ToString();

                if (resultado.Error != null && resultado.Error != "")
                {
                    mensaje = resultado.Error;
                }
                else
                {
                    mensaje = "Proceso Finalizado!";
                }

                MessageBox.Show(mensaje, "Módulo De Carga", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            }

            this.Cursor = Cursors.Default;
        }
コード例 #4
0
ファイル: FrmEficiencia.cs プロジェクト: hcarra90/SgpApp
        private void ExportaDatos()
        {
            this.Cursor = Cursors.WaitCursor;
            var wb = FuncionesExcel.ExportaEficiencia(detalleEficiencia, dtpFechaInicio.Value, dtpFechaTermino.Value, opcion);

            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.InitialDirectory = @"C:\";
            saveFileDialog1.Title            = "Save Excel Files";
            saveFileDialog1.DefaultExt       = "xlsx";
            saveFileDialog1.Filter           = "Excel files (*.xlsx)|*.xlsx";
            saveFileDialog1.FilterIndex      = 2;
            saveFileDialog1.RestoreDirectory = true;

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                nombreArchivo = saveFileDialog1.FileName;
                try
                {
                    wb.SaveAs(nombreArchivo);
                    MessageBox.Show("Archivo Creado!", "Módulo Eficiencia", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: ", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    this.Cursor = Cursors.Default;
                }
            }
        }
コード例 #5
0
ファイル: FrmPackingList.cs プロジェクト: hcarra90/SgpApp
        private void ExportarData()
        {
            this.Cursor = Cursors.WaitCursor;
            //List<string[]> titulos = new List<string[]>();

            //string[] t1=new string[]{ "Caja Envio","Euid","Ind Euid","Fecha Packing","Total Weight",
            //    "Total kernel", "Total Ear","Country","Breeder Code 1", "Breeder Code 2",
            //    "Breeder Code 3", "Breeder Code 4","Project Lead","Cc","Ship To","Crop" };
            //titulos.Add(t1);
            var wb = FuncionesExcel.ExportaPackingList(dataCajas, detailPackingList, cboShipment.SelectedValue.ToString());

            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.InitialDirectory = @"C:\";
            saveFileDialog1.Title            = "Save Excel Files";
            saveFileDialog1.DefaultExt       = "xlsx";
            saveFileDialog1.Filter           = "Excel files (*.xlsx)|*.xlsx";
            saveFileDialog1.FilterIndex      = 2;
            saveFileDialog1.RestoreDirectory = true;

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                nombreArchivo = saveFileDialog1.FileName;
                try
                {
                    wb.SaveAs(nombreArchivo);
                    MessageBox.Show("Archivo Creado!", "Módulo Packing", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: ", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
            }
        }
コード例 #6
0
        private void CreaExcel(CentroCostoExperimentoDto item)
        {
            string nombreArchivo = "";

            var            book            = FuncionesExcel.ExportaTemplateEntryList(item, lblInicio.Text);
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.InitialDirectory = @"C:\";
            saveFileDialog1.Title            = "Save Excel Files";
            saveFileDialog1.DefaultExt       = "xlsx";
            saveFileDialog1.Filter           = "Excel files (*.xlsx)|*.xlsx";
            saveFileDialog1.FilterIndex      = 2;
            saveFileDialog1.RestoreDirectory = true;

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                nombreArchivo = saveFileDialog1.FileName;
                try
                {
                    book.SaveAs(nombreArchivo);
                    MessageBox.Show("Archivo Creado!", "Módulo Centro Costo", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    btnProcesar.Enabled = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: ", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    btnProcesar.Enabled = false;
                }
            }
        }
コード例 #7
0
ファイル: FrmUploadEntryList.cs プロジェクト: hcarra90/SgpApp
        private void CargaArchivo()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "xlsx files (*.xlsx)|*.xlsx";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                pathFile = openFileDialog.FileName;
                //lblFile.Text = pathFile;
            }

            if (pathFile != "")
            {
                datos = FuncionesExcel.GetEntryListFile(pathFile);
                var resumen = (from EntryList in datos
                               group EntryList by new
                {
                    EntryList.Year,
                    EntryList.Country,
                    EntryList.Location,
                    EntryList.ExpName,
                    EntryList.Client,
                    EntryList.Crop
                } into g
                               select new
                {
                    g.Key.Year,
                    g.Key.Country,
                    N_Euid = g.Count(p => p.Euid != null),
                    g.Key.Location,
                    g.Key.ExpName,
                    g.Key.Client,
                    g.Key.Crop
                }).ToList();

                grdResumen.AutoGenerateColumns = false;
                grdResumen.DataSource          = resumen;
                grdResumen.ClearSelection();
                grdResumen.Text = "N° Filas : " + grdResumen.RowCount.ToString();

                if (resumen.Count == 1)
                {
                    var existe = InfoLocBusiness.GetLocByCuartel(resumen[0].Location.ToString()).FirstOrDefault();
                    if (existe != null)
                    {
                        grdeuids.AutoGenerateColumns = false;
                        grdeuids.DataSource          = datos;
                        grdeuids.ClearSelection();

                        btnProcesar.Enabled = true;
                    }
                }
                else
                {
                    btnProcesar.Enabled = false;
                    grpSplit.Enabled    = false;
                }
            }
        }
コード例 #8
0
        private void GeneraExcel()
        {
            List <string[]> titulos = new List <string[]>();

            string[] t1 = new string[] { "Fecha", "Origen", "Destino", "Location", "Crop",
                                         "Experiment", "Evento", "Gmo", "Sag", "Cc",
                                         "Internación", "N°Euid", "Kilos", "Conductor", "Rut", "Patente", "Creación", "Usuario" };
            titulos.Add(t1);
            var archivo = FuncionesExcel.ExportaGuiaDespacho(datosGuia, "Detalle Guía Despacho", titulos);

            archivo.SaveAs(@"C:\Template\Test.xlsx");
        }
コード例 #9
0
ファイル: FrmTemplate.cs プロジェクト: hcarra90/SgpApp
        private void btnPackingList_Click(object sender, EventArgs e)
        {
            IEnumerable <string> columnas = new List <string>()
            {
                "Fecha Envio", "Ship To", "Pallet"
            };
            List <string[]> titulos = new List <string[]>();

            string[] t1 = new string[] { "Caja Envio", "Euid", "Ind Euid", "Fecha Packing", "Total Weight",
                                         "Total kernel", "Total Ear", "Country", "Breeder Code 1", "Breeder Code 2",
                                         "Breeder Code 3", "Breeder Code 4", "Project Lead", "Cc", "Ship To", "Crop" };
            titulos.Add(t1);
            var resultado = FuncionesExcel.CreaTemplate("PackingList", titulos);
        }
コード例 #10
0
        private void CargaArchivo()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "xlsx files (*.xlsx)|*.xlsx";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                pathFile     = openFileDialog.FileName;
                lblFile.Text = pathFile;
            }

            if (pathFile != "")
            {
                datos = FuncionesExcel.GetData(pathFile);
                dataRows.AutoGenerateColumns = true;
                dataRows.DataSource          = datos;
                dataRows.ClearSelection();
                lblRows.Text = "N° Filas : " + dataRows.RowCount.ToString();
            }
        }
コード例 #11
0
        private void CargaArchivo()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "xlsx files (*.xlsx)|*.xlsx";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                pathFile = openFileDialog.FileName;
            }

            if (pathFile != "")
            {
                datos = FuncionesExcel.GetSplitFile(pathFile);
                var resumen = (from splits in datos
                               select splits).OrderBy(e => e.Euid).ToList();

                grdResumen.AutoGenerateColumns = false;
                grdResumen.DataSource          = resumen;
                grdResumen.ClearSelection();

                var listaV = (from splits in datos
                              select new EntryList {
                    Euid = splits.Euid
                }).ToList();

                var existe = EntryListBusiness.ValidateEuids(listaV);
                if (!existe)
                {
                    btnProcesar.Enabled = false;
                    MessageBox.Show("Euid No Existe ", "Módulo Split", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
                else
                {
                    btnProcesar.Enabled = true;
                }
                lblEuids.Text = resumen.Count.ToString();
            }
        }
コード例 #12
0
        private void ExportaDatos()
        {
            this.Cursor        = Cursors.WaitCursor;
            tracking.Info      = detailPackingList;
            tracking.Cosecha   = movCosecha;
            tracking.Desgrane  = movDesgrane;
            tracking.Secado    = movSecado;
            tracking.Packing   = movPacking;
            tracking.Shipping  = movShipping;
            tracking.Caja      = movCaja;
            tracking.Rogging   = movRogging;
            tracking.EntryList = entryList;

            var wb = FuncionesExcel.ExportaTracking(tracking, opcion, valor);

            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.InitialDirectory = @"C:\";
            saveFileDialog1.Title            = "Save Excel Files";
            saveFileDialog1.DefaultExt       = "xlsx";
            saveFileDialog1.Filter           = "Excel files (*.xlsx)|*.xlsx";
            saveFileDialog1.FilterIndex      = 2;
            saveFileDialog1.RestoreDirectory = true;

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                nombreArchivo = saveFileDialog1.FileName;
                try
                {
                    wb.SaveAs(nombreArchivo);
                    MessageBox.Show("Archivo Creado!", "Módulo Packing", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: ", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
            }
        }
コード例 #13
0
        private void CargaArchivo()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "xlsx files (*.xlsx)|*.xlsx";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                pathFile = openFileDialog.FileName;
                //lblFile.Text = pathFile;
            }

            if (pathFile != "")
            {
                try
                {
                    datos = FuncionesExcel.GetData(pathFile);
                    var val = InfoFieldBookBusiness.ValidateIndEuids(datos);
                    if (!val)
                    {
                        insertados = datos.Count;
                        InfoFieldBookBusiness.InsertBulk(datos);
                    }
                    //Validación Inicial
                    //foreach (var item in datos)
                    //{
                    //    infoF = InfoFieldBookBusiness.GetIndEuid(item.indEuid, item.euid);
                    //    if (infoF != null)
                    //    {
                    //        //infoF.Id = infoF.Id;
                    //        //infoF.cc = item.cc;
                    //        //infoF.client = item.client;
                    //        //infoF.codInternacion = item.codInternacion;
                    //        //infoF.CodPermanencia = item.CodPermanencia;
                    //        //infoF.codReception = item.codReception;
                    //        //infoF.country = item.country;
                    //        //infoF.crop = item.crop;
                    //        //infoF.ent = item.ent;
                    //        //infoF.EntName = item.EntName;
                    //        //infoF.EntRole = item.EntRole;
                    //        //infoF.gmoEvent = item.gmoEvent;
                    //        //infoF.GranosHilera = item.GranosHilera;
                    //        //infoF.instructions = item.instructions;
                    //        //infoF.location = item.location;
                    //        //infoF.LotId = item.LotId;
                    //        //infoF.opExpName = item.opExpName;
                    //        //infoF.order = item.order;
                    //        //infoF.Owner = item.Owner;
                    //        //infoF.plt = item.plt;
                    //        //infoF.ResImportation = item.ResImportation;
                    //        //infoF.rng = item.rng;
                    //        //infoF.sag = item.sag;
                    //        //infoF.year = item.year;

                    //        infoF.breedersCode1 = item.breedersCode1;
                    //        infoF.breedersCode2 = item.breedersCode2;
                    //        infoF.breedersCode3 = item.breedersCode3;
                    //        infoF.breedersCode4 = item.breedersCode4;
                    //        infoF.BreedersInstructions1 = item.BreedersInstructions1;
                    //        infoF.BreedersInstructions2 = item.BreedersInstructions2;
                    //        infoF.BreedersInstructions3 = item.BreedersInstructions3;
                    //        infoF.BreedersInstructions4 = item.BreedersInstructions4;
                    //        infoF.fechaModificacion = (DateTime?)DateTime.Now;
                    //        infoF.projecLead = item.projecLead;
                    //        infoF.projectCode = item.projectCode;
                    //        infoF.shelling = item.shelling;
                    //        infoF.shipTo = item.shipTo;
                    //        infoF.targears = item.targears;
                    //        infoF.targetKern = item.targetKern;
                    //        infoF.targetWg = item.targetWg;
                    //        infoF.obs = item.obs;
                    //        existentes.Add(infoF);

                    //        modificados++;
                    //    }
                    //    else
                    //    {
                    //        infoF = new InfoFieldBook();
                    //        infoF = item;
                    //        infoF.fechaCarga = DateTime.Now;
                    //        nuevos.Add(infoF);

                    //        insertados++;
                    //    }
                    //}

                    grdDetalle.AutoGenerateColumns = false;
                    grdDetalle.DataSource          = datos;
                    grdDetalle.ClearSelection();

                    lblEuids.Text       = "N° Filas : " + grdDetalle.RowCount.ToString();
                    btnProcesar.Enabled = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: " + ex.Message, "Módulo Carga Field Book", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
            }
        }