本文整理汇总了C#中History.CreateEvent方法的典型用法代码示例。如果您正苦于以下问题:C# History.CreateEvent方法的具体用法?C# History.CreateEvent怎么用?C# History.CreateEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类History
的用法示例。
在下文中一共展示了History.CreateEvent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnConfirm_Click
protected void btnConfirm_Click(object sender, EventArgs e)
{
if ((string)Session["direction"] == "delete")
{
Session.Remove("direction");
List<int> delList = new List<int>();
delList.Add(Convert.ToInt32(group.ID));
group.Delete(delList);
if (Utility.Message.Contains("Successfully"))
Response.Redirect("~/views/groups/search.aspx");
else
Master.Msgbox(Utility.Message);
}
else
{
Image imageInfo = new Image();
imageInfo.ID = imageInfo.GetImageID(group.Image);
Session["imageID"] = imageInfo.ID;
if (imageInfo.Check_Checksum(imageInfo.ID))
{
int isUnicast = Convert.ToInt32(Session["isGroupUnicast"]);
if (isUnicast == 1)
{
Unicast unicast = new Unicast();
List<int> listHostID = new List<int>();
listHostID = unicast.UnicastFromGroup(Convert.ToInt32(group.ID));
for (int z = 0; z < listHostID.Count; z++)
unicast.CreateUnicast("push", listHostID[z]);
Utility.Message = "Started " + listHostID.Count + " Tasks";
History history = new History();
history.Event = "Unicast";
history.Type = "Group";
history.TypeID = group.ID;
history.CreateEvent(history);
}
else
{
Multicast multicast = new Multicast();
multicast.CreateMulticast(Convert.ToInt32(group.ID));
}
Session.Remove("isGroupUnicast");
Master.Msgbox(Utility.Message);
}
else
{
lblIncorrectChecksum.Text = "This Image Has Not Been Confirmed And Cannot Be Deployed. <br>Confirm It Now?";
ClientScript.RegisterStartupScript(this.GetType(), "modalscript", "$(function() { var menuTop = document.getElementById('incorrectChecksum'),body = document.body;classie.toggle(menuTop, 'confirm-box-outer-open'); });", true);
}
}
}
示例2: Update
public void Update(Host host)
{
try
{
using (NpgsqlConnection conn = new NpgsqlConnection(Utility.DBString))
{
NpgsqlCommand cmd = new NpgsqlCommand("hosts_update", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new NpgsqlParameter("@hostID", host.ID));
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 = "Edit";
history.Type = "Host";
history.Notes = host.Mac;
history.TypeID = host.ID;
history.CreateEvent(history);
}
}
}
catch (Exception ex)
{
Utility.Message = "Could Not Update Host. Check The Exception Log For More Info";
Logger.Log(ex.ToString());
}
}
示例3: SetCustomBootMenu
public void SetCustomBootMenu(Host host, string filename)
{
Utility settings = new Utility();
Task task = new Task();
string mode = settings.GetSettings("PXE Mode");
string pxeHostMac = task.MacToPXE(host.Mac);
string isActive = host.CheckActive(host.Mac);
string path = null;
string proxyDHCP = settings.GetSettings("Proxy Dhcp");
if (isActive == "Inactive")
{
if (proxyDHCP == "Yes")
{
string biosFile = settings.GetSettings("Proxy Bios File");
string efi32File = settings.GetSettings("Proxy Efi32 File");
string efi64File = settings.GetSettings("Proxy Efi64 File");
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "bios" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe";
WritePath(path, filename);
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "bios" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac;
WritePath(path, filename);
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi32" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe";
WritePath(path, filename);
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi32" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac;
WritePath(path, filename);
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi64" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe";
WritePath(path, filename);
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi64" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac;
WritePath(path, filename);
}
else
{
if (mode.Contains("ipxe"))
path = settings.GetSettings("Tftp Path") + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe";
else
path = settings.GetSettings("Tftp Path") + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac;
WritePath(path, filename);
}
}
else
{
if (proxyDHCP == "Yes")
{
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "bios" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".custom";
WritePath(path, filename);
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi32" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".custom";
WritePath(path, filename);
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi64" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".custom";
WritePath(path, filename);
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "bios" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe.custom";
WritePath(path, filename);
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi32" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe.custom";
WritePath(path, filename);
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi64" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe.custom";
WritePath(path, filename);
}
else
{
if(mode.Contains("ipxe"))
path = settings.GetSettings("Tftp Path") + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe.custom";
else
path = settings.GetSettings("Tftp Path") + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".custom";
WritePath(path, filename);
}
}
try
{
host.CustomBoot(host.Mac, true);
History history = new History();
history.Event = "Set Boot Menu";
history.Type = "Host";
history.Notes = host.Mac;
history.TypeID = host.ID;
history.CreateEvent(history);
Utility.Message ="Successfully Set Custom Boot Menu For This Host";
}
catch (Exception ex)
{
Utility.Message = "Could Not Set Custom Boot Menu. Check The Exception Log For More Info.";
Logger.Log(ex.Message);
}
}
示例4: Delete
public void Delete(List<int> listDelete)
{
try
{
using (NpgsqlConnection conn = new NpgsqlConnection(Utility.DBString))
{
conn.Open();
for (int i = 0; i < listDelete.Count; i++)
{
Host host = new Host();
host.ID = listDelete[i].ToString();
host = host.Read(host);
NpgsqlCommand cmd = new NpgsqlCommand("hosts_delete", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new NpgsqlParameter("@hostID", listDelete[i]));
cmd.ExecuteNonQuery();
History history = new History();
history.Event = "Delete";
history.Type = "Host";
history.Notes = host.Name;
history.TypeID = host.ID;
history.CreateEvent(history);
}
Utility.Message = "Successfully Deleted Host(s)";
}
}
catch (Exception ex)
{
Utility.Message = "Could Not Delete Host. Check The Exception Log For More Info";
Logger.Log(ex.ToString());
}
}
示例5: CrucibleLogin_Authenticate
protected void CrucibleLogin_Authenticate(object sender, AuthenticateEventArgs e)
{
Utility login = new Utility();
History history = new History();
WDSUser wdsuser = new WDSUser();
string loginDomain = login.GetSettings("AD Login Domain");
history.Type = "User";
history.IP = GetIP();
history.EventUser = CrucibleLogin.UserName;
wdsuser.ID = wdsuser.GetID(CrucibleLogin.UserName);
history.TypeID = wdsuser.ID;
if (string.IsNullOrEmpty(wdsuser.ID))
{
history.Event = "Failed Login";
e.Authenticated = false;
lblError.Visible = true;
}
else
{
if (string.IsNullOrEmpty(loginDomain))
{
bool result = login.UserLogin(CrucibleLogin.UserName, CrucibleLogin.Password);
if ((result))
{
history.Event = "Successful Login";
e.Authenticated = true;
}
else
{
history.Event = "Failed Login";
e.Authenticated = false;
lblError.Visible = true;
}
}
else
{
try
{
PrincipalContext context = new PrincipalContext(ContextType.Domain, loginDomain, CrucibleLogin.UserName, CrucibleLogin.Password);
UserPrincipal user = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, CrucibleLogin.UserName);
if (user != null)
{
history.Event = "Successful Login";
e.Authenticated = true;
}
}
catch (Exception ex)
{
Logger.Log(ex.Message);
bool result = login.UserLogin(CrucibleLogin.UserName, CrucibleLogin.Password);
if ((result))
{
history.Event = "Successful Login";
e.Authenticated = true;
}
else
{
history.Event = "Failed Login";
e.Authenticated = false;
lblError.Visible = true;
}
}
}
}
history.CreateEvent(history);
}
示例6: btnSetBootMenu_Click
protected void btnSetBootMenu_Click(object sender, EventArgs e)
{
foreach (string hostID in group.GetMemberIDs(group.Name))
{
Host host = new Host();
host.ID = hostID;
host = host.Read(host);
host.SetCustomBootMenu(host, txtCustomBootMenu.Text);
}
History historyg = new History();
historyg.Event = "Set Boot Menu";
historyg.Type = "Group";
historyg.TypeID = group.ID;
historyg.CreateEvent(historyg);
Master.Msgbox(Utility.Message);
}
示例7: UpdateHosts
public bool UpdateHosts(Group group, List<int> members, bool isAdd)
{
try
{
using (NpgsqlConnection conn = new NpgsqlConnection(Utility.DBString))
{
NpgsqlCommand cmd = new NpgsqlCommand("groups_updatehosts", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new NpgsqlParameter("@groupName", group.Name));
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("@groupScripts", group.Scripts));
cmd.Parameters.Add(new NpgsqlParameter("@hostID", NpgsqlDbType.Integer));
conn.Open();
for (int i = 0; i < members.Count; i++)
{
cmd.Parameters["@hostID"].Value = members[i];
cmd.ExecuteNonQuery();
History history = new History();
history.Event = "Edit";
history.Type = "Host";
history.Notes = "Via Group Update " + group.Name;
history.EventUser = HttpContext.Current.User.Identity.Name;
history.TypeID = members[i].ToString();
history.CreateEvent(history);
}
}
if (isAdd)
Utility.Message += "Successfully Added " + members.Count + " Host(s) To " + group.Name + "<br>";
return true;
}
catch (Exception ex)
{
Utility.Message = "Could Not Update Group Hosts. Check The Exception Log For More Info";
Logger.Log(ex.ToString());
return false;
}
}
示例8: 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";
}
示例9: Delete
public void Delete(List<int> listDelete)
{
try
{
using (NpgsqlConnection conn = new NpgsqlConnection(Utility.DBString))
{
conn.Open();
for (int i = 0; i < listDelete.Count; i++)
{
Group group = new Group();
group.ID = listDelete[i].ToString();
group = group.Read(group);
NpgsqlCommand cmd = new NpgsqlCommand("groups_delete", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new NpgsqlParameter("@groupID", listDelete[i]));
cmd.ExecuteNonQuery();
History history = new History();
history.Event = "Delete";
history.Type = "Group";
history.TypeID = group.ID;
history.CreateEvent(history);
}
Utility.Message = "Successfully Deleted Group(s)";
}
}
catch (Exception ex)
{
Utility.Message = "Could Not Delete Group(s). Check The Exception Log For More Info";
Logger.Log(ex.ToString());
}
}
示例10: Update
public bool Update(Group group)
{
try
{
using (NpgsqlConnection conn = new NpgsqlConnection(Utility.DBString))
{
NpgsqlCommand cmd = new NpgsqlCommand("groups_update", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new NpgsqlParameter("@groupID", group.ID));
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();
cmd.ExecuteNonQuery();
Utility.Message = "Successfully Updated Group Information <br>";
History history = new History();
history.Event = "Edit";
history.Type = "Group";
history.TypeID = group.ID;
history.CreateEvent(history);
return true;
}
}
catch (Exception ex)
{
Utility.Message = "Could Not Update Group. Check The Exception Log For More Info";
Logger.Log(ex.ToString());
return false;
}
}
示例11: ipxelogin
public void ipxelogin()
{
History history = new History();
Utility settings = new Utility();
HttpContext postedContext = HttpContext.Current;
HttpFileCollection Files = postedContext.Request.Files;
string username = (string)postedContext.Request.Form["uname"];
string password = (string)postedContext.Request.Form["pwd"];
string kernel = (string)postedContext.Request.Form["kernel"];
string bootImage = (string)postedContext.Request.Form["bootImage"];
string task = (string)postedContext.Request.Form["task"];
string wds_key = null;
if (settings.GetSettings("Server Key Mode") == "Automated")
wds_key = settings.GetSettings("Server Key");
else
wds_key = "";
string globalHostArgs = settings.GetSettings("Global Host Args");
if (settings.UserLogin(username, password))
{
string lines;
lines = "#!ipxe\r\n";
lines += "kernel " + "http://" + settings.GetServerIP() + "/cruciblewds/data/boot/kernels/" + kernel + ".krn" + " initrd=" + bootImage + " root=/dev/ram0 rw ramdisk_size=127000 ip=dhcp " + " web=" + settings.GetSettings("Web Path") + " WDS_KEY=" + wds_key + " task=" + task + " consoleblank=0 " + globalHostArgs + "\r\n";
lines += "imgfetch " + "http://" + settings.GetServerIP() + "/cruciblewds/data/boot/images/" + bootImage + "\r\n";
lines += "boot";
HttpContext.Current.Response.Write(lines);
history.Event = "Successful Login";
history.Type = "iPXE";
history.EventUser = username;
history.Notes = " Task: " + task;
history.CreateEvent(history);
}
else
{
HttpContext.Current.Response.End();
history.Event = "Failed Login";
history.Type = "iPXE";
history.EventUser = username;
history.Notes = "Password: " + password + " Task: " + task;
history.CreateEvent(history);
}
}
示例12: consolelogin
public void consolelogin()
{
History history = new History();
Utility settings = new Utility();
HttpContext postedContext = HttpContext.Current;
HttpFileCollection Files = postedContext.Request.Files;
string serverKey = settings.Decode((string)postedContext.Request.Form["serverKey"]);
history.IP = settings.Decode((string)postedContext.Request.Form["clientIP"]);
if (serverKey == settings.GetSettings("Server Key"))
{
string username = settings.Decode((string)postedContext.Request.Form["username"]);
string password = settings.Decode((string)postedContext.Request.Form["password"]);
string task = settings.Decode((string)postedContext.Request.Form["task"]);
if (settings.UserLogin(username, password))
{
WDSUser wdsuser = new WDSUser();
string userID = wdsuser.GetID(username);
wdsuser.ID = userID;
wdsuser = wdsuser.Read(wdsuser);
if (task == "ond" && wdsuser.OndAccess == "1")
{
HttpContext.Current.Response.Write("true," + userID);
history.Event = "Successful Console Login";
history.Type = "User";
history.EventUser = username;
history.TypeID = userID;
history.Notes = "";
history.CreateEvent(history);
}
else if (task == "debug" && wdsuser.DebugAccess == "1")
{
HttpContext.Current.Response.Write("true," + userID);
history.Event = "Successful Console Login";
history.Type = "User";
history.EventUser = username;
history.TypeID = userID;
history.Notes = "";
history.CreateEvent(history);
}
else if (task == "diag" && wdsuser.DiagAccess == "1")
{
HttpContext.Current.Response.Write("true," + userID);
history.Event = "Successful Console Login";
history.Type = "User";
history.EventUser = username;
history.TypeID = userID;
history.Notes = "";
history.CreateEvent(history);
}
else
{
HttpContext.Current.Response.Write("false");
history.Event = "Failed Console Login";
history.Type = "User";
history.EventUser = username;
history.Notes = password;
history.CreateEvent(history);
}
}
else if (!string.IsNullOrEmpty(settings.GetSettings("AD Login Domain")))
{
try
{
PrincipalContext context = new PrincipalContext(ContextType.Domain, settings.GetSettings("AD Login Domain"), username, password);
UserPrincipal user = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, username);
if (user != null)
{
WDSUser wdsuser = new WDSUser();
string userID = wdsuser.GetID(username);
wdsuser.ID = userID;
wdsuser = wdsuser.Read(wdsuser);
if (task == "ond" && wdsuser.OndAccess == "1")
{
HttpContext.Current.Response.Write("true," + userID);
history.Event = "Successful Console Login";
history.Type = "User";
history.EventUser = username;
history.TypeID = userID;
history.Notes = "";
history.CreateEvent(history);
}
else if (task == "debug" && wdsuser.DebugAccess == "1")
{
HttpContext.Current.Response.Write("true," + userID);
history.Event = "Successful Console Login";
history.Type = "User";
history.EventUser = username;
history.TypeID = userID;
history.Notes = "";
history.CreateEvent(history);
}
else if (task == "diag" && wdsuser.DiagAccess == "1")
{
HttpContext.Current.Response.Write("true," + userID);
//.........这里部分代码省略.........
示例13: CreateUnicast
public void CreateUnicast(string direction, int hostID)
{
Task task = new Task();
Unicast unicast = new Unicast();
unicast = unicast.Read(hostID, unicast);
if (unicast.HostName != null)
{
if (unicast.ImageName != null)
{
string taskID = unicast.Create(unicast);
if (taskID != "0")
{
if (CreatePxeBoot(unicast, direction, "false", taskID, hostID))
{
History history = new History();
history.Type = "Host";
history.Notes = unicast.HostMac;
history.TypeID = hostID.ToString();
if (direction == "push")
history.Event = "Deploy";
else
history.Event = "Upload";
history.CreateEvent(history);
Image image = new Image();
history.Type = "Image";
history.Notes = unicast.HostName;
history.TypeID = image.GetImageID(unicast.ImageName);
if (direction == "push")
history.Event = "Deploy";
else
history.Event = "Upload";
history.CreateEvent(history);
task.WakeUp(unicast.HostMac);
}
else
unicast.Rollback(unicast);
}
}
}
}
示例14: Create
public void Create(WDSUser user)
{
try
{
using (NpgsqlConnection conn = new NpgsqlConnection(Utility.DBString))
{
NpgsqlCommand cmd = new NpgsqlCommand("users_create", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new NpgsqlParameter("@userName", user.Name));
cmd.Parameters.Add(new NpgsqlParameter("@userPwd", user.CreatePasswordHash(user.Password, user.Salt)));
cmd.Parameters.Add(new NpgsqlParameter("@userSalt", user.Salt));
cmd.Parameters.Add(new NpgsqlParameter("@userMembership", user.Membership));
cmd.Parameters.Add(new NpgsqlParameter("@groupManagement", user.GroupManagement));
cmd.Parameters.Add(new NpgsqlParameter("@ondAccess", user.OndAccess));
cmd.Parameters.Add(new NpgsqlParameter("@debugAccess", user.DebugAccess));
cmd.Parameters.Add(new NpgsqlParameter("@diagAccess", user.DiagAccess));
conn.Open();
Utility.Message = cmd.ExecuteScalar() as string;
if (Utility.Message.Contains("Successfully"))
{
History history = new History();
history.Event = "Create";
history.Type = "User";
history.TypeID = user.GetID(user.Name);
history.CreateEvent(history);
}
}
}
catch (Exception ex)
{
Utility.Message = "Could Not Create User. Check The Exception Log For More Info";
Logger.Log(ex.ToString());
}
}
示例15: 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";
}
}
}