Esempio n. 1
0
 /// <summary>
 /// Loads data into grid view
 /// </summary>
 private void CargarGridInfoData() {
     if (log.IsDebugEnabled) {
         log.Debug("CargarGridInfoData Starts");
     }
     var entList = new Entidad().getValoresEntidad(listaEntidades.SelectedValue);
     if (entList.Count > 0) {
         btnActualizar.Visible = btnEliminar.Visible = false;
     }
     grdInfo.DataSource = entList;
     grdInfo.SelectedIndex = -1;
     grdInfo.DataBind();
     if (log.IsDebugEnabled) {
         log.Debug("CargarGridInfoData Ends");
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Loads data info to Gender combobox
 /// </summary>
 protected void PoblarDropGenero() {
     if (log.IsDebugEnabled) {
         log.Debug("PoblarDropGenero Starts");
     }
     Entidad daoEnt = new Entidad();
     List<EntidadDto> entityList = daoEnt.getValoresEntidad(Settings.SysParamGender);
     List<KeyValue> l = new List<KeyValue>();
     l.Add(new KeyValue() { key = "-1", value = "-- SELECCIONE --" });
     entityList.ForEach(t => l.Add(new KeyValue() { key = t.idEntidad.ToString(), value = t.valorEntidad }));
     listGenero.DataSource = l;
     listGenero.DataTextField = "value";
     listGenero.DataValueField = "key";
     listGenero.DataBind();
     if (log.IsDebugEnabled) {
         log.Debug("PoblarDropGenero Ends");
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Loads the schedule for movie and generates the HTML to be used as a basis for its schedule.
        /// </summary>
        private void pintarProgramacion() {
            if (log.IsDebugEnabled) {
                log.Debug("pintarProgramacion Starts");
            }
            if (Session["Formatos"] == null) {
                Session["Formatos"] = new Entidad().getValoresEntidad("SISTEMA_FORMATO_PELICULA");
            }            
            List<EntidadDto> formatos = (List<EntidadDto>)Session["Formatos"];
            int idPelicula = Convert.ToInt32(ListBoxPeliculas.SelectedValue);
            int idTeatro = Convert.ToInt32(teatroSeleccionado.Value.ToString());
            List<PeliculaFullInfoDto> listaProgramacion = obtenerProgramacion(idPelicula, idTeatro);
            List<DateTime> fechas = listaProgramacion.Select(x => new DateTime(int.Parse(x.annoHorarioPelicula), int.Parse(x.mesHorarioPelicula), int.Parse(x.diaHorarioPelicula))).Distinct().OrderByDescending(x => x).ToList();
            ltFechas.Text = "";
            int cont = 1;
            foreach (var item in fechas) {
                ltFechas.Text += string.Format("<div class='fechas'>");

                List<PeliculaFullInfoDto> info_x_fecha = listaProgramacion.Where(x => (new DateTime(int.Parse(x.annoHorarioPelicula), int.Parse(x.mesHorarioPelicula), int.Parse(x.diaHorarioPelicula))) == item).ToList();
                ltFechas.Text += string.Format("<div class='fecha' ><input class='txt_fecha' type='text' value='{0}'/><span class='mas'><img id='imgExpand' title='Ver Elementos' class='imgFechas' src='images/{2}.png'/></span><span class='clon'><img class='imgFechas' title='Clonar Fecha' src='images/Clonar.png'/></span></div><div class='horas{1}'>", String.Format("{0:dddd, dd/MM/yyyy}", item), cont == 1 ? " expanded" : "", cont == 1 ? "FlechaAba" : "FlechaDer");
                foreach (var formato in formatos) {
                    var horarioPelicula = info_x_fecha.Where(x => x.idFormato == formato.idEntidad).ToList();
                    var idHorarioPelicula = horarioPelicula.Select(x => x.idHorarioPelicula).Distinct().FirstOrDefault();
                    ltFechas.Text += string.Format("<div class='formatos' idFormato='{0}' idHorarioPelicula='{2}'><span class='nombre_formato'>Formato - {1}  </span><span class='masHora'><img class='imgFechas'  title='Adicionar Hora' src='images/MasHora.png'/></span><br>", formato.idEntidad, formato.valorEntidad, idHorarioPelicula);
                    foreach (var hora in horarioPelicula) {
                        if (!string.IsNullOrEmpty(hora.horaPelicula) && !string.IsNullOrEmpty(hora.minutoPelicula))
                            ltFechas.Text += string.Format("<input class='txt_hora' type='text' value='{0}:{1}'/>", int.Parse(hora.horaPelicula) < 10 ? "0" + hora.horaPelicula : hora.horaPelicula, int.Parse(hora.minutoPelicula) < 10 ? "0" + hora.minutoPelicula : hora.minutoPelicula);
                    }
                    ltFechas.Text += "</div><hr>";  //Cierra div formato_{0}
                }
                ltFechas.Text += "</div></div>";//Cierra div horas  
                cont++;
            }
            //Llenar plantilla vacia para adicionar fecha
            foreach (var formato in formatos) {
                codNuevaFecha.Value += string.Format("<div class='formatos' idFormato='{0}' idHorarioPelicula='{2}'><span class='nombre_formato'>Formato - {1}</span><span class='masHora_nuevo'><img class='imgFechas'  title='Adicionar Hora' src='images/MasHora.png'/></span><br></div><hr>", formato.idEntidad, formato.valorEntidad, 0);
            }
            codNuevaFecha.Value = string.Format("<div class='fechas'><div class='fecha'><input class='txt_fecha' type='text' value=''/><span class='mas_nuevo'><img id='imgExpand' title='Ver Elementos' class='imgFechas' src='images/FlechaAba.png'/></span><span class='clon_nuevo'><img class='imgFechas' title='Clonar Fecha' src='images/Clonar.png'/></span></div><div class='horas expanded'>{0}</div></div>", codNuevaFecha.Value);
            if (log.IsDebugEnabled) {
                log.Debug("HTML generated is [" + codNuevaFecha.Value + "]");
                log.Debug("pintarProgramacion Ends");
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Update a record
 /// </summary>
 /// <param name="sender">Objet which sends event</param>
 /// <param name="e">event parameteres</param>
 protected void OnButtonActualizar(object sender, EventArgs e) {
     if (log.IsDebugEnabled) {
         log.Debug("OnButtonActualizar Starts");
     }
     if (!ValidarCampos()) {
         if (log.IsDebugEnabled) {
             log.Debug("No input data supplied");
         }
         registerToastrMsg(MessageType.Error, "No ha ingresado datos para actualizar.");
     }
     else {
         Entidad daoEnt = new Entidad();
         var idToLocate = Convert.ToInt32(grdInfo.DataKeys[grdInfo.SelectedIndex].Value);
         if (log.IsDebugEnabled) {
             log.Debug("Record data id to update [" + idToLocate + "]");
         }
         EntidadDto r = daoEnt.getValorEntidad(idToLocate);
         if (r == null) {
             if (log.IsDebugEnabled) {
                 log.Debug("Record data to update not found");
             }
         }
         if (r != null) {                   
             r.valorEntidad = txtEntidad.Text;
             r.descripcionEntidad = txtDescEntidad.Text;
             if (log.IsDebugEnabled) {
                 log.Debug("Record data id to update [" + r.ToString() + "]");
             }
             daoEnt.createEntidad(r, 2);
             CargarGridInfoData();
             txtDescEntidad.Text = txtEntidad.Text = "";
             btnNuevo.Visible = true;
             btnEliminar.Visible = btnActualizar.Visible = btnCancelar.Visible = false;
             registerToastrMsg(MessageType.Success, "Actualización realizada con éxito.");
             if (log.IsDebugEnabled) {
                 log.Debug("Record updated");
             }
         }
     }
     if (log.IsDebugEnabled) {
         log.Debug("OnButtonActualizar Ends");
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Record to remove.
 /// </summary>
 /// <param name="sender">Objet which sends event</param>
 /// <param name="e">event parameteres</param>
 protected void OnButtonEliminar(object sender, EventArgs e) {
     if (log.IsDebugEnabled) {
         log.Debug("OnButtonEliminar Starts");
     }
     if (grdInfo.SelectedIndex == -1) {
         if (log.IsDebugEnabled) {
             log.Debug("No input data supplied");
         }
         registerToastrMsg(MessageType.Error, "No ha seleccionado un registro para eliminar.");
     }
     else {
         Entidad daoEnt = new Entidad();
         var idToLocate = Convert.ToInt32(grdInfo.DataKeys[grdInfo.SelectedIndex].Value);
         if (log.IsDebugEnabled) {
             log.Debug("Record data id to remove [" + idToLocate + "]");
         }
         EntidadDto r = daoEnt.getValorEntidad(idToLocate);
         if (r == null) {
             if (log.IsDebugEnabled) {
                 log.Debug("Record data to remove not found");
             }
         }                
         if (r != null) {
             if (log.IsDebugEnabled) {
                 log.Debug("Record to remove [" + r.ToString() + "]");
             }
             try {
                 var rslt = daoEnt.createEntidad(r, 3);
                 if (rslt == -1) {
                     if (log.IsDebugEnabled) {
                         log.Debug("Record cannot be removed as relationships would break");
                     }
                     registerToastrMsg(MessageType.Error, "El registro de entidad a eliminar no se puede eliminar ya que tiene referencias en el sistema.");
                 }
                 else {
                     if (log.IsDebugEnabled) {
                         log.Debug("Record removed");
                     }
                     registerToastrMsg(MessageType.Success, "Registro eliminado con éxito.");
                 }
             } catch (Exception) {
                 if (log.IsDebugEnabled) {
                     log.Debug("Record cannot be removed as relationships would break");
                 }
                 registerToastrMsg(MessageType.Error, "El registro de entidad a eliminar no se puede eliminar ya que tiene referencias en el sistema.");
             }
             CargarGridInfoData();
             txtDescEntidad.Text = txtEntidad.Text = "";
             btnNuevo.Visible = true;
             btnEliminar.Visible = btnActualizar.Visible = btnCancelar.Visible = false;
         }
     }
     if (log.IsDebugEnabled) {
         log.Debug("OnButtonEliminar Ends");
     }
 }
Esempio n. 6
0
        /// <summary>
        /// Event fired to create a new record
        /// </summary>
        /// <param name="sender">object which fires the event</param>
        /// <param name="e">Event arguments</param>
        protected void OnButtonNuevo(object sender, EventArgs e) {
            if (log.IsDebugEnabled) {
                log.Debug("OnButtonNuevo Starts");
            }
            if (!ValidarCampos()) {
                if (listaEntidades.SelectedValue == "-1") {
                    registerToastrMsg(MessageType.Warning, "Debe seleccionar un valor de entidad para crear un nuevo registro.");
                    if (log.IsDebugEnabled) {
                        log.Debug("Must an entity value to work on");
                    }
                }
                else {
                    registerToastrMsg(MessageType.Error, "No ha ingresado datos para crear.");
                    if (log.IsDebugEnabled) {
                        log.Debug("No data input");
                    }
                }
            }
            else {
                ParametroSistema daoPs = new ParametroSistema();
                ParametroSistemaDto ps = daoPs.getValorParametroSistema(listaEntidades.SelectedValue.ToString());

                if (log.IsDebugEnabled) {
                    log.Debug("Record data to work on [" + listaEntidades.SelectedValue.ToString() + "]");
                }
                if (ps == null) {
                    if (log.IsDebugEnabled) {
                        log.Debug("Record data not found");
                    }
                }
                if (ps != null) {                    
                    Entidad daoEnt = new Entidad();
                    EntidadDto entInfo = new EntidadDto() { idEntidad = 0, codEntidad = Convert.ToInt32(ps.valorParametro), nombreEntidad = ps.descValorParametro, valorEntidad = txtEntidad.Text, descripcionEntidad = txtDescEntidad.Text };
                    if (log.IsDebugEnabled) {
                        log.Debug("Record data [" + entInfo.ToString() + "]");
                    }
                    daoEnt.createEntidad(entInfo, 1);
                    CargarGridInfoData();
                    txtDescEntidad.Text = txtEntidad.Text = "";
                    btnNuevo.Visible = true;
                    btnEliminar.Visible = btnActualizar.Visible = false;
                    registerToastrMsg(MessageType.Success, "Nuevo registro realizado con éxito.");
                    if (log.IsDebugEnabled) {
                        log.Debug("New record created");
                    }
                }
            }
            if (log.IsDebugEnabled) {
                log.Debug("OnButtonNuevo Ends");
            }
        }
Esempio n. 7
0
 /// <summary>
 /// When a select index changes.
 /// </summary>
 /// <param name="sender">Objet which sends event</param>
 /// <param name="e">event parameteres</param>
 protected void OnGridInfoSelectedIndexChanged(object sender, EventArgs e) {
     if (log.IsDebugEnabled) {
         log.Debug("OnGridInfoSelectedIndexChanged Starts");
     }
     Entidad entDao = new Entidad();
     var idToLocate = Convert.ToInt32(grdInfo.DataKeys[grdInfo.SelectedIndex].Value);
     EntidadDto r = entDao.getValorEntidad(idToLocate);
     if (r != null) {
         txtEntidad.Text = r.valorEntidad;
         txtDescEntidad.Text = r.descripcionEntidad;
         btnNuevo.Visible = false;
         btnEliminar.Visible = btnActualizar.Visible = btnCancelar.Visible = true;
     }
     if (log.IsDebugEnabled) {
         log.Debug("OnGridInfoSelectedIndexChanged Ends");
     }
 }
Esempio n. 8
0
 /// <summary>
 /// Loads Departamentos in combo box.
 /// </summary>
 private void PoblarDepartamentos() {
     if (log.IsDebugEnabled) {
         log.Debug("PoblarDepartamentos Starts ");
     }
     Entidad daoEntity = new Entidad();
     List<EntidadDto> countyList = daoEntity.getValoresEntidad(Settings.SysParamEstate);
     List<KeyValue> l = new List<KeyValue>();
     l.Add(new KeyValue() { key = "-1", value = "-- SELECCIONE --" });
     countyList.ForEach(t => l.Add(new KeyValue { key = t.idEntidad.ToString(), value = t.valorEntidad }));
     listaDepartamentos.DataSource = l;
     listaDepartamentos.DataTextField = "value";
     listaDepartamentos.DataValueField = "key";
     listaDepartamentos.DataBind();
     if (log.IsDebugEnabled) {
         log.Debug("PoblarDepartamentos Ends ");
     }
 }