public bool Process() { Debug.WriteLine("start LoadMaterialChangeEntry"); WorksheetEntry sheet = GetWorksheet("Materials"); if (sheet == null) { _finishCallback(false); return(false); } sheet = CheckColumns(sheet, LogData.MaterialChangeInfo.SpreadsheetColumnTitle()); var list = Query(sheet); lock (((ICollection)_materialsChangeLog).SyncRoot) { foreach (var row in list) { var it = new LogData.MaterialChangeInfo(row); it.MemberID = _memberId; it.Number = _materialsChangeLog.Count + 1; if (_materialsChangeLog.Count > 0) { it.PrevItem = _materialsChangeLog.Last(); } _materialsChangeLog.Add(it); _postCallback(it); } } _finishCallback(true); return(true); }
public AddMaterialChangeEntry(SpreadSheetWrapper wrapper, LogData.MaterialChangeInfo info , LogStore.LogStore.LogUploadCompleted finishCallback) { _wrapper = wrapper; _info = info; _memberId = info.MemberID; _finishCallback = finishCallback; }
/// <summary> /// 資源推移情報の追加 /// </summary> /// <param name="info">資源情報</param> public bool AddMaterialsChangeResult(LogData.MaterialChangeInfo info) { if (info == null) { Debug.WriteLine("invalid MaterialChange(null)"); return(false); } DateTime now = DTNow; if (_bLoadingMaterialInfo) { Debug.WriteLine("MaterialChange still loading..."); return(false); } Debug.WriteLine(string.Format("LastMod:{0} Now:{1}", _dtLastMaterialUploaded, now)); if (_dtLastMaterialUploaded == DateTime.MinValue || (_dtLastMaterialUploaded < now)) { Debug.WriteLine("Update MaterialsInfo"); info.Date = now; lock (((ICollection)_materialsLog).SyncRoot) { //リストが空の時例外を投げるらしい。 if (_materialsLog.Count > 0) { info.PrevItem = _materialsLog.Last(); } _materialsLog.Add(info); } _addMaterialRow(info.SetRowData(_createMaterialNewRow())); UpdateMaterialChart(); _vlvMaterialChange.UpdateList(); _dtLastMaterialUploaded = now; _logStore.AddMaterialChange(info, (bool bSucceeded) => { if (!(Properties.Settings.Default.SuppressSuceedWriteLog && bSucceeded)) { UpdateStatusMessage("資源推移の書き込みに{0}しました", bSucceeded ? "成功" : "失敗"); } }); return(true); } return(false); }
public override bool LoadMaterialChange(string MemberID, IList <LogData.MaterialChangeInfo> materialsLog, MaterialDataLoadPostProcess postCallback, LogDownloadCompleted finishCallback) { string file = GetFilePath(MemberID, material_filename); if (file == null) { finishCallback(false); return(false); } if (!File.Exists(file)) { finishCallback(false); return(false); } using (TextFieldParser parser = new TextFieldParser(file, System.Text.Encoding.UTF8)) { parser.TextFieldType = FieldType.Delimited; parser.SetDelimiters(","); lock (((ICollection)materialsLog).SyncRoot) { while (!parser.EndOfData) { string[] row = parser.ReadFields(); var info = new LogData.MaterialChangeInfo(row); if (materialsLog.Count > 0) { info.PrevItem = materialsLog.Last(); } info.Number = materialsLog.Count + 1; info.MemberID = MemberID; materialsLog.Add(info); postCallback(info); } } } finishCallback(true); return(true); }
public LogData.MaterialChangeInfo RecordMaterial(MemberData.Material matDat, MemberData.Basic basicData) { var info = new LogData.MaterialChangeInfo(matDat, basicData); return(info); }
public override bool LoadMaterialChange(string MemberID, IList<LogData.MaterialChangeInfo> materialsLog, MaterialDataLoadPostProcess postCallback, LogDownloadCompleted finishCallback) { string file = GetFilePath(MemberID, material_filename); if (file == null) { finishCallback(false); return false; } if (!File.Exists(file)) { finishCallback(false); return false; } using (TextFieldParser parser = new TextFieldParser(file, System.Text.Encoding.UTF8)) { parser.TextFieldType = FieldType.Delimited; parser.SetDelimiters(","); lock (((ICollection)materialsLog).SyncRoot) { while (!parser.EndOfData) { string[] row = parser.ReadFields(); var info = new LogData.MaterialChangeInfo(row); if (materialsLog.Count > 0) info.PrevItem = materialsLog.Last(); info.Number = materialsLog.Count + 1; info.MemberID = MemberID; materialsLog.Add(info); postCallback(info); } } } finishCallback(true); return true; }
public virtual bool AddMaterialChange(LogData.MaterialChangeInfo info, LogUploadCompleted finishCallback) { finishCallback(true); return(true); }
public override bool AddMaterialChange(LogData.MaterialChangeInfo info, LogUploadCompleted finishCallback) { _jobq.Add(new GSpread.Job.CreateIfNotExistSheet(info.MemberID, _wrapper)); _jobq.Add(new GSpread.Job.AddMaterialChangeEntry(_wrapper, info, finishCallback)); return(true); }
public LogData.MaterialChangeInfo RecordMaterial(MemberData.Material matDat,MemberData.Basic basicData) { var info = new LogData.MaterialChangeInfo(matDat, basicData); return info; }