Skip to content

Instantly share code, notes, and snippets.

@Azerothian
Forked from bdallen/gist:1375162
Created November 18, 2011 00:58
Show Gist options
  • Save Azerothian/1375166 to your computer and use it in GitHub Desktop.
Save Azerothian/1375166 to your computer and use it in GitHub Desktop.
Blah
List<normutils.data.Entities.DHCPLease> _leases;
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>();
_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