Skip to content

Instantly share code, notes, and snippets.

@bdallen
Created November 18, 2011 00:56
Show Gist options
  • Save bdallen/1375162 to your computer and use it in GitHub Desktop.
Save bdallen/1375162 to your computer and use it in GitHub Desktop.
Blah
using (ISession session = Global._DatabaseConn.OpenSession())
{
using (ITransaction transaction = session.BeginTransaction())
{
// Get list of all Leases
//Leases = session.CreateCriteria(typeof(normutils.data.Entities.DHCPLease)).List<normutils.data.Entities.DHCPLease>();
var LQ = session.Query<normutils.data.Entities.DHCPLease>();
var Leases = from v in LQ
where v.BindState == "active"
orderby v.Name ascending
select v;
}
}
foreach (normutils.data.Entities.DHCPLease Lease in Leases)
{
if (Lease.BindState == "active")
{
ListViewItem lvi = new ListViewItem(Lease.Name);
lvi.SubItems.Add(Lease.IPAddress);
lvi.SubItems.Add(Lease.ID);
lvi.SubItems.Add(Lease.StartDate.ToString("yyyy-MM-dd HH:mm:ss"));
lvi.SubItems.Add(GetManufacturer(Lease.ID));
lvLeases.Items.Add(lvi);
}
}
}
@Azerothian
Copy link

        using (ISession session = Global._DatabaseConn.OpenSession())
        {
            using (ITransaction transaction = session.BeginTransaction())
            {
                // Get list of all Leases
                //Leases = session.CreateCriteria(typeof(normutils.data.Entities.DHCPLease)).List<normutils.data.Entities.DHCPLease>();
                var LQ = session.Query<normutils.data.Entities.DHCPLease>();
                var Leases = (from v in LQ
                             where v.BindState == "active"
                             orderby v.Name ascending
                             select v).ToList();
            }
        }

        foreach (normutils.data.Entities.DHCPLease Lease in Leases)
        {
            if (Lease.BindState == "active")
            {
                ListViewItem lvi = new ListViewItem(Lease.Name);
                lvi.SubItems.Add(Lease.IPAddress);
                lvi.SubItems.Add(Lease.ID);
                lvi.SubItems.Add(Lease.StartDate.ToString("yyyy-MM-dd HH:mm:ss"));
                lvi.SubItems.Add(GetManufacturer(Lease.ID));
                lvLeases.Items.Add(lvi);
            }
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment