示例#1
0
        }//Fin de BuscaLoteNombre

        public string NuevaDescripcion(string descripcion, int cantidad, string fechacaducidad, string fechaproduccion, int tipo)
        {
            RepositorioGenerico<Lotes> REP = new RepositorioGenerico<Lotes>();
            Lotes LTS = new Lotes();
            string resultado;
            try
            {
                IEnumerable busca = BuscaLoteNombre(descripcion);
                if (busca.Cast<object>().Any())
                    resultado = "Error: ya existe el cliente " + descripcion;
                else
                {
                    LTS.Id_Lotes = Convert.ToInt32(REP.ListarTodo().Max(l => l.Id_Lotes)) + 1;//los lista
                    LTS.Descripcion = descripcion;
                    LTS.Cantidad = cantidad;
                    LTS.Fecha_Caducidad = Convert.ToDateTime(fechacaducidad);
                    LTS.Fecha_Produccion = Convert.ToDateTime(fechaproduccion);
                    LTS.Productos_Id = tipo;
                    resultado = REP.Agregar(LTS);
                }
            }
            catch (Exception error)
            {
                resultado = "Error " + error.Message;

            }
            return resultado;
        }//fin de NuevoLote
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            BLL.Exportacion exportacion = new BLL.Exportacion();

            if (ExportacionIdtextBox.Text.Length == 0)
            {
                double.TryParse(CantidadtextBox.Text, out toneladas);
                exportacion.CantidadToneladas = toneladas;
                exportacion.Fecha = FechadateTimePicker.Text;
                exportacion.CertificacionId = (int)CertificacionIdcomboBox.SelectedValue;
                exportacion.DestinoId = (int)DestinosIdcomboBox.SelectedValue;
                exportacion.Resumen = ResumenrichTextBox.Text;

                for (int i = 0; i < LoteslistBox.Items.Count; i++)
                 {
                     Lotes lotes = new Lotes();
                    lotes.LoteId = (int)LoteIdcomboBox.SelectedValue;
                    exportacion.AgregarLotes(lotes.LoteId,LoteslistBox.Items[i].ToString());
                 }
                 if (exportacion.Insertar())
                 {
                     MessageBox.Show("Se guardaron los datos!");
                 }
                 else
                 {
                     MessageBox.Show("No se han guardado los datos!");
                 }

            }
            else
            {
                int.TryParse(ExportacionIdtextBox.Text, out exportacionId);
                exportacion.ExportacionId = exportacionId;

                double.TryParse(CantidadtextBox.Text, out toneladas);
                exportacion.CantidadToneladas = toneladas;
                exportacion.Fecha = FechadateTimePicker.Text;
                exportacion.CertificacionId = (int)CertificacionIdcomboBox.SelectedValue;
                exportacion.ExportacionId = (int)DestinosIdcomboBox.SelectedValue;
                exportacion.Resumen = ResumenrichTextBox.Text;

                if (exportacion.Editar())
                {
                    MessageBox.Show("Se han actualizado los datos!");
                }
                else
                {
                    MessageBox.Show("No se han guardado los datos!");
                }
            }
        }
        private void Buscarbutton_Click(object sender, EventArgs e)
        {
            Lotes lote = new Lotes();
            Exportacion exportacion = new Exportacion();
            int.TryParse(ExportacionIdtextBox.Text, out idbuscado);
            lote.ExportacionId = idbuscado;
            lote.Buscar(idbuscado);

                exportacion.Fecha = FechadateTimePicker.Text;

                foreach (var item in exportacion.Lotes)
                {
                LotesdataGridView.Rows.Add(item.CodigoLote);
                }
        }
示例#4
0
        }//fin de NuevoLote

        public string ActualizaLotes(Lotes Info)
        {
            string resultado = "";
            RepositorioGenerico<Lotes> REP = new RepositorioGenerico<Lotes>();
            try
            {
                resultado = REP.Editar(Info);
            }
            catch (Exception error)
            {

                resultado = "Error " + error.Message;
            }
            return resultado;
        }//fin de ActualizaLotes
        private void button3_Click(object sender, EventArgs e)
        {
            //LotesdataGridView.Items.Add(LoteIdcomboBox.Text);
            Lotes lotes = new Lotes();
            DataTable dt = new DataTable();

            lotes.Buscar((int)LoteIdcomboBox.SelectedValue);
            this.LotesdataGridView.Rows.Add(LoteIdcomboBox.SelectedValue.ToString(), lotes.Total.ToString());

            double.TryParse(PreciotextBox.Text, out precio);
            total += lotes.Total * precio;

            TotaltextBox.Text = total.ToString();

            total = Monto;
        }
        private void Recepcion_Load(object sender, EventArgs e)
        {
            Socios socio = new Socios();
            SocioIdcomboBox.DataSource = socio.Listar("SocioId, Nombre", "1=1", "");
            SocioIdcomboBox.DisplayMember = "Nombre";
            SocioIdcomboBox.ValueMember = "SocioId";

            BLL.Certificaciones Cert = new BLL.Certificaciones();
            CertificacionIdcomboBox.DataSource = Cert.Listar("CertificacionId, Descripcion", "1=1", "");
            CertificacionIdcomboBox.DisplayMember = "Descripcion";
            CertificacionIdcomboBox.ValueMember = "CertificacionId";

            Lotes lotes = new Lotes();
            LoteIdcomboBox.DataSource = lotes.Listar("*", "1=1", "");
            LoteIdcomboBox.DisplayMember = "CodigoLote";
            LoteIdcomboBox.ValueMember = "LoteId";

            BLL.TipoCacao TipoC = new BLL.TipoCacao();
            TipoCacaoIdcomboBox.DataSource = TipoC.Listar("TipoCacaoId, Descripcion", "1=1", "");
            TipoCacaoIdcomboBox.DisplayMember = "Descripcion";
            TipoCacaoIdcomboBox.ValueMember = "TipoCacaoId";
        }
        private void RegistroExportacion_Load(object sender, EventArgs e)
        {
            Lotes lotes = new Lotes();
            LoteIdcomboBox.DataSource = lotes.Listar("*","1=1","");
            LoteIdcomboBox.DisplayMember = "CodigoLote";
            LoteIdcomboBox.ValueMember = "LoteId";
            addlotes = LoteIdcomboBox.Text;

            DestinosIdcomboBox.DataSource = destinos.Listar("DestinoId, NombreDestino", "1=1", "");
            DestinosIdcomboBox.DisplayMember = "NombreDestino";
            DestinosIdcomboBox.ValueMember = "DestinoId";
        }
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            BLL.Exportacion exportacion = new BLL.Exportacion();

            if (ExportacionIdtextBox.Text.Length == 0)
            {

                exportacion.Fecha = FechadateTimePicker.Text;
                exportacion.DestinoId = (int)DestinosIdcomboBox.SelectedValue;
                exportacion.Resumen = ResumenrichTextBox.Text;
                double.TryParse(TotaltextBox.Text, out Monto);
                exportacion.Monto = Monto;

                foreach (DataGridViewRow item in LotesdataGridView.Rows)
                {
                    Lotes lotes = new Lotes();
                    lotes.LoteId = (int)LoteIdcomboBox.SelectedValue;
                    exportacion.AgregarLotes(lotes.LoteId, item.Cells["CodigoLote"].Value.ToString());
                }

                    if (exportacion.Insertar())
                    {
                        MessageBox.Show("El producto esta listo para exportarce");
                    }
                    else
                    {
                        MessageBox.Show("No se han guardado los datos!");
                    }

            }
            else
            {
                int.TryParse(ExportacionIdtextBox.Text, out exportacionId);
                exportacion.ExportacionId = exportacionId;
                exportacion.Fecha = FechadateTimePicker.Text;
                exportacion.ExportacionId = (int)DestinosIdcomboBox.SelectedValue;
                exportacion.Resumen = ResumenrichTextBox.Text;

                if (exportacion.Editar())
                {
                    MessageBox.Show("Se han actualizado los datos!");
                }
                else
                {
                    MessageBox.Show("No se han guardado los datos!");
                }
            }
        }