Esempio n. 1
0
        public void GuardarCliente(CdClient persona)
        {
            MyConnection myConnection = new MyConnection();
            SqlConnection conexion = myConnection.CreateConnection();
            SqlCommand comando = myConnection.CreateCommand(conexion);
            SqlDataReader cliente;

            comando.CommandText = GUARDAR_Cliente;
            comando.CommandType = CommandType.StoredProcedure;
            comando.Parameters.Add(new SqlParameter("@pId", persona.Id));
            comando.Parameters.Add(new SqlParameter("@pName ", persona.Name));
            comando.Parameters.Add(new SqlParameter("@pLastname", persona.Lastname));
            //comando.Parameters.Add(new SqlParameter("@pAapellido2", persona.Apellido2));
            comando.Parameters.Add(new SqlParameter("@pEmail", persona.Email));
            comando.Parameters.Add(new SqlParameter("@pPhone", persona.Phone));
            comando.Parameters.Add(new SqlParameter("@pClientState", persona.ClientState));
            comando.Parameters.Add(new SqlParameter("@pClientType", persona.ClientType));
            conexion.Open();
            cliente = comando.ExecuteReader();
            conexion.Close();
        }
Esempio n. 2
0
        public void ModifyCliente(CdClient mdfPersona)
        {
            MyConnection myConnection = new MyConnection();
            SqlConnection conexion = myConnection.CreateConnection();
            SqlCommand comando = myConnection.CreateCommand(conexion);
            SqlDataReader cliente;

            comando.CommandText = Modify_Cliente;
            comando.CommandType = CommandType.StoredProcedure;
            comando.Parameters.Add(new SqlParameter("@pId", mdfPersona.Id));
            comando.Parameters.Add(new SqlParameter("@pName ", mdfPersona.Name));
            comando.Parameters.Add(new SqlParameter("@pLastname", mdfPersona.Lastname));

            comando.Parameters.Add(new SqlParameter("@pEmail", mdfPersona.Email));
            comando.Parameters.Add(new SqlParameter("@pPhone", mdfPersona.Phone));
            comando.Parameters.Add(new SqlParameter("@pClientState", mdfPersona.ClientState));
            comando.Parameters.Add(new SqlParameter("@pClientType", mdfPersona.ClientType));
            comando.Parameters.Add(new SqlParameter("@pStatus_db", mdfPersona.Status));

            conexion.Open();
            cliente = comando.ExecuteReader();
            conexion.Close();
        }