Ejemplo n.º 1
0
        private void BuscaInfo()
        {
            var data = InfoFieldBookBusiness.GetEuid(txtEuid.Text, "");

            dataEuid.AutoGenerateColumns = false;
            dataEuid.DataSource          = data;
            dataEuid.ClearSelection();
            lblTotal.Text = dataEuid.RowCount.ToString();
        }
Ejemplo n.º 2
0
        private void BuscarInfo(string euid)
        {
            dataEuid.DataSource = null;

            var euidData = InfoFieldBookBusiness.GetEuid(euid, "");

            dataEuid.AutoGenerateColumns = false;
            dataEuid.DataSource          = euidData;
            dataEuid.ClearSelection();
            primeraCarga = false;
        }
Ejemplo n.º 3
0
        private void LlenaGrillaInfo(string valor)
        {
            detailPackingList = InfoFieldBookBusiness.GetEuid(valor, opcion);
            dataDetail.AutoGenerateColumns = false;
            dataDetail.DataSource          = detailPackingList;
            dataDetail.ClearSelection();

            var euid    = detailPackingList.GroupBy(c => c.euid).Count().ToString();
            var indEuid = detailPackingList.Count(c => c.indEuid != "").ToString();

            lblTotalEuid.Text = euid;
            lblTotalInd.Text  = indEuid;
        }
Ejemplo n.º 4
0
        private void bg_DoWork(object sender, DoWorkEventArgs e)
        {
            totalEmpleadosProcesar = datos.Count;

            //Se debe crear lista de InfoFieldBook para cargarlas
            foreach (var item in datos)
            {
                itemInfoField.BreedersInstructions1 = item.Bi1;
                itemInfoField.BreedersInstructions2 = item.Bi2;
                itemInfoField.BreedersInstructions3 = item.Bi3;
                itemInfoField.BreedersInstructions4 = item.Bi4;
                itemInfoField.cc             = item.Cc;
                itemInfoField.client         = item.Client;
                itemInfoField.codInternacion = item.CodInternacion;
                itemInfoField.CodPermanencia = item.CodPermanencia;
                itemInfoField.codReception   = item.CodReception;
                itemInfoField.country        = item.Country;
                itemInfoField.crop           = item.Crop;
                itemInfoField.ent            = item.Ent;
                itemInfoField.EntName        = item.EntName;
                itemInfoField.EntRole        = item.EntRole;
                itemInfoField.euid           = item.Euid;
                itemInfoField.fechaCarga     = DateTime.Now;
                itemInfoField.gmoEvent       = item.GmoEvent;
                itemInfoField.GranosHilera   = int.Parse(item.GranosHilera);
                itemInfoField.indEuid        = "";
                itemInfoField.instructions   = "";
                itemInfoField.location       = item.Location;
                itemInfoField.LotId          = item.LotId;
                itemInfoField.obs            = item.Obs;
                itemInfoField.opExpName      = item.ExpName;
                itemInfoField.Owner          = item.Owner;
                itemInfoField.plt            = item.Plt;
                itemInfoField.projecLead     = item.ProjectLead;
                itemInfoField.projectCode    = item.ProjectCode;
                itemInfoField.ResImportation = item.ResImportacion;
                itemInfoField.rng            = item.Rng;
                itemInfoField.sag            = item.Sag;
                itemInfoField.year           = item.Year;
                listaSplit.Add(itemInfoField);
                itemInfoField = new InfoFieldBook();

                progreso++;                                                                                  //Aumentando el progreso
                porciento = Convert.ToInt16((((double)progreso / (double)totalEmpleadosProcesar) * 100.00)); //Calculo del porcentaje
                bg.ReportProgress(porciento);
            }
            EntryListBusiness.InsertBulk(datos);
            InfoFieldBookBusiness.InsertBulk(listaSplit);
        }
Ejemplo n.º 5
0
        private void LlenaCombos()
        {
            //Combo Project Lead
            var data2 = InfoFieldBookBusiness.GetProjectLead();

            cboProject.DisplayMember = "projectLead";
            cboProject.ValueMember   = "projectLead";
            cboProject.DataSource    = data2;

            //Combo Anio
            var anios = InfoFieldBookBusiness.GetAnio();

            cboAnio.DisplayMember = "anio";
            cboAnio.ValueMember   = "anio";
            cboAnio.DataSource    = anios;
        }
Ejemplo n.º 6
0
        private void LlenaComboBox()
        {
            //Combo Ship To
            var data = InfoShippingBusiness.GetAll();

            cboShipTo.DisplayMember = "shipTo";
            cboShipTo.ValueMember   = "shipTo";
            cboShipTo.DataSource    = data;

            //Combo Project Lead
            var data2 = InfoFieldBookBusiness.GetProjectLead();

            cboProject.DisplayMember = "projectLead";
            cboProject.ValueMember   = "projectLead";
            cboProject.DataSource    = data2;

            //Combo Emails
            var emails = EmailBusiness.GetEmails();

            cboEmail.DisplayMember = "EmailUsado";
            cboEmail.ValueMember   = "Id";
            cboEmail.DataSource    = emails;

            //Combo Anio
            var anios = InfoFieldBookBusiness.GetAnio();

            cboAnio.DisplayMember = "anio";
            cboAnio.ValueMember   = "anio";
            cboAnio.DataSource    = anios;

            //Combo CC
            var ccs = InfoFieldBookBusiness.GetCC();

            cboCC.DisplayMember = "cc";
            cboCC.ValueMember   = "cc";
            cboCC.DataSource    = ccs;

            //Combo ExpName
            var expNames = InfoFieldBookBusiness.GetExpName();

            cboExpName.DisplayMember = "expName";
            cboExpName.ValueMember   = "expName";
            cboExpName.DataSource    = expNames;
        }
Ejemplo n.º 7
0
        private void ImprimeEtiqueta()
        {
            string euidC = "";

            if (txtEuid.Text != "")
            {
                euidC = txtEuid.Text;
            }

            var infoField = InfoFieldBookBusiness.GetIndEuid(txtIndEuid.Text, euidC);

            if (infoField != null && impresora != "")
            {
                zebraInstructions = new StringBuilder();

                string bc1      = infoField.breedersCode1 ?? "";
                string bc2      = infoField.breedersCode2 ?? "";
                string bc3      = infoField.breedersCode3 ?? "";
                string bc4      = infoField.breedersCode4 ?? "";
                string euid     = txtEuid.Text;
                string shipTo   = infoField.shipTo;
                string order    = infoField.order.ToString() ?? "";
                string tw       = movimientoPacking.totalWeight.ToString();
                string tk       = movimientoPacking.totalKernels.ToString();
                string te       = movimientoPacking.totalEars.ToString();
                string year     = (infoField.year == null) ? "" : infoField.year.ToString();
                string location = infoField.location ?? "";
                string rng      = (infoField.rng == null) ? "" : infoField.rng.ToString();
                string plt      = (infoField.plt == null) ? "" : infoField.plt.ToString();
                string ent      = (infoField.ent == null) ? "" : infoField.ent.ToString();

                zebraInstructions.Append("^XA\n");
                //Codigo Barra Euid
                zebraInstructions.Append("^BY2,3,60" + Environment.NewLine);
                zebraInstructions.Append("^FO20,20^BC^FD" + euid + "^FS" + Environment.NewLine);
                //QR Euid
                zebraInstructions.Append("^FT687,112^BQN,2,4" + Environment.NewLine);
                zebraInstructions.Append(@"^FH\^FDLA," + euid + "^FS" + Environment.NewLine);

                zebraInstructions.Append(@"^FT36,155^A0N,39,38^FH\^FDShip To^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT63,208^A0N,39,38^FH\^FD" + shipTo + "^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT290,155^A0N,39,38^FH\^FD" + bc1 + "^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT694,155^A0N,39,38^FH\^FDOrder^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT723,208^A0N,39,38^FH\^FD" + order + "^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT369,231^A0N,39,38^FH\^FD" + bc2 + "^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT36,273^A0N,25,31^FH\^FD" + bc3 + "^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT36,311^A0N,25,31^FH\^FD" + bc4 + "^FS" + Environment.NewLine);


                if (movimientoPacking.indEuid != "")
                {
                    //Codigo Barra IndEuid
                    zebraInstructions.Append("^BY2,3,60" + Environment.NewLine);
                    zebraInstructions.Append("^FO20,320^BC^FD" + movimientoPacking.indEuid + "^FS" + Environment.NewLine);
                    //QR IndEuid
                    zebraInstructions.Append("^FT687,389^BQN,2,4" + Environment.NewLine);
                    zebraInstructions.Append(@"^FH\^FDLA," + movimientoPacking.indEuid + "^FS" + Environment.NewLine);
                }

                zebraInstructions.Append(@"^FT40,423^A0N,28,28^FH\^FDWeight (gr):^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT85,461^A0N,28,28^FH\^FD" + tw + "^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT352,423^A0N,28,28^FH\^FDKernels:^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT384,461^A0N,28,28^FH\^FD" + tk + "^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT665,423^A0N,28,28^FH\^FDEars:^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT685,461^A0N,28,28^FH\^FD" + te + "^FS" + Environment.NewLine);

                zebraInstructions.Append(@"^FT32,500^A0N,28,28^FH\^FDYear:^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT105,499^A0N,27,28^FH\^FD" + year + "^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT289,500^A0N,28,28^FH\^FDLoc:^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT348,499^A0N,27,28^FH\^FD" + location + "^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT32,544^A0N,28,28^FH\^FDRNG:^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT114,543^A0N,27,28^FH\^FD" + rng + "^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT355,544^A0N,28,28^FH\^FDPLT:^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT445,543^A0N,27,28^FH\^FD" + plt + "^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT636,544^A0N,28,28^FH\^FDENT:^FS" + Environment.NewLine);
                zebraInstructions.Append(@"^FT707,543^A0N,27,28^FH\^FD" + ent + "^FS" + Environment.NewLine);
                zebraInstructions.Append("^PQ1,0,1,Y" + Environment.NewLine);
                zebraInstructions.Append("^XZ");

                //Habilitar en la casa
                string selectedPrinterName = impresora;//"ZDesigner ZM400 200 dpi (ZPL)";
                new ZebraPrinter(selectedPrinterName).Print(zebraInstructions.ToString());
            }
        }
Ejemplo n.º 8
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);
                }
            }
        }
Ejemplo n.º 9
0
        //private void ExportarDatos(List<InfoFieldBook> 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);
        //        }

        //    }
        //}
        #endregion

        #region -------Rutina Barra de Progreso-------
        private void bg_DoWork(object sender, DoWorkEventArgs e)
        {
            totalEmpleadosProcesar = datos.Count;

            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;

                    modificados++;
                }
                else
                {
                    infoF            = new InfoFieldBook();
                    infoF            = item;
                    infoF.fechaCarga = DateTime.Now;
                    insertados++;
                }
                InfoFieldBookBusiness.GrabaInformacion(infoF);

                progreso++;                                                                                  //Aumentando el progreso
                porciento = Convert.ToInt16((((double)progreso / (double)totalEmpleadosProcesar) * 100.00)); //Calculo del porcentaje
                bg.ReportProgress(porciento);
            }
        }
Ejemplo n.º 10
0
        private void GrabaEuid(int tipo)
        {
            MovimientoShipping       movimientoShipping = new MovimientoShipping();
            TransactionalInformation transaccion        = new TransactionalInformation();

            if (txtBox.Text.Trim() != "")
            {
                if (tipo == 1)
                {
                    movimientoShipping.euid = txtEuid.Text;
                }
                else if (tipo == 2)
                {
                    var euid = txtIndEuid.Text.Split('_');

                    movimientoShipping.indEuid = txtIndEuid.Text.Trim();
                    movimientoShipping.euid    = euid[0];
                }

                //Validación del Euid cuando posee un Individual Euid
                var dataEuid = InfoFieldBookBusiness.GetEuid(movimientoShipping.euid.ToString(), "");
                if (tipo == 1 && dataEuid.Count > 1 && txtIndEuid.Text == "")
                {
                    MessageBox.Show("Debe Ingresar Individual Euid", "Módulo Packing", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                    txtIndEuid.Focus();
                    return;
                }

                //Validación que nos indica que un euid no puede ir a un destino distinto al cuál ya esta seteado en la tabla InfoFieldBook
                if (tipo == 2)
                {
                    if (txtEuid.Text == "")
                    {
                        var posicion = txtIndEuid.Text.IndexOf("_");
                        var euid     = txtIndEuid.Text.Substring(0, posicion);
                        txtEuid.Text = euid;
                    }

                    //Valido que IndEuid no exista en la misma caja
                    var boxE = MovimientoShippingBusiness.GetBoxByIndEuid(txtIndEuid.Text, txtBox.Text);
                    if (boxE != null)
                    {
                        MessageBox.Show("Individual Euid no puede ser ingresar nuevamente en la misma caja", "Módulo Packing", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                        txtEuid.Text    = "";
                        txtIndEuid.Text = "";
                        txtIndEuid.Focus();
                        return;
                    }

                    var ie = dataEuid.Where(d => d.euid == txtEuid.Text && d.indEuid == txtIndEuid.Text).FirstOrDefault();
                    if (ie != null)
                    {
                        if (ie.shipTo != txtBox.Text.Substring(0, 2).ToUpper())
                        {
                            MessageBox.Show("Euid no puede ser enviado a un destino distinto", "Módulo Packing", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                            txtIndEuid.Text = "";
                            txtEuid.Text    = "";
                            txtIndEuid.Focus();
                            return;
                        }
                    }
                }
                else if (tipo == 1)
                {
                    if (dataEuid.Count > 0)
                    {
                        if (dataEuid[0].shipTo != txtBox.Text.Substring(0, 2).ToUpper())
                        {
                            MessageBox.Show("Euid no puede ser enviado a un destino distinto", "Módulo Packing", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                            txtEuid.Text = "";
                            txtIndEuid.Focus();
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Debe Ingresar Euid Válido", "Módulo Shipping", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                        txtEuid.Text = "";
                        txtEuid.Focus();
                        return;
                    }
                }

                //Validación que comprueba que un euid o indivual euid no vaya en cajas distintas
                var movShipping = MovimientoShippingBusiness.GetBoxesByEuid(txtEuid.Text, txtIndEuid.Text, txtBox.Text);

                if (movShipping.Count > 0)
                {
                    MessageBox.Show("Euid no puede ser ingresado en cajas distintas", "Módulo Packing", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                    return;
                }
                //if (txtBox.Text.Substring(0,2) != )
                //{

                //}
                movimientoShipping.cajaEnvio        = txtBox.Text.Trim().ToUpper();
                movimientoShipping.fechaPreparacion = DateTime.Now;
                movimientoShipping.usuario          = usuarioValido.nombre_usuario;

                MovimientoShippingBusiness.GrabaInformacion(movimientoShipping, out transaccion);
                if (transaccion.ReturnStatus)
                {
                    txtIndEuid.Text = "";
                    txtEuid.Text    = "";
                    if (tipo == 1)
                    {
                        txtEuid.Focus();
                    }
                    else
                    {
                        txtIndEuid.Focus();
                    }

                    BuscarInfo(txtBox.Text.Trim());
                }
                else
                {
                    MessageBox.Show("Error: " + transaccion.ReturnMessage, "Módulo Packing", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
            }
            else
            {
                MessageBox.Show("Debe Ingresar Una Caja", "Módulo Shipping", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            }
        }
Ejemplo n.º 11
0
        private void bg_DoWork(object sender, DoWorkEventArgs e)
        {
            totalEmpleadosProcesar = datos.Sum(s => s.EuidSplit);

            foreach (var item in datos)
            {
                var num = InfoFieldBookBusiness.GetSecuenciaIndEuid(item.Euid);

                if (num.IsNumeric())
                {
                    EntryListDto row   = new EntryListDto();
                    int          index = int.Parse(num);

                    for (int i = 1; i <= item.EuidSplit; i++)
                    {
                        itemO = EntryListBusiness.GetEntryList(item.Euid, "Euid")[0];
                        if (itemO != null)
                        {
                            row.Index          = i;
                            row.Euid           = item.Euid;
                            row.IndEuid        = item.Euid + "_" + index.ToString();
                            row.Year           = itemO.Year;
                            row.Country        = itemO.Country;
                            row.Location       = itemO.Location;
                            row.Rng            = itemO.Rng;
                            row.Plt            = itemO.Plt;
                            row.Ent            = itemO.Ent;
                            row.ExpName        = itemO.ExpName;
                            row.ProjectLead    = itemO.ProjectLead;
                            row.Cc             = itemO.Cc;
                            row.Crop           = itemO.Crop;
                            row.Obs            = itemO.Obs;
                            row.ProjectCode    = itemO.ProjectCode;
                            row.GmoEvent       = itemO.GmoEvent;
                            row.Sag            = itemO.Sag;
                            row.CodInternacion = itemO.CodInternacion;
                            row.CodReception   = itemO.CodReception;
                            row.Client         = itemO.Client;
                            row.EntName        = itemO.EntName;
                            row.EntRole        = itemO.EntRole;
                            row.ResImportacion = itemO.ResImportacion;
                            row.GranosHilera   = itemO.GranosHilera;
                            row.Bi1            = itemO.Bi1;
                            row.Bi2            = itemO.Bi2;
                            row.Bi3            = itemO.Bi3;
                            row.Bi4            = itemO.Bi4;
                            row.Owner          = itemO.Owner;
                            row.CodPermanencia = itemO.CodPermanencia;
                            row.LotId          = itemO.LotId;

                            listData.Add(row);
                            index++;
                            row = new EntryListDto();
                        }

                        progreso++;                                                                                  //Aumentando el progreso
                        porciento = Convert.ToInt16((((double)progreso / (double)totalEmpleadosProcesar) * 100.00)); //Calculo del porcentaje
                        bg.ReportProgress(porciento);
                    }
                }
            }
        }
Ejemplo n.º 12
0
        public static ResultadoCarga SaveExcelData(List <InfoFieldBook> data)
        {
            int            rowUpdated      = 0;
            int            rowInserted     = 0;
            ResultadoCarga status          = new ResultadoCarga();
            InfoFieldBook  ultimoProcesado = new InfoFieldBook();

            try
            {
                foreach (var result in data)
                {
                    var row = InfoFieldBookBusiness.GetIndEuid(result.indEuid, result.euid);
                    if (row != null)
                    {
                        rowUpdated++;
                        row.fechaModificacion = DateTime.Now;
                    }
                    else
                    {
                        row = new InfoFieldBook();
                        rowInserted++;
                        row.fechaCarga = DateTime.Now;
                    }

                    row.breedersCode1  = result.breedersCode1;
                    row.breedersCode2  = result.breedersCode2;
                    row.breedersCode3  = result.breedersCode3;
                    row.breedersCode4  = result.breedersCode4;
                    row.cc             = result.cc;
                    row.client         = result.client;
                    row.codInternacion = result.codInternacion;
                    row.codReception   = result.codReception;
                    row.country        = result.country;
                    row.crop           = result.crop;
                    row.ent            = result.ent;
                    row.euid           = result.euid;
                    row.gmoEvent       = result.gmoEvent;
                    row.indEuid        = result.indEuid;
                    row.instructions   = result.instructions;
                    row.location       = result.location;
                    row.obs            = result.obs;
                    row.opExpName      = result.opExpName;
                    row.order          = result.order;
                    row.plt            = result.plt;
                    row.projecLead     = result.projecLead;
                    row.projectCode    = result.projectCode;
                    row.rng            = result.rng;
                    row.sag            = result.sag;
                    row.shelling       = result.shelling;
                    row.shipTo         = result.shipTo;
                    row.targears       = result.targears;
                    row.targetKern     = result.targetKern;
                    row.targetWg       = result.targetWg;
                    row.year           = result.year;

                    ultimoProcesado = row;
                    var obj = InfoFieldBookBusiness.GrabaInformacion(row);
                }
            }
            catch (Exception ex)
            {
                status.Error = "Error: " + ex.Message;
            }

            status.TotalRows          = data.Count();
            status.NumeroActualizados = rowUpdated;
            status.NumeroInsertados   = rowInserted;
            status.UltimoProcesado    = ultimoProcesado;

            return(status);
        }