public async Task LogUserActivityAsync([CallerMemberName] string aktywnosc = "") { if (string.IsNullOrEmpty(aktywnosc)) { return; } if (UzytkownikZalogowany.Uzytkownik == null || UzytkownikZalogowany.Uzytkownik.ID_PracownikGAT == 0) { return; } aktywnosc = aktywnosc.Replace("CommandExecute", "") .Replace("Execute", "") .Replace("Otworz", ""); logEntity = new tblLog() { Data = DateTime.Now, ID_Log = Guid.NewGuid(), Aktywnosc = aktywnosc, Uzytkownik = UzytkownikZalogowany.Uzytkownik.ImieINazwiskoGAT }; unitOfWork.tblLog.Add(logEntity); await unitOfWork.SaveAsync(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserName"] == null) { Response.Redirect("Login.aspx"); } if (!IsPostBack) { using (var obj = new QueryDataContext()) { var res = QueryHelper.Context.tblSources.Where(a => a.LocationName.Contains(Session["Query"].ToString()) && a.FK_TypeId == Convert.ToInt64(Session["Type"])); GridView1.DataSource = res; GridView1.DataBind(); foreach (var item in res) { if (QueryHelper.Context.tblLogs.Count(a => a.FK_SourceId == item.Id && a.FK_UserID == QueryHelper.Context.tblUsers.Single(b => b.UserName == Session["UserName"].ToString()).Id) <= 0) { var log = new tblLog(); log.FK_SourceId = item.Id; log.FK_UserID = QueryHelper.Context.tblUsers.Single(a => a.UserName == Session["UserName"].ToString()).Id; log.Date = DateTime.Now; obj.tblLogs.InsertOnSubmit(log); obj.SubmitChanges(); } } } } }
public Admin() { var versionstring = "100"; version = double.Parse(versionstring); dc = new AlsiTMDataContext(); mac = Utilities.GetMacAddress().First(); CreateNewUserIfNotExist(); UserID = dc.tblUsers.Where(z => z.USER_MACADRESS == mac).Select(z => z.ID).First(); UserList = dc.tblUsers.ToList(); var user = dc.tblUsers.Where(z => z.USER_MACADRESS == mac).First(); if (GetNewVersionNumber(user) > version) { var u = new UpdateForm("https://www.dropbox.com/s/rcnhl5eab7f2ywp/WebNotify.zip"); u.ShowDialog(); } var log = new tblLog { LOG_TS = DateTime.UtcNow.AddHours(2), LOG_USER_ID = user.ID, LOG_VERSION = version.ToString(), }; dc.tblLogs.InsertOnSubmit(log); dc.SubmitChanges(); }
public Logar(int kulId, string aciklama) { tblLog log = new tblLog() { kullaniciId = kulId, logBilgisi = "Kullanıcı " + DateTime.Now + aciklama }; KullaniciIslem.HareketEkle(log); }
public static tblLog MapData(Log r) { tblLog log = new tblLog() { logId = r.logId, kullaniciId = r.kullaniciId, logBilgisi = r.logBilgisi }; return(log); }
//kullanıcı hareketleri /loglama işlemi için public static char HareketEkle(tblLog log) { try { using (BuyutecDBEntities db = new BuyutecDBEntities()) { db.tblLogs.Add(log); db.SaveChanges(); return('+'); } } catch { return('-'); } }
public static void Write(MessageReport report, User currentuser, string objId, string objname, string classname, string appcode, string actions) { var computername = Common.GetComputerName(HttpContext.Current.Request.UserHostAddress); objname = objname.Replace("'", ""); var t = new tblLog(); t.LogID = Guid.NewGuid(); t.Actions = actions; t.AppCode = appcode; t.ComputerName = computername; t.Date = DateTime.Now; t.Description = string.Format("Action: {0} - Name: {1} - Id: {2}", report.Message, objname, objId); t.IPAddress = computername; t.ObjectName = objname; t.SubSystemCode = classname; t.UserName = currentuser.Username; var str = new StringBuilder(); str.Append("INSERT INTO tblLog (LogID, Date, UserName, AppCode, SubSystemCode, ObjectName, Actions, Description, ComputerName)"); str.AppendLine("VALUES ("); str.AppendLine(string.Format("'{0}'", Guid.NewGuid())); str.AppendLine(string.Format(", '{0}'", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"))); str.AppendLine(string.Format(", '{0}'", t.UserName)); str.AppendLine(string.Format(", '{0}'", t.AppCode)); str.AppendLine(string.Format(", '{0}'", t.SubSystemCode)); str.AppendLine(string.Format(", N'{0}'", t.ObjectName)); str.AppendLine(string.Format(", N'{0}'", t.Actions)); str.AppendLine(string.Format(", N'{0}'", t.Description)); str.AppendLine(string.Format(", '{0}'", t.ComputerName)); str.AppendLine(")"); SqlExQuery <tblLog> .ExcuteNone(str.ToString()); }
private void detach_tblLogs(tblLog entity) { this.SendPropertyChanging(); entity.tblSource = null; }
private void attach_tblLogs(tblLog entity) { this.SendPropertyChanging(); entity.tblSource = this; }
partial void DeletetblLog(tblLog instance);
partial void UpdatetblLog(tblLog instance);
partial void InserttblLog(tblLog instance);