public bool BFindMarkFile(DateTime dt, ref MarkFile mkfile) { var dtMonth = new DateTime(dt.Year, dt.Month, 1); foreach (var mkf in MarkFiles) { if (mkf.DtMonth == dtMonth) { mkfile = mkf; return(true); } } return(false); }
public bool GetMarkData(DateTime dt, ref MarkData mkDa) { var dtMonth = new DateTime(dt.Year, dt.Month, 1); var mkf = new MarkFile(dtMonth); if (BFindMarkFile(dt, ref mkf)) { if (mkf.GetMarkData(dt, ref mkDa)) { return(true); } } return(false); }
public bool SetMarkData(DateTime dt, MarkData mkDa) { try { var dtMonth = new DateTime(dt.Year, dt.Month, 1); var mkf = new MarkFile(dtMonth); if (BFindMarkFile(dtMonth, ref mkf)) //need add to mkf list { mkf.SetMarkData(dt, mkDa); return(true); } } catch (Exception) { // ignored } return(false); }
public bool AddMarkData(DateTime dt, MarkData mkDa, string mkFileRootDir) { try { var dtMonth = new DateTime(dt.Year, dt.Month, 1); var mkf = new MarkFile(dtMonth); if (!BFindMarkFile(dtMonth, ref mkf)) //need add to mkf list { var mkFilePath = Path.Combine(mkFileRootDir, SkewkyMark + mkf.GetMarkFileName()); mkf.FilePath = mkFilePath; mkf.SetMarkData(dt, mkDa); MarkFiles.Add(mkf); return(true); } } catch (Exception) { // ignored } return(false); }