示例#1
0
        private void cargarDatosArticulo(string artCod)
        {
            string resp = "";

            clase_articulo articulo = new clase_articulo();

            resp = articulo.CargarDatosArticuloPorCod(artCod);

            if (resp == "")
            {
                tbArtDes.Text       = articulo.ArtDes;
                cbArtePesca.Text    = articulo.ArtePesca;
                cbObtencion.Text    = articulo.Obtencion;
                cbPresentacion.Text = articulo.Presentacion;

                if (!string.IsNullOrEmpty(articulo.ZFao))
                {
                    cbZonaCaptura.Text = articulo.ZFao;
                }

                if (frmPpal.USUARIO == "5")
                {
                    lCondEsps.Text = articulo.AnomCongel;
                }
            }
            else
            {
                MessageBox.Show("Error al cargar los datos del artículo: \n\n" + resp);
            }
        }
示例#2
0
        private void Cargar()
        {
            if (CnO != null)
            {
                string    strQ          = "SELECT ArtCod, ArtDes, Tipo1, Tipo2, EtiqOblig FROM ARTICULOS ORDER BY ArtCod";
                ArrayList listArticulos = new ArrayList();

                try
                {
                    SqlDataReader myReader  = null;
                    SqlCommand    myCommand = new SqlCommand(strQ, CnO);
                    myReader = myCommand.ExecuteReader();
                    while (myReader.Read())
                    {
                        clase_articulo articulo = new clase_articulo();

                        articulo.ArtCod    = myReader["ArtCod"].ToString();
                        articulo.ArtDes    = myReader["ArtDes"].ToString();
                        articulo.Tipo1     = myReader["Tipo1"].ToString();
                        articulo.Tipo2     = myReader["Tipo2"].ToString();
                        articulo.EtiqOblig = myReader["EtiqOblig"].ToString();

                        listArticulos.Add(articulo);
                    }

                    myReader.Close();

                    //this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
                    //dataGridView1.AutoGenerateColumns = false;

                    dataGridView1.DataSource = listArticulos;

                    dataGridView1.AutoGenerateColumns = false;

                    if (dataGridView1.Rows.Count > 0)
                    {
                        dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                        dataGridView1.Columns[0].ReadOnly     = true;
                        dataGridView1.Columns[0].HeaderText   = "CÓDIGO";
                        dataGridView1.Columns[0].Name         = "ArtCod";
                        dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                        dataGridView1.Columns[1].ReadOnly     = true;
                        dataGridView1.Columns[1].HeaderText   = "NOMBRE";
                        dataGridView1.Columns[1].Name         = "ArtDes";
                        dataGridView1.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                        dataGridView1.Columns[2].ReadOnly     = true;
                        dataGridView1.Columns[2].HeaderText   = "TIPO";
                        dataGridView1.Columns[2].Name         = "Tipo1";
                        dataGridView1.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                        dataGridView1.Columns[3].ReadOnly     = true;
                        dataGridView1.Columns[3].HeaderText   = "ALIMENTAC.";
                        dataGridView1.Columns[3].Name         = "Tipo2";
                        dataGridView1.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                        dataGridView1.Columns[4].ReadOnly     = true;
                        dataGridView1.Columns[4].HeaderText   = "ETIQ.OBLIG.";
                        dataGridView1.Columns[4].Name         = "EtiqOblig";
                        dataGridView1.Columns[5].Visible      = false;
                        dataGridView1.Columns[6].Visible      = false;
                        dataGridView1.Columns[7].Visible      = false;

                        for (int x = 0; x < dataGridView1.Rows.Count; x++)
                        {
                            if (dataGridView1.Rows[x].Cells[3].Value != null)
                            {
                                //if (dataGridView1.Rows[x].Cells[2].Value.ToString().Trim() == "F")
                                //{
                                //    dataGridView1.Rows[x].Cells[2].Value = "Fresco";
                                //}
                                //else if (dataGridView1.Rows[x].Cells[2].Value.ToString().Trim() == "C")
                                //{
                                //    dataGridView1.Rows[x].Cells[2].Value = "Congelado";
                                //}//if (dataGridView1.Rows[x].Cells[2].Value.ToString().Trim() == "F")

                                if (dataGridView1.Rows[x].Cells[3].Value.ToString().Trim() == "W")
                                {
                                    dataGridView1.Rows[x].Cells[3].Value = "SALVAJE";
                                }

                                if (dataGridView1.Rows[x].Cells[3].Value.ToString().Trim() == "C")
                                {
                                    dataGridView1.Rows[x].Cells[3].Value = "CRIANZA";
                                } //if (dataGridView1.Rows[x].Cells[3].Value.ToString().Trim() == "W")
                            }     //if (dataGridView1.Rows[x].Cells[2].Value != null)

                            if (dataGridView1.Rows[x].Cells[4].Value != null)
                            {
                                if (dataGridView1.Rows[x].Cells[4].Value.ToString().Trim() == "True")
                                {
                                    dataGridView1.Rows[x].Cells[4].Value = "SI";
                                }
                                else //if (dataGridView1.Rows[x].Cells[4].Value.ToString().Trim() == "C")
                                {
                                    dataGridView1.Rows[x].Cells[4].Value = "NO";
                                } //if (dataGridView1.Rows[x].Cells[4].Value.ToString().Trim() == "W")
                            }
                        }         //for (int x = 0; x < dataGridView1.Rows.Count; x++)
                    }   //if (dataGridView1.Rows.Count > 0)
                }
                catch (Exception ex)
                {
                    Mostrar(ex.ToString());
                }
            } //if (CnO != null)
        }     //Cargar()