private void InserirIndice() { if (bsDescontoAmostra.Current != null) { using (TFIndiceDesc fIndice = new TFIndiceDesc()) { if (fIndice.ShowDialog() == DialogResult.OK) { if (fIndice.rPerc != null) { if ((bsDescontoAmostra.Current as CamadaDados.Graos.TRegistro_DescontoXAmostra).lPerc.Exists(p => p.Pc_resultado.Equals(fIndice.rPerc.Pc_resultado))) { (bsDescontoAmostra.Current as CamadaDados.Graos.TRegistro_DescontoXAmostra).lPerc.Find(p => p.Pc_resultado.Equals(fIndice.rPerc.Pc_resultado)).Pc_descpagto = fIndice.rPerc.Pc_descpagto; (bsDescontoAmostra.Current as CamadaDados.Graos.TRegistro_DescontoXAmostra).lPerc.Find(p => p.Pc_resultado.Equals(fIndice.rPerc.Pc_resultado)).Pc_descestoque = fIndice.rPerc.Pc_descestoque; } else { (bsDescontoAmostra.Current as CamadaDados.Graos.TRegistro_DescontoXAmostra).lPerc.Add(fIndice.rPerc); } bsDescontoAmostra.ResetCurrentItem(); } } } } }
private void AlterarIndice() { if (bsPerc.Current != null) { using (TFIndiceDesc fIndice = new TFIndiceDesc()) { fIndice.rPerc = bsPerc.Current as CamadaDados.Graos.TRegistro_PercDesconto; if (fIndice.ShowDialog() != DialogResult) { (bsPerc.Current as CamadaDados.Graos.TRegistro_PercDesconto).Pc_descpagto = fIndice.rPerc.Pc_descpagto; (bsPerc.Current as CamadaDados.Graos.TRegistro_PercDesconto).Pc_descestoque = fIndice.rPerc.Pc_descestoque; } bsPerc.ResetCurrentItem(); } } }