/// <summary>返回日志文件名</summary> /// <returns>返回日志文件名</returns> public string GetLogFileName() { string fname = ""; DateTime dqrq = DateTime.Now; string lsp = AppList.LogSavePath; string lname = DateOften.ReFDateTime("{$Year}{$Month}{$Day}{$Hour}", dqrq); int n = 1; bool isoper = true; while (isoper) { isoper = false; string nums = Often.LStrDup(n.ToString(), "0", 7); fname = ServerName + "_" + lname + nums + ".txt"; string fpath = AppList.LogSavePath + fname; if (File.Exists(fpath)) { FileInfo info = new FileInfo(fpath); if (info.Length >= 2097152) { isoper = true; } } n++; } return(fname); }
/// <summary>返回Excel文件名序号</summary> /// <returns>返回Excel文件名序号</returns> public string GetExcelNum() { string s = DateOften.ReFDateTime("{$Year}{$Month}{$Day}{$Hour}{$Minute}{$Second}", DateTime.Now) + ExcelSaveNum.ToString(); ExcelSaveNum++; return(s); }
private void LoadUserList() { userdt = wapp.UserList.UsersTable; userlist.Items.Clear(); for (int i = 0; i < userdt.Rows.Count; i++) { ListViewItem itema = new ListViewItem(userdt.Rows[i]["UserName"].ToString().Trim(), 0); itema.SubItems.Add(userdt.Rows[i]["RealName"].ToString().Trim()); itema.SubItems.Add(WebOften.GetListVal(wapp.AppList.UserManageLv(), userdt.Rows[i]["ManageLv"].ToString().Trim())); itema.SubItems.Add(DateOften.ReFDateTime("{$Year}-{$Month}-{$Day} {$Hour}:{$Minute}", userdt.Rows[i]["LoginDate"].ToString().Trim())); itema.SubItems.Add(userdt.Rows[i]["LoginCount"].ToString().Trim()); itema.SubItems.Add(userdt.Rows[i]["Phones"].ToString().Trim()); userlist.Items.AddRange(new ListViewItem[] { itema }); } }
private void LoadWebSpiderList() { wsdt = wapp.WebSpiderList.WebSpiderTable; wslist.Items.Clear(); for (int i = 0; i < wsdt.Rows.Count; i++) { ListViewItem itema = new ListViewItem(wsdt.Rows[i]["OrderNum"].ToString().Trim(), 0); itema.SubItems.Add(wsdt.Rows[i]["SpiderName"].ToString().Trim()); itema.SubItems.Add(wsdt.Rows[i]["UrlList"].ToString().Trim()); itema.SubItems.Add(wsdt.Rows[i]["ExcelSavePath"].ToString().Trim()); itema.SubItems.Add(WebOften.GetListVal(wapp.AppList.IsYesNo(), wsdt.Rows[i]["IsSaveHtml"].ToString().Trim())); itema.SubItems.Add(wsdt.Rows[i]["HtmlSavePath"].ToString().Trim()); itema.SubItems.Add(DateOften.ReFDateTime("{$Year}-{$Month}-{$Day} {$Hour}:{$Minute}", wsdt.Rows[i]["GatherDate"].ToString().Trim())); itema.SubItems.Add(wsdt.Rows[i]["GatherCount"].ToString().Trim()); itema.SubItems.Add(wsdt.Rows[i]["SpiderID"].ToString().Trim()); wslist.Items.AddRange(new ListViewItem[] { itema }); } }
/// <summary>返回指定日期的数字格式</summary> /// <param name="rqs">指定日期</param> /// <returns>返回指定日期的数字格式</returns> public static int GetDateDayNum(string rqs) { return(Convert.ToInt32(DateOften.ReFDateTime("{$Year}{$Month}{$Day}", rqs))); }
/// <summary>保存并返回日志信息</summary> /// <param name="m">权重, 0:必须记录的日志,1:只有日志记录模式为完整时才会记录的日志</param> /// <param name="s">信息</param> /// <returns>保存并返回日志信息</returns> public string GetLogInfo(int m, string s) { if (m == 0 || LogSaveMode == 0) { string info = "[" + ServerName + "][" + czxh.ToString() + "] >>> " + s + "[" + DateOften.ReFDateTime("{$Year}-{$Month}-{$Day} {$Hour}:{$Minute}:{$Second}", DateTime.Now) + "]\r\n\r\n"; SaveServerLog(info); OutOperDate(); return(info); } return(""); }