public static void WriteAccountLog(VMGlobal.LOG_ACTION action, string memo, Guid Id) { if (Id != Guid.Empty) { using (RPM_Account rpmAccount = new RPM_Account()) { Account account = rpmAccount.GetAccount(Id); memo = string.Format("{0} [{1}]\n", account.ToString(), account.BadgeNumber) + memo; } } AccountLog log = new AccountLog(); log.Action = action.ToString(); log.Memo = memo; using (RPM_Logs rpmLogs = new RPM_Logs()) rpmLogs.LogAccount(log); }
public static void Log(AccountLog log) { try { log.DomainName = Environment.UserDomainName; log.LogTimestamp = new DateTime?(DateTime.Now); log.MachineAccount = Environment.UserName; log.MachineName = Environment.MachineName; log.AccountId = new Guid?(GlobalAccount.Id); log.AccountName = GlobalAccount.ToString(); log.BadgeNumber = GlobalAccount.BadgeNumber; log.IPAddress = IPAddress; log.MachineID = MachineID; using (RPM_Logs rpmLogs = new RPM_Logs()) rpmLogs.LogAccount(log); } catch { } }