Example #1
0
        private Cpcompradetserie AsignarCpCompraDetSerie(VwCpcompradetserie vwCpcompradetserie)
        {
            Cpcompradetserie cpcompradetserie = new Cpcompradetserie();

            cpcompradetserie.Idcpcompradetserie = vwCpcompradetserie.Idcpcompradetserie;
            cpcompradetserie.Idcpcompradet      = vwCpcompradetserie.Idcpcompradet;
            cpcompradetserie.Idseriearticulo    = vwCpcompradetserie.Idseriearticulo;
            return(cpcompradetserie);
        }
Example #2
0
        public CpCompraDetSerieMntItemDinamicoFrm(TipoMantenimiento tipoMnt, VwCpcompradet vwCpcompradet, VwCpcompradetserie vwCpcompradetserie)
        {
            InitializeComponent();

            _errorProvider = new DXErrorProvider();
            var styleController = new StyleController();

            WinFormUtils.SetStyleController(this, styleController);

            TipoMnt            = tipoMnt;
            VwCpcompradet      = vwCpcompradet;
            VwCpcompradetserie = vwCpcompradetserie;
        }
Example #3
0
        private void bmSeries_ItemClick(object sender, ItemClickEventArgs e)
        {
            var subMenu = e.Item as BarSubItem;

            if (subMenu != null)
            {
                return;
            }

            TipoMantenimiento tipoMantenimientoItem;
            CpCompraDetSerieMntItemDinamicoFrm cpCompraDetSerieMntItemDinamicoFrm;
            VwCpcompradetserie vwCpcompradetserie;

            switch (e.Item.Name)
            {
            case "btnAddItem":

                if (IdEntidadMnt == 0)
                {
                    XtraMessageBox.Show("Grabe la información", "Atención", MessageBoxButtons.OK,
                                        MessageBoxIcon.Error);
                    break;
                }


                vwCpcompradetserie = new VwCpcompradetserie();

                tipoMantenimientoItem = TipoMantenimiento.Nuevo;
                cpCompraDetSerieMntItemDinamicoFrm = new CpCompraDetSerieMntItemDinamicoFrm(tipoMantenimientoItem, VwCpcompradet, vwCpcompradetserie);
                cpCompraDetSerieMntItemDinamicoFrm.ShowDialog();

                if (cpCompraDetSerieMntItemDinamicoFrm.DialogResult == DialogResult.OK)
                {
                    Cpcompradetserie cpcompradetserie = AsignarCpCompraDetSerie(vwCpcompradetserie);
                    int idinventariostockdetserie     = Service.SaveCpcompradetserie(cpcompradetserie);
                    if (idinventariostockdetserie > 0)
                    {
                        vwCpcompradetserie.Idcpcompradetserie = idinventariostockdetserie;
                        VwCpcompradetserieList.Add(vwCpcompradetserie);
                        ActualizarDetalle();
                        if (!gvDetalle.IsLastRow)
                        {
                            gvDetalle.MoveLastVisible();
                            gvDetalle.Focus();
                        }
                    }
                }
                break;

            case "btnEditItem":
                if (gvDetalle.RowCount == 0)
                {
                    break;
                }

                vwCpcompradetserie = (VwCpcompradetserie)gvDetalle.GetFocusedRow();
                cpCompraDetSerieMntItemDinamicoFrm = new CpCompraDetSerieMntItemDinamicoFrm(TipoMantenimiento.Modificar, VwCpcompradet, vwCpcompradetserie);
                cpCompraDetSerieMntItemDinamicoFrm.ShowDialog();

                if (cpCompraDetSerieMntItemDinamicoFrm.DialogResult == DialogResult.OK)
                {
                    Cpcompradetserie cpcompradetserie = AsignarCpCompraDetSerie(vwCpcompradetserie);
                    if (cpcompradetserie.Idcpcompradetserie > 0)
                    {
                        Service.UpdateCpcompradetserie(cpcompradetserie);
                        ActualizarDetalle();
                    }
                }


                break;

            case "btnDelItem":
                if (gvDetalle.RowCount == 0)
                {
                    break;
                }

                if (DialogResult.Yes == XtraMessageBox.Show("¿Desea eliminar el item seleccionado?",
                                                            "Eliminar Item", MessageBoxButtons.YesNo,
                                                            MessageBoxIcon.Question, MessageBoxDefaultButton.Button1))
                {
                    vwCpcompradetserie = (VwCpcompradetserie)gvDetalle.GetFocusedRow();
                    if (vwCpcompradetserie != null && vwCpcompradetserie.Idcpcompradetserie > 0)
                    {
                        Service.DeleteInventariostockdetserie(vwCpcompradetserie.Idcpcompradetserie);
                        vwCpcompradetserie.DataEntityState = DataEntityState.Deleted;
                        if (!gvDetalle.IsFirstRow)
                        {
                            gvDetalle.MovePrev();
                        }
                        ActualizarDetalle();
                    }
                }
                break;
            }
        }