public Participante_Result Managment_Participante(Participante _Participante, int Action)
        {
            P_Participante      dao = new P_Participante();
            Participante_Result ar  = dao.Managment_Participante(_Participante, Action);

            return(ar);
        }
Exemple #2
0
        public String Managment_Participante(Participante_S_C _Participante)
        {
            B_Participante      b_Participante = new B_Participante();
            Participante_Result a = b_Participante.Managment_Participante(new Participante(_Participante.ParticipanteId, _Participante.TrabajadorId, _Participante.ProgramaId, _Participante.Estado), _Participante.Action);
            var jsonSerialiser    = new JavaScriptSerializer();
            var json = jsonSerialiser.Serialize(a);

            return(json);
        }
        public Participante_Result Managment_Participante(Participante _Participante, int Action)
        {
            Participante_Result resu = new Participante_Result();

            using (SqlConnection connection = new SqlConnection(cadena))
            {
                try
                {
                    String id = "";
                    connection.Open();
                    SqlCommand command = new SqlCommand("VR_Managment_Participante", connection);
                    command.CommandType = CommandType.StoredProcedure;

                    command.Parameters.Add("@ParticipanteId", SqlDbType.Int).Value = _Participante.ParticipanteId;
                    command.Parameters.Add("@TrabajadorId", SqlDbType.Int).Value   = _Participante.TrabajadorId;
                    command.Parameters.Add("@ProgramaId", SqlDbType.Int).Value     = _Participante.@ProgramaId;
                    command.Parameters.Add("@Estado", SqlDbType.Int).Value         = _Participante.@Estado;
                    command.Parameters.Add("@Action", SqlDbType.Int).Value         = Action;
                    SqlDataReader reader = command.ExecuteReader(CommandBehavior.SingleResult);
                    if (reader.HasRows)
                    {
                        if (reader.Read())
                        {
                            id = reader.GetValue(0).ToString();
                        }
                    }
                    reader.Close();
                    connection.Close();
                    resu.Result  = 1;
                    resu.Message = id;
                }
                catch (Exception e)
                {
                    connection.Close();
                    resu.Result  = 0;
                    resu.Message = e.Message;
                }
            }
            return(resu);
        }