/// <summary> /// Method that return a part of date. Is is used internally when the dates are reading. /// </summary> /// <param name="ofxDate">Date</param> /// <param name="partDateTime">Part of date</param> /// <returns></returns> private int GetPartOfOfxDate(string ofxDate, PartDateTime partDateTime) { int result = 0; switch (partDateTime) { case PartDateTime.DAY: result = int.Parse(ofxDate.Substring(6, 2)); break; case PartDateTime.MONTH: result = int.Parse(ofxDate.Substring(4, 2)); break; case PartDateTime.YEAR: result = int.Parse(ofxDate.Substring(0, 4)); break; case PartDateTime.HOUR: if (ofxDate.Length >= 10) { result = int.Parse(ofxDate.Substring(8, 2)); } else { result = 0; } break; case PartDateTime.MINUTE: if (ofxDate.Length >= 12) { result = int.Parse(ofxDate.Substring(10, 2)); } else { result = 0; } break; case PartDateTime.SECOND: if (ofxDate.Length >= 14) { result = int.Parse(ofxDate.Substring(12, 2)); } else { result = 0; } break; default: break; } return(result); }
/// <summary> /// Method that return a part of date. Is is used internally when the dates are reading. /// </summary> /// <param name="ofxDate">Date</param> /// <param name="partDateTime">Part of date</param> /// <returns></returns> private static int GetPartOfOfxDate(String ofxDate, PartDateTime partDateTime) { int result = 0; if (partDateTime == PartDateTime.YEAR) { result = Int32.Parse(ofxDate.Substring(0, 4)); } else if (partDateTime == PartDateTime.MONTH) { result = Int32.Parse(ofxDate.Substring(4, 2)); } if (partDateTime == PartDateTime.DAY) { result = Int32.Parse(ofxDate.Substring(6, 2)); } if (partDateTime == PartDateTime.HOUR) { if (ofxDate.Length >= 10) { result = Int32.Parse(ofxDate.Substring(8, 2)); } else { result = 0; } } if (partDateTime == PartDateTime.MINUTE) { if (ofxDate.Length >= 12) { result = Int32.Parse(ofxDate.Substring(10, 2)); } else { result = 0; } } if (partDateTime == PartDateTime.SECOND) { if (ofxDate.Length >= 14) { result = Int32.Parse(ofxDate.Substring(12, 2)); } else { result = 0; } } return(result); }
/// <summary> /// Method that return a part of date. Is is used internally when the dates are reading. /// </summary> /// <param name="ofxDate">Date</param> /// <param name="partDateTime">Part of date</param> /// <returns></returns> private static int GetPartOfOfxDate(string ofxDate, PartDateTime partDateTime) { if (partDateTime == PartDateTime.YEAR) { return(int.Parse(ofxDate.Substring(0, 4))); } else if (partDateTime == PartDateTime.MONTH) { return(int.Parse(ofxDate.Substring(4, 2))); } else if (partDateTime == PartDateTime.DAY) { return(int.Parse(ofxDate.Substring(6, 2))); } else if (partDateTime == PartDateTime.HOUR) { if (ofxDate.Length >= 10) { return(int.Parse(ofxDate.Substring(8, 2))); } } else if (partDateTime == PartDateTime.MINUTE) { if (ofxDate.Length >= 12) { return(int.Parse(ofxDate.Substring(10, 2))); } } else if (partDateTime == PartDateTime.SECOND) { if (ofxDate.Length >= 14) { return(int.Parse(ofxDate.Substring(12, 2))); } } return(0); }
// obtem pedaços de data private static int getPartOfOfxDate(String ofxDate, PartDateTime partDateTime) { int result = 0; if (partDateTime == PartDateTime.YEAR) { result = Int32.Parse(ofxDate.Substring(0, 4)); } else if (partDateTime == PartDateTime.MONTH) { result = Int32.Parse(ofxDate.Substring(4, 2)); } if (partDateTime == PartDateTime.DAY) { result = Int32.Parse(ofxDate.Substring(6, 2)); } if (partDateTime == PartDateTime.HOUR) { if (ofxDate.Length >= 10) { result = Int32.Parse(ofxDate.Substring(8, 2)); } else { result = 0; } } if (partDateTime == PartDateTime.MINUTE) { if (ofxDate.Length >= 12) { result = Int32.Parse(ofxDate.Substring(10, 2)); } else { result = 0; } } if (partDateTime == PartDateTime.SECOND) { if (ofxDate.Length >= 14) { result = Int32.Parse(ofxDate.Substring(12, 2)); } else { result = 0; } } return result; }