/// <summary> /// Fetch Selected User Information From the Userlogs table /// </summary> /// <param name="UserID">Long UserID </param> /// <param name="CurrentDate">Date time paramenter</param> /// <returns>List of UserLogs of type UserLogCustom</returns> public List <cstAutditLog> GetUserLog(Guid UserID, DateTime CurrentDate) { List <cstAutditLog> _lsReturn = new List <cstAutditLog>(); try { DateTime Cdate = CurrentDate.Date; var UserLoginfo = from userl in x3v6.Audits where userl.UserID == UserID && EntityFunctions.TruncateTime(userl.ActionTime) == Cdate select userl; foreach (var _UserLogitem in UserLoginfo) { cstAutditLog _UserCustom = new cstAutditLog(); _UserCustom.UserLogID = _UserLogitem.UserLogID; _UserCustom.UserID = _UserLogitem.UserID; _UserCustom.ActionType = _UserLogitem.ActionType; _UserCustom.ActionTime = Convert.ToDateTime(_UserLogitem.ActionTime); _UserCustom.ActionValue = _UserLogitem.ActionValue; _lsReturn.Add(_UserCustom); } } catch (Exception Ex) { Error_Loger.elAction.save("UserLogAction.GetUserLog(1)", Ex.Message.ToString()); } return(_lsReturn); }
/// <summary> /// save User log with ShipmentID /// </summary> /// <param name="UserID">String</param> /// <param name="ActionType">String</param> /// <param name="ActionTime">String</param> /// <param name="ShipmentID">String</param> /// <returns></returns> public static Boolean logThis(string UserID, String ActionType, String ActionTime, String ShipmentID) { Boolean _return = false; Thread T = new Thread(() => { try { List <cstAutditLog> _UserLog = new List <cstAutditLog>(); cstAutditLog _UserC = new cstAutditLog(); _UserC.UserLogID = Guid.Empty; Guid TUserID = Guid.Empty; Guid.TryParse(UserID.ToString(), out TUserID); _UserC.UserID = TUserID; _UserC.ActionType = ActionType; _UserC.ActionTime = Convert.ToDateTime(ActionTime); _UserC.ActionValue = ShipmentID; _UserLog.Add(_UserC); _return = Global.controller.SaveUserLog(_UserLog); } catch (Exception Ex) { ErrorLoger.save("Classes\\LogThis(2)", Ex.InnerException.ToString()); } }); return(_return); }
/// <summary> /// Current time and Global UserID is the default vaues saved. with shipmentID /// </summary> /// <param name="ActionType">String</param> /// <param name="ShipmentID">String</param> /// <returns>Boolean true or false</returns> public static Boolean logThis(String ActionType, String ShipmentID) { Boolean _return = false; Thread T = new Thread(() => { try { List <cstAutditLog> _UserLog = new List <cstAutditLog>(); cstAutditLog _UserC = new cstAutditLog(); _UserC.UserLogID = Guid.Empty; _UserC.UserID = Global.LoggedUserId; _UserC.ActionType = ActionType; _UserC.ActionTime = Convert.ToDateTime(DateTime.UtcNow.ToString()); _UserC.ActionValue = ShipmentID; _UserLog.Add(_UserC); _return = Global.controller.SaveUserLog(_UserLog); } catch (Exception Ex) { ErrorLoger.save("Classes\\LogThis(3)", Ex.InnerException.ToString()); } }); T.Start(); return(_return); }
/// <summary> /// Fetch Selected User Information From the Userlogs table /// </summary> /// <param name="UserID">Long UserID </param> /// <returns>List of UserLogs of type UserLogCustom</returns> public List <cstAutditLog> GetUserLog(Guid UserID) { List <cstAutditLog> _lsReturn = new List <cstAutditLog>(); try { var UserLoginfo = from userl in Service.Get.AllAudit() where userl.UserID == UserID select userl; foreach (var _UserLogitem in UserLoginfo) { cstAutditLog _UserCustom = new cstAutditLog(); _UserCustom.UserLogID = _UserLogitem.UserLogID; _UserCustom.UserID = _UserLogitem.UserID; _UserCustom.ActionType = _UserLogitem.ActionType; _UserCustom.ActionTime = Convert.ToDateTime(_UserLogitem.ActionTime); _UserCustom.ActionValue = _UserLogitem.ActionValue; _lsReturn.Add(_UserCustom); } } catch (Exception Ex) { Error_Loger.elAction.save("UserLogAction.GetUserLog(1)", Ex.Message.ToString()); } return(_lsReturn); }
/// <summary> /// fetch all rows from the UserLogs table and return the list /// </summary> /// <returns>list of UserLogCustom type</returns> public List <cstAutditLog> GetUserLog() { List <cstAutditLog> _lsReturn = new List <cstAutditLog>(); try { var UserLogsinfo = from Userl in x3v6.Audits select Userl; foreach (var _UserLogitem in UserLogsinfo) { cstAutditLog _UserCustom = new cstAutditLog(); _UserCustom.UserLogID = _UserLogitem.UserLogID; _UserCustom.UserID = _UserLogitem.UserID; _UserCustom.ActionType = _UserLogitem.ActionType; _UserCustom.ActionTime = Convert.ToDateTime(_UserLogitem.ActionTime); _UserCustom.ActionValue = _UserLogitem.ActionValue; _lsReturn.Add(_UserCustom); } } catch (Exception Ex) { Error_Loger.elAction.save("UserLogAction.GetUserLog(0)", Ex.Message.ToString()); } return(_lsReturn); }