using System; using System.Collections.Generic; using System.Text; using Pub_Class; using System.IO; namespace EDI { public class pubCls { //дÈëÈÕÖ¾ /// /// дÈëÈÕÖ¾ /// /// ÎÞÓà /// ²Ù×÷ÈÕÖ¾ /// ²Ù×÷Ô± /// public static bool Add_Log(string UserID, string WorkList, string CurUserName) { ClsSqlHelper oCn = new ClsSqlHelper(); try { if (DBUtility.ClsPub.CBCurYear != 9999) { oCn.RunProc("Insert into System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " + "(getdate(),'" + CurUserName + "','" + UserID + "','" + WorkList + "','EDIϵͳ','','²Ù×÷')" ); } ErrorLog("¡¾" + CurUserName + "¡¿,¡¾" + UserID + "¡¿,¡¾" + WorkList + "¡¿"); return true; } catch (Exception e) { return false; } } public static void ErrorLog(string mssg) { string FilePath = (DBUtility.ClsPub.AppPath + @"/Log" + DateTime.Today.ToShortDateString().Replace("-", "") + ".txt"); try { if (File.Exists(FilePath)) { using (StreamWriter tw = File.AppendText(FilePath)) { tw.WriteLine(DateTime.Now.ToString() + "> " + mssg); } //END using } //END if else { TextWriter tw = new StreamWriter(FilePath); tw.WriteLine(DateTime.Now.ToString() + "> " + mssg); tw.Flush(); tw.Close(); tw = null; } //END else } //END Try catch (Exception ex) { } //END Catch } // END ErrorLog } }