Esempio n. 1
0
        public override void OpenAddForm()
        {
            DespachanteAddForm form = new DespachanteAddForm(this);

            AddForm(form);
            if (form.ActionResult == DialogResult.OK)
            {
                _entity = form.Entity;
            }
        }
        public override void OpenAddForm()
        {
            SelectEnumInputForm select_form = new SelectEnumInputForm(true);

            ETipoAcreedor[] tipos = new ETipoAcreedor[6] {
                ETipoAcreedor.Acreedor, ETipoAcreedor.Proveedor, ETipoAcreedor.Despachante, ETipoAcreedor.Naviera, ETipoAcreedor.TransportistaDestino, ETipoAcreedor.TransportistaOrigen
            };
            select_form.SetDataSource(moleQule.Common.Structs.EnumText <ETipoAcreedor> .GetList(tipos, false));

            if (select_form.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            ComboBoxSource estado = select_form.Selected as ComboBoxSource;

            switch ((ETipoAcreedor)(long)estado.Oid)
            {
            case ETipoAcreedor.Acreedor:
            case ETipoAcreedor.Proveedor:
            {
                ProveedorAddForm form = new ProveedorAddForm(this);
                if (form.Entity != null)
                {
                    AddForm(form);
                    if (form.ActionResult == DialogResult.OK)
                    {
                        _entity = new ProviderBase();
                        _entity.CopyValues(form.Entity.ProviderBase);
                        _entity.Record.CopyValues(form.Entity.Base.Record);
                    }
                }
            }
            break;

            case ETipoAcreedor.Despachante:
            {
                DespachanteAddForm form = new DespachanteAddForm(this);
                if (form.Entity != null)
                {
                    AddForm(form);
                    if (form.ActionResult == DialogResult.OK)
                    {
                        _entity = new ProviderBase();
                        _entity.CopyValues(form.Entity.ProviderBase);
                        _entity.Record.CopyValues(form.Entity.Base.Record);
                    }
                }
            }
            break;

            case ETipoAcreedor.Naviera:
            {
                NavieraAddForm form = new NavieraAddForm();
                if (form.Entity != null)
                {
                    AddForm(form);
                    if (form.ActionResult == DialogResult.OK)
                    {
                        _entity = new ProviderBase();
                        _entity.CopyValues(form.Entity.ProviderBase);
                        _entity.Record.CopyValues(form.Entity.Base.Record);
                    }
                }
            }
            break;

            case ETipoAcreedor.TransportistaOrigen:
            {
                TransporterAddForm form = new TransporterAddForm(this, ETipoAcreedor.TransportistaOrigen);
                if (form.Entity != null)
                {
                    AddForm(form);
                    if (form.ActionResult == DialogResult.OK)
                    {
                        _entity = new ProviderBase();
                        _entity.CopyValues(form.Entity.ProviderBase);
                        _entity.Record.CopyValues(form.Entity.Base.Record);
                    }
                }
            }
            break;

            case ETipoAcreedor.TransportistaDestino:
            {
                TransporterAddForm form = new TransporterAddForm(this, ETipoAcreedor.TransportistaDestino);
                if (form.Entity != null)
                {
                    AddForm(form);
                    if (form.ActionResult == DialogResult.OK)
                    {
                        _entity = new ProviderBase();
                        _entity.CopyValues(form.Entity.ProviderBase);
                        _entity.Record.CopyValues(form.Entity.Base.Record);
                    }
                }
            }
            break;
            }
        }