public override void OpenEditForm() { switch (ActiveItem.ETipoAcreedor) { case ETipoAcreedor.Acreedor: case ETipoAcreedor.Proveedor: { ProveedorEditForm form = new ProveedorEditForm(ActiveItem.OidAcreedor, ActiveItem.ETipoAcreedor, 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: { DespachanteEditForm form = new DespachanteEditForm(ActiveItem.OidAcreedor, 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: { NavieraEditForm form = new NavieraEditForm(ActiveItem.OidAcreedor, 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.TransportistaOrigen: case ETipoAcreedor.TransportistaDestino: { TransporterEditForm form = new TransporterEditForm(ActiveItem.OidAcreedor, ActiveItem.ETipoAcreedor, 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; } }
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; } }