Beispiel #1
0
        private void modificaItem(string field1, string field2)
        {
            Clases.cCat oCatal = new Clases.cCat();
                //  llama a creaItem
                fCreaItem fCrea = new fCreaItem(catal, field1, field2, "M", fila, oCatal);
                fCrea.ShowDialog();

                //  busca en catalogo el id a modificar
                for (int i = 0; i < dtCatalogo.Rows.Count; i++)
                {
                    if (int.Parse(dtCatalogo.Rows[i][field1].ToString()) == oCatal.id)
                    {
                        dtCatalogo.Rows[i][field2] = oCatal.nombreItem;
                        break;
                    }

                }

                dtCatalogo.AcceptChanges();
                grCatalogo.RefreshDataSource();
                fCrea.Close();
                fCrea.Dispose();
        }
Beispiel #2
0
        private void creaItem(int campos )
        {
            Formas.fCreaItem fcrea = new fCreaItem(ocat, campos, "A");
            fcrea.Text = ocat.lista[1];
            fcrea.ShowDialog();
            if (fcrea.DialogResult == DialogResult.Yes)
            {
                DataRow fila = dtCatalogo.NewRow();
                fila[ocat.lista[2]] = fcrea.idItem;
                fila[ocat.lista[3]] = fcrea.Item.ToUpper();

                if(campos == 2)
                    fila[ocat.lista[4]] = ocat.idForaneo ;

                else if (campos == 3)
                    fila[ocat.lista[4]] = ocat.bcampo;

                dtCatalogo.Rows.Add(fila);
            }
            fcrea.Close();
            fcrea.Dispose();
        }