本文整理汇总了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");
}
示例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";
}