Exemple #1
0
        /// <summary>Duplica un objeto y abre el formulario para editar item
        /// <returns>void</returns>
        /// </summary>
        public override void CopyObjectAction(long oid)
        {
            try
            {
                PlanEstudios old = PlanEstudios.Get(oid);
                PlanEstudios dup = old.CloneAsNew();
                old.CloseSession();

                AddForm(new PlanDocenteAddForm(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();
        }
Exemple #2
0
 /// <summary>
 /// Abre el formulario para editar item
 /// <returns>void</returns>
 /// </summary>
 public override void OpenEditForm()
 {
     try
     {
         PlanDocenteEditForm form = new PlanDocenteEditForm(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);
     }
 }
Exemple #3
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
                {
                    PlanEstudios.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);
                }
            }
        }
Exemple #4
0
 /// <summary>Aplica las reglas de validación de usuarios al formulario.
 /// <returns>void</returns>
 /// </summary>
 protected override void ApplyAuthorizationRules()
 {
     Tabla.Visible         = PlanEstudios.CanGetObject();
     Add_Button.Enabled    = PlanEstudios.CanAddObject();
     Edit_Button.Enabled   = PlanEstudios.CanEditObject();
     Delete_Button.Enabled = PlanEstudios.CanDeleteObject();
     Print_Button.Enabled  = PlanEstudios.CanGetObject();
     View_Button.Enabled   = PlanEstudios.CanGetObject();
 }
 public PlanDocenteAddForm(PlanEstudios source)
     : base()
 {
     InitializeComponent();
     _entity = source.Clone();
     _entity.BeginEdit();
     SetFormData();
     _mf_type  = ManagerFormType.MFAdd;
     this.Text = Resources.Labels.PLAN_DOCENTE_ADD_TITLE;
 }
Exemple #6
0
 //Acion Guardar
 public ActionResult Guardar(PlanEstudios objplanestudio)
 {
     if (ModelState.IsValid)
     {
         objplanestudio.Guardar();
         return(Redirect("~/PlanEstudios"));
     }
     else
     {
         return(View("~/Views/PlanEstudios/AgregarEditar.cshtml"));
     }
 }
Exemple #7
0
        public override void UpdateList()
        {
            switch (_current_action)
            {
            case molAction.Add:
                if (_entity == null)
                {
                    return;
                }
                List.AddItem(_entity.GetInfo(false));
                if (FilterType == IFilterType.Filter)
                {
                    PlanEstudiosList listA = PlanEstudiosList.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)
                {
                    PlanEstudiosList listD = PlanEstudiosList.GetList(_filter_results);
                    listD.RemoveItem(ActiveOID);
                    _filter_results = listD.GetSortedList();
                }
                break;
            }

            _entity = null;
            RefreshSources();
        }
        /// <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;

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

                // 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;
                }
            }
        }
Exemple #9
0
 protected override void GetFormSourceData(long oid)
 {
     _entity = PlanEstudios.Get(oid);
     _entity.BeginEdit();
     _mf_type = ManagerFormType.MFEdit;
 }
        protected override bool DoSearch()
        {
            bool             plan    = false;
            PlanEstudiosList sublist = null;

            if (_lista == null)
            {
                MessageBox.Show(Resources.Messages.NO_RESULTS);
                return(false);
            }

            FCriteria criteria = null;

            foreach (Control ctl in this.Campos_Groupbox.Controls)
            {
                if (((System.Windows.Forms.RadioButton)ctl).Checked)
                {
                    switch (ctl.Name)
                    {
                    case "Nombre_RB":
                    {
                        criteria = new FCriteria <string>("Nombre", Valor_TB.Text);
                        break;
                    }

                    case "Plan_RB":
                    {
                        CriteriaEx criteriaex = PlanEstudios.GetCriteria(PlanEstudios.OpenSession());
                        criteriaex.AddContains("Nombre", Valor_TB.Text);
                        sublist = PlanEstudiosList.GetList(criteriaex);
                        // No existe el plan
                        if (sublist.Count == 0)
                        {
                            MessageBox.Show(Resources.Messages.NO_RESULTS);
                            return(false);
                        }
                        plan = true;
                        break;
                    }
                    }
                }
            }

            // Consulta en la bd
            SortedBindingList <PromocionInfo> lista;

            if (SortProperty != string.Empty)
            {
                if (!plan)
                {
                    lista = _lista.GetSortedSubList(criteria, SortProperty, SortDirection);
                }
                else
                {
                    PromocionList list = PromocionList.GetList(PromocionList.GetFilteredList(_lista, sublist, "OidPlan"));
                    lista = list.ToSortedList(SortProperty, SortDirection);
                }
            }
            else
            {
                lista = _lista.GetSortedSubList(criteria, "Oid", SortDirection);
            }

            Datos.DataSource = lista;

            if (lista.Count == 0)
            {
                MessageBox.Show(Resources.Messages.NO_RESULTS);
                return(false);
            }

            Datos.MoveFirst();

            return(true);
        }
        protected override bool DoSearch()
        {
            bool             promo        = false;
            bool             plan         = false;
            PromocionList    sublist      = null;
            PlanEstudiosList sublist_plan = null;

            DateTime inicio = DateTime.MinValue;
            DateTime fin    = DateTime.MaxValue;

            if (Desde_DTP.Checked)
            {
                inicio = Desde_DTP.Value;
            }

            if (Hasta_DTP.Checked)
            {
                fin = Hasta_DTP.Value;
            }

            if (_lista == null)
            {
                MessageBox.Show(Resources.Messages.NO_RESULTS);
                return(false);
            }

            FCriteria criteria = null;

            if (Valor_TB.Text != " ")
            {
                foreach (Control ctl in this.Campos_Groupbox.Controls)
                {
                    if (((System.Windows.Forms.RadioButton)ctl).Checked)
                    {
                        switch (ctl.Name)
                        {
                        case "Promocion_RB":
                        {
                            CriteriaEx criteriaex = Promocion.GetCriteria(Promocion.OpenSession());
                            criteriaex.AddContains("Nombre", Valor_TB.Text);
                            criteriaex.Childs = false;
                            sublist           = PromocionList.GetList(criteriaex);
                            // No existe la promoción
                            if (sublist.Count == 0)
                            {
                                MessageBox.Show(Resources.Messages.NO_RESULTS);
                                return(false);
                            }
                            promo = true;
                            break;
                        }

                        case "Plan_RB":
                        {
                            CriteriaEx criteriaex = PlanEstudios.GetCriteria(PlanEstudios.OpenSession());
                            criteriaex.AddContains("Nombre", Valor_TB.Text);
                            criteriaex.Childs = false;
                            sublist_plan      = PlanEstudiosList.GetList(criteriaex);
                            // No existe la promoción
                            if (sublist_plan.Count == 0)
                            {
                                MessageBox.Show(Resources.Messages.NO_RESULTS);
                                return(false);
                            }
                            plan = true;
                            break;
                        }
                        }
                    }
                }
            }

            // Consulta en la bd
            SortedBindingList <HorarioInfo> lista = null;

            if (SortProperty != string.Empty)
            {
                if (promo)
                {
                    HorarioList list = HorarioList.GetList(HorarioList.GetFilteredList(HorarioList.GetFilteredFechaList(_lista, inicio, fin),
                                                                                       sublist, "OidPromocion"));
                    lista = list.ToSortedList(SortProperty, SortDirection);
                }
                else
                {
                    if (plan)
                    {
                        HorarioList list = HorarioList.GetList(HorarioList.GetFilteredList(HorarioList.GetFilteredFechaList(_lista, inicio, fin),
                                                                                           sublist_plan, "OidPlan"));
                        lista = list.ToSortedList(SortProperty, SortDirection);
                    }
                    else
                    {
                        lista = HorarioList.SortList(HorarioList.GetFilteredFechaList(_lista, inicio, fin), SortProperty, SortDirection);
                    };
                }
            }
            else
            {
                lista = _lista.GetSortedSubList(criteria, "Oid", SortDirection);
            }

            Datos.DataSource = lista;

            if (lista.Count == 0)
            {
                MessageBox.Show(Resources.Messages.NO_RESULTS);
                return(false);
            }

            Datos.MoveFirst();

            return(true);
        }
 public void SetSourceData(PlanEstudios item)
 {
     _entity = item;
 }
 protected override void GetFormSourceData()
 {
     _entity = PlanEstudios.New();
     _entity.BeginEdit();
 }
Exemple #14
0
        public ActionResult DetallesCarrera(int id)
        {
            PlanEstudios planEstudios   = new PlanEstudios();
            DataSet      dsPlanEstudios = new DataSet();

            using (SqlConnection conexion = new SqlConnection(ConfigurationManager.ConnectionStrings["EscuelaConnectionString"].ConnectionString))
            {
                conexion.Open();
                using (SqlCommand comando = new SqlCommand("spGetPlanEstudios", conexion))
                {
                    comando.CommandType = CommandType.StoredProcedure;
                    comando.Parameters.AddWithValue("@IdCarrera", id);
                    SqlDataAdapter DA = new SqlDataAdapter(comando);
                    DA.Fill(dsPlanEstudios);
                }
            }

            if (dsPlanEstudios.Tables.Count > 0)
            {
                planEstudios.IdCarrera     = id;
                planEstudios.NombreCarrera = dsPlanEstudios.Tables[0].Rows[0]["NombreCarrera"].ToString();

                List <DetallePlanEstudios> detallesPlanEstudios = new List <DetallePlanEstudios>();

                foreach (DataRow row in dsPlanEstudios.Tables[1].Rows)
                {
                    detallesPlanEstudios.Add(new DetallePlanEstudios()
                    {
                        IdCarrera     = Convert.ToInt32(row["IdCarrera"]),
                        NombreCarrera = row["NombreCarrera"].ToString(),
                        Creditos      = Convert.ToInt32(row["Creditos"]),
                        IdMateria     = Convert.ToInt32(row["IdMateria"]),
                        Nivel         = Convert.ToInt32(row["Nivel"]),
                        NombreMateria = row["NombreMateria"].ToString(),
                        TipoNivel     = row["TipoNivel"].ToString(),
                        Niveles       = Convert.ToInt32(row["Niveles"])
                    }
                                             );
                }

                var Niveles = (from d in detallesPlanEstudios
                               group d by new { d.Nivel, d.TipoNivel }
                               into gcs
                               select new NivelCarrera()
                {
                    Nivel = gcs.Key.Nivel, TipoNivel = gcs.Key.TipoNivel, Materias = new List <Materia>()
                }).ToList();


                foreach (var nivel in Niveles)
                {
                    var detalles = (from m in detallesPlanEstudios where m.Nivel == nivel.Nivel && m.TipoNivel == nivel.TipoNivel select m);

                    foreach (var detalle in detalles)
                    {
                        nivel.Materias.Add(new Materia()
                        {
                            IdMateria = detalle.IdMateria, NombreMateria = detalle.NombreMateria, Creditos = detalle.Creditos
                        });
                    }
                }

                planEstudios.Niveles = Niveles;
            }

            return(View(planEstudios));
        }