public void InsertIntoDBorIntoFıle() { DBOpt.InsertProcess((Object)this); fOperation.CreateFile((Object)this); }
public void LifeCycle() { int counter = 0; while (true) { if (DBOpt.RowCountForField((Object)this) != 0) { CheckTheChangeInDefinitionTable(); if (isActive == true) { if (CheckHourFormat() && CheckDayFormat()) { if (CheckTimeSpanwithCurrentTimeSpan() && CompareDatesAndDecideWhatNextActionWillBe()) { uniqueString = seq.GetUniqueString(); GenerateWebRequest(); GetResponse(); } else { uniqueString = seq.GetUniqueString(); threadId = Thread.CurrentThread.ManagedThreadId; try { /* Possible Exception that name cause */ /* Invalid Operation Example */ threadName = Thread.CurrentThread.Name; } catch (Exception e) { Exception ex = new Exception(); StackTrace st = new StackTrace(); /* https://msdn.microsoft.com/en-us/library/system.exception.getbaseexception(v=vs.110).aspx */ exMsgList.Add(ex.GetBaseException().ToString()); /* https://msdn.microsoft.com/en-us/library/system.diagnostics.stacktrace.getframe(v=vs.110).aspx */ stTraceFramee.Add(st.GetFrame(0).ToString()); } urlAddress = urlAddress; statusCode = -99; requestTime = DateTime.Now; responseTime = DateTime.Now; theDifference = TimeSpan.Zero; responseExist = -99; } } else if (!CheckHourFormat() || !CheckDayFormat()) { uniqueString = seq.GetUniqueString(); threadId = Thread.CurrentThread.ManagedThreadId; try { /* Possible Exception that name cause */ /* Invalid Operation Example */ threadName = Thread.CurrentThread.Name; } catch (Exception e) { Exception ex = new Exception(); StackTrace st = new StackTrace(); /* https://msdn.microsoft.com/en-us/library/system.exception.getbaseexception(v=vs.110).aspx */ exMsgList.Add(ex.GetBaseException().ToString()); /* https://msdn.microsoft.com/en-us/library/system.diagnostics.stacktrace.getframe(v=vs.110).aspx */ stTraceFramee.Add(st.GetFrame(0).ToString()); } urlAddress = urlAddress; statusCode = -0; requestTime = DateTime.Now; responseTime = DateTime.Now; theDifference = TimeSpan.Zero; responseExist = -1; exMsgList.Add("Check the format"); stTraceFramee.Add("Format must be correct."); } } else { uniqueString = seq.GetUniqueString(); threadId = Thread.CurrentThread.ManagedThreadId; try { threadName = Thread.CurrentThread.Name; } catch (Exception e) { Exception ex = new Exception(); StackTrace st = new StackTrace(); exMsgList.Add(ex.GetBaseException().ToString()); stTraceFramee.Add(st.GetFrame(0).ToString()); } urlAddress = urlAddress; statusCode = -99; requestTime = DateTime.Now; responseTime = DateTime.Now; theDifference = TimeSpan.Zero; responseExist = -99; } } else { if (counter < 10) { uniqueString = seq.GetUniqueString(); threadId = Thread.CurrentThread.ManagedThreadId; try { threadName = Thread.CurrentThread.Name; } catch (Exception e) { Exception ex = new Exception(); StackTrace st = new StackTrace(); exMsgList.Add(ex.GetBaseException().ToString()); stTraceFramee.Add(st.GetFrame(0).ToString()); } urlAddress = urlAddress; statusCode = -0; requestTime = DateTime.Now; responseTime = DateTime.Now; theDifference = TimeSpan.Zero; responseExist = -1; counter++; } else { Console.WriteLine("Life Cycle is terminated"); break; } } InsertIntoDBorIntoFıle(); determineTheExceotion = DBOpt.Warning((Object)this); exMsgList = new ConcurrentBag <string>(); stTraceFramee = new ConcurrentBag <string>(); sqlExMsgList = new ConcurrentBag <string>(); sqlStTraceFrame = new ConcurrentBag <string>(); checkDayFormat = false; checkHourFormat = false; timeSpanChecker = false; listofTime = new List <List <TimeSpan> >(); listOfDays = new List <int>(); try { Thread.Sleep(this.sleepTime); } catch (Exception e) { Exception ex = new Exception(); StackTrace st = new StackTrace(); exMsgList.Add(ex.GetBaseException().ToString()); stTraceFramee.Add(st.GetFrame(0).ToString()); } } }