예제 #1
0
        public static List<Cliente> BuscarOld(Cliente ClienteBuscar)
        {
            using (IObjectContainer db = Connect.getDataBase())
            {
                List<Cliente> lRes = new List<Cliente>();
                try
                {
                    ClienteBuscar.dbId = ClienteBuscar.Id;
                    if (ClienteBuscar.Id > 0)
                    {
                        ClienteBuscar.dbId = null;
                        //db.Ext().Bind(ClienteBuscar, ClienteBuscar.Id);
                    }
                    IObjectSet result = db.QueryByExample(ClienteBuscar);
                    while (result.HasNext())
                    {
                        Cliente o = (Cliente)result.Next();
                        Connect.getdbId(db, (object)o);
                        lRes.Add(o);

                    }

                    return lRes;
                }
                finally
                {
                    db.Close();
                }
            }
            return null;
        }
예제 #2
0
 public static bool Borrar(long Id)
 {
     using (IObjectContainer db = Connect.getDataBase())
     {
         try
         {
             Cliente o = new Cliente(Id);
             Connect.setdbId(db, o);
             db.Delete(o);
             return true;
         }
         catch
         {
             return false;
         }
         finally
         {
             db.Close();
         }
     }
 }
예제 #3
0
        public static Cliente Leer(int Id)
        {
            string sqlConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["TurnosConnectionString"].ConnectionString;

            using (var connection = new SqlConnection(sqlConnectionString))
            {

                SqlCommand command = connection.CreateCommand();
                command.CommandText = "SELECT * FROM Clientes WHERE Id" + Id.ToString();
                command.CommandType = CommandType.Text;

                connection.Open();
                SqlDataReader ret = command.ExecuteReader();
                if(ret.HasRows)
                {
                    Cliente ClienteBuscar = new Cliente(Id);
                }

                List<Cliente> lClientes = ClientesDAO.Buscar(ClienteBuscar);
                if (lClientes.Count == 1) return lClientes[0];
                return null;
            }
        }
예제 #4
0
 public static Cliente Guardar(Cliente objetoAGuardar)
 {
 }