Lets poll no matter what time of the day
-
public static bool checkPolTime(string SFDCStartTime)
{
string configSFDCStartTime = string.Empty;
string configSFDCAMPM = string.Empty;
int len = 0;
len = SFDCStartTime.Length;
//Reading from Config File
if (len > 7)
{
configSFDCStartTime = SFDCStartTime.Substring(0, 5);
configSFDCAMPM = SFDCStartTime.Substring(6, 2);
}
else
{
configSFDCStartTime = SFDCStartTime.Substring(0, 4);
configSFDCAMPM = SFDCStartTime.Substring(5, 2);
}//Reading System Time string systemSFDCStartMin = string.Empty; string systemSFDCStartSec = string.Empty; string systemSFDCAMPM = string.Empty; string time = DateTime.Now.ToString(); string\[\] splitchr = { " " }; string\[\] strarr = time.Split(splitchr, StringSplitOptions.None); string s = strarr\[0\]; len = s.Length; if (len == 9) { splitchr\[0\] = ":"; strarr = time.Split(splitchr, StringSplitOptions.None); s = strarr\[0\]; len = s.Length; if (len == 11) { systemSFDCStartMin = time.Substring(10, 4); systemSFDCStartSec = time.Substring(15, 2); systemSFDCAMPM = time.Substring(18, 2); } else if (len == 12) { systemSFDCStartMin = time.Substring(10, 5); systemSFDCStartSec = time.Substring(16, 2); systemSFDCAMPM = time.Substring(19, 2); } } else if (len == 10) { splitchr\[0\] = ":"; strarr = time.Split(splitchr, StringSplitOptions.None); s = strarr\[0\]; len = s.Length; if (len == 12) { systemSFDCStartMin = time.Substring(11, 4); systemSFDCStartSec = time.Substring(16, 2); systemSFDCAMPM = time.Substring(19, 2); } else if (len == 13) { systemSFDCStartMin = time.Substring(11, 5); systemSFDCStartSec = time.Substring(17, 2); systemSFDCAMPM = time.Substrin
-
public static bool checkPolTime(string SFDCStartTime)
{
string configSFDCStartTime = string.Empty;
string configSFDCAMPM = string.Empty;
int len = 0;
len = SFDCStartTime.Length;
//Reading from Config File
if (len > 7)
{
configSFDCStartTime = SFDCStartTime.Substring(0, 5);
configSFDCAMPM = SFDCStartTime.Substring(6, 2);
}
else
{
configSFDCStartTime = SFDCStartTime.Substring(0, 4);
configSFDCAMPM = SFDCStartTime.Substring(5, 2);
}//Reading System Time string systemSFDCStartMin = string.Empty; string systemSFDCStartSec = string.Empty; string systemSFDCAMPM = string.Empty; string time = DateTime.Now.ToString(); string\[\] splitchr = { " " }; string\[\] strarr = time.Split(splitchr, StringSplitOptions.None); string s = strarr\[0\]; len = s.Length; if (len == 9) { splitchr\[0\] = ":"; strarr = time.Split(splitchr, StringSplitOptions.None); s = strarr\[0\]; len = s.Length; if (len == 11) { systemSFDCStartMin = time.Substring(10, 4); systemSFDCStartSec = time.Substring(15, 2); systemSFDCAMPM = time.Substring(18, 2); } else if (len == 12) { systemSFDCStartMin = time.Substring(10, 5); systemSFDCStartSec = time.Substring(16, 2); systemSFDCAMPM = time.Substring(19, 2); } } else if (len == 10) { splitchr\[0\] = ":"; strarr = time.Split(splitchr, StringSplitOptions.None); s = strarr\[0\]; len = s.Length; if (len == 12) { systemSFDCStartMin = time.Substring(11, 4); systemSFDCStartSec = time.Substring(16, 2); systemSFDCAMPM = time.Substring(19, 2); } else if (len == 13) { systemSFDCStartMin = time.Substring(11, 5); systemSFDCStartSec = time.Substring(17, 2); systemSFDCAMPM = time.Substrin
Your code snippet is not complete. You forgot e.g.
systemSFDCStartHour
andsystemSFDCStartMilliSecond
. Also code for non-American locales is missing. You can add several hundred lines more of useless code before thatreturn true
statement, there is a lot of space for future optimizations! -
public static bool checkPolTime(string SFDCStartTime)
{
string configSFDCStartTime = string.Empty;
string configSFDCAMPM = string.Empty;
int len = 0;
len = SFDCStartTime.Length;
//Reading from Config File
if (len > 7)
{
configSFDCStartTime = SFDCStartTime.Substring(0, 5);
configSFDCAMPM = SFDCStartTime.Substring(6, 2);
}
else
{
configSFDCStartTime = SFDCStartTime.Substring(0, 4);
configSFDCAMPM = SFDCStartTime.Substring(5, 2);
}//Reading System Time string systemSFDCStartMin = string.Empty; string systemSFDCStartSec = string.Empty; string systemSFDCAMPM = string.Empty; string time = DateTime.Now.ToString(); string\[\] splitchr = { " " }; string\[\] strarr = time.Split(splitchr, StringSplitOptions.None); string s = strarr\[0\]; len = s.Length; if (len == 9) { splitchr\[0\] = ":"; strarr = time.Split(splitchr, StringSplitOptions.None); s = strarr\[0\]; len = s.Length; if (len == 11) { systemSFDCStartMin = time.Substring(10, 4); systemSFDCStartSec = time.Substring(15, 2); systemSFDCAMPM = time.Substring(18, 2); } else if (len == 12) { systemSFDCStartMin = time.Substring(10, 5); systemSFDCStartSec = time.Substring(16, 2); systemSFDCAMPM = time.Substring(19, 2); } } else if (len == 10) { splitchr\[0\] = ":"; strarr = time.Split(splitchr, StringSplitOptions.None); s = strarr\[0\]; len = s.Length; if (len == 12) { systemSFDCStartMin = time.Substring(11, 4); systemSFDCStartSec = time.Substring(16, 2); systemSFDCAMPM = time.Substring(19, 2); } else if (len == 13) { systemSFDCStartMin = time.Substring(11, 5); systemSFDCStartSec = time.Substring(17, 2); systemSFDCAMPM = time.Substrin
The original plan was to finish the method while poll isn't active. It just never happened since...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is (V).
-
public static bool checkPolTime(string SFDCStartTime)
{
string configSFDCStartTime = string.Empty;
string configSFDCAMPM = string.Empty;
int len = 0;
len = SFDCStartTime.Length;
//Reading from Config File
if (len > 7)
{
configSFDCStartTime = SFDCStartTime.Substring(0, 5);
configSFDCAMPM = SFDCStartTime.Substring(6, 2);
}
else
{
configSFDCStartTime = SFDCStartTime.Substring(0, 4);
configSFDCAMPM = SFDCStartTime.Substring(5, 2);
}//Reading System Time string systemSFDCStartMin = string.Empty; string systemSFDCStartSec = string.Empty; string systemSFDCAMPM = string.Empty; string time = DateTime.Now.ToString(); string\[\] splitchr = { " " }; string\[\] strarr = time.Split(splitchr, StringSplitOptions.None); string s = strarr\[0\]; len = s.Length; if (len == 9) { splitchr\[0\] = ":"; strarr = time.Split(splitchr, StringSplitOptions.None); s = strarr\[0\]; len = s.Length; if (len == 11) { systemSFDCStartMin = time.Substring(10, 4); systemSFDCStartSec = time.Substring(15, 2); systemSFDCAMPM = time.Substring(18, 2); } else if (len == 12) { systemSFDCStartMin = time.Substring(10, 5); systemSFDCStartSec = time.Substring(16, 2); systemSFDCAMPM = time.Substring(19, 2); } } else if (len == 10) { splitchr\[0\] = ":"; strarr = time.Split(splitchr, StringSplitOptions.None); s = strarr\[0\]; len = s.Length; if (len == 12) { systemSFDCStartMin = time.Substring(11, 4); systemSFDCStartSec = time.Substring(16, 2); systemSFDCAMPM = time.Substring(19, 2); } else if (len == 13) { systemSFDCStartMin = time.Substring(11, 5); systemSFDCStartSec = time.Substring(17, 2); systemSFDCAMPM = time.Substrin
Nope, no redundant code in there, nope, none. Nothing to see here, move along...:TunelessWhistleSmiley:
The only instant messaging I do involves my middle finger. English doesn't borrow from other languages. English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.
-
public static bool checkPolTime(string SFDCStartTime)
{
string configSFDCStartTime = string.Empty;
string configSFDCAMPM = string.Empty;
int len = 0;
len = SFDCStartTime.Length;
//Reading from Config File
if (len > 7)
{
configSFDCStartTime = SFDCStartTime.Substring(0, 5);
configSFDCAMPM = SFDCStartTime.Substring(6, 2);
}
else
{
configSFDCStartTime = SFDCStartTime.Substring(0, 4);
configSFDCAMPM = SFDCStartTime.Substring(5, 2);
}//Reading System Time string systemSFDCStartMin = string.Empty; string systemSFDCStartSec = string.Empty; string systemSFDCAMPM = string.Empty; string time = DateTime.Now.ToString(); string\[\] splitchr = { " " }; string\[\] strarr = time.Split(splitchr, StringSplitOptions.None); string s = strarr\[0\]; len = s.Length; if (len == 9) { splitchr\[0\] = ":"; strarr = time.Split(splitchr, StringSplitOptions.None); s = strarr\[0\]; len = s.Length; if (len == 11) { systemSFDCStartMin = time.Substring(10, 4); systemSFDCStartSec = time.Substring(15, 2); systemSFDCAMPM = time.Substring(18, 2); } else if (len == 12) { systemSFDCStartMin = time.Substring(10, 5); systemSFDCStartSec = time.Substring(16, 2); systemSFDCAMPM = time.Substring(19, 2); } } else if (len == 10) { splitchr\[0\] = ":"; strarr = time.Split(splitchr, StringSplitOptions.None); s = strarr\[0\]; len = s.Length; if (len == 12) { systemSFDCStartMin = time.Substring(11, 4); systemSFDCStartSec = time.Substring(16, 2); systemSFDCAMPM = time.Substring(19, 2); } else if (len == 13) { systemSFDCStartMin = time.Substring(11, 5); systemSFDCStartSec = time.Substring(17, 2); systemSFDCAMPM = time.Substrin