This commit is contained in:
2022-12-05 15:29:03 +03:00
parent affbd18de2
commit c4b15d7387
12 changed files with 33 additions and 2 deletions

74
classlib/class/address.cs Normal file
View File

@@ -0,0 +1,74 @@
namespace PS.IPAM;
using System;
[Serializable]
public class Address {
public int Id { get; }
public int SubnetId { get; }
public string Ip { get; }
public bool IsGateway { get; }
public string Description { get; }
public string Hostname { get; }
public string MAC { get; }
public string Owner { get; }
public int TagId { get; }
public int DeviceId { get; }
public string Location { get; }
public string Port { get; }
public string Note { get; }
public DateTime? LastSeen { get; }
public bool ExcludePing { get; }
public bool PTRignore { get; }
public int PTR { get; }
public string FirewallAddressObject { get; }
public DateTime? EditDate { get; }
public int CustomerId { get; }
public Address(
int id,
int subnetId,
string ip,
bool is_gateway,
string description,
string hostname,
string mac,
string owner,
int tag,
int deviceId,
string location,
string port,
string note,
DateTime? lastSeen,
bool excludePing,
bool PTRignore,
int PTR,
string firewallAddressObject,
DateTime? editDate,
int customer_id
) {
this.Id = id;
this.SubnetId = subnetId;
this.Ip = ip;
this.IsGateway = is_gateway;
this.Description = description;
this.Hostname = hostname;
this.MAC = mac;
this.Owner = owner;
this.TagId = tag;
this.DeviceId = deviceId;
this.Location = location;
this.Port = port;
this.Note = note;
this.EditDate = lastSeen;
this.ExcludePing = excludePing;
this.PTRignore = PTRignore;
this.PTR = PTR;
this.FirewallAddressObject = firewallAddressObject;
this.EditDate = editDate;
this.CustomerId = customer_id;
}
public override string ToString() {
return this.Ip;
}
}

27
classlib/class/domain.cs Normal file
View File

@@ -0,0 +1,27 @@
namespace PS.IPAM;
using System;
[Serializable]
public class Domain {
public int Id { get; }
public string Name { get; }
public string Description { get; }
public string Sections { get; }
public Domain (
int id,
string name,
string description,
string sections
) {
this.Id = id;
this.Name = name;
this.Description = description;
this.Sections = sections;
}
public override string ToString()
{
return this.Name;
}
}

54
classlib/class/section.cs Normal file
View File

@@ -0,0 +1,54 @@
namespace PS.IPAM;
using System;
[Serializable]
public class Section {
public int Id { get; }
public string Name { get; }
public string Description { get; }
public int MasterSectionId { get; }
public string Permissions { get; }
public bool StrictMode { get; }
public string SubnetOrdering { get; }
public int Order { get; }
public DateTime? EditDate { get; }
public bool ShowVlan { get; }
public bool ShowVRF { get; }
public bool ShowSupernetOnly { get; }
public int DNSId { get; }
public Section (
int id,
string name,
string description,
int masterSectionId,
string permissions,
bool strictMode,
string subnetOrdering,
int order,
DateTime? editDate,
bool showVlan,
bool showVRF,
bool showSupernetOnly,
int dnsId
) {
this.Id = id;
this.Name = name;
this.Description = description;
this.MasterSectionId = masterSectionId;
this.Permissions = permissions;
this.StrictMode = strictMode;
this.SubnetOrdering = subnetOrdering;
this.Order = order;
this.EditDate = editDate;
this.ShowVlan = showVlan;
this.ShowVRF = showVRF;
this.ShowSupernetOnly = showSupernetOnly;
this.DNSId = dnsId;
}
public override string ToString()
{
return this.Name;
}
}

67
classlib/class/subnet.cs Normal file
View File

@@ -0,0 +1,67 @@
namespace PS.IPAM;
using System;
[Serializable]
public class Subnetwork {
public int Id { get; }
public string Subnet { get; }
public int Mask { get; }
public int SectionId { get; }
public string Description { get; }
public string LinkedSubnet { get; }
public int FirewallAddressObject { get; }
public int VrfId { get; }
public int MasterSubnetId { get; }
public bool AllowRequests { get; }
public int VlanId { get; }
public bool ShowName { get; }
public int Device { get; }
public bool PingSubnet { get; }
public bool DiscoverSubnet { get; }
public bool ResolveDNS { get; }
public Subnetwork(
int id,
string subnet,
int mask,
int sectionId,
string description,
string linkedSubnet,
int firewallAddressObject,
int vrfId,
int masterSubnetId,
string permissions,
bool allowRequests,
int vlanId,
bool showName,
int device,
bool pingSubnet,
bool discoverSubnet,
bool resolveDNS
) {
this.Id = id;
this.Subnet = subnet;
this.Mask = mask;
this.SectionId = sectionId;
this.Description = description;
this.LinkedSubnet = linkedSubnet;
this.FirewallAddressObject = firewallAddressObject;
this.VrfId = vrfId;
this.MasterSubnetId = masterSubnetId;
this.AllowRequests = allowRequests;
this.VlanId = vlanId;
this.ShowName = showName;
this.Device = device;
this.PingSubnet = pingSubnet;
this.DiscoverSubnet = discoverSubnet;
this.ResolveDNS = resolveDNS;
}
public string GetCIDR() {
return $"{this.Subnet}/{this.Mask}";
}
public override string ToString()
{
return this.GetCIDR();
}
}

44
classlib/class/tag.cs Normal file
View File

@@ -0,0 +1,44 @@
namespace PS.IPAM;
[Serializable]
public class Tag {
public int Id { get; }
public string Type { get; }
public bool ShowTag { get; }
public string BGColor { get; }
public string FGColor { get; }
public bool Compress { get; }
public bool Locked { get; }
public bool UpdateTag { get; }
public Tag(
int id,
string type,
bool showTag,
string BGColor,
string FGColor,
string compress,
string locked,
bool updateTag
) {
this.Id = id;
this.Type = type;
this.ShowTag = showTag;
this.BGColor = BGColor;
this.FGColor = FGColor;
this.Compress = this.StringToBool(compress);
this.Locked = this.StringToBool(locked);
this.UpdateTag = updateTag;
}
public override string ToString() {
return this.Type;
}
private bool StringToBool(string str) {
if (str == "Yes") {
return true;
}
return false;
}
}

32
classlib/class/vlan.cs Normal file
View File

@@ -0,0 +1,32 @@
namespace PS.IPAM;
using System;
[Serializable]
public class Vlan {
public int Id { get; }
public int DomainId { get; }
public string Name { get; }
public int Number { get; }
public string Description { get; }
public DateTime? EditDate { get; }
public Vlan (
int id,
int domainId,
string name,
int number,
string description,
DateTime? editDate
) {
this.Id = id;
this.DomainId = domainId;
this.Name = name;
this.Number = number;
this.Description = description;
this.EditDate = editDate;
}
public override string ToString()
{
return $"{this.Number}";
}
}

32
classlib/class/vrf.cs Normal file
View File

@@ -0,0 +1,32 @@
namespace PS.IPAM;
using System;
[Serializable]
public class Vrf {
public int Id { get; }
public string Name { get; }
public string RouteDistinguisher { get; }
public string Description { get; }
public string Sections { get; }
public DateTime? EditDate { get; }
public Vrf(
int id,
string name,
string rd,
string description,
string sections,
DateTime? editDate
) {
this.Id = id;
this.Name = name;
this.RouteDistinguisher = rd;
this.Description = description;
this.Sections = sections;
this.EditDate = editDate;
}
public override string ToString()
{
return this.Name;
}
}