Mmmm no, since they wouldn't pay for a converter (which I suggested before actually seeing it), I'll be doing it all by hand, and be damned if I'm copying it verbatim, it's probably why I got picked to do it in the firts place, I'll actually refactor it into not being done in the most inane way possible.
TrailerParkJihad
@TrailerParkJihad
Best posts made by TrailerParkJihad
Latest posts made by TrailerParkJihad
-
RE: Why oh why did I get assigned this task.
-
RE: Why oh why did I get assigned this task.
For whatever reason the powers that be have decided everything has to be in the same language, regardless of them both being .NET. I have a feeling it's because the people who've been asked to do anything wiht it besides the guy who wrote it, have immediately come back with "Sorry I don't know VB.", I'm starting to think it's "Sorry no way." :(
-
Why oh why did I get assigned this task.
So, I work for a major, huge, massive conglomerate telecomm, like, $30bn+ net profit last year big. I was hired 6 years ago as a C/C++ developer, since then, we've switched to being a .NET shop, we've spent the last 2 years updating and rewriting everything from whatever it was before to C#, and into a nice, company wide VCS.
I am the most senior person on my team, our primary role is the development (and maintenance, obviously) of employee facing tools, whether they be portals to billing systems, or to equipment in customers homes, our workforce management, whatever. We're a big enough company apparently we always feel the need to roll our own, so that it suits our company perfectly. Generally, this is fantastic, and it allows me to work however I want on some pretty crazy things.
Rewind to last Tuesday. I was tasked with converting a very large VB.NET project (that someone now on our team, who is mysteriously absent wrote some time ago), you see it's almost year end, and this is used to help a large portion of our budgeting process (and our budget process this year has been alotted 210,000 'man hours' solely for the budget, across the company, it's a big thing). Firstly, I hate VB as much as the next guy, while I don't think it's an entirely useless language, I'm not a fan of it. After seeing the size of the project, I made the simple request that we buy a commercial package for converting VB<->C# projects, and forget about it - however it's "not in the budget", and "shouldn't take me long"... There've been plenty of WTFs since then, but I feel the deeper I go ,the more insane I go, and the crazier the code (terrible, terrible code) gets. I don't think this guy is on vacation, I think he's in a mental hospital. Here's a small representation (note: this function is overloaded 7 more times, they all do the same thing, they just accept/return different types)
Private Function theDate(ByVal tofixs As String) As String
Dim response As String = ""
If InStr(tofixs, "-") = 0 Then
Dim TodayDate As Date = Date.Now
Dim YesterdayDate As Date = DateAdd(DateInterval.Day, -1, TodayDate)
Dim stringFiscalMonthStartDate As String = ""
Dim stringFiscalMonthEndDate As String = ""
Dim stringYesterdayDate As String = ""
If Val(YesterdayDate.Day) >= 22 Then
Dim FiscalMonthStartDate As Date = YesterdayDate
Dim FiscalMonthEndDate As Date = DateAdd(DateInterval.Day, 12, YesterdayDate)
stringFiscalMonthStartDate = YesterdayDate.Year
If Len(YesterdayDate.Month.ToString) = 1 Then
stringFiscalMonthStartDate = stringFiscalMonthStartDate & "-0" & FiscalMonthStartDate.Month
Else
stringFiscalMonthStartDate = stringFiscalMonthStartDate & "-" & FiscalMonthStartDate.Month
End If
stringFiscalMonthStartDate = stringFiscalMonthStartDate & "-22"
stringFiscalMonthEndDate = FiscalMonthEndDate.Year
If Len(FiscalMonthEndDate.Month.ToString) = 1 Then
stringFiscalMonthEndDate = stringFiscalMonthEndDate & "-0" & FiscalMonthEndDate.Month
Else
stringFiscalMonthEndDate = stringFiscalMonthEndDate & "-" & FiscalMonthEndDate.Month
End If
stringFiscalMonthEndDate = stringFiscalMonthEndDate & "-21"
Else
Dim FiscalMonthStartDate As Date = DateAdd(DateInterval.Month, -1, YesterdayDate)
Dim FiscalMonthEndDate As Date = YesterdayDate
stringFiscalMonthEndDate = FiscalMonthEndDate.Year
If Len(FiscalMonthEndDate.Month.ToString) = 1 Then
stringFiscalMonthEndDate = stringFiscalMonthEndDate & "-0" & FiscalMonthEndDate.Month
Else
stringFiscalMonthEndDate = stringFiscalMonthEndDate & "-" & FiscalMonthEndDate.Month
End If
stringFiscalMonthEndDate = stringFiscalMonthEndDate & "-21"
stringFiscalMonthStartDate = FiscalMonthStartDate.Year
If Len(FiscalMonthStartDate.Month.ToString) = 1 Then
stringFiscalMonthStartDate = stringFiscalMonthStartDate & "-0" & FiscalMonthStartDate.Month
Else
stringFiscalMonthStartDate = stringFiscalMonthStartDate & "-" & FiscalMonthStartDate.Month
End If
stringFiscalMonthStartDate = stringFiscalMonthStartDate & "-22"
End If
stringYesterdayDate = YesterdayDate.Year
If Len(YesterdayDate.Month.ToString) = 1 Then
stringYesterdayDate = stringYesterdayDate & "-0" & YesterdayDate.Month
Else
stringYesterdayDate = stringYesterdayDate & "-" & YesterdayDate.Month
End If
If Len(YesterdayDate.Day.ToString) = 1 Then
stringYesterdayDate = stringYesterdayDate & "-0" & YesterdayDate.Day
Else
stringYesterdayDate = stringYesterdayDate & "-" & YesterdayDate.Day
End If
If tofixs = "fiscalmonthstart" Then response = stringFiscalMonthStartDate
If tofixs = "fiscalmonthtodate" Then response = stringYesterdayDate
If tofixs = "fiscalmonthend" Then response = stringFiscalMonthEndDate
End If
Return response
End Function..... sigh.