From 55ad66198702117457c2424d3c77ff59d565cedf Mon Sep 17 00:00:00 2001 From: K Date: Fri, 17 May 2024 15:06:17 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BB=D0=B0=D0=B1=D0=B0=20=D0=B6=D0=B8=D0=B2?= =?UTF-8?q?=D0=B0=20=D1=8F=20=D0=BD=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PrecastConcretePlantContracts.dll | Bin 32768 -> 32768 bytes .../PrecastConcretePlantDataModels.dll | Bin 7168 -> 7168 bytes .../PrecastConcretePlantDatabaseImplement.dll | Bin 76800 -> 76800 bytes .../PrecastConcretePlantFileImplement.dll | Bin 41984 -> 41984 bytes .../PrecastConcretePlantListImplement.dll | Bin 27648 -> 27648 bytes .../BusinessLogic/BackUpLogic.cs | 5 ----- .../DI/DependencyManager.cs | 2 -- .../DatabaseImplementationExtension.cs | 2 +- .../DataGridViewExtension.cs | 6 ++++-- 9 files changed, 5 insertions(+), 10 deletions(-) diff --git a/PrecastConcretePlant/ImplementationExtensions/PrecastConcretePlantContracts.dll b/PrecastConcretePlant/ImplementationExtensions/PrecastConcretePlantContracts.dll index 73606a1f6e0c6b1c63ac7617727fe7c5e1ce42e7..77bfdc7bc4871ee6ee1e0dc54149ea299e843744 100644 GIT binary patch delta 238 zcmZo@U}|V!n$W@Gu)*v5#-4;Mfv=x(ogXZ{#-fUf{%EGc^rsKQGDWw4daUYGi zl8u7=*OXt$T>AgR^T|g_Hz_~`-|IjHL8_Otr|!Spku;<7*_FMUrGNdvj zGNdq=GbA&ZF_-{J3x*^h%aFmC!IU8lNLm2dX$%HHu_Pc5q&5kt#}KF%B%T7KQ-LrA Ms4jW)_i9cS0Muks6#xJL delta 238 zcmZo@U}|V!n$W>wDra$LV^2bsz*+gv>ijM;p6d&H-es}cW^DeGCC;W{m};J8U}J<*}71bg~d2R@z&&&(g1iZt%GDOKyMk`3RYzVBn^P#MnKXGtlMbw I_i9cS01He=GXMYp diff --git a/PrecastConcretePlant/ImplementationExtensions/PrecastConcretePlantDataModels.dll b/PrecastConcretePlant/ImplementationExtensions/PrecastConcretePlantDataModels.dll index 3adb759f85687a9fd34922aae82470fe1537c0c9..5021ec7b0c1187e54b864ccfd97f07a646d53dac 100644 GIT binary patch delta 235 zcmZp$Xt0>j!E#G%+lh@m27Chcb1qI)F01jKaI}4Wf>`Q?&1d*(88s{oQxj9nlg&($ zEt1R(jZM>xEez8P%#w@~Q<72*O$^ggOj1)*ERrV|3Z%1Gt4?1u`Hnz5fa9FVj7w%}wN!7U0f9W9b^;TAL&-RSwLtFtG^|KAww!dB0~y; zIYTmo8G{Lsv|vaAvJ4rF8B7_{fTRVGoyK4Q6iWi~Kx&hKdJKVTLE1_1JcOBetE delta 235 zcmZp$Xt0>j!7}yu)-M}-4EO{dI9e!GUM0|yIDYJ4XeK)Ln?zgLmGnt zgC&D0kY&kW$dCl2lYz7ukhEYh2J%yY>{Or{bB08)3RAEuBOqx26gL8rW?$Y9K1%8&*mEr9Ga1_Pj25|9T{n*`Kj2viFaPXW@Y QK$rqlm%QCwgK;M_09f`(0ssI2 delta 243 zcmZp;!P0PpWkLr_cMQj~jXg3y1=de%{~LQSz}v(+d#p8R9_9+u{alGl@W%m@&$*s{{U zzfaVyEslGdXLQ}A$r3YnDL@5}9fJyjR6B1`6$Y9K1%8&*mEr9Ga1_Pj25|9T{n*`Kj2viFaPXW@YK$rql Lm%Lei!9!*M`x;IQ delta 237 zcmZoT!PIbqX+j6fjkNVMHumi45C}I8j^fHN@M>GbG{5BB^o^S%IxF}z3{%b13@lB} zEe(^*lMT(1EsT>=%u)@^6D!v4N{E^%uLOVCjXeehh@vLH@_zDm=PeLbU|jL zBD0Cpx=V*;t{z)Bce2FHT?$Y^COxPiNcHL6pZjK?xuLz}KC|QIPc!ea`WrH&GMF=@ zF&HpdGMEBcmJEgrNkBRoNSgsk3kG8#KLyB61*$P;NCc}e1*pHa8+%TK2{0{hoywwV;I#XaV*WN68_&%t;ZmF$mWHW`Ddx#$ zCdn2_W`@S5X~q_YX$EFV#)&COsfH$oX(=YDsVNr8lb0p5u}o%7{V~}fF+kuT_ZB;~ zC2t&Nw$!cln7gEN@`S`)3Q$3Xn=nDv)QXc2oOV delta 237 zcmZp;!PszvaY6@+==G2*8+%TK3Hc!C(yJrvTZhKsDwJiC`6`U{yvy(f}xK1SHMCx{Wr= IXFOyE0QA~Qi2wiq diff --git a/PrecastConcretePlant/PrecastConcretePlantBusinessLogic/BusinessLogic/BackUpLogic.cs b/PrecastConcretePlant/PrecastConcretePlantBusinessLogic/BusinessLogic/BackUpLogic.cs index e27cb12..f3870f3 100644 --- a/PrecastConcretePlant/PrecastConcretePlantBusinessLogic/BusinessLogic/BackUpLogic.cs +++ b/PrecastConcretePlant/PrecastConcretePlantBusinessLogic/BusinessLogic/BackUpLogic.cs @@ -50,7 +50,6 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic { File.Delete(fileName); } - // берем метод для сохранения _logger.LogDebug("Get assembly"); var typeIId = typeof(IId); var assembly = typeIId.Assembly; @@ -71,14 +70,11 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic throw new InvalidOperationException($"Не найден класс-модель для {type.Name}"); } _logger.LogDebug("Call SaveToFile method for {name} type", type.Name); - // вызываем метод на выполнение method?.MakeGenericMethod(modelType).Invoke(this, new object[] { model.FolderName }); } } _logger.LogDebug("Create zip and remove folder"); - // архивируем ZipFile.CreateFromDirectory(model.FolderName, fileName); - // удаляем папку dirInfo.Delete(true); } catch (Exception) @@ -86,7 +82,6 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic throw; } } - private void SaveToFile(string folderName) where T : class, new() { var records = _backUpInfo.GetList(); diff --git a/PrecastConcretePlant/PrecastConcretePlantContracts/DI/DependencyManager.cs b/PrecastConcretePlant/PrecastConcretePlantContracts/DI/DependencyManager.cs index f5c1394..067e517 100644 --- a/PrecastConcretePlant/PrecastConcretePlantContracts/DI/DependencyManager.cs +++ b/PrecastConcretePlant/PrecastConcretePlantContracts/DI/DependencyManager.cs @@ -21,7 +21,6 @@ namespace PrecastConcretePlantContracts.DI } public static DependencyManager Instance { get { if (_manager == null) { lock (_locjObject) { _manager = new DependencyManager(); } } return _manager; } } - public static void InitDependency() { var ext = ServiceProviderLoader.GetImplementationExtensions(); @@ -29,7 +28,6 @@ namespace PrecastConcretePlantContracts.DI { throw new ArgumentNullException("Отсутствуют компоненты для загрузки зависимостей по модулям"); } - // регистрируем зависимости ext.RegisterServices(); } diff --git a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/DatabaseImplementationExtension.cs b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/DatabaseImplementationExtension.cs index 6139359..020e32c 100644 --- a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/DatabaseImplementationExtension.cs +++ b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/DatabaseImplementationExtension.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; using PrecastConcretePlantContracts.DI; using PrecastConcretePlantContracts.StoragesContracts; using PrecastConcretePlantDatabaseImplement.Implements; - +//начало 3его вопроса - Как реализован новый механизм настройки зависимостей? namespace PrecastConcretePlantDatabaseImplement { public class DatabaseImplementationExtension : IImplementationExtension diff --git a/PrecastConcretePlant/PrecastConcretePlantView/DataGridViewExtension.cs b/PrecastConcretePlant/PrecastConcretePlantView/DataGridViewExtension.cs index 27e34eb..25d7cba 100644 --- a/PrecastConcretePlant/PrecastConcretePlantView/DataGridViewExtension.cs +++ b/PrecastConcretePlant/PrecastConcretePlantView/DataGridViewExtension.cs @@ -5,7 +5,6 @@ using System.Text; using System.Threading.Tasks; using PrecastConcretePlantContracts.Attributes; - namespace PrecastConcretePlantView { public static class DataGridViewExtension @@ -20,6 +19,7 @@ namespace PrecastConcretePlantView var type = typeof(T); var properties = type.GetProperties(); + foreach (DataGridViewColumn column in grid.Columns) { var property = properties.FirstOrDefault(x => x.Name == column.Name); @@ -27,13 +27,15 @@ namespace PrecastConcretePlantView { throw new InvalidOperationException($"В типе {type.Name} не найдено свойство с именем {column.Name}"); } + var attribute = property.GetCustomAttributes(typeof(ColumnAttribute), true)?.SingleOrDefault(); + if (attribute == null) { throw new InvalidOperationException($"Не найден атрибут типа ColumnAttribute для свойства {property.Name}"); } - if (attribute is ColumnAttribute columnAttr) + if (attribute is ColumnAttribute columnAttr)//проставляем полученные аттрибуты { column.HeaderText = columnAttr.Title; column.Visible = columnAttr.Visible;