public SessionInfo LogOn(string username, string userIP) { MA_USER user; SessionInfo sessioninfo = new SessionInfo(); AuditBusiness _auditBusiness = new AuditBusiness(); LoggingHelper.Debug("Begin Logon by " + username); using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { sessioninfo.ConnectionString = (string)ConfigurationManager.AppSettings[AppSettingName.CONNECTION_STRING]; sessioninfo.Local = "Localhost"; sessioninfo.StartSession = DateTime.Now; LoggingHelper.Debug("Begin get user data"); user = unitOfWork.MA_USERRepository.GetByUserCode(username); if (user == null) { LoggingHelper.Debug(username + " error: " + Messages.USER_NOT_UNAVAILABLE); throw this.CreateException(new Exception(), Messages.USER_NOT_UNAVAILABLE); } sessioninfo.ID = Guid.NewGuid(); sessioninfo.CurrentUserId = user.ID; sessioninfo.UserFullName = user.NAME; sessioninfo.UserLogon = username; sessioninfo.IsActive = user.ISACTIVE.Value; sessioninfo.IsLocked = user.ISLOCKED.Value; sessioninfo.ProfileId = user.USER_PROFILE_ID; sessioninfo.ProfileName = user.MA_USER_PROFILE.LABEL; sessioninfo.IPAddress = userIP; LoggingHelper.Debug("End get user data"); //Get from MA_PROCESS_DATE //LoggingHelper.Debug("Begin get processing date from OPICS"); //OpicsBusiness _opicsBusiness = new OpicsBusiness(); //PROCDateModel prcDate = _opicsBusiness.GetDateProcessing(DateTime.Today); //sessioninfo.Process.CurrentDate = prcDate.CURRDATE; //sessioninfo.Process.PreviousDate = prcDate.PREVDATE; //sessioninfo.Process.NextDate = prcDate.NEXTDATE; //LoggingHelper.Debug("End get processing date from OPICS"); LoggingHelper.Debug("Begin get processing date from MA_PROCESS_DATE"); MA_PROCESS_DATE PROC = unitOfWork.MA_PROCESS_DATERepository.All().FirstOrDefault(); sessioninfo.Process.CurrentDate = PROC != null ? PROC.PROC_DATE : DateTime.Today; sessioninfo.Process.PreviousDate = PROC != null ? PROC.PREV_PROC_DATE : DateTime.Today.AddDays(-1); sessioninfo.Process.NextDate = PROC != null ? PROC.NEXT_PROC_DATE : DateTime.Today.AddDays(1); LoggingHelper.Debug("End get processing date from MA_PROCESS_DATE"); //AUDIT USER TRANSACTION LoggingHelper.Debug("Begin Trace Audit User " + user.NAME); _auditBusiness.TraceAuditLoginUser(sessioninfo); LoggingHelper.Debug("End Trace Audit User " + user.NAME); } return(sessioninfo); }
public static void LogOut(SessionInfo sessioninfo) { AuditBusiness _auditBusiness = new AuditBusiness(); _auditBusiness.TraceAuditLogoutUser(sessioninfo); }
public SessionInfo LogOn(string username, string userIP) { MA_USER user; SessionInfo sessioninfo = new SessionInfo(); AuditBusiness _auditBusiness = new AuditBusiness(); LoggingHelper.Debug("Begin Logon by " + username); using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { sessioninfo.ConnectionString = (string)ConfigurationManager.AppSettings[AppSettingName.CONNECTION_STRING]; sessioninfo.Local = "Localhost"; sessioninfo.StartSession = DateTime.Now; LoggingHelper.Debug("Begin get user data"); user = unitOfWork.MA_USERRepository.GetByUserCode(username); if (user == null) { LoggingHelper.Debug(username + " error: " + Messages.USER_NOT_UNAVAILABLE); throw this.CreateException(new Exception(), Messages.USER_NOT_UNAVAILABLE); } sessioninfo.ID = Guid.NewGuid(); sessioninfo.CurrentUserId = user.ID; sessioninfo.UserFullName = user.NAME; sessioninfo.UserLogon = username; sessioninfo.IsActive = user.ISACTIVE.Value; sessioninfo.IsLocked = user.ISLOCKED.Value; sessioninfo.ProfileId = user.USER_PROFILE_ID; sessioninfo.ProfileName = user.MA_USER_PROFILE.LABEL; sessioninfo.IPAddress = userIP; LoggingHelper.Debug("End get user data"); //Get from MA_PROCESS_DATE //LoggingHelper.Debug("Begin get processing date from OPICS"); //OpicsBusiness _opicsBusiness = new OpicsBusiness(); //PROCDateModel prcDate = _opicsBusiness.GetDateProcessing(DateTime.Today); //sessioninfo.Process.CurrentDate = prcDate.CURRDATE; //sessioninfo.Process.PreviousDate = prcDate.PREVDATE; //sessioninfo.Process.NextDate = prcDate.NEXTDATE; //LoggingHelper.Debug("End get processing date from OPICS"); LoggingHelper.Debug("Begin get processing date from MA_PROCESS_DATE"); MA_PROCESS_DATE PROC = unitOfWork.MA_PROCESS_DATERepository.All().FirstOrDefault(); sessioninfo.Process.CurrentDate = PROC!=null ? PROC.PROC_DATE : DateTime.Today; sessioninfo.Process.PreviousDate = PROC!=null ? PROC.PREV_PROC_DATE : DateTime.Today.AddDays(-1); sessioninfo.Process.NextDate = PROC!=null ? PROC.NEXT_PROC_DATE : DateTime.Today.AddDays(1); LoggingHelper.Debug("End get processing date from MA_PROCESS_DATE"); //AUDIT USER TRANSACTION LoggingHelper.Debug("Begin Trace Audit User " + user.NAME); _auditBusiness.TraceAuditLoginUser(sessioninfo); LoggingHelper.Debug("End Trace Audit User " + user.NAME); } return sessioninfo; }
public static DA_LOGIN_AUDIT GetLogUser(SessionInfo sessioninfo) { AuditBusiness _auditBusiness = new AuditBusiness(); return _auditBusiness.GetUserLogged(sessioninfo); }