示例#1
0
        /// <summary>
        /// Metodo Público encargado de Eliminar el Cargo Recurrente
        /// </summary>
        /// <returns></returns>
        public RetornoOperacion EliminaCargoRecurrente()
        {   //Declarando Objeto de Retorno
            RetornoOperacion result = new RetornoOperacion();

            //Validando que exista un Registro Seleccionado
            if (gvResultado.SelectedIndex != -1)
            {     //Instanciando Cargo Recurrente
                using (SAT_CL.Tarifas.CargoRecurrente cr = new SAT_CL.Tarifas.CargoRecurrente(Convert.ToInt32(gvResultado.SelectedDataKey["Id"])))
                { //Validando que exista el Registro
                    if (cr.id_cargo_recurrente != 0)
                    {
                        //Editando Cargo
                        result = cr.DeshabilitaCargoRecurrente(((SAT_CL.Seguridad.Usuario)Session["usuario"]).id_usuario);
                    }
                }
            }
            else//Instanciando Exception
            {
                result = new RetornoOperacion("Debe Seleccionar un Cargo");
            }
            //Validando si la Operacion fue Exitosa
            if (result.OperacionExitosa)
            {   //Limpiando Controles
                limpiaControles();
                //Cargando Reporte
                cargaCargosRecurrentes();
            }
            //Mostrando Mensaje
            lblError.Text = result.Mensaje;
            //Devolviendo Resultado Obtenido
            return(result);
        }
示例#2
0
        /// <summary>
        /// Metodo Público encargado de Guardar los Cambios sobre un Cargo Recurrente
        /// </summary>
        /// <returns></returns>
        public RetornoOperacion GuardaCargoRecurrente()
        {   //Declarando Objeto de Retorno
            RetornoOperacion result = new RetornoOperacion();

            //Validando que exista un Registro Seleccionado
            if (gvResultado.SelectedIndex != -1)
            {     //Instanciando Cargo Recurrente
                using (SAT_CL.Tarifas.CargoRecurrente cr = new SAT_CL.Tarifas.CargoRecurrente(Convert.ToInt32(gvResultado.SelectedDataKey["Id"])))
                { //Validando que exista el Registro
                    if (cr.id_cargo_recurrente != 0)
                    {
                        //Editando Cargo
                        result = cr.EditaCargoRecurrente(this._idTarifa, this._idTarifaDetalle, Convert.ToInt32(ddlTipo.SelectedValue),
                                                         Convert.ToDecimal(txtCantidad.Text), Convert.ToByte(ddlUnidad.SelectedValue),
                                                         Convert.ToDecimal(txtValorUnitario.Text), ((SAT_CL.Seguridad.Usuario)Session["usuario"]).id_usuario);
                    }
                }
            }
            else
            {   //Validando que exista la Tarifa
                if (this._idTarifa != 0)
                {
                    //Insertando Cargo
                    result = SAT_CL.Tarifas.CargoRecurrente.InsertaCargoRecurrente(this._idTarifa, this._idTarifaDetalle, Convert.ToInt32(ddlTipo.SelectedValue),
                                                                                   Convert.ToDecimal(txtCantidad.Text), Convert.ToByte(ddlUnidad.SelectedValue),
                                                                                   Convert.ToDecimal(txtValorUnitario.Text), ((SAT_CL.Seguridad.Usuario)Session["usuario"]).id_usuario);
                }
                else//Instanciando Excepcion
                {
                    result = new RetornoOperacion("Debe existir la Tarifa");
                }
            }
            //Validando si la Operacion fue Exitosa
            if (result.OperacionExitosa)
            {   //Limpiando Controles
                limpiaControles();
                //Cargando Reporte
                cargaCargosRecurrentes();
            }
            //Mostrando Mensaje
            lblError.Text = result.Mensaje;
            //Devolviendo Resultado Obtenido
            return(result);
        }
示例#3
0
 /// <summary>
 /// Evento Producido al Presionar el LinkButton "Editar"
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void lnkEditar_Click(object sender, EventArgs e)
 {     //Validando que existan Registros
     if (gvResultado.DataKeys.Count > 0)
     { //Seleccionando Fila
         TSDK.ASP.Controles.SeleccionaFila(gvResultado, sender, "lnk", false);
         //Instanciando Cargo Recurrente
         using (SAT_CL.Tarifas.CargoRecurrente cr = new SAT_CL.Tarifas.CargoRecurrente(Convert.ToInt32(gvResultado.SelectedDataKey["Id"])))
         {     //Validando que exista el Registro
             if (cr.id_cargo_recurrente != 0)
             { //Asignando Valores
                 ddlTipo.SelectedValue   = cr.id_tipo_cargo.ToString();
                 ddlUnidad.SelectedValue = cr.id_unidad.ToString();
                 txtCantidad.Text        = cr.cantidad.ToString();
                 txtValorUnitario.Text   = cr.valor_unitario.ToString();
             }
             else
             {   //Mostrando Error
                 lblError.Text = "No se pudo acceder al registro seleccionado, probablemente no existe";
                 //Quitando Selección
                 gvResultado.SelectedIndex = -1;
             }
         }
     }
 }