Esempio n. 1
0
 /// <summary>
 /// Abre el formulario para editar item
 /// <returns>void</returns>
 /// </summary>
 public override void OpenEditForm()
 {
     try
     {
         PlanAnualEditForm form = new PlanAnualEditForm(ActiveOID);
         if (form.Entity != null)
         {
             AddForm(form);
             _entity = form.Entity;
         }
     }
     catch (Csla.DataPortalException ex)
     {
         MessageBox.Show(ex.BusinessException.ToString(),
                         moleQule.Face.Resources.Labels.ERROR_TITLE,
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Exclamation);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(),
                         moleQule.Face.Resources.Labels.ERROR_TITLE,
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Exclamation);
     }
 }
        public ActionResult Create(PlanAnual planAnual)
        {
            try
            {
                ModelState["Id"].Errors.Clear();
                DepurarMarcoTeorico(planAnual);
                if (ModelState.IsValid)
                {
                    planAnual.Id = Guid.NewGuid();
                    _db.PlanesAnuales.AddObject(planAnual);
                    _db.SaveChanges();
                    _auditorRepository.GuardarRegistroCreacion(planAnual);
                    _bitacora.GuardarBitacora((EstadoPlanEtapa)planAnual.EstadoPlanEtapa, planAnual.Id);

                    return(RedirectToAction("Index", "Home"));
                }
                ViewBag.IdEjercicio = SesionUsuario.IdEjercicioActivoSesion;
                ViewBag.IdEstructuraOrganizativa = SesionUsuario.Usuario.PerfilUsuario.IdEstructuraOrganizativa;
                ViewBag.Estado = (int)EstadoPlanEtapa.Iniciado;
                return(View(planAnual));
            }
            catch (Exception ex)
            {
                Utilidades.ColocarMensaje(ex, Request);
                return(RedirectToAction("Index", "Home"));
            }
        }
Esempio n. 3
0
        /// <summary>Duplica un objeto y abre el formulario para editar item
        /// <returns>void</returns>
        /// </summary>
        public override void DuplicateObject(long oid)
        {
            try
            {
                PlanAnual old = PlanAnual.Get(oid, true);
                PlanAnual dup = old.CloneAsNew();
                old.CloseSession();

                AddForm(new PlanAnualAddForm(dup));
            }
            catch (iQException ex)
            {
                MessageBox.Show(ex.Message,
                                moleQule.Face.Resources.Labels.ERROR_TITLE,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
            }
            catch (Csla.DataPortalException ex)
            {
                MessageBox.Show(iQExceptionHandler.GetiQException(ex).Message,
                                moleQule.Face.Resources.Labels.ERROR_TITLE,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(),
                                moleQule.Face.Resources.Labels.ERROR_TITLE,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
            }

            RefreshList();
        }
Esempio n. 4
0
        /// <summary>
        /// Abre el formulario para borrar item
        /// <returns>void</returns>
        /// </summary>
        public override void DeleteObject(long oid)
        {
            //if (MessageBox.Show(moleQule.Face.Resources.Messages.DELETE_CONFIRM,
            //                    moleQule.Face.Resources.Labels.ADVISE_TITLE,
            //                    MessageBoxButtons.YesNoCancel,
            //                    MessageBoxIcon.Question) == DialogResult.Yes)
            //{
            try
            {
                PlanAnual.Delete(oid);
                _action_result = DialogResult.OK;

                //Se eliminan todos los formularios de ese objeto
                foreach (ItemMngBaseForm form in _list_active_form)
                {
                    if (form.Oid == oid)
                    {
                        form.Dispose();
                        break;
                    }
                }
            }
            catch (Csla.DataPortalException ex)
            {
                MessageBox.Show(iQExceptionHandler.GetiQException(ex).Message);
            }
            //}
        }
Esempio n. 5
0
        public async Task cambiaEstadoPublicacion(PlanAnual model)
        {
            try
            {
                var infoAgregada = await _genContext.dbSetNuevoOC.Where(e => e.descripcion.Equals(model.Nombre)).FirstOrDefaultAsync();

                var estatusComunidad = await _db.DbSetComunidades.Where(e => e.ComunidadId == model.idCP).AsNoTracking().Select(x => x.Estado).FirstOrDefaultAsync();

                if (estatusComunidad)  //Solo se pueden hacer operaciones si la comunidad esta activa
                {
                    if (infoAgregada != null && !model.Estado.Equals("Aprobado"))
                    {
                        infoAgregada.nuevo = false;
                        await _genContext.SaveChangesAsync();
                    }
                    else if (infoAgregada != null && model.Estado.Equals("Aprobado"))
                    {
                        infoAgregada.nuevo = true;
                        await _genContext.SaveChangesAsync();
                    }
                    else
                    {
                        await repo.Create("CP", "PlanesAnuales", model.Nombre, "indexCP.html#/detallesPlanAnual/" + model.PlanId, Convert.ToString(model.PlanId));
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
        }
Esempio n. 6
0
        public async Task Create(PlanAnual model)
        {
            try
            {
                if (model.claveAutores != null)
                {
                    var plan = _db.DbSetPlanAnual.Add(model);
                    await _db.SaveChangesAsync();

                    var estatusComunidad = await _db.DbSetComunidades.Where(e => e.ComunidadId == model.idCP).AsNoTracking().Select(x => x.Estado).FirstOrDefaultAsync();

                    if (model.Estado.Equals("Aprobado") && estatusComunidad)
                    {
                        //Los parametros son: moduloid, id del oc (en este caso son strings), descripcion, liga del detalle del oc
                        await repo.Create("CP", "PlanesAnuales", plan.Nombre, "indexCP.html#/detallesPlanAnual/" + plan.PlanId, Convert.ToString(plan.PlanId));
                    }


                    Autores autor = new Autores();
                    foreach (var clave in model.claveAutores)
                    {
                        autor.clave         = clave;
                        autor.ContenidoId   = plan.PlanId;
                        autor.idOC          = 5;
                        autor.FechaRegistro = DateTime.Now;
                        _db.DbSetAutores.Add(autor);
                        await _db.SaveChangesAsync();
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
        }
Esempio n. 7
0
        public async Task <Object> GetAllConsultaPorOC(PlanAnual parametros)
        {
            try
            {
                var entities = (from pa in _db.DbSetPlanAnual select pa).Include(e => e.Comunidad).Include(e => e.LineaDesarrolloTecnologico);

                AutoresCPRepository autoresOC = new AutoresCPRepository();
                Autores             a         = new Autores();

                if (entities != null)
                {
                    if (!String.IsNullOrEmpty(parametros.busquedaFecha))  //busqueda por fecha
                    {
                        entities = entities.Where(e => (DbFunctions.TruncateTime(e.FechaRegistro) >= DbFunctions.TruncateTime(parametros.fechaInicioComparacion) &&
                                                        DbFunctions.TruncateTime(e.FechaRegistro) <= DbFunctions.TruncateTime(parametros.fechaFinalComparacion)));
                    }
                    if (!String.IsNullOrEmpty(parametros.nombreComunidad)) //busqueda por el nombre de la comunidad
                    {
                        ComunidadesRepository comunidad = new ComunidadesRepository();
                        var listaComunidades            = await comunidad.GetPKComunidadesByCollateLatin1(parametros.nombreComunidad);

                        entities = entities.Where(e => listaComunidades.Contains(e.idCP));
                    }
                    if (!String.IsNullOrEmpty(parametros.Nombre)) //busqueda por nombre del EA
                    {
                        var listaArte = await GetPKPlanByCollateLatin1(parametros.Nombre);

                        entities = entities.Where(e => listaArte.Contains(e.PlanId));
                    }
                    if (!String.IsNullOrEmpty(parametros.PalabrasClave))  //busqueda por palabras clave
                    {
                        var listaPalabras = await GetPKPalabrasClaveByCollateLatin1(parametros.PalabrasClave);

                        entities = entities.Where(e => listaPalabras.Contains(e.PlanId));
                    }
                    if (!String.IsNullOrEmpty(parametros.nombrePersona))                                                //busqueda por autores del OC
                    {
                        List <int> listaIds = await autoresOC.GetPKAutoresByCollateLatin1(parametros.nombrePersona, 5); //el numero viene de la lista de oc de cp en la bd

                        entities = entities.Where(e => listaIds.Contains(e.PlanId));
                    }
                    if (parametros.idLineaInv != 0 && parametros.idLineaInv != null)  //busqueda por linea de investigacion
                    {
                        entities = entities.Where(e => e.idLineaInv == parametros.idLineaInv);
                    }

                    foreach (var estado in entities)
                    {
                        estado.personas = await autoresOC.GetByOC(estado.PlanId, 5);
                    }
                }

                return(entities);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
        }
        private void ColocarPendienteObservaciones(PlanAnual plan)
        {
            var observaciones = _db.ObservacionesPlan(plan.Id, (int)EstadoObservacion.Agregado).ToList();

            observaciones.ForEach(x => x.Estado = (int)EstadoObservacion.Pendiente);
            observaciones.ForEach(x => _db.Observaciones.ApplyCurrentValues(x));
            _db.SaveChanges();
        }
Esempio n. 9
0
        public async Task Update(PlanAnual model)
        {
            try
            {
                var _model = await _db.DbSetPlanAnual.FirstOrDefaultAsync(e => e.PlanId == model.PlanId);

                if (_model != null)
                {
                    //Cuando se elimina el adjunto en modo edicion
                    if (model.AdjuntoId != null)
                    {
                        int id = Convert.ToInt32(model.AdjuntoId);
                        model.AdjuntoId = null;
                        _db.Entry(_model).CurrentValues.SetValues(model);
                        await _db.SaveChangesAsync();

                        await _adjuntoRepo.Delete(id);
                    }
                    //Cuando se agrega un nuevo archivo
                    if (model.Adjunto != null && model.AdjuntoId == null)
                    {
                        Adjunto key = await _adjuntoRepo.CreateAd(model.Adjunto);

                        model.AdjuntoId         = key.AdjuntoId;
                        model.Adjunto.AdjuntoId = key.AdjuntoId;
                    }
                    if (model.claveAutores != null)
                    {
                        var autoresRegistro = await _db.DbSetAutores.Where(e => e.idOC == 5 && e.ContenidoId == model.PlanId).AsNoTracking().ToListAsync();

                        //Eliminacion de autores
                        AutoresCPRepository autoresRepo = new AutoresCPRepository();
                        foreach (var c in autoresRegistro)
                        {
                            await autoresRepo.Delete(c.AutorId);
                        }
                        Autores autor = new Autores();
                        foreach (var clave in model.claveAutores)
                        {
                            autor.clave         = clave;
                            autor.ContenidoId   = model.PlanId;
                            autor.idOC          = 5;
                            autor.FechaRegistro = DateTime.Now;
                            _db.DbSetAutores.Add(autor);
                            await _db.SaveChangesAsync();
                        }
                    }
                    _db.Entry(_model).CurrentValues.SetValues(model);
                    await _db.SaveChangesAsync();

                    await cambiaEstadoPublicacion(_model);
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
        }
Esempio n. 10
0
 /// <summary>Aplica las reglas de validación de usuarios al formulario.
 /// <returns>void</returns>
 /// </summary>
 protected override void ApplyAuthorizationRules()
 {
     Tabla.Visible         = PlanAnual.CanGetObject();
     Add_Button.Enabled    = PlanAnual.CanAddObject();
     Edit_Button.Enabled   = PlanAnual.CanEditObject();
     Delete_Button.Enabled = PlanAnual.CanDeleteObject();
     Print_Button.Enabled  = PlanAnual.CanGetObject();
     View_Button.Enabled   = PlanAnual.CanGetObject();
 }
Esempio n. 11
0
 public PlanAnualAddForm(PlanAnual source)
     : base()
 {
     InitializeComponent();
     _entity = source.Clone();
     _entity.BeginEdit();
     SetFormData();
     _mf_type  = ManagerFormType.MFAdd;
     this.Text = Resources.Labels.PLAN_ANUAL_ADD_TITLE;
 }
Esempio n. 12
0
        /// <summary>
        /// Guarda en la bd el objeto actual
        /// </summary>
        protected override bool SaveObject()
        {
            using (StatusBusy busy = new StatusBusy(moleQule.Face.Resources.Messages.SAVING))
            {
                this.Datos.RaiseListChangedEvents = false;

                PlanAnual temp = _entity.Clone();
                temp.ApplyEdit();

                foreach (Plan_Tipo item in _entity.PlanesTipos)
                {
                    if (item.OidTipo == 0)
                    {
                        MessageBox.Show(Resources.Messages.PLAN_TIPO_NO_VALIDO,
                                        moleQule.Library.Application.AppController.APP_TITLE,
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Exclamation);
                        return(false);
                    }
                }

                // do the save
                try
                {
                    _entity = temp.Save();
                    _entity.ApplyEdit();

                    //Decomentar si se va a mantener en memoria
                    //_entity.BeginEdit();
                    return(true);
                }
                catch (iQValidationException ex)
                {
                    MessageBox.Show(iQExceptionHandler.GetAllMessages(ex) +
                                    Environment.NewLine + ex.SysMessage,
                                    moleQule.Library.Application.AppController.APP_TITLE,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    return(false);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(iQExceptionHandler.GetAllMessages(ex),
                                    moleQule.Library.Application.AppController.APP_TITLE,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    return(false);
                }
                finally
                {
                    this.Datos.RaiseListChangedEvents = true;
                }
            }
        }
Esempio n. 13
0
        public async Task <IHttpActionResult> GetAllConsultaPorOC(PlanAnual param)
        {
            try
            {
                log.Info(new MDCSet(this.ControllerContext.RouteData));
                var entities = await _entityRepo.GetAllConsultaPorOC(param);

                return(Ok(entities));
            }
            catch (Exception e)
            {
                log.Error(new MDCSet(this.ControllerContext.RouteData), e);
                return(InternalServerError(e));
            }
        }
Esempio n. 14
0
        private static List <string> RevisarCamposPlan(PlanAnual planAnual)
        {
            var listaErrores = new List <string>();

            if (planAnual.ObjetivosEspecificos.Count(x => x.Metas.Count == 0) >= 1)
            {
                listaErrores.Add("Los objetivos deben tener por lo menos una meta.");
            }
            else
            {
                if (planAnual.ObjetivosEspecificos.Count(x => x.Metas.Count(y => y.Macroactividades.Count == 0) >= 1) >= 1)
                {
                    listaErrores.Add("Las metas deben tener por lo menos una macroactividad.");
                }
            }
            return(listaErrores);
        }
Esempio n. 15
0
        public override void UpdateList()
        {
            switch (_current_action)
            {
            case molAction.Add:
                if (_entity == null)
                {
                    return;
                }
                List.AddItem(_entity.GetInfo(false));
                if (FilterType == IFilterType.Filter)
                {
                    PlanAnualList listA = PlanAnualList.GetList(_filter_results);
                    listA.AddItem(_entity.GetInfo(false));
                    _filter_results = listA.GetSortedList();
                }
                break;

            case molAction.Edit:
            case molAction.Lock:
            case molAction.Unlock:
                if (_entity == null)
                {
                    return;
                }
                ActiveItem.CopyFrom(_entity);
                break;

            case molAction.Delete:
                if (ActiveItem == null)
                {
                    return;
                }
                List.RemoveItem(ActiveOID);
                if (FilterType == IFilterType.Filter)
                {
                    PlanAnualList listD = PlanAnualList.GetList(_filter_results);
                    listD.RemoveItem(ActiveOID);
                    _filter_results = listD.GetSortedList();
                }
                break;
            }

            _entity = null;
            RefreshSources();
        }
        private List <string> RevisarCamposPlan(PlanAnual planAnual)
        {
            var listaErrores = new List <string>();

            if (string.IsNullOrEmpty(planAnual.Introduccion))
            {
                listaErrores.Add("La introducción no puede ir vacía");
            }
            if (string.IsNullOrEmpty(planAnual.Mision))
            {
                listaErrores.Add("La misión no puede ir vacía");
            }
            if (string.IsNullOrEmpty(planAnual.Vision))
            {
                listaErrores.Add("La visión no puede ir vacía");
            }
            if (string.IsNullOrEmpty(planAnual.Valores))
            {
                listaErrores.Add("Los valores no puede ir vacíos.");
            }
            if (string.IsNullOrEmpty(planAnual.ObjetivoGeneral))
            {
                listaErrores.Add("El objetivo general no puede ir vacío.");
            }
            if (!planAnual.ObjetivosEspecificos.Any())
            {
                listaErrores.Add("Debe tener por lo menos un objetivo específico.");
            }

            if (planAnual.ObjetivosEspecificos.Any(obj => obj.Metas.Count == 0))
            {
                listaErrores.Add("Todos los objetivo específicos deben contener al menos una meta.");
            }

            if (planAnual.ObjetivosEspecificos.Any(obj => obj.Metas.Any(meta => meta.Macroactividades.Count == 0)))
            {
                listaErrores.Add("Todas las metas deben contener al menos una macroactividad.");
            }

            if (planAnual.ObjetivosEspecificos.Any(obj => obj.Metas.Any(meta => meta.Macroactividades.Any(macro => macro.Proyecciones.Count == 0))))
            {
                listaErrores.Add("Todas las macroactividads deben contener al menos una proyección.");
            }
            return(listaErrores);
        }
        private void DepurarMarcoTeorico(PlanAnual planAnual)
        {
            if (string.IsNullOrEmpty(planAnual.Introduccion))
            {
                planAnual.Introduccion = "";
                ModelState["Introduccion"].Errors.Clear();
            }

            if (string.IsNullOrEmpty(planAnual.EstrategiasObjetivos))
            {
                planAnual.EstrategiasObjetivos = "";
                ModelState["EstrategiasObjetivos"].Errors.Clear();
            }

            if (string.IsNullOrEmpty(planAnual.Mision))
            {
                planAnual.Mision = "";
                ModelState["Mision"].Errors.Clear();
            }

            if (string.IsNullOrEmpty(planAnual.ObjetivoGeneral))
            {
                planAnual.ObjetivoGeneral = "";
                ModelState["ObjetivoGeneral"].Errors.Clear();
            }

            if (string.IsNullOrEmpty(planAnual.Politicas))
            {
                planAnual.Politicas = "";
                ModelState["Politicas"].Errors.Clear();
            }

            if (string.IsNullOrEmpty(planAnual.Valores))
            {
                planAnual.Valores = "";
                ModelState["Valores"].Errors.Clear();
            }

            if (string.IsNullOrEmpty(planAnual.Vision))
            {
                planAnual.Vision = "";
                ModelState["Vision"].Errors.Clear();
            }
        }
        ///// <summary>
        ///// Abre el formulario para borrar item
        ///// <returns>void</returns>
        ///// </summary>
        public override void DeleteObject(long oid)
        {
            if (MessageBox.Show(moleQule.Face.Resources.Messages.DELETE_CONFIRM,
                                moleQule.Face.Resources.Labels.ADVISE_TITLE,
                                MessageBoxButtons.YesNoCancel,
                                MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    PlanAnualInfo instructor = PlanAnualInfo.Get(oid, true);
                    //if (instructor != null
                    //    && instructor.Sesiones.Count == 0
                    //    && instructor.Examenes.Count == 0)
                    PlanAnual.Delete(oid);
                    //else
                    //    MessageBox.Show("No es posible eliminar al instructor seleccionado.\n"
                    //                    + "Es posible que tenga sesiones asociados en algún horario o exámenes creados por este instructor.\n"
                    //                    + "Debe modificarlas antes de continuar.");

                    //Se eliminan todos los formularios de ese objeto
                    foreach (EntityDriverForm form in _list_active_form)
                    {
                        if (form is ItemMngBaseForm)
                        {
                            if (((ItemMngBaseForm)form).Oid == oid)
                            {
                                form.Dispose();
                                break;
                            }
                        }
                    }
                }
                catch (DataPortalException ex)
                {
                    MessageBox.Show(iQExceptionHandler.GetiQException(ex).Message);
                }
                finally
                {
                    RefreshList();
                }
            }
        }
Esempio n. 19
0
        public async Task <IHttpActionResult> Update([FromBody] PlanAnual model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                log.Info(new MDCSet(this.ControllerContext.RouteData));
                await _entityRepo.Update(model);

                return(Ok("Registro actualizado exitosamente!"));
            }
            catch (Exception e)
            {
                log.Error(new MDCSet(this.ControllerContext.RouteData), e);
                return(InternalServerError(e));
            }
        }
        /// <summary>
        /// Abre el formulario para borrar item
        /// <returns>void</returns>
        /// </summary>
        public override void DeleteObject(long oid)
        {
            if (MessageBox.Show(moleQule.Face.Resources.Messages.DELETE_CONFIRM,
                                moleQule.Face.Resources.Labels.ADVISE_TITLE,
                                MessageBoxButtons.YesNoCancel,
                                MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    PlanAnualInfo plan = PlanAnualInfo.Get(oid, true);
                    if (plan != null && plan.PlanesTipos.Count > 0)
                    {
                        MessageBox.Show(Resources.Messages.PLAN_ANUAL_CON_TIPOS_ASOCIADOS);
                        _action_result = DialogResult.Ignore;
                        return;
                    }

                    PlanAnual.Delete(oid);
                    _action_result = DialogResult.OK;

                    //Se eliminan todos los formularios de ese objeto
                    foreach (ItemMngBaseForm form in _list_active_form)
                    {
                        if (form.Oid == oid)
                        {
                            form.Dispose();
                            break;
                        }
                    }
                }
                catch (Csla.DataPortalException ex)
                {
                    MessageBox.Show(iQExceptionHandler.GetiQException(ex).Message);
                }
                finally
                {
                    RefreshList();
                }
            }
        }
        /// <summary>
        /// Aplica el filtro correspondiente según la pestaña
        /// </summary>
        protected override void ApplyFilter()
        {
            switch (Filtros.SelectedTab.Name)
            {
            case "Todos_TP":
            {
                RefreshMainData();
            } break;

            case "Advanced_TP":
            {
                try
                {
                    Datos_Planes.DataSource =
                        PlanAnualList.SortList(_lista_filtrada, "Codigo", ListSortDirection.Ascending);
                }
                catch (Exception)
                {
                    Datos_Planes.DataSource = _lista;
                }
            } break;

            case "Nombre_TP":
            {
                try
                {
                    CriteriaEx criteria = PlanAnual.GetCriteria(PlanAnual.OpenSession());
                    criteria.AddStartsWith("Nombre", ActiveItem.Nombre[0].ToString());
                    _lista = PlanAnualList.GetList(criteria);
                    Datos_Planes.DataSource = PlanAnualList.SortList(_lista,
                                                                     "Codigo",
                                                                     ListSortDirection.Ascending);
                }
                catch (Exception)
                {
                    _lista = null;
                }
            } break;
            }
        }
 public ActionResult Edit(PlanAnual planAnual)
 {
     try
     {
         DepurarMarcoTeorico(planAnual);
         if (ModelState.IsValid)
         {
             _db.PlanesAnuales.Attach(planAnual);
             _db.ObjectStateManager.ChangeObjectState(planAnual, EntityState.Modified);
             _db.SaveChanges();
             _auditorRepository.GuardarRegistroEdicion(TempData["plananualEdit" + planAnual.Id], planAnual);
             return(RedirectToAction("Index", "Home"));
         }
         ViewBag.IdEjercicio = planAnual.IdEjercicio;
         ViewBag.IdEstructuraOrganizativa = planAnual.IdEstructuraOrganizativa;
         ViewBag.Estado = planAnual.EstadoPlanEtapa;
         return(View(planAnual));
     }
     catch (Exception ex)
     {
         Utilidades.ColocarMensaje(ex, Request);
         return(RedirectToAction("Index", "Home"));
     }
 }
Esempio n. 23
0
 protected override void GetFormSourceData()
 {
     _entity = PlanAnual.New();
     _entity.BeginEdit();
 }
Esempio n. 24
0
 protected override void GetFormSourceData(long oid)
 {
     _entity = PlanAnual.Get(oid, true);
     _entity.BeginEdit();
     _mf_type = ManagerFormType.MFEdit;
 }
        ///// <summary>Imprime la lista del objetos
        ///// <returns>void</returns>
        ///// </summary>
        //public override void PrintList()
        //{
        //    ClienteReportMng reportMng = new ClienteReportMng(AppContext.ActiveSchema);

        //    PlanAnualListRpt report = reportMng.GetPlanAnualListReport(PlanAnualList.GetList((IList<PlanAnualInfo>)Datos.List));

        //    if (report != null)
        //    {
        //        ReportViewer.SetReport(report);
        //        ReportViewer.ShowDialog();
        //    }
        //    else
        //    {
        //        MessageBox.Show(Resources.Messages.NO_DATA_REPORTS,
        //                        Labels.EMPTY_REPORT,
        //                        MessageBoxButtons.OK,
        //                        MessageBoxIcon.Exclamation);
        //    }
        //}

        #endregion

        #region Events

        private void PlanAnualMngForm_KeyPress(object sender, KeyPressEventArgs e)
        {
            DataGridViewColumn col;

            if (Tabla.CurrentCell == null)
            {
                if (Tabla.SortedColumn != null)
                {
                    col = Tabla.SortedColumn;
                }
                else
                {
                    col = Tabla.Columns[0];
                }
            }
            else
            {
                col = Tabla.Columns[Tabla.CurrentCell.ColumnIndex];
            }

            if (col.ValueType != null)
            {
                if (col.ValueType.Name == "Int32")
                {
                    return;
                }
                if (col.ValueType.Name == "Int64")
                {
                    return;
                }
                if (col.ValueType.Name == "Single")
                {
                    return;
                }
                if (col.ValueType.Name == "Double")
                {
                    return;
                }

                string     car      = e.KeyChar.ToString();
                CriteriaEx criteria = PlanAnual.GetCriteria(PlanAnual.OpenSession());

                criteria.AddStartsWith(col.DataPropertyName, car);

                // Buscamos las palabras que empiecen por el caracter
                PlanAnualList lista = PlanAnualList.GetList(criteria);
                SortedBindingList <PlanAnualInfo> list =
                    PlanAnualList.GetSortedList(lista, col.DataPropertyName, ListSortDirection.Ascending);

                int foundIndex;

                // Nos situamos en la primera aparicion de esa lista en la
                // que se muestra. Esto se hace pq se ha consultado la bd y no la lista actual
                // lo que puede dar lugar a inconsistencias si otro usuario a cambiado la bd
                foreach (PlanAnualInfo cli in list)
                {
                    foundIndex = Datos.IndexOf(cli);
                    if (foundIndex != -1)
                    {
                        Datos.Position = foundIndex;
                        break;
                    }
                }
            }
        }