Example #1
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            ToolBar.AsyncPostBacks = false;

            int tipo;

            if (!int.TryParse(Request.QueryString["t"], out tipo))
            {
                return;
            }
            if (Session["ViewOnly"] != null)
            {
                ViewState["ViewOnly"] = Session["ViewOnly"];
                Session.Remove("ViewOnly");
            }
            var tipoDoc = DAOFactory.TipoDocumentoDAO.FindById(tipo);

            var strategyFactory = GetStrategyFactory(tipoDoc.Strategy);

            if (strategyFactory != null)
            {
                presenter = strategyFactory.GetPresentStrategy(tipoDoc, this, DAOFactory);
                saver     = strategyFactory.GetSaverStrategy(tipoDoc, this, DAOFactory);
            }
            else
            {
                presenter = new GenericPresenter(tipoDoc, this, DAOFactory);
                saver     = new GenericSaver(tipoDoc, this, DAOFactory);
            }
        }
Example #2
0
        protected override void OnPreLoad(EventArgs e)
        {
            Response.CacheControl = "no-cache";
            if (IdTipoDocumento < 0)
            {
                throw new ArgumentException(@"No se encontro el parametro", "Id Tipo Documento");
            }

            var tipoDoc = DAOFactory.TipoDocumentoDAO.FindById(IdTipoDocumento);

            IdTipoDocumento = tipoDoc.Id;

            presenter = new PartePresentStrategy(tipoDoc, this, DAOFactory);
            saver     = new ParteSaveStrategy(tipoDoc, this);

            presenter.CrearForm();

            if (EditMode)
            {
                presenter.SetValores(EditObject);
                if (Usuario.AccessLevel < Logictracker.Types.BusinessObjects.Usuario.NivelAcceso.SysAdmin && EditObject.Valores[ParteCampos.EstadoControl].ToString() != "0")
                {
                    PanelForm.Enabled = false;
                }
            }

            base.OnPreLoad(e);
        }
Example #3
0
        public void LoadDocument(Documento documento)
        {
            Presenter = GetPresentStrategy(documento.TipoDocumento);

            Presenter.CrearForm();
            Presenter.SetValores(documento);
            DisableCombos();

            TipoDocumentoEdit.Set(documento.TipoDocumento.Id);
            DocumentoEdit.Set(documento.Id);
            multiDocumentos.SetActiveView(viewDocument);

            btBorrar.Visible = Permission == null || Permission.Delete;
        }
Example #4
0
        public void NewDocument(TipoDocumento tipoDocumento)
        {
            TipoDocumentoEdit.Set(tipoDocumento.Id);
            DocumentoEdit.Set(-1);

            Presenter = GetPresentStrategy(tipoDocumento);
            Presenter.CrearForm();

            SetCurrentValues(tipoDocumento);

            DisableCombos();
            multiDocumentos.SetActiveView(viewDocument);

            btBorrar.Visible = false;
        }
Example #5
0
        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;
                }
            }
        }