Exemplo n.º 1
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.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;
                }
            }
        }
Exemplo n.º 2
0
        private void LlenaComboLocation()
        {
            var data = new List <InfoLocDto>();

            data = InfoLocBusiness.GetLocsByEmpresa(usuarioValido.id_empresa);
            cboLocation.ValueMember   = "Id";
            cboLocation.DisplayMember = "LocationCuartel";
            cboLocation.DataSource    = data;
            cboLocation.Refresh();
        }
Exemplo n.º 3
0
        private void ActualizaLocalidades()
        {
            FrmTemplateEntryList frm = (FrmTemplateEntryList)Application.OpenForms["FrmTemplateEntryList"];
            GroupBox             grp = (GroupBox)frm.Controls["grpLocation"];
            ComboBox             cb  = (ComboBox)grp.Controls["cboLocation"];
            var data = InfoLocBusiness.GetLocs();

            cb.ValueMember   = "Id";
            cb.DisplayMember = "LocationCuartel";
            cb.DataSource    = data;
        }
Exemplo n.º 4
0
        public void LlenaComboLocation()
        {
            cboLocation.DataSource = null;
            cboLocation.Refresh();
            var data = new List <InfoLocDto>();

            data = InfoLocBusiness.GetLocs();
            cboLocation.ValueMember   = "Id";
            cboLocation.DisplayMember = "LocationCuartel";
            cboLocation.DataSource    = data;
            cboLocation.Refresh();
        }
Exemplo n.º 5
0
        private void CreaEntidad()
        {
            InfoLoc NewLoc = new InfoLoc
            {
                CaudalGoterosLtsSeg = txtCaudalGoteros.Text,
                CodigoPoligono      = txtCodigoPoligono.Text,
                DireccionGd         = txtDireccionGd.Text,
                DistEntreHileraM    = decimal.Parse(txtDistEntreHileras.Text),
                DistGoterosM        = txtDistGoteros.Text,
                DistSobreHileraM    = decimal.Parse(txtDistSobreHilera.Text),
                FechaCarga          = DateTime.Now,
                FechaEstCosecha     = dtpCosecha.Value,
                id_crop             = (int)cboCrop.SelectedValue,
                id_estado           = (int)cboCrop.SelectedValue,
                id_farm             = SubFarmSelected.Id,
                id_tipo_agro        = (int)cboTipo.SelectedValue,
                Jaula           = txtJaula.Text.ToUpper(),
                Latitud         = txtLatitud.Text,
                LineaRiego      = txtLineaRiego.Text,
                LocationCuartel = txtLocation.Text.ToUpper(),
                Longitud        = txtLongitud.Text,
                Owner           = 5,
                SuperficieHa    = decimal.Parse(txtSuperficie.Text),
                TotLineaRiegoM  = txtTotalLineaRiego.Text,
                Year            = int.Parse(txtAnio.Text),
                Gmo             = chkGmo.Checked
            };

            if (txtSemillero.Text == "")
            {
                NewLoc.CodSemillero = null;
            }
            else
            {
                NewLoc.CodSemillero = txtSemillero.Text.ToUpper();
            }

            if (cboTipo.Text == "FRUT")
            {
                NewLoc.FechaPlantacion  = dtpPlantacion.Value;
                NewLoc.FechaSiembra     = null;
                NewLoc.FechaTransplante = null;
            }
            else
            {
                NewLoc.FechaPlantacion  = null;
                NewLoc.FechaSiembra     = dtpSiembra.Value;
                NewLoc.FechaTransplante = dtpTransplante.Value;
            }

            try
            {
                InfoLocBusiness.Insert(NewLoc);
                MessageBox.Show("Localidad Creada ", "Módulo Nueva Localidad", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);

                ActualizaLocalidades();

                Thread.Sleep(1500);
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message, "Módulo Nueva Localidad", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }