本文整理汇总了C#中Host.GetHostID方法的典型用法代码示例。如果您正苦于以下问题:C# Host.GetHostID方法的具体用法?C# Host.GetHostID怎么用?C# Host.GetHostID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Host
的用法示例。
在下文中一共展示了Host.GetHostID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnSubmit_Click
protected void btnSubmit_Click(object sender, EventArgs e)
{
if (Utility.NoSpaceNotEmpty(txtHostName.Text))
{
if (Utility.NoSpaceNotEmpty(txtHostMac.Text))
{
if (Utility.NoSpaceNotEmpty(ddlHostKernel.Text))
{
if (Utility.NoSpaceNotEmpty(ddlHostBootImage.Text))
{
Host host = new Host();
host.Name = txtHostName.Text;
host.Mac = Utility.FixMac(txtHostMac.Text);
host.Image = ddlHostImage.Text;
host.Group = ddlHostGroup.Text;
host.Description = txtHostDesc.Text;
host.Kernel = ddlHostKernel.Text;
host.BootImage = ddlHostBootImage.Text;
host.Args = txtHostArguments.Text;
foreach (ListItem item in lbScripts.Items)
if (item.Selected == true)
host.Scripts += item.Value + ",";
host.Create(host);
if (Utility.Message.Contains("Successfully") && !createAnother.Checked)
Response.Redirect("~/views/hosts/view.aspx?page=edit&hostid=" + host.GetHostID(host.Mac));
else
Master.Msgbox(Utility.Message);
}
else
Master.Msgbox("Boot Image Cannot Be Empty");
}
else
Master.Msgbox("Kernel Cannot Be Empty");
}
else
Master.Msgbox("MAC Address Cannot Be Empty Or Contain Spaces");
}
else
Master.Msgbox("Name Cannot Be Empty Or Contain Spaces");
}
示例2: Create
public void Create(Host host)
{
try
{
using (NpgsqlConnection conn = new NpgsqlConnection(Utility.DBString))
{
NpgsqlCommand cmd = new NpgsqlCommand("hosts_create", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new NpgsqlParameter("@hostName", host.Name));
cmd.Parameters.Add(new NpgsqlParameter("@hostMac", host.Mac));
cmd.Parameters.Add(new NpgsqlParameter("@hostImage", host.Image));
cmd.Parameters.Add(new NpgsqlParameter("@hostGroup", host.Group));
cmd.Parameters.Add(new NpgsqlParameter("@hostDesc", host.Description));
cmd.Parameters.Add(new NpgsqlParameter("@hostKernel", host.Kernel));
cmd.Parameters.Add(new NpgsqlParameter("@hostBootImage", host.BootImage));
cmd.Parameters.Add(new NpgsqlParameter("@hostArguments", host.Args));
cmd.Parameters.Add(new NpgsqlParameter("@hostScripts", host.Scripts));
conn.Open();
Utility.Message = cmd.ExecuteScalar() as string;
if (Utility.Message.Contains("Successfully"))
{
History history = new History();
history.Event = "Create";
history.Type = "Host";
history.Notes = host.Mac;
history.TypeID = host.GetHostID(host.Mac);
history.CreateEvent(history);
}
}
}
catch (Exception ex)
{
Utility.Message = "Could Not Create Host. Check The Exception Log For More Info";
Logger.Log(ex.ToString());
}
}
示例3: getHostName
public void getHostName(string mac)
{
Host host = new Host();
host.ID = host.GetHostID(mac);
if (host.ID == "error")
{
HttpContext.Current.Response.Write("");
return;
}
host.Read(host);
HttpContext.Current.Response.Write(host.Name);
}
示例4: CreateMulticast
public void CreateMulticast(int groupID)
{
Multicast multicast = new Multicast();
Utility settings = new Utility();
Task task = new Task();
int portBase = task.GetPort();
if (portBase != 0)
{
multicast = multicast.Read(groupID);
if (multicast != null)
{
if (String.IsNullOrEmpty(multicast.GroupSenderArgs))
multicast.GroupSenderArgs = settings.GetSettings("Sender Args");
if (multicast.HostNames.Count > 0)
{
if (CheckAllHostsEqual(multicast))
{
if (CreateMulticastTask(multicast, "push", "true", portBase))
{
if (StartMulticastSender(multicast, portBase))
{
History history = new History();
history.Event = "Multicast";
history.Type = "Group";
history.TypeID = groupID.ToString();
history.CreateEvent(history);
Host host = new Host();
foreach (string mac in HostMacs)
{
history.Event = "Deploy";
history.Type = "Host";
history.Notes = "Via Group Multicast: " + multicast.GroupName;
history.TypeID = host.GetHostID(mac);
history.CreateEvent(history);
}
foreach (string name in HostNames)
{
Image image = new Image();
history.Event = "Deploy";
history.Type = "Image";
history.Notes = name;
history.TypeID = image.GetImageID(multicast.GroupImage);
history.CreateEvent(history);
}
}
else
RollBack(multicast, true, true, true);
}
}
}
else
Utility.Message = "The Group Does Not Have Any Hosts";
}
}
}