private void SaveDocument() { var tipoDocumento = DAOFactory.TipoDocumentoDAO.FindById(TipoDocumentoEdit.Get()); var documento = DocumentoEdit.Get() > 0 ? DAOFactory.DocumentoDAO.FindById(DocumentoEdit.Get()) : new Documento(); try { var saver = GetSaverStrategy(tipoDocumento); saver.Save(documento); CloseDocument(); } catch (Exception ex) { lblDocError.Text = ex.Message; } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); GridUtils.GenerateColumnIndices(); if (multiDocumentos.ActiveViewIndex == 1) { DocumentContainer.EnableViewState = false; var tipoDocumento = DAOFactory.TipoDocumentoDAO.FindById(TipoDocumentoEdit.Get()); Presenter = GetPresentStrategy(tipoDocumento); Presenter.CrearForm(); DocumentContainer.EnableViewState = true; } if (!IsPostBack) { btBorrar.OnClientClick = string.Concat("return confirm('", CultureManager.GetString("SystemMessages", "CONFIRM_OPERATION"), "');"); btNuevo.Visible = cbTipoDocumento.Visible = Permission == null || Permission.Add; if (OnlyForVehicles && Coche.Get() <= 0) { Visible = false; } if (OnlyForEmployees && Empleado.Get() <= 0) { Visible = false; } if (OnlyForEquipment && Equipo.Get() <= 0) { Visible = false; } if (OnlyForTransporter && Transportista.Get() <= 0) { Visible = false; } } }