コード例 #1
0
        public string AsignarPrestacion(DPrestacion Prestacion)
        {
            string queryUpdate = @"
                UPDATE [Prestacion] SET
                    porcentajeOtorgado = @porcentajeOtorgado,
                    montoOtorgado = @montoOtorgado,
                    razonDecision = @razonDecision,
                    estado = @estado
                WHERE idPrestacion = @idPrestacion;
	        "    ;

            try
            {
                Conexion.ConexionSql.Open();

                using SqlCommand comm = new SqlCommand(queryUpdate, Conexion.ConexionSql);
                comm.Parameters.AddWithValue("@idPrestacion", Prestacion.idPrestacion);
                comm.Parameters.AddWithValue("@porcentajeOtorgado", Prestacion.porcentajeOtorgado);
                comm.Parameters.AddWithValue("@montoOtorgado", Prestacion.montoOtorgado);
                comm.Parameters.AddWithValue("@razonDecision", Prestacion.razonDecision);
                comm.Parameters.AddWithValue("@estado", Prestacion.estado);

                return(comm.ExecuteNonQuery() == 1 ? "OK" : "No se Asignó el Monto de Prestacion");
            }
            catch (SqlException e) { return(e.Message); }
            finally { if (Conexion.ConexionSql.State == ConnectionState.Open)
                      {
                          Conexion.ConexionSql.Close();
                      }
            }
        }
コード例 #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (Validate())
            {
                return;
            }

            DPrestacion prestacion = new DPrestacion(
                0,
                int.Parse(CbEmpleado.SelectedValue.ToString()),
                double.Parse(txtMontoPresupuesto.Text),
                0,
                0,
                txtRazon.Text,
                "",
                DPFechaSolicitud.DisplayDate,
                1
                );

            string respuesta = Metodos.Insertar(prestacion);

            if (respuesta.Equals("OK"))
            {
                MessageBox.Show("Prestación Registrada Correctamente", "SwissNet", MessageBoxButton.OK, MessageBoxImage.Information);
                this.Hide();
            }
        }
コード例 #3
0
        public RespuestaPrestacionFrm(DPrestacion prestacion)
        {
            InitializeComponent();

            Prestacion = prestacion;
            Type       = TypeForm.Create;

            txtPorcentajePrestacion.KeyDown += new KeyEventHandler(Validaciones.TextBox_KeyDown);
        }
コード例 #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (Validate())
            {
                return;
            }

            //HACER CALCULO DE MONTOTOTAL

            string razonOtorgado = txtRazonResultado.Text;

            DPrestacion Res;

            if (RBOtorgado.IsChecked ?? false)
            {
                int porcentajeOtorgado = int.Parse(txtPorcentajePrestacion.Text);
                Res = new DPrestacion()
                {
                    idPrestacion       = Prestacion.idPrestacion,
                    porcentajeOtorgado = porcentajeOtorgado,
                    montoOtorgado      = montoPorcentual,
                    razonDecision      = razonOtorgado,
                    estado             = 2
                };
            }
            else if (RBNoOtorgado.IsChecked ?? false)
            {
                Res = new DPrestacion()
                {
                    idPrestacion       = Prestacion.idPrestacion,
                    porcentajeOtorgado = 0,
                    montoOtorgado      = 0,
                    razonDecision      = razonOtorgado,
                    estado             = 3
                };
            }
            else
            {
                return;
            }

            //ejecutar prestacion aca
            string respuesta = Metodos.AsignarPrestacion(Res);

            if (respuesta.Equals("OK"))
            {
                this.DialogResult = true;
                this.Close();
            }
            else
            {
                MessageBox.Show(respuesta);
            }
        }
コード例 #5
0
        public string Insertar(DPrestacion Prestacion)
        {
            string queryInsert = @"
                INSERT INTO [Prestacion] (
                    idEmpleado,
                    montoPresupuesto,
                    porcentajeOtorgado,
                    montoOtorgado,
                    razon,
                    razonDecision,
                    fechaSolicitud,
                    estado
                ) VALUES (
                    @idEmpleado,
                    @montoPresupuesto,
                    @porcentajeOtorgado,
                    @montoOtorgado,
                    @razon,
                    '',
                    @fechaSolicitud,
                    1
                );
	        "    ;

            try
            {
                Conexion.ConexionSql.Open();

                using SqlCommand comm = new SqlCommand(queryInsert, Conexion.ConexionSql);
                comm.Parameters.AddWithValue("@idEmpleado", Prestacion.idEmpleado);
                comm.Parameters.AddWithValue("@montoPresupuesto", Prestacion.montoPresupuesto);
                comm.Parameters.AddWithValue("@porcentajeOtorgado", Prestacion.porcentajeOtorgado);
                comm.Parameters.AddWithValue("@montoOtorgado", Prestacion.montoOtorgado);
                comm.Parameters.AddWithValue("@razon", Prestacion.razon);
                comm.Parameters.AddWithValue("@fechaSolicitud", Prestacion.fechaSolicitud);

                return(comm.ExecuteNonQuery() == 1 ? "OK" : "No se Ingreso el Registro del Presupuesto");
            }
            catch (SqlException e) { return(e.Message); }
            finally { if (Conexion.ConexionSql.State == ConnectionState.Open)
                      {
                          Conexion.ConexionSql.Close();
                      }
            }
        }