public int UpdateLog(ActionHistoryModel log) { try { if (!dbCon.IsDBConnected) { dbCon.DBConnect(); } string sQuery = "SELECT COALESCE(MAX(action_idx) +1, 1) AS action_idx FROM log_action_history"; DataSet ds = dbCon.NewDataSet(sQuery); int action_idx = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString()); string sInsQuery = @" INSERT INTO log_action_history (action_idx, action_module, action_module_idx, action_type, action_target_idx, action_ip, action_dt, action_us, action_url, session_id, description) VALUES({0}, {1}, {2}, {3}, {4}, '192.0.0.1', now(), -1, 'ezDeamon', null, null)"; sInsQuery = string.Format(sInsQuery, action_idx, (int)log.action_module, log.action_module_idx == null ? "null" : log.action_module_idx.ToString(), (int)log.action_type, log.action_target_idx); int res = dbCon.DBExecuteQuery(sInsQuery); return(res); } catch (Exception ex) { throw ex; } }
public static void SetLog(IAction action, eActionType actionType, string Description = "") { ActionHistoryModel history = new ActionHistoryModel(); history.action_module = action.action_module; history.action_module_idx = action.action_module_idx; history.action_type = actionType; history.action_target_idx = action.target_idx; history.action_ip = "192.0.0.1"; history.action_us = -1; history.session_id = null; history.description = Description; history.action_url = "ezDeamon"; history.Save(); }
public static void SetLog(IAction action, eActionType actionType, HttpContextBase context, string Description = "") { ActionHistoryModel history = new ActionHistoryModel(); history.action_module = action.action_module; history.action_module_idx = action.action_module_idx; history.action_type = actionType; history.action_target_idx = action.target_idx; history.action_ip = CommonUtil.GetRemoteIP(context.Request); history.action_us = Convert.ToInt32(context.Session["USER_IDX"]); history.session_id = context.Session.SessionID; history.description = Description; history.action_url = context.Request.FilePath; history.Save(); }
public void AddHistory(ActionHistoryModel history) { this.History.Add(history); }
public void FileRemove() { NpgsqlTransaction tran = biz.dbCon.DBBeginTrans(); try { FileControl fileCtrl = new FileControl(); string isFileDelete = biz.SysConfigValue("FILE", "IS_DEL"); if (isFileDelete != "Y") { return; } string iniPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\ini\app.ini"; string filePath = CfgControl.IniReadValue("PROCESS", "ITF_FILE_FOLDER", iniPath); int fileDelTermDay = Convert.ToInt32(biz.SysConfigValue("FILE", "DEL_TERM")); List <ItfFileInfo> fileList = biz.TermFileList(fileDelTermDay); if (fileList.Count == 0) { return; } foreach (ItfFileInfo file in fileList) { string fileFullPath = Path.Combine(filePath, file.part_no); try { fileCtrl.DeleteFile(fileFullPath, file.file_org_nm); } catch { } biz.UpdateFileStatus(tran, file.file_idx); ActionHistoryModel log = new ActionHistoryModel(); log.action_module = file.action_module; log.action_module_idx = null; log.action_type = eActionType.FileDelete; log.action_target_idx = file.target_idx; biz.UpdateLog(log); } biz.dbCon.DBCommit(tran); } catch (Exception ex) { biz.dbCon.DBRollBack(tran); throw ex; } finally { biz.dbCon.DBDisconnect(); } }
public JsonResult GetActionHistory(ActionHistoryModel searchParam) { var ActionList = Mapper.Instance().QueryForList <ActionHistoryModel>("Log.selActionHis", searchParam); return(Json(ActionList)); }
public void StatusManage() { DmsBiz biz = new DmsBiz(); NpgsqlTransaction tran = biz.dbCon.DBBeginTrans(); try { var distList = biz.GetDistList(); if (!(distList == null || distList.Count == 0)) { foreach (DistMasterModel dist in distList) { DateTime chkDt; string sChkDate = string.Empty; string sStatus = dist.dist_st; string sNextStatus = string.Empty; sChkDate = dist.finish_date; chkDt = DateTime.Parse(sChkDate); TimeSpan TS = chkDt - DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); int diffDay = TS.Days; if (diffDay >= 0) { continue; } biz.UpdateDistStatus(tran, new DistMasterModel() { dist_idx = dist.dist_idx, dist_st = "DF" }); ActionHistoryModel log = new ActionHistoryModel(); log.action_module = dist.action_module; log.action_module_idx = dist.action_module_idx; log.action_type = eActionType.Expire; log.action_target_idx = dist.target_idx; biz.UpdateLog(log); } } var recvDistList = biz.GetRecvDistList(); if (!(recvDistList == null || recvDistList.Count == 0)) { foreach (DistReceiverModel recv in recvDistList) { DateTime chkDt; string sChkDate = string.Empty; string sStatus = recv.recv_dist_st; string sNextStatus = string.Empty; sChkDate = recv.recv_finish_date; chkDt = DateTime.Parse(sChkDate); TimeSpan TS = chkDt - DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); int diffDay = TS.Days; if (diffDay >= 0) { continue; } biz.UpdateRecvDistStatus(tran, new DistReceiverModel() { recv_idx = recv.recv_idx, recv_dist_st = "DF" }); ActionHistoryModel log = new ActionHistoryModel(); log.action_module = recv.action_module; log.action_module_idx = recv.action_module_idx; log.action_type = eActionType.Expire; log.action_target_idx = recv.target_idx; biz.UpdateLog(log); } } biz.dbCon.DBCommit(tran); } catch (Exception ex) { biz.dbCon.DBRollBack(tran); throw ex; } finally { biz.dbCon.DBDisconnect(); } }