public async Task <ActionMessage> EditExplanation(int id, ExplanationInfo _Explanation, string _userU, [FromForm] List <IFormFile> files) { ActionMessage ret = new ActionMessage(); SqlConnectionFactory sqlConnection = new SqlConnectionFactory(); using (SqlConnection connection = sqlConnection.GetConnection()) { try { UserLogInfo info = new UserLogInfo(); info.Action = "Edit"; info.Description = "ngày : " + _Explanation.InTime + " code : " + _Explanation.ExplanationCode + " trạng thái : " + _Explanation.Status; info.Feature = TableFile.Proposal.ToString(); info.Time = DateTime.Now; info.UserName = _userU; info.UserID = 1; UserService.GetInstance().TrackUserAction(info); ExplanationDataLayer.GetInstance().UpdateExplanation(connection, id, _Explanation, _userU); } catch (Exception ex) { throw ex; } } DocumentService.GetInstance().DeleteDocumentsNotExitsInList(_Explanation.ListDocument, TableFile.Explanation.ToString(), id); using (SqlConnection connection = sqlConnection.GetConnection()) { try { foreach (ItemPropsalInfo item in _Explanation.Items) { ProposalDataLayer.GetInstance().UpdateItemExplanation(connection, item, _userU); } } catch (Exception ex) { throw ex; } } foreach (var item in files) { DocumentInfo documentInfo = new DocumentInfo(); documentInfo.TableName = TableFile.Explanation.ToString(); documentInfo.PreferId = id.ToString(); documentInfo.Link = DateTime.Now.ToString("yyMMddHHmmssfff") + "-" + Utils.ChuyenTVKhongDau(item.FileName); documentInfo.FileName = item.FileName; documentInfo.Length = item.Length.ToString(); documentInfo.Type = item.ContentType; ret = await FilesHelpers.UploadFile(TableFile.Explanation.ToString(), id.ToString(), item, documentInfo.Link); DocumentService.GetInstance().InsertDocument(documentInfo, _userU.ToString()); } ret.isSuccess = true; return(ret); }
public IHttpActionResult CreateLog(int id, [FromBody] UserLogInfo logInfo) { try { var request = new AuthenticatedRequest(); var isAuth = request.IsApiAuthenticated && AccessTokenManager.IsScope(request.ApiToken, AccessTokenManager.ScopeUsers) || request.IsUserLoggin && request.UserId == id || request.IsAdminLoggin && request.AdminPermissions.HasSystemPermissions(ConfigManager.SettingsPermissions.User); if (!isAuth) { return(Unauthorized()); } var userInfo = UserManager.GetUserInfoByUserId(id); if (userInfo == null) { return(NotFound()); } var retval = DataProvider.UserLogDao.ApiInsert(userInfo.UserName, logInfo); return(Ok(new { Value = retval })); } catch (Exception ex) { LogUtils.AddErrorLog(ex); return(InternalServerError(ex)); } }
public IHttpActionResult CreateLog(int id, [FromBody] UserLogInfo logInfo) { try { var oRequest = new ORequest(AccessTokenManager.ScopeUsers); if (!oRequest.IsApiAuthorized) { return(Unauthorized()); } if (!DataProvider.UserDao.ApiIsExists(id)) { return(NotFound()); } var userName = DataProvider.UserDao.GetUserName(id); var retval = DataProvider.UserLogDao.ApiInsert(userName, logInfo); return(Ok(new OResponse(retval))); } catch (Exception ex) { LogUtils.AddErrorLog(ex); return(InternalServerError(ex)); } }
public List <ILogInfo> List(string userName, int totalNum, string action) { var list = new List <ILogInfo>(); var sqlString = "SELECT * FROM siteserver_UserLog WHERE UserName = @UserName"; if (!string.IsNullOrEmpty(action)) { sqlString += " And Action = @Action"; } sqlString += " ORDER BY ID DESC"; var parameters = new List <IDataParameter> { GetParameter(ParmUserName, DataType.VarChar, 50, userName) }; if (!string.IsNullOrEmpty(action)) { parameters.Add(GetParameter(ParmAction, DataType.VarChar, 255, action)); } using (var rdr = ExecuteReader(sqlString, parameters.ToArray())) { while (rdr.Read()) { var i = 0; var info = new UserLogInfo(GetInt(rdr, i++), GetString(rdr, i++), GetString(rdr, i++), GetDateTime(rdr, i++), GetString(rdr, i++), GetString(rdr, i)); list.Add(info); } } return(list); }
public int CreateUserInfo(UserLogInfo model) { string spName = "Wap.UserLog_Create"; var p = new DynamicParameters(); p.Add("@CookieId", model.CookieId); p.Add("@UserId", model.UserId); p.Add("@UserName", model.UserName); p.Add("@ClientId", model.ClientId); p.Add("@Version", model.Version); p.Add("@UserAgent", model.UserAgent); p.Add("@IMEI", model.IMEI); p.Add("@IMSI", model.IMSI); p.Add("@ChannelId", model.ChannelId); p.Add("@SourceType", model.SourceType); p.Add("@StartupCount", model.StartupCount); p.Add("@RecentStartupTime", model.RecentStartupTime); p.Add("@OnlineTime", model.OnlineTime); p.Add("@Mobile", model.Mobile); p.Add("@NetType", model.NetType); p.Add("@Province", model.Province); p.Add("@City", model.City); p.Add("@ReferUrl", model.ReferUrl); p.Add("@Url", model.Url); p.Add("@IPAddress", model.IPAddress); p.Add("@RemoteHost", model.RemoteHost); p.Add("@AddTime", model.AddTime); return(DbManage.Execute(spName, p, CommandType.StoredProcedure)); }
public List <UserLogInfo> List(string userName, int totalNum, string action) { var list = new List <UserLogInfo>(); var sqlString = "SELECT * FROM bairong_UserLog WHERE UserName = @UserName"; if (!string.IsNullOrEmpty(action)) { sqlString += " And Action = @Action"; } else { action = EUserActionTypeUtils.GetValue(EUserActionType.Login); sqlString += " And Action <> @Action"; } sqlString += " ORDER BY ID DESC"; var parms = new IDataParameter[] { GetParameter(ParmUserName, EDataType.VarChar, 50, userName), GetParameter(ParmAction, EDataType.NVarChar, 255, action) }; using (var rdr = ExecuteReader(sqlString, parms)) { while (rdr.Read()) { var i = 0; var info = new UserLogInfo(GetInt(rdr, i++), GetString(rdr, i++), GetString(rdr, i++), GetDateTime(rdr, i++), GetString(rdr, i++), GetString(rdr, i)); list.Add(info); } } return(list); }
public static void AddUserLog(string userName, string actionType, string summary) { if (!ConfigManager.SystemConfigInfo.IsLogUser) { return; } try { DataProvider.UserLogDao.DeleteIfThreshold(); if (!string.IsNullOrEmpty(summary)) { summary = StringUtils.MaxLengthText(summary, 250); } var userLogInfo = new UserLogInfo(0, userName, PageUtils.GetIpAddress(), DateTime.Now, actionType, summary); DataProvider.UserLogDao.Insert(userLogInfo); } catch (Exception ex) { AddErrorLog(ex); } }
protected void CreateUserLog() { object obj = SessionHelper.Get(Constants.SecurityKey.UserId_SessionName); if (obj != null && !StringHelper.IsObjectNullOrEmpty(obj)) { } else { string cookieId = GetCookieId(); try { UserLogInfo logInfo = new UserLogInfo(); logInfo = GetLogInfo(logInfo) as UserLogInfo; logInfo.AddTime = DateTime.Now; logInfo.CookieId = cookieId; logInfo.OnlineTime = 0; logInfo.RecentStartupTime = DateTime.Now; logInfo.StartupCount = 0; logInfo.Url = StringHelper.ToString(this.Request.Url); ILogService log = DataContext.ResolveService <ILogService>(); log.CreateUserInfo(logInfo); } catch { } finally { SessionHelper.Set(Constants.SecurityKey.UserId_SessionName, cookieId); } } }
protected void Page_Load(object sender, EventArgs e) { string type = Request["type"]; UserLogInfo userLog = (UserLogInfo)Session[KEY_CACHEOPERATOR]; TSysUserVo userInfoLogin = userLog.UserInfo; Response.Redirect(ConfigurationManager.AppSettings["ccflow"] + "/AppServices/DoType.aspx?userNo=" + userInfoLogin.USER_NAME + "&type=" + type); }
private void InsertUserLog(UserInfo userInfo) { UserLogInfo userLogInfo = new UserLogInfo(); userLogInfo.UserId = userInfo.UserId; userLogInfo.LogonName = userInfo.LogonName; userLogInfo.InputDate = DateTime.Now; UserInfoAdapter.Instance.InsertUserLogInfo(userLogInfo); }
public void TrackUserAction(UserLogInfo userLoginfo) { SqlConnectionFactory sqlConnection = new SqlConnectionFactory(); using (SqlConnection connection = sqlConnection.GetConnection()) { UsersDataLayer.GetInstance().TrackingUserBehavior(connection, userLoginfo); } }
public int CreateUserInfo(UserLogInfo model) { if (model == null) { return(0); } using (var conn = DbConnection(DbOperation.Write)) { var repo = new Repository.LogRepo(conn); return(repo.CreateUserInfo(model)); } }
/// <summary> /// 对象添加 的日志 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="user"></param> /// <param name="tag"></param> /// <param name="t"></param> /// <param name="ip"></param> public void InsertLog <T>(UserLogInfo uinfo, string tag, T t) where T : class, new() { OperateLog log = new OperateLog { Tag = tag, Content = ObjectToStr(t, "UpdatePerson,UpdateDate"), Operator = uinfo.Name, OperatorId = uinfo.Id, IP = uinfo.ClientIP }; base.Add(log); }
/// <summary> /// 更新用户日志信息 /// </summary> public int UpdateUserLogInfo(UserLogInfo userLog) { DynamicParameters param = new DynamicParameters(); param.Add("@Processor", userLog.Processor); param.Add("@Process_Content", userLog.Process_Content); param.Add("@Process_Time", userLog.Process_Time); param.Add("@Current_State", userLog.Current_State); param.Add("@Happen_Time", userLog.Happen_Time); using (Conn) { return(Conn.Execute(UPDATE_UserLog, param)); } }
public void Insert(UserLogInfo userLog) { var sqlString = "INSERT INTO siteserver_UserLog(UserName, IPAddress, AddDate, Action, Summary) VALUES (@UserName, @IPAddress, @AddDate, @Action, @Summary)"; var parms = new IDataParameter[] { GetParameter(ParmUserName, DataType.VarChar, 50, userLog.UserName), GetParameter(ParmIpAddress, DataType.VarChar, 50, userLog.IpAddress), GetParameter(ParmAddDate, DataType.DateTime, userLog.AddDate), GetParameter(ParmAction, DataType.VarChar, 255, userLog.Action), GetParameter(ParmSummary, DataType.VarChar, 255, userLog.Summary) }; ExecuteNonQuery(sqlString, parms); }
/// <summary> /// 添加用户日志信息 /// </summary> public int InsertUserLogInfo(UserLogInfo userLog) { DynamicParameters param = new DynamicParameters(); param.Add("@Happen_Time", userLog.Happen_Time); param.Add("@Operation_Content", userLog.Operation_Content); param.Add("@The_Operator", userLog.The_Operator); param.Add("@Notice_time", userLog.Notice_time); param.Add("@Receive_People", userLog.Receive_People); param.Add("@Current_State", userLog.Current_State); using (Conn) { return(Conn.Execute(INSERT_UserLog, param)); } }
/// <summary> /// 添加日志 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="uinfo"></param> /// <param name="BillNo"></param> /// <param name="tag"></param> /// <param name="t"></param> public void InsertLog <T>(UserLogInfo uinfo, int priceTempletId, string tag, T t) where T : class, new() { PriceTempletLog log = new PriceTempletLog { CreateTime = DateTime.Now, Operator = uinfo.Name, OperatorId = uinfo.Id, IP = uinfo.ClientIP, Title = tag, PriceTempletId = priceTempletId, Message = OperateLogBLL.ObjectToStr(t) }; base.Add(log); }
/// <summary> /// 添加日志 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="uinfo"></param> /// <param name="BillNo"></param> /// <param name="tag"></param> /// <param name="t"></param> public void InsertLog <T>(UserLogInfo uinfo, string BillNo, string tag, T t) where T : class, new() { OrderOperationLog log = new OrderOperationLog { CreateTime = DateTime.Now, Operator = uinfo.Name, OperatorId = uinfo.Id, IP = uinfo.ClientIP, Title = tag, BillNo = BillNo, Message = OperateLogBLL.ObjectToStr(t) }; base.Add(log); }
/// <summary> /// 对象编辑 的日志 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="user"></param> /// <param name="tag"></param> /// <param name="ip"></param> /// <param name="before"></param> /// <param name="after"></param> public void EditLog <T>(UserLogInfo uinfo, string tag, T before, T after) where T : class, new() { OperateLog log = new OperateLog { Tag = tag, Content = ObjectEquals(before, after, "CreatePerson,CreateDate,UpdatePerson,UpdateDate"), Operator = uinfo.Name, OperatorId = uinfo.Id, IP = uinfo.ClientIP }; if (!string.IsNullOrEmpty(log.Content)) { base.Add(log); } }
/// <summary> /// 自定义 日志内容 /// </summary> /// <param name="uinfo"></param> /// <param name="tag"></param> /// <param name="content"></param> public void CustomLog(UserLogInfo uinfo, string tag, string content) { OperateLog log = new OperateLog { Tag = tag, Content = content, Operator = uinfo.Name, OperatorId = uinfo.Id, IP = uinfo.ClientIP }; if (!string.IsNullOrWhiteSpace(content)) { base.Add(log); } }
/// <summary> /// 读取注册用户的动作日志 /// </summary> /// <param name="count"></param> /// <returns></returns> public static List <UserLogInfo> GetUserLog(int count) { IDataReader reader = DatabaseProvider.GetInstance().GetUserLog(count); List <UserLogInfo> userLogList = new List <UserLogInfo>(); while (reader.Read()) { UserLogInfo logInfo = new UserLogInfo(); logInfo.UId = TypeConverter.ObjectToInt(reader["uid"]); logInfo.Action = Utils.GetEnum <UserLogActionEnum>(reader["action"].ToString(), UserLogActionEnum.Update); logInfo.DateTime = reader["datetime"].ToString(); userLogList.Add(logInfo); } reader.Close(); return(userLogList); }
public UserLogInfo ApiInsert(string userName, UserLogInfo logInfo) { logInfo.UserName = userName; logInfo.IpAddress = PageUtils.GetIpAddress(); logInfo.AddDate = DateTime.Now; using (var connection = GetConnection()) { var identity = connection.Insert(logInfo); if (identity > 0) { logInfo.Id = Convert.ToInt32(identity); } } return(logInfo); }
/// <summary> /// 对象编辑 的日志 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="uinfo"></param> /// <param name="BillNo"></param> /// <param name="tag"></param> /// <param name="before"></param> /// <param name="after"></param> public void EditLog <T>(UserLogInfo uinfo, int priceTempletId, string tag, T before, T after) where T : class, new() { PriceTempletLog log = new PriceTempletLog { CreateTime = DateTime.Now, Operator = uinfo.Name, OperatorId = uinfo.Id, IP = uinfo.ClientIP, Title = tag, PriceTempletId = priceTempletId, Message = OperateLogBLL.ObjectEquals(before, after) }; if (!string.IsNullOrEmpty(log.Message)) { base.Add(log); } }
/// <summary> /// 自定义 日志内容 /// </summary> /// <param name="uinfo"></param> /// <param name="tag"></param> /// <param name="content"></param> public void CustomLog(UserLogInfo uinfo, int priceTempletId, string tag, string content) { PriceTempletLog log = new PriceTempletLog { CreateTime = DateTime.Now, Operator = uinfo.Name, OperatorId = uinfo.Id, IP = uinfo.ClientIP, Title = tag, PriceTempletId = priceTempletId, Message = content }; if (!string.IsNullOrWhiteSpace(content)) { base.Add(log); } }
/// <summary> /// 对象编辑 的日志 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="uinfo"></param> /// <param name="BillNo"></param> /// <param name="tag"></param> /// <param name="before"></param> /// <param name="after"></param> public void EditLog <T>(UserLogInfo uinfo, string BillNo, string tag, T before, T after) where T : class, new() { OrderOperationLog log = new OrderOperationLog { CreateTime = DateTime.Now, Operator = uinfo.Name, OperatorId = uinfo.Id, IP = uinfo.ClientIP, Title = tag, BillNo = BillNo, Message = OperateLogBLL.ObjectEquals(before, after) }; if (!string.IsNullOrEmpty(log.Message)) { base.Add(log); } }
/// <summary> /// 自定义 日志内容 /// </summary> /// <param name="uinfo"></param> /// <param name="tag"></param> /// <param name="content"></param> public void CustomLog(UserLogInfo uinfo, string BillNo, string tag, string content) { OrderOperationLog log = new OrderOperationLog { CreateTime = DateTime.Now, Operator = uinfo.Name, OperatorId = uinfo.Id, IP = uinfo.ClientIP, Title = tag, BillNo = BillNo, Message = content }; if (!string.IsNullOrWhiteSpace(content)) { base.Add(log); } }
/// <summary> /// 更新会员表储值金额并记录储值日志 /// </summary> /// <param name="userContext"></param> /// <param name="userStoreParam"></param> /// <param name="userInfo"></param> /// <param name="transaction"></param> /// <returns></returns> private bool LoggingStoreMoneyLog(UserContext userContext, UserStoreMoneyAdd userStoreParam, UserInfoDetail userInfo, IDbTransaction transaction) { var logInfoResult = true; var updateRequest = new UserInfoDetail { Uid = userStoreParam.UserId, UStoreMoney = userInfo.UStoreMoney + userStoreParam.RechargeMoney }; var storeResult = _userInfoRepository.Update <UserInfoDetail>(updateRequest, item => new { item.UStoreMoney }, transaction); if (storeResult) { var storeLogInfo = new UserLogInfo { AccId = userContext.AccId, OriginalAccId = userContext.AccId, UId = userStoreParam.UserId, LogType = (int)UserLogTypeEnum.StoreChange, ItemType = (int)UserLogItemTypeEnum.Shopping, OriginalVal = userInfo.UStoreMoney, EditMoney = userStoreParam.RealMoney, EditVal = userStoreParam.RechargeMoney, FinalVal = userInfo.UStoreMoney + userStoreParam.RechargeMoney, LogTime = DateTime.Now, OperatorTime = DateTime.Now, OperatorId = userContext.UserId, OperatorIp = userContext.IpAddress, Remark = userStoreParam.Remark, Flag = string.Empty, FlagStatus = 0, FlagStatusTime = DateTime.Now, EditMoneyType = userStoreParam.PayType, AddedLgUserId = userStoreParam.Salesman, BindCardId = 0 }; //记录日志 logInfoResult = _userLogRepository.Insert(storeLogInfo, transaction); } return(logInfoResult); }
public ActionMessage DeleteSurvey(int id, string user, string _userID) { ActionMessage ret = new ActionMessage(); SurveyDetailInfo temp = GetDetailSurvey(id, _userID); SqlConnectionFactory sqlConnection = new SqlConnectionFactory(); using (SqlConnection connection = sqlConnection.GetConnection()) { try { UserLogInfo info = new UserLogInfo(); info.Action = "Delete"; if (temp != null) { info.Description = "code : " + temp.SurveyCode + " id : " + id; } else { info.Description = " id : " + id; } info.Feature = TableFile.Proposal.ToString(); info.Time = DateTime.Now; info.UserName = user; info.UserID = 1; UserService.GetInstance().TrackUserAction(info); SurveyDataLayer.GetInstance().Delete(connection, id); ret.isSuccess = true; } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error"; ret.err.msgString = ex.ToString(); } } return(ret); }
public int createProposal2(ProposalInfo _Proposal, string _userI) { int ret = -1; SqlConnectionFactory sqlConnection = new SqlConnectionFactory(); using (SqlConnection connection = sqlConnection.GetConnection()) { try { int year = DateTime.Now.Year; int maxPropCode = ProposalDataLayer.GetInstance().GetMaxPropCode(connection, year); string departmentCode = DepartmentDataLayer.GetInstance().GetDepartmentCodeById(connection, _Proposal.DepartmentID); _Proposal.ProposalCode = departmentCode + year.ToString() + maxPropCode.ToString().PadLeft(4, '0'); UserLogInfo info = new UserLogInfo(); info.Action = "Insert"; info.Description = "ngày : " + _Proposal.DateIn + " khoa/phòng chịu trách nhiệm ID " + _Proposal.CurDepartmentID + " code " + _Proposal.ProposalCode + " khoa phòng đề xuất ID : " + _Proposal.DepartmentID + " trạng thái : " + _Proposal.Status; info.Feature = TableFile.Proposal.ToString(); info.Time = DateTime.Now; info.UserName = _userI; info.UserID = 1; UserService.GetInstance().TrackUserAction(info); ret = ProposalDataLayer.GetInstance().InsertProposal(connection, _Proposal, _userI); ProposalDataLayer.GetInstance().UpdateMaxCode(connection, maxPropCode, year); // ret.isSuccess = true; } catch (Exception ex) { throw ex; } } return(ret); }
protected string getFlowList() { UserLogInfo userLoginInfo = this.LogInfo; TSysUserVo user = userLoginInfo.UserInfo; string info = CCFlowFacade.GetEmpStart(user.USER_NAME); XmlDocument document = new XmlDocument(); document.LoadXml(info); XmlNodeList rows = document.SelectNodes("/root/record/row"); IList <Dictionary <string, string> > list = new List <Dictionary <string, string> >(); IList <Dictionary <string, string> > sort = new List <Dictionary <string, string> >(); for (int i = 0; i < rows.Count; i++) { XmlNode node = rows.Item(i); XmlNodeList children = node.ChildNodes; Dictionary <string, string> dic = new Dictionary <string, string>(); for (int j = 0; j < children.Count; j++) { XmlNode element = children[j]; dic.Add(element.Name, Server.UrlDecode(element.InnerText)); if (element.Name == "FlowPic") { string FlowPicUrl = dic["FlowPic"]; string[] arrayUrl = FlowPicUrl.Split('/'); arrayUrl[3] = Server.UrlEncode(arrayUrl[3]); string temp = string.Concat(FlowPicUrl, "/"); dic["FlowPic"] = temp.Substring(0, temp.LastIndexOf("/")); } } list.Add(dic); } JavaScriptSerializer serializer = new JavaScriptSerializer(); return(serializer.Serialize(new { Rows = list })); }
public Int32 InsertUserLogInfo(UserLogInfo userLogInfo) { String sql = ORMapping.GetInsertSql(userLogInfo, BuilderEx.TSqlBuilderInstance); int result = _DataHelper.ExecuteSql(sql); return result; }