コード例 #1
0
ファイル: cine.aspx.cs プロジェクト: yoginp/try_git
 protected void OnButtonActualizar(object sender, EventArgs e)
 {
     lblMsg.Text = lblError.Text = "";
     if (!ValidarCampos())
     {
         lblError.Text = "No ha ingresado datos para actualizar.";
     }
     else
     {
         Cine    daoMovie   = new Cine();
         var     idToLocate = Convert.ToInt32(grdInfo.DataKeys[grdInfo.SelectedIndex].Value);
         CineDto r          = daoMovie.getCine(idToLocate);
         if (r != null)
         {
             r.nombreCine = txtNombre.Text;
             r.nit        = txtNit.Text;
             daoMovie.crearCine(r, 2);
             CargarGridInfoData();
             txtNombre.Text      = txtNit.Text = "";
             btnNuevo.Visible    = true;
             btnEliminar.Visible = btnActualizar.Visible = btnCancelar.Visible = false;
             lblMsg.Text         = "Actualización realizada con éxito.";
         }
     }
 }
コード例 #2
0
ファイル: cine.aspx.cs プロジェクト: yoginp/try_git
 protected void OnButtonEliminar(object sender, EventArgs e)
 {
     lblMsg.Text = lblError.Text = "";
     if (grdInfo.SelectedIndex == -1)
     {
         lblError.Text = "No ha seleccionado un registro para eliminar.";
     }
     else
     {
         Cine    daoMovie   = new Cine();
         var     idToLocate = Convert.ToInt32(grdInfo.DataKeys[grdInfo.SelectedIndex].Value);
         CineDto r          = daoMovie.getCine(idToLocate);
         if (r != null)
         {
             try {
                 var rslt = daoMovie.crearCine(r, 3);
                 if (rslt == -1)
                 {
                     lblError.Text = "El registro de cine a eliminar no se puede eliminar ya que tiene referencias en el sistema.";
                 }
                 else
                 {
                     lblMsg.Text = "Registro eliminado con éxito.";
                 }
             } catch (Exception) {
                 lblError.Text = "El registro de cine a eliminar no se puede eliminar ya que tiene referencias en el sistema.";
             }
             CargarGridInfoData();
             txtNombre.Text      = txtNit.Text = "";
             btnNuevo.Visible    = true;
             btnEliminar.Visible = btnActualizar.Visible = btnCancelar.Visible = false;
         }
     }
 }
コード例 #3
0
ファイル: cine.aspx.cs プロジェクト: yoginp/try_git
        protected void OnGridInfoSelectedIndexChanged(object sender, EventArgs e)
        {
            Cine    daoMovie   = new Cine();
            var     idToLocate = Convert.ToInt32(grdInfo.DataKeys[grdInfo.SelectedIndex].Value);
            CineDto r          = daoMovie.getCine(idToLocate);

            if (r != null)
            {
                txtNombre.Text      = r.nombreCine;
                txtNit.Text         = r.nit;
                btnNuevo.Visible    = false;
                btnEliminar.Visible = btnActualizar.Visible = btnCancelar.Visible = true;
            }
        }
コード例 #4
0
 /// <summary>
 /// Event fired to update a new record
 /// </summary>
 /// <param name="sender">object which fires the event</param>
 /// <param name="e">Event arguments</param>
 protected void OnButtonActualizar(object sender, EventArgs e)
 {
     if (log.IsDebugEnabled)
     {
         log.Debug("OnButtonActualizar Ends");
     }
     if (!ValidarCampos())
     {
         registerToastrMsg(MessageType.Error, "No ha ingresado datos para actualizar.");
     }
     else
     {
         Cine    daoMovie   = new Cine();
         var     idToLocate = Convert.ToInt32(grdInfo.DataKeys[grdInfo.SelectedIndex].Value);
         CineDto r          = daoMovie.getCine(idToLocate);
         if (r == null)
         {
             if (log.IsDebugEnabled)
             {
                 log.Debug("Record not found  for id [" + idToLocate + "]");
             }
         }
         if (r != null)
         {
             r.nombreCine = txtNombre.Text;
             r.nit        = txtNit.Text;
             if (log.IsDebugEnabled)
             {
                 log.Debug("Update Record data [" + r.ToString() + "]");
             }
             daoMovie.createCine(r, 2);
             CargarGridInfoData();
             txtNombre.Text      = txtNit.Text = "";
             btnNuevo.Visible    = true;
             btnEliminar.Visible = btnActualizar.Visible = btnCancelar.Visible = false;
             registerToastrMsg(MessageType.Success, "Actualización realizada con éxito.");
             if (log.IsDebugEnabled)
             {
                 log.Debug("Update sucessfull");
             }
         }
     }
     if (log.IsDebugEnabled)
     {
         log.Debug("OnButtonActualizar Ends");
     }
 }
コード例 #5
0
 /// <summary>
 /// Event fired to remove a new record
 /// </summary>
 /// <param name="sender">object which fires the event</param>
 /// <param name="e">Event arguments</param>
 protected void OnButtonEliminar(object sender, EventArgs e)
 {
     if (log.IsDebugEnabled)
     {
         log.Debug("OnButtonEliminar Starts");
     }
     if (grdInfo.SelectedIndex == -1)
     {
         registerToastrMsg(MessageType.Error, "No ha seleccionado un registro para eliminar.");
         if (log.IsDebugEnabled)
         {
             log.Debug("No input data to remove");
         }
     }
     else
     {
         Cine daoMovie   = new Cine();
         var  idToLocate = Convert.ToInt32(grdInfo.DataKeys[grdInfo.SelectedIndex].Value);
         if (log.IsDebugEnabled)
         {
             log.Debug("id for record to delete is [" + idToLocate + "]");
         }
         CineDto r = daoMovie.getCine(idToLocate);
         if (r == null)
         {
             if (log.IsDebugEnabled)
             {
                 log.Debug("Record to remove not found");
             }
         }
         if (r != null)
         {
             if (log.IsDebugEnabled)
             {
                 log.Debug("Record data to remove [" + r.ToString() + "]");
             }
             try {
                 var rslt = daoMovie.createCine(r, 3);
                 if (log.IsDebugEnabled)
                 {
                     log.Debug("Record to remove =[" + r.ToString() + "]");
                 }
                 if (rslt == -1)
                 {
                     registerToastrMsg(MessageType.Error, "El registro de cine a eliminar no se puede eliminar ya que tiene referencias en el sistema.");
                     if (log.IsDebugEnabled)
                     {
                         log.Debug("Record has referenced data, cannot be removed");
                     }
                 }
                 else
                 {
                     registerToastrMsg(MessageType.Success, "Registro eliminado con éxito.");
                     if (log.IsDebugEnabled)
                     {
                         log.Debug("Record removed");
                     }
                 }
             } catch (Exception) {
                 registerToastrMsg(MessageType.Error, "El registro de cine a eliminar no se puede eliminar ya que tiene referencias en el sistema.");
                 if (log.IsDebugEnabled)
                 {
                     log.Debug("Record has referenced data, cannot be removed");
                 }
             }
             CargarGridInfoData();
             txtNombre.Text      = txtNit.Text = "";
             btnNuevo.Visible    = true;
             btnEliminar.Visible = btnActualizar.Visible = btnCancelar.Visible = false;
         }
     }
     if (log.IsDebugEnabled)
     {
         log.Debug("OnButtonEliminar Ends");
     }
 }