public void OnOpened(object sender, DocumentOpenedEventArgs args) { try { Document doc = args.Document; if (!CheckTools.AllWorksetsAreOpened(doc)) { return; } if (doc.IsWorkshared && !doc.IsDetached) { string path = ModelPathUtils.ConvertModelPathToUserVisiblePath(doc.GetWorksharingCentralModelPath()); FileInfo centralPath = new FileInfo(path); foreach (DbDocument dbDoc in KPLNDataBase.DbControll.Documents) { FileInfo metaCentralPath = new FileInfo(dbDoc.Path); if (dbDoc.Code == "NONE") { continue; } if (centralPath.FullName == metaCentralPath.FullName) { if (File.Exists(string.Format(@"Z:\Отдел BIM\03_Скрипты\09_Модули_KPLN_Loader\DB\BatchModelCheck\doc_id_{0}.sqlite", dbDoc.Id.ToString()))) { List <DbRowData> rows = DbController.GetRows(dbDoc.Id.ToString()); if (rows.Count != 0) { if ((DateTime.Now.Day - rows.Last().DateTime.Day > 7 && rows.Last().DateTime.Day != DateTime.Now.Day) || rows.Last().DateTime.Month != DateTime.Now.Month || rows.Last().DateTime.Year != DateTime.Now.Year) { CheckDocument(doc, dbDoc); } } else { CheckDocument(doc, dbDoc); } } else { CheckDocument(doc, dbDoc); } } } } } catch (Exception) { } }