Exemplo n.º 1
0
 public void insertLog(string msgType, int msg_idnum, int EDI_idnum, int Detail_idnum, string logMsg)
 {
     if (dbConnectionCheck())
     {
         using (DBContext context = new DBContext())
         {
             Pasring_Log dbLog = new Pasring_Log()
             {
                 msg_type     = msgType,
                 msg_idnum    = (msg_idnum != 0 ? (int?)msg_idnum : null),
                 EDI_idnum    = (EDI_idnum != 0 ? (int?)EDI_idnum : null),
                 Detail_idnum = (Detail_idnum != 0 ? (int?)Detail_idnum : null),
                 log_msg      = logMsg,
                 created_date = DateTime.Now
             };
             context.Pasring_Log.Add(dbLog);
             context.SaveChanges();
             context.Dispose();
         }
     }
     else
     {
         // create text file
         FileLocation += "" + DateTime.Today.Year + @"\" + DateTime.Today.Month + @"\" + DateTime.Today.Day;
         if (!Directory.Exists(fileLocation))
         {
             Directory.CreateDirectory(fileLocation);
         }
         if (!File.Exists(fullFilePathName))
         {
             StreamWriter sw = File.CreateText(fullFilePathName);
             sw.Close();
         }
     }
 }
Exemplo n.º 2
0
 public void insertLog(string msgType, int msg_idnum, int EDI_idnum, int Detail_idnum, string logMsg)
 {
     if (dbConnectionCheck())
     {
         using (DBContext context = new DBContext())
         {
             Pasring_Log dbLog = new Pasring_Log()
             {
                 msg_type     = msgType,
                 msg_idnum    = (msg_idnum != 0 ? (int?)msg_idnum : null),
                 EDI_idnum    = (EDI_idnum != 0 ? (int?)EDI_idnum : null),
                 Detail_idnum = (Detail_idnum != 0 ? (int?)Detail_idnum : null),
                 log_msg      = logMsg,
                 created_date = DateTime.Now
             };
             context.Pasring_Log.Add(dbLog);
             context.SaveChanges();
             context.Dispose();
         }
     }
     else
     {
         // create text file
     }
 }
Exemplo n.º 3
0
        public void insertLog(string msgType, int msg_idnum, int EDI_idnum, int Detail_idnum, string logMsg)
        {
            if (dbConnectionCheck())
            {
                using (DBContext context = new DBContext())
                {
                    Pasring_Log dbLog = new Pasring_Log()
                    {
                        msg_type     = msgType,
                        msg_idnum    = (msg_idnum != 0 ? (int?)msg_idnum : null),
                        EDI_idnum    = (EDI_idnum != 0 ? (int?)EDI_idnum : null),
                        Detail_idnum = (Detail_idnum != 0 ? (int?)Detail_idnum : null),
                        log_msg      = logMsg,
                        created_date = DateTime.Now
                    };
                    context.Pasring_Log.Add(dbLog);
                    context.SaveChanges();
                    context.Dispose();
                }
            }
            else
            {
                // create text file
                FileName += DateTime.Today.ToString("yyyy_MM_dd");
                string textLogMsg = "mstType: " + msgType;
                textLogMsg += "\r\nmsg_idnum: ";
                if (msg_idnum != 0)
                {
                    textLogMsg += msg_idnum;
                }

                textLogMsg += "\r\nEDI_idnum: ";
                if (EDI_idnum != 0)
                {
                    textLogMsg += msg_idnum;
                }


                logMsg += "mstType: " + msgType + "\r\n";
                logMsg += "mstType: " + msgType + "\r\n";


                string filePathName = Path.Combine(FileLocation, FileName);
                if (!Directory.Exists(FileLocation))
                {
                    Directory.CreateDirectory(FileLocation);
                }
                if (!File.Exists(filePathName))
                {
                    StreamWriter sw = File.CreateText(filePathName);
                    sw.Close();
                }

                using (StreamWriter sw = new StreamWriter(filePathName, true, Encoding.GetEncoding("iso-8859-1")))
                {
                    sw.Write(logMsg);
                    sw.Close();
                }
            }
        }
Exemplo n.º 4
0
 public void insertLog(string msgType, int msg_idnum, int EDI_idnum, int Detail_idnum, string logMsg)
 {
     if (dbConnectionCheck())
     {
         using (DBContext context = new DBContext())
         {
             Pasring_Log dbLog = new Pasring_Log()
             {
             };
             context.Pasring_Log
         }
     }
 }
Exemplo n.º 5
0
 public void insertLog(string msgType, int msg_idnum, int EDI_idnum, int Detail_idnum, string logMsg)
 {
     if (dbConnectionCheck())
     {
         using (DBContext context = new DBContext())
         {
             Pasring_Log dbLog = new Pasring_Log()
             {
                 msg_type  = msgType,
                 msg_idnum = (msg_idnum != 0 ? (int?)msg_idnum : null),
             };
             context.Pasring_Log
         }
     }
 }
Exemplo n.º 6
0
 public void insertLog(string msgType, int msg_idnum, int EDI_idnum, int Detail_idnum, string logMsg)
 {
     if (dbConnectionCheck())
     {
         using (DBContext context = new DBContext())
         {
             Pasring_Log dbLog = new Pasring_Log()
             {
                 msg_type     = msgType,
                 msg_idnum    = (msg_idnum != 0 ? (int?)msg_idnum : null),
                 EDI_idnum    = (EDI_idnum != 0 ? (int?)EDI_idnum : null),
                 Detail_idnum = (Detail_idnum != 0 ? (int?)Detail_idnum : null),
                 log_msg      = logMsg
             };
             context.Pasring_Log.Add(dbLog);
             context.SaveChanges();
         }
     }
 }