当前位置: 首页>>代码示例>>C#>>正文


C# Host.GetHostID方法代码示例

本文整理汇总了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");
 }
开发者ID:cocoon,项目名称:crucibleWDS,代码行数:40,代码来源:create.aspx.cs

示例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());
        }
    }
开发者ID:cocoon,项目名称:crucibleWDS,代码行数:38,代码来源:Host.cs

示例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);
 }
开发者ID:cocoon,项目名称:crucibleWDS,代码行数:12,代码来源:ClientSvc.asmx.cs

示例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";
            }
        }
    }
开发者ID:cocoon,项目名称:crucibleWDS,代码行数:60,代码来源:Multicast.cs


注:本文中的Host.GetHostID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。