示例#1
0
        private void ShowFormMnt()
        {
            if (TipoMnt == TipoMantenimiento.SinEspecificar)
            {
                throw new ArgumentException("No se especifico el tipo de mantenimiento.");
            }

            AsignarIdEntidadMnt();
            var formMnt = new EntradaalmacenMntFrm(IdEntidadMnt, TipoMnt, gcConsulta, this);

            formMnt.ShowDialog();

            switch (formMnt.DataEntityState)
            {
            case DataEntityState.Added:
                VwEntradaalmacen vwEntradaalmacenAdded = Service.GetVwEntradaalmacen(x => x.Identradaalmacen == formMnt.IdEntidadMnt);
                VwEntradaalmacenList.Add(vwEntradaalmacenAdded);
                IdEntidadMnt = formMnt.IdEntidadMnt;
                SetFocusIdEntity();
                EstadoBotonesMantenimiento();
                break;

            case DataEntityState.Modified:
                VwEntradaalmacen vwEntradaalmacenUnchanged = VwEntradaalmacenList.FirstOrDefault(x => x.Identradaalmacen == formMnt.IdEntidadMnt);
                int index = VwEntradaalmacenList.IndexOf(vwEntradaalmacenUnchanged);
                VwEntradaalmacenList.Remove(vwEntradaalmacenUnchanged);
                if (vwEntradaalmacenUnchanged != null)
                {
                    VwEntradaalmacenList.Insert(index, Service.GetVwEntradaalmacen(x => x.Identradaalmacen == formMnt.IdEntidadMnt));
                }
                break;

            case DataEntityState.Deleted:
                VwEntradaalmacenList.Remove(VwEntradaalmacenList.SingleOrDefault(x => x.Identradaalmacen == formMnt.IdEntidadMnt));
                break;
            }

            gcConsulta.RefreshDataSource();
            gvConsulta.BestFitColumns(true);
        }
示例#2
0
        private void CargarDatosFiltro()
        {
            gcDetalle.DataSource = null;


            string whereFiltro = string.Empty;


            switch (cboBuscar.SelectedIndex)
            {
            case 0:    //Entrada almacen

                whereFiltro = string.Format(@"serieentradaalmacen = '{0}'
                        and numeroentradaalmacen = '{1}' and anulado = '0' and idsucursal = {2}",
                                            iSerie.Text.Trim(),
                                            iNumero.Text.Trim(),
                                            (int)iIdsucursal.EditValue
                                            );

                break;

            case 1:     // GUIA DE ENTRADA

                whereFiltro = string.Format(@"Serieguiaremision = '{0}'
                        and numeroguiaremision = '{1}' and anulado = '0' and idsucursal = {2}",
                                            iSerie.Text.Trim(),
                                            iNumero.Text.Trim(),
                                            (int)iIdsucursal.EditValue
                                            );

                break;
            }


            VwEntradaalmacenList = Service.GetAllVwEntradaalmacen(whereFiltro, "identradaalmacen");

            if (VwEntradaalmacenList != null && VwEntradaalmacenList.Count > 0)
            {
                Cursor = Cursors.WaitCursor;
                VwEntradaalmacen vwEntradaalmacen = VwEntradaalmacenList.FirstOrDefault();
                if (vwEntradaalmacen != null)
                {
                    rIdsocionegocio.EditValue = vwEntradaalmacen.Idsocionegocio;
                    rFechaentrada.EditValue   = vwEntradaalmacen.Fechaentrada;
                    pkIdEntidad.EditValue     = vwEntradaalmacen.Identradaalmacen;
                    //iIdresponsable.EditValue = vwEntradaalmacen.Idresponsableverifica;
                    iIdalmacendestino.EditValue = vwEntradaalmacen.Idalmacendestino;
                    EntradaalmacenMnt           =
                        Service.GetEntradaalmacen(x => x.Identradaalmacen == vwEntradaalmacen.Identradaalmacen);
                }

                string wheredet = string.Format(@"identradaalmacen = '{0}'", pkIdEntidad.EditValue);
                VwEntradaalmacendetList = Service.GetAllVwEntradaalmacendet(wheredet, "identradaalmacen");

                gcDetalle.BeginUpdate();
                gcDetalle.DataSource = VwEntradaalmacendetList;
                gcDetalle.EndUpdate();
                gvDetalle.BestFitColumns();

                Cursor = Cursors.Default;
            }
            else
            {
                gcDetalle.DataSource      = null;
                gcObservado.DataSource    = null;
                rIdsocionegocio.EditValue = null;
                rFechaentrada.EditValue   = null;
                pkIdEntidad.EditValue     = 0;
                XtraMessageBox.Show("No hay información requerimientos, verifique", "Atención", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                iNumero.Select();
            }

            ObtenerAlmacenDestino();
        }