Model1.ssdl 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Schema Namespace="Хранилище Goiman_A_AModel" Provider="System.Data.SqlClient" ProviderManifestToken="2012" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
  3. <EntityType Name="Agent">
  4. <Key>
  5. <PropertyRef Name="ID" />
  6. </Key>
  7. <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
  8. <Property Name="Title" Type="nvarchar" MaxLength="150" Nullable="false" />
  9. <Property Name="AgentTypeID" Type="int" Nullable="false" />
  10. <Property Name="Address" Type="nvarchar" MaxLength="300" />
  11. <Property Name="INN" Type="varchar" MaxLength="12" Nullable="false" />
  12. <Property Name="KPP" Type="varchar" MaxLength="9" />
  13. <Property Name="DirectorName" Type="nvarchar" MaxLength="100" />
  14. <Property Name="Phone" Type="nvarchar" MaxLength="20" Nullable="false" />
  15. <Property Name="Email" Type="nvarchar" MaxLength="255" />
  16. <Property Name="Logo" Type="nvarchar" MaxLength="100" />
  17. <Property Name="Priority" Type="int" Nullable="false" />
  18. </EntityType>
  19. <EntityType Name="AgentPriorityHistory">
  20. <Key>
  21. <PropertyRef Name="ID" />
  22. </Key>
  23. <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
  24. <Property Name="AgentID" Type="int" Nullable="false" />
  25. <Property Name="ChangeDate" Type="datetime" Nullable="false" />
  26. <Property Name="PriorityValue" Type="int" Nullable="false" />
  27. </EntityType>
  28. <EntityType Name="AgentType">
  29. <Key>
  30. <PropertyRef Name="ID" />
  31. </Key>
  32. <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
  33. <Property Name="Title" Type="nvarchar" MaxLength="50" Nullable="false" />
  34. <Property Name="Image" Type="nvarchar" MaxLength="100" />
  35. </EntityType>
  36. <EntityType Name="Material">
  37. <Key>
  38. <PropertyRef Name="ID" />
  39. </Key>
  40. <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
  41. <Property Name="Title" Type="nvarchar" MaxLength="100" Nullable="false" />
  42. <Property Name="CountInPack" Type="int" Nullable="false" />
  43. <Property Name="Unit" Type="nvarchar" MaxLength="10" Nullable="false" />
  44. <Property Name="CountInStock" Type="float" />
  45. <Property Name="MinCount" Type="float" Nullable="false" />
  46. <Property Name="Description" Type="nvarchar(max)" />
  47. <Property Name="Cost" Type="decimal" Precision="10" Scale="2" Nullable="false" />
  48. <Property Name="Image" Type="nvarchar" MaxLength="100" />
  49. <Property Name="MaterialTypeID" Type="int" Nullable="false" />
  50. </EntityType>
  51. <EntityType Name="MaterialCountHistory">
  52. <Key>
  53. <PropertyRef Name="ID" />
  54. </Key>
  55. <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
  56. <Property Name="MaterialID" Type="int" Nullable="false" />
  57. <Property Name="ChangeDate" Type="datetime" Nullable="false" />
  58. <Property Name="CountValue" Type="float" Nullable="false" />
  59. </EntityType>
  60. <EntityType Name="MaterialSupplier">
  61. <Key>
  62. <PropertyRef Name="MaterialID" />
  63. <PropertyRef Name="SupplierID" />
  64. </Key>
  65. <Property Name="MaterialID" Type="int" Nullable="false" />
  66. <Property Name="SupplierID" Type="int" Nullable="false" />
  67. </EntityType>
  68. <EntityType Name="MaterialType">
  69. <Key>
  70. <PropertyRef Name="ID" />
  71. </Key>
  72. <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
  73. <Property Name="Title" Type="nvarchar" MaxLength="50" Nullable="false" />
  74. <Property Name="DefectedPercent" Type="float" />
  75. </EntityType>
  76. <EntityType Name="Product">
  77. <Key>
  78. <PropertyRef Name="ID" />
  79. </Key>
  80. <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
  81. <Property Name="Title" Type="nvarchar" MaxLength="100" Nullable="false" />
  82. <Property Name="ProductTypeID" Type="int" />
  83. <Property Name="ArticleNumber" Type="nvarchar" MaxLength="10" Nullable="false" />
  84. <Property Name="Description" Type="nvarchar(max)" />
  85. <Property Name="Image" Type="nvarchar" MaxLength="100" />
  86. <Property Name="ProductionPersonCount" Type="int" />
  87. <Property Name="ProductionWorkshopNumber" Type="int" />
  88. <Property Name="MinCostForAgent" Type="decimal" Precision="10" Scale="2" Nullable="false" />
  89. </EntityType>
  90. <EntityType Name="ProductCostHistory">
  91. <Key>
  92. <PropertyRef Name="ID" />
  93. </Key>
  94. <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
  95. <Property Name="ProductID" Type="int" Nullable="false" />
  96. <Property Name="ChangeDate" Type="datetime" Nullable="false" />
  97. <Property Name="CostValue" Type="decimal" Precision="10" Scale="2" Nullable="false" />
  98. </EntityType>
  99. <EntityType Name="ProductMaterial">
  100. <Key>
  101. <PropertyRef Name="ProductID" />
  102. <PropertyRef Name="MaterialID" />
  103. </Key>
  104. <Property Name="ProductID" Type="int" Nullable="false" />
  105. <Property Name="MaterialID" Type="int" Nullable="false" />
  106. <Property Name="Count" Type="float" />
  107. </EntityType>
  108. <EntityType Name="ProductSale">
  109. <Key>
  110. <PropertyRef Name="ID" />
  111. </Key>
  112. <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
  113. <Property Name="AgentID" Type="int" Nullable="false" />
  114. <Property Name="ProductID" Type="int" Nullable="false" />
  115. <Property Name="SaleDate" Type="date" Nullable="false" />
  116. <Property Name="ProductCount" Type="int" Nullable="false" />
  117. </EntityType>
  118. <EntityType Name="ProductType">
  119. <Key>
  120. <PropertyRef Name="ID" />
  121. </Key>
  122. <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
  123. <Property Name="Title" Type="nvarchar" MaxLength="50" Nullable="false" />
  124. <Property Name="DefectedPercent" Type="float" />
  125. </EntityType>
  126. <EntityType Name="Role">
  127. <Key>
  128. <PropertyRef Name="Role_ID" />
  129. </Key>
  130. <Property Name="Role_ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
  131. <Property Name="RoleName" Type="nvarchar" MaxLength="50" Nullable="false" />
  132. </EntityType>
  133. <EntityType Name="Shop">
  134. <Key>
  135. <PropertyRef Name="ID" />
  136. </Key>
  137. <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
  138. <Property Name="Title" Type="nvarchar" MaxLength="150" Nullable="false" />
  139. <Property Name="Address" Type="nvarchar" MaxLength="300" />
  140. <Property Name="AgentID" Type="int" Nullable="false" />
  141. </EntityType>
  142. <EntityType Name="Supplier">
  143. <Key>
  144. <PropertyRef Name="ID" />
  145. </Key>
  146. <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
  147. <Property Name="Title" Type="nvarchar" MaxLength="150" Nullable="false" />
  148. <Property Name="INN" Type="varchar" MaxLength="12" Nullable="false" />
  149. <Property Name="StartDate" Type="date" Nullable="false" />
  150. <Property Name="QualityRating" Type="int" />
  151. <Property Name="SupplierType" Type="nvarchar" MaxLength="20" />
  152. </EntityType>
  153. <EntityType Name="User">
  154. <Key>
  155. <PropertyRef Name="User_ID" />
  156. </Key>
  157. <Property Name="User_ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
  158. <Property Name="Login" Type="nvarchar" MaxLength="50" Nullable="false" />
  159. <Property Name="Password" Type="nvarchar" MaxLength="50" Nullable="false" />
  160. <Property Name="SurName" Type="nvarchar" MaxLength="50" Nullable="false" />
  161. <Property Name="FirstName" Type="nvarchar" MaxLength="50" Nullable="false" />
  162. <Property Name="MiddleName" Type="nvarchar" MaxLength="50" />
  163. <Property Name="Role_id" Type="int" Nullable="false" />
  164. </EntityType>
  165. <Association Name="FK_Agent_AgentType">
  166. <End Role="AgentType" Type="Self.AgentType" Multiplicity="1" />
  167. <End Role="Agent" Type="Self.Agent" Multiplicity="*" />
  168. <ReferentialConstraint>
  169. <Principal Role="AgentType">
  170. <PropertyRef Name="ID" />
  171. </Principal>
  172. <Dependent Role="Agent">
  173. <PropertyRef Name="AgentTypeID" />
  174. </Dependent>
  175. </ReferentialConstraint>
  176. </Association>
  177. <Association Name="FK_AgentPriorityHistory_Agent">
  178. <End Role="Agent" Type="Self.Agent" Multiplicity="1" />
  179. <End Role="AgentPriorityHistory" Type="Self.AgentPriorityHistory" Multiplicity="*" />
  180. <ReferentialConstraint>
  181. <Principal Role="Agent">
  182. <PropertyRef Name="ID" />
  183. </Principal>
  184. <Dependent Role="AgentPriorityHistory">
  185. <PropertyRef Name="AgentID" />
  186. </Dependent>
  187. </ReferentialConstraint>
  188. </Association>
  189. <Association Name="FK_Material_MaterialType">
  190. <End Role="MaterialType" Type="Self.MaterialType" Multiplicity="1" />
  191. <End Role="Material" Type="Self.Material" Multiplicity="*" />
  192. <ReferentialConstraint>
  193. <Principal Role="MaterialType">
  194. <PropertyRef Name="ID" />
  195. </Principal>
  196. <Dependent Role="Material">
  197. <PropertyRef Name="MaterialTypeID" />
  198. </Dependent>
  199. </ReferentialConstraint>
  200. </Association>
  201. <Association Name="FK_MaterialCountHistory_Material">
  202. <End Role="Material" Type="Self.Material" Multiplicity="1" />
  203. <End Role="MaterialCountHistory" Type="Self.MaterialCountHistory" Multiplicity="*" />
  204. <ReferentialConstraint>
  205. <Principal Role="Material">
  206. <PropertyRef Name="ID" />
  207. </Principal>
  208. <Dependent Role="MaterialCountHistory">
  209. <PropertyRef Name="MaterialID" />
  210. </Dependent>
  211. </ReferentialConstraint>
  212. </Association>
  213. <Association Name="FK_MaterialSupplier_Material">
  214. <End Role="Material" Type="Self.Material" Multiplicity="1" />
  215. <End Role="MaterialSupplier" Type="Self.MaterialSupplier" Multiplicity="*" />
  216. <ReferentialConstraint>
  217. <Principal Role="Material">
  218. <PropertyRef Name="ID" />
  219. </Principal>
  220. <Dependent Role="MaterialSupplier">
  221. <PropertyRef Name="MaterialID" />
  222. </Dependent>
  223. </ReferentialConstraint>
  224. </Association>
  225. <Association Name="FK_MaterialSupplier_Supplier">
  226. <End Role="Supplier" Type="Self.Supplier" Multiplicity="1" />
  227. <End Role="MaterialSupplier" Type="Self.MaterialSupplier" Multiplicity="*" />
  228. <ReferentialConstraint>
  229. <Principal Role="Supplier">
  230. <PropertyRef Name="ID" />
  231. </Principal>
  232. <Dependent Role="MaterialSupplier">
  233. <PropertyRef Name="SupplierID" />
  234. </Dependent>
  235. </ReferentialConstraint>
  236. </Association>
  237. <Association Name="FK_Product_ProductType">
  238. <End Role="ProductType" Type="Self.ProductType" Multiplicity="0..1" />
  239. <End Role="Product" Type="Self.Product" Multiplicity="*" />
  240. <ReferentialConstraint>
  241. <Principal Role="ProductType">
  242. <PropertyRef Name="ID" />
  243. </Principal>
  244. <Dependent Role="Product">
  245. <PropertyRef Name="ProductTypeID" />
  246. </Dependent>
  247. </ReferentialConstraint>
  248. </Association>
  249. <Association Name="FK_ProductCostHistory_Product">
  250. <End Role="Product" Type="Self.Product" Multiplicity="1" />
  251. <End Role="ProductCostHistory" Type="Self.ProductCostHistory" Multiplicity="*" />
  252. <ReferentialConstraint>
  253. <Principal Role="Product">
  254. <PropertyRef Name="ID" />
  255. </Principal>
  256. <Dependent Role="ProductCostHistory">
  257. <PropertyRef Name="ProductID" />
  258. </Dependent>
  259. </ReferentialConstraint>
  260. </Association>
  261. <Association Name="FK_ProductMaterial_Material">
  262. <End Role="Material" Type="Self.Material" Multiplicity="1" />
  263. <End Role="ProductMaterial" Type="Self.ProductMaterial" Multiplicity="*" />
  264. <ReferentialConstraint>
  265. <Principal Role="Material">
  266. <PropertyRef Name="ID" />
  267. </Principal>
  268. <Dependent Role="ProductMaterial">
  269. <PropertyRef Name="MaterialID" />
  270. </Dependent>
  271. </ReferentialConstraint>
  272. </Association>
  273. <Association Name="FK_ProductMaterial_Product">
  274. <End Role="Product" Type="Self.Product" Multiplicity="1" />
  275. <End Role="ProductMaterial" Type="Self.ProductMaterial" Multiplicity="*" />
  276. <ReferentialConstraint>
  277. <Principal Role="Product">
  278. <PropertyRef Name="ID" />
  279. </Principal>
  280. <Dependent Role="ProductMaterial">
  281. <PropertyRef Name="ProductID" />
  282. </Dependent>
  283. </ReferentialConstraint>
  284. </Association>
  285. <Association Name="FK_ProductSale_Agent">
  286. <End Role="Agent" Type="Self.Agent" Multiplicity="1" />
  287. <End Role="ProductSale" Type="Self.ProductSale" Multiplicity="*" />
  288. <ReferentialConstraint>
  289. <Principal Role="Agent">
  290. <PropertyRef Name="ID" />
  291. </Principal>
  292. <Dependent Role="ProductSale">
  293. <PropertyRef Name="AgentID" />
  294. </Dependent>
  295. </ReferentialConstraint>
  296. </Association>
  297. <Association Name="FK_ProductSale_Product">
  298. <End Role="Product" Type="Self.Product" Multiplicity="1" />
  299. <End Role="ProductSale" Type="Self.ProductSale" Multiplicity="*" />
  300. <ReferentialConstraint>
  301. <Principal Role="Product">
  302. <PropertyRef Name="ID" />
  303. </Principal>
  304. <Dependent Role="ProductSale">
  305. <PropertyRef Name="ProductID" />
  306. </Dependent>
  307. </ReferentialConstraint>
  308. </Association>
  309. <Association Name="FK_Shop_Agent">
  310. <End Role="Agent" Type="Self.Agent" Multiplicity="1" />
  311. <End Role="Shop" Type="Self.Shop" Multiplicity="*" />
  312. <ReferentialConstraint>
  313. <Principal Role="Agent">
  314. <PropertyRef Name="ID" />
  315. </Principal>
  316. <Dependent Role="Shop">
  317. <PropertyRef Name="AgentID" />
  318. </Dependent>
  319. </ReferentialConstraint>
  320. </Association>
  321. <Association Name="FK_User_Role">
  322. <End Role="Role" Type="Self.Role" Multiplicity="1">
  323. <OnDelete Action="Cascade" />
  324. </End>
  325. <End Role="User" Type="Self.User" Multiplicity="*" />
  326. <ReferentialConstraint>
  327. <Principal Role="Role">
  328. <PropertyRef Name="Role_ID" />
  329. </Principal>
  330. <Dependent Role="User">
  331. <PropertyRef Name="Role_id" />
  332. </Dependent>
  333. </ReferentialConstraint>
  334. </Association>
  335. <EntityContainer Name="Хранилище Goiman_A_AModelContainer">
  336. <EntitySet Name="Agent" EntityType="Self.Agent" Schema="dbo" store:Type="Tables" />
  337. <EntitySet Name="AgentPriorityHistory" EntityType="Self.AgentPriorityHistory" Schema="dbo" store:Type="Tables" />
  338. <EntitySet Name="AgentType" EntityType="Self.AgentType" Schema="dbo" store:Type="Tables" />
  339. <EntitySet Name="Material" EntityType="Self.Material" Schema="dbo" store:Type="Tables" />
  340. <EntitySet Name="MaterialCountHistory" EntityType="Self.MaterialCountHistory" Schema="dbo" store:Type="Tables" />
  341. <EntitySet Name="MaterialSupplier" EntityType="Self.MaterialSupplier" Schema="dbo" store:Type="Tables" />
  342. <EntitySet Name="MaterialType" EntityType="Self.MaterialType" Schema="dbo" store:Type="Tables" />
  343. <EntitySet Name="Product" EntityType="Self.Product" Schema="dbo" store:Type="Tables" />
  344. <EntitySet Name="ProductCostHistory" EntityType="Self.ProductCostHistory" Schema="dbo" store:Type="Tables" />
  345. <EntitySet Name="ProductMaterial" EntityType="Self.ProductMaterial" Schema="dbo" store:Type="Tables" />
  346. <EntitySet Name="ProductSale" EntityType="Self.ProductSale" Schema="dbo" store:Type="Tables" />
  347. <EntitySet Name="ProductType" EntityType="Self.ProductType" Schema="dbo" store:Type="Tables" />
  348. <EntitySet Name="Role" EntityType="Self.Role" Schema="dbo" store:Type="Tables" />
  349. <EntitySet Name="Shop" EntityType="Self.Shop" Schema="dbo" store:Type="Tables" />
  350. <EntitySet Name="Supplier" EntityType="Self.Supplier" Schema="dbo" store:Type="Tables" />
  351. <EntitySet Name="User" EntityType="Self.User" Schema="dbo" store:Type="Tables" />
  352. <AssociationSet Name="FK_Agent_AgentType" Association="Self.FK_Agent_AgentType">
  353. <End Role="AgentType" EntitySet="AgentType" />
  354. <End Role="Agent" EntitySet="Agent" />
  355. </AssociationSet>
  356. <AssociationSet Name="FK_AgentPriorityHistory_Agent" Association="Self.FK_AgentPriorityHistory_Agent">
  357. <End Role="Agent" EntitySet="Agent" />
  358. <End Role="AgentPriorityHistory" EntitySet="AgentPriorityHistory" />
  359. </AssociationSet>
  360. <AssociationSet Name="FK_Material_MaterialType" Association="Self.FK_Material_MaterialType">
  361. <End Role="MaterialType" EntitySet="MaterialType" />
  362. <End Role="Material" EntitySet="Material" />
  363. </AssociationSet>
  364. <AssociationSet Name="FK_MaterialCountHistory_Material" Association="Self.FK_MaterialCountHistory_Material">
  365. <End Role="Material" EntitySet="Material" />
  366. <End Role="MaterialCountHistory" EntitySet="MaterialCountHistory" />
  367. </AssociationSet>
  368. <AssociationSet Name="FK_MaterialSupplier_Material" Association="Self.FK_MaterialSupplier_Material">
  369. <End Role="Material" EntitySet="Material" />
  370. <End Role="MaterialSupplier" EntitySet="MaterialSupplier" />
  371. </AssociationSet>
  372. <AssociationSet Name="FK_MaterialSupplier_Supplier" Association="Self.FK_MaterialSupplier_Supplier">
  373. <End Role="Supplier" EntitySet="Supplier" />
  374. <End Role="MaterialSupplier" EntitySet="MaterialSupplier" />
  375. </AssociationSet>
  376. <AssociationSet Name="FK_Product_ProductType" Association="Self.FK_Product_ProductType">
  377. <End Role="ProductType" EntitySet="ProductType" />
  378. <End Role="Product" EntitySet="Product" />
  379. </AssociationSet>
  380. <AssociationSet Name="FK_ProductCostHistory_Product" Association="Self.FK_ProductCostHistory_Product">
  381. <End Role="Product" EntitySet="Product" />
  382. <End Role="ProductCostHistory" EntitySet="ProductCostHistory" />
  383. </AssociationSet>
  384. <AssociationSet Name="FK_ProductMaterial_Material" Association="Self.FK_ProductMaterial_Material">
  385. <End Role="Material" EntitySet="Material" />
  386. <End Role="ProductMaterial" EntitySet="ProductMaterial" />
  387. </AssociationSet>
  388. <AssociationSet Name="FK_ProductMaterial_Product" Association="Self.FK_ProductMaterial_Product">
  389. <End Role="Product" EntitySet="Product" />
  390. <End Role="ProductMaterial" EntitySet="ProductMaterial" />
  391. </AssociationSet>
  392. <AssociationSet Name="FK_ProductSale_Agent" Association="Self.FK_ProductSale_Agent">
  393. <End Role="Agent" EntitySet="Agent" />
  394. <End Role="ProductSale" EntitySet="ProductSale" />
  395. </AssociationSet>
  396. <AssociationSet Name="FK_ProductSale_Product" Association="Self.FK_ProductSale_Product">
  397. <End Role="Product" EntitySet="Product" />
  398. <End Role="ProductSale" EntitySet="ProductSale" />
  399. </AssociationSet>
  400. <AssociationSet Name="FK_Shop_Agent" Association="Self.FK_Shop_Agent">
  401. <End Role="Agent" EntitySet="Agent" />
  402. <End Role="Shop" EntitySet="Shop" />
  403. </AssociationSet>
  404. <AssociationSet Name="FK_User_Role" Association="Self.FK_User_Role">
  405. <End Role="Role" EntitySet="Role" />
  406. <End Role="User" EntitySet="User" />
  407. </AssociationSet>
  408. </EntityContainer>
  409. </Schema>