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


C# Group.GetGroupID方法代码示例

本文整理汇总了C#中Group.GetGroupID方法的典型用法代码示例。如果您正苦于以下问题:C# Group.GetGroupID方法的具体用法?C# Group.GetGroupID怎么用?C# Group.GetGroupID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Group的用法示例。


在下文中一共展示了Group.GetGroupID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Submit_Click

    protected void Submit_Click(object sender, EventArgs e)
    {
        if (Utility.NoSpaceNotEmpty(txtGroupName.Text))
        {
            if (Utility.NoSpaceNotEmpty(ddlGroupKernel.Text))
            {
                if (Utility.NoSpaceNotEmpty(ddlGroupBootImage.Text))
                {
                    List<int> members = new List<int>();
                    Group group = new Group();

                    foreach (GridViewRow row in gvHosts.Rows)
                    {
                        CheckBox cb = (CheckBox)row.FindControl("chkSelector");
                        if (cb != null && cb.Checked)
                            members.Add(Convert.ToInt32(gvHosts.DataKeys[row.RowIndex].Value));
                    }

                    group.Name = txtGroupName.Text;
                    group.Description = txtGroupDesc.Text;
                    group.Image = ddlGroupImage.Text;
                    group.Kernel = ddlGroupKernel.Text;
                    group.BootImage = ddlGroupBootImage.Text;
                    group.Args = txtGroupArguments.Text;
                    group.SenderArgs = txtGroupSenderArgs.Text;
                    foreach (ListItem item in lbScripts.Items)
                        if (item.Selected == true)
                            group.Scripts += item.Value + ",";
                    group.Create(group, members);

                    if (Utility.Message.Contains("Successfully"))
                        Response.Redirect("~/views/groups/view.aspx?page=edit&groupid=" + group.GetGroupID(group.Name));

                    Master.Msgbox(Utility.Message);
                }
                else
                    Master.Msgbox("Boot Image Cannot Be Empty");
            }
            else
                Master.Msgbox("Kernel Cannot Be Empty");
        }
        else
            Master.Msgbox("Name Cannot Be Empty Or Contain Spaces");
    }
开发者ID:cocoon,项目名称:crucibleWDS,代码行数:44,代码来源:create.aspx.cs

示例2: Create

    public void Create(Group group, List<int> members)
    {
        bool result = false;
        try
        {
            using (NpgsqlConnection conn = new NpgsqlConnection(Utility.DBString))
            {
                NpgsqlCommand cmd = new NpgsqlCommand("groups_create", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new NpgsqlParameter("@groupName", group.Name));
                cmd.Parameters.Add(new NpgsqlParameter("@groupDesc", group.Description));
                cmd.Parameters.Add(new NpgsqlParameter("@groupImage", group.Image));
                cmd.Parameters.Add(new NpgsqlParameter("@groupKernel", group.Kernel));
                cmd.Parameters.Add(new NpgsqlParameter("@groupBootImage", group.BootImage));
                cmd.Parameters.Add(new NpgsqlParameter("@groupArguments", group.Args));
                cmd.Parameters.Add(new NpgsqlParameter("@groupSenderArgs", group.SenderArgs));
                cmd.Parameters.Add(new NpgsqlParameter("@groupScripts", group.Scripts));
                conn.Open();
                result = Convert.ToBoolean(cmd.ExecuteScalar());
            }
        }
        catch (Exception ex)
        {
            Utility.Message = "Could Not Create Group.  Check The Exception Log For More Info";
            Logger.Log(ex.ToString());
        }

        if (result)
        {
            History history = new History();
            history.Event = "Create";
            history.Type = "Group";
            history.TypeID = group.GetGroupID(group.Name);
            history.CreateEvent(history);

            if (UpdateHosts(group, members, true))
                Utility.Message = "Successfully Created Group " + group.Name + " With " + members.Count + " Hosts";
        }
        else
            Utility.Message = "The Group " + group.Name + " Already Exists";
    }
开发者ID:cocoon,项目名称:crucibleWDS,代码行数:41,代码来源:Group.cs


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