コード例 #1
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            string codigo;
            bool   respuesta;

            codigo = na + nb + es;
            if (Bom.ExisteHilos(codigo) == false && dtDatos.CurrentRow.Cells[0].Value != null && dtDatos.CurrentRow.Cells[1].Value != null && dtDatos.CurrentRow.Cells[2].Value != null && dtDatos.CurrentRow.Cells[3].Value != null && dtDatos.CurrentRow.Cells[3].Value != null && dtDatos.CurrentRow.Cells[4].Value != null && dtDatos.CurrentRow.Cells[5].Value != null && imagen == 0)
            {
                if (dtDatos.Rows.Count > 0)
                {
                    respuesta = Bom.GuardarHilos(nb, es, na, imagen);
                    if (respuesta)
                    {
                        respuesta = Bom.GuardarHilosDetails(dtDatos, nb, es, na, imagen);
                        if (respuesta)
                        {
                            Dialogs.Show("Los hilos han sido guardados exitosamente", DialogsType.Info);
                            flag = true;
                        }
                        else
                        {
                            Dialogs.Show("Ocurrio un error registrando hilos", DialogsType.Error);
                            flag = false;
                        }
                    }
                    else
                    {
                        Dialogs.Show("Ocurrio un error registrando hilos", DialogsType.Error);
                        flag = false;
                    }
                    this.Close();
                }
            }
            else if (Bom.ExisteHilos(codigo) == true && dtDatos.CurrentRow.Cells[0].Value != null && dtDatos.CurrentRow.Cells[1].Value != null && dtDatos.CurrentRow.Cells[2].Value != null && dtDatos.CurrentRow.Cells[3].Value != null && dtDatos.CurrentRow.Cells[3].Value != null && dtDatos.CurrentRow.Cells[4].Value != null && dtDatos.CurrentRow.Cells[5].Value != null)
            {
                respuesta = Bom.UpdateHilosDetail(dtDatos, codigo);
                if (respuesta)
                {
                    // Dialogs.Show("Los hilos han sido guardados exitosamente", DialogsType.Info);
                    flag = true;
                }
                else
                {
                    //  Dialogs.Show("Ocurrio un error registrando hilos", DialogsType.Error);
                    flag = false;
                }
                this.Close();
            }
        }