示例#1
0
        public FrmDiscrepancia(Discrepancia discrepancia, string tipoDoc)
        {
            InitializeComponent();
            _tipoDoc = tipoDoc;
            discrepanciaBindingSource.DataSource = discrepancia;
            discrepanciaBindingSource.ResetBindings(false);

            Load += (s, e) =>
            {
                using (var ctx = new OpenInvoicePeruDb())
                {
                    var tipoDocumento = ctx.Set <TipoDocumento>()
                                        .AsNoTracking()
                                        .SingleOrDefault(p => p.Codigo == _tipoDoc);

                    if (tipoDocumento == null)
                    {
                        return;
                    }

                    tipoDiscrepanciaBindingSource.DataSource = ctx.Set <TipoDiscrepancia>()
                                                               .Where(t => t.IdTipoDocumento == tipoDocumento.Id).AsNoTracking().ToList();

                    tipoDiscrepanciaBindingSource.ResetBindings(false);
                }
            };

            toolOk.Click += (s, e) =>
            {
                discrepanciaBindingSource.EndEdit();

                DialogResult = DialogResult.OK;
            };

            toolCancel.Click += (s, e) => DialogResult = DialogResult.Cancel;
        }
示例#2
0
 public async Task <ParametroConfiguracion> Get(int id)
 {
     return(await _context.Set <ParametroConfiguracion>().FindAsync(id));
 }
示例#3
0
 public async Task <Empresa> Get(int id)
 {
     return(await _context.Set <Empresa>().FindAsync(id));
 }