Model.ssdl 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Schema Namespace="Хранилище LopushokModel" 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" Nullable="false" />
  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" Nullable="false" />
  125. </EntityType>
  126. <EntityType Name="Shop">
  127. <Key>
  128. <PropertyRef Name="ID" />
  129. </Key>
  130. <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
  131. <Property Name="Title" Type="nvarchar" MaxLength="150" Nullable="false" />
  132. <Property Name="Address" Type="nvarchar" MaxLength="300" />
  133. <Property Name="AgentID" Type="int" Nullable="false" />
  134. </EntityType>
  135. <EntityType Name="Supplier">
  136. <Key>
  137. <PropertyRef Name="ID" />
  138. </Key>
  139. <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
  140. <Property Name="Title" Type="nvarchar" MaxLength="150" Nullable="false" />
  141. <Property Name="INN" Type="varchar" MaxLength="12" Nullable="false" />
  142. <Property Name="StartDate" Type="date" Nullable="false" />
  143. <Property Name="QualityRating" Type="int" />
  144. <Property Name="SupplierType" Type="nvarchar" MaxLength="20" />
  145. </EntityType>
  146. <Association Name="FK_Agent_AgentType">
  147. <End Role="AgentType" Type="Self.AgentType" Multiplicity="1" />
  148. <End Role="Agent" Type="Self.Agent" Multiplicity="*" />
  149. <ReferentialConstraint>
  150. <Principal Role="AgentType">
  151. <PropertyRef Name="ID" />
  152. </Principal>
  153. <Dependent Role="Agent">
  154. <PropertyRef Name="AgentTypeID" />
  155. </Dependent>
  156. </ReferentialConstraint>
  157. </Association>
  158. <Association Name="FK_AgentPriorityHistory_Agent">
  159. <End Role="Agent" Type="Self.Agent" Multiplicity="1" />
  160. <End Role="AgentPriorityHistory" Type="Self.AgentPriorityHistory" Multiplicity="*" />
  161. <ReferentialConstraint>
  162. <Principal Role="Agent">
  163. <PropertyRef Name="ID" />
  164. </Principal>
  165. <Dependent Role="AgentPriorityHistory">
  166. <PropertyRef Name="AgentID" />
  167. </Dependent>
  168. </ReferentialConstraint>
  169. </Association>
  170. <Association Name="FK_Material_MaterialType">
  171. <End Role="MaterialType" Type="Self.MaterialType" Multiplicity="1" />
  172. <End Role="Material" Type="Self.Material" Multiplicity="*" />
  173. <ReferentialConstraint>
  174. <Principal Role="MaterialType">
  175. <PropertyRef Name="ID" />
  176. </Principal>
  177. <Dependent Role="Material">
  178. <PropertyRef Name="MaterialTypeID" />
  179. </Dependent>
  180. </ReferentialConstraint>
  181. </Association>
  182. <Association Name="FK_MaterialCountHistory_Material">
  183. <End Role="Material" Type="Self.Material" Multiplicity="1" />
  184. <End Role="MaterialCountHistory" Type="Self.MaterialCountHistory" Multiplicity="*" />
  185. <ReferentialConstraint>
  186. <Principal Role="Material">
  187. <PropertyRef Name="ID" />
  188. </Principal>
  189. <Dependent Role="MaterialCountHistory">
  190. <PropertyRef Name="MaterialID" />
  191. </Dependent>
  192. </ReferentialConstraint>
  193. </Association>
  194. <Association Name="FK_MaterialSupplier_Material">
  195. <End Role="Material" Type="Self.Material" Multiplicity="1" />
  196. <End Role="MaterialSupplier" Type="Self.MaterialSupplier" Multiplicity="*" />
  197. <ReferentialConstraint>
  198. <Principal Role="Material">
  199. <PropertyRef Name="ID" />
  200. </Principal>
  201. <Dependent Role="MaterialSupplier">
  202. <PropertyRef Name="MaterialID" />
  203. </Dependent>
  204. </ReferentialConstraint>
  205. </Association>
  206. <Association Name="FK_MaterialSupplier_Supplier">
  207. <End Role="Supplier" Type="Self.Supplier" Multiplicity="1" />
  208. <End Role="MaterialSupplier" Type="Self.MaterialSupplier" Multiplicity="*" />
  209. <ReferentialConstraint>
  210. <Principal Role="Supplier">
  211. <PropertyRef Name="ID" />
  212. </Principal>
  213. <Dependent Role="MaterialSupplier">
  214. <PropertyRef Name="SupplierID" />
  215. </Dependent>
  216. </ReferentialConstraint>
  217. </Association>
  218. <Association Name="FK_Product_ProductType">
  219. <End Role="ProductType" Type="Self.ProductType" Multiplicity="0..1" />
  220. <End Role="Product" Type="Self.Product" Multiplicity="*" />
  221. <ReferentialConstraint>
  222. <Principal Role="ProductType">
  223. <PropertyRef Name="ID" />
  224. </Principal>
  225. <Dependent Role="Product">
  226. <PropertyRef Name="ProductTypeID" />
  227. </Dependent>
  228. </ReferentialConstraint>
  229. </Association>
  230. <Association Name="FK_ProductCostHistory_Product">
  231. <End Role="Product" Type="Self.Product" Multiplicity="1" />
  232. <End Role="ProductCostHistory" Type="Self.ProductCostHistory" Multiplicity="*" />
  233. <ReferentialConstraint>
  234. <Principal Role="Product">
  235. <PropertyRef Name="ID" />
  236. </Principal>
  237. <Dependent Role="ProductCostHistory">
  238. <PropertyRef Name="ProductID" />
  239. </Dependent>
  240. </ReferentialConstraint>
  241. </Association>
  242. <Association Name="FK_ProductMaterial_Material">
  243. <End Role="Material" Type="Self.Material" Multiplicity="1" />
  244. <End Role="ProductMaterial" Type="Self.ProductMaterial" Multiplicity="*" />
  245. <ReferentialConstraint>
  246. <Principal Role="Material">
  247. <PropertyRef Name="ID" />
  248. </Principal>
  249. <Dependent Role="ProductMaterial">
  250. <PropertyRef Name="MaterialID" />
  251. </Dependent>
  252. </ReferentialConstraint>
  253. </Association>
  254. <Association Name="FK_ProductMaterial_Product">
  255. <End Role="Product" Type="Self.Product" Multiplicity="1" />
  256. <End Role="ProductMaterial" Type="Self.ProductMaterial" Multiplicity="*" />
  257. <ReferentialConstraint>
  258. <Principal Role="Product">
  259. <PropertyRef Name="ID" />
  260. </Principal>
  261. <Dependent Role="ProductMaterial">
  262. <PropertyRef Name="ProductID" />
  263. </Dependent>
  264. </ReferentialConstraint>
  265. </Association>
  266. <Association Name="FK_ProductSale_Agent">
  267. <End Role="Agent" Type="Self.Agent" Multiplicity="1" />
  268. <End Role="ProductSale" Type="Self.ProductSale" Multiplicity="*" />
  269. <ReferentialConstraint>
  270. <Principal Role="Agent">
  271. <PropertyRef Name="ID" />
  272. </Principal>
  273. <Dependent Role="ProductSale">
  274. <PropertyRef Name="AgentID" />
  275. </Dependent>
  276. </ReferentialConstraint>
  277. </Association>
  278. <Association Name="FK_ProductSale_Product">
  279. <End Role="Product" Type="Self.Product" Multiplicity="1" />
  280. <End Role="ProductSale" Type="Self.ProductSale" Multiplicity="*" />
  281. <ReferentialConstraint>
  282. <Principal Role="Product">
  283. <PropertyRef Name="ID" />
  284. </Principal>
  285. <Dependent Role="ProductSale">
  286. <PropertyRef Name="ProductID" />
  287. </Dependent>
  288. </ReferentialConstraint>
  289. </Association>
  290. <Association Name="FK_Shop_Agent">
  291. <End Role="Agent" Type="Self.Agent" Multiplicity="1" />
  292. <End Role="Shop" Type="Self.Shop" Multiplicity="*" />
  293. <ReferentialConstraint>
  294. <Principal Role="Agent">
  295. <PropertyRef Name="ID" />
  296. </Principal>
  297. <Dependent Role="Shop">
  298. <PropertyRef Name="AgentID" />
  299. </Dependent>
  300. </ReferentialConstraint>
  301. </Association>
  302. <EntityContainer Name="Хранилище LopushokModelContainer">
  303. <EntitySet Name="Agent" EntityType="Self.Agent" Schema="dbo" store:Type="Tables" />
  304. <EntitySet Name="AgentPriorityHistory" EntityType="Self.AgentPriorityHistory" Schema="dbo" store:Type="Tables" />
  305. <EntitySet Name="AgentType" EntityType="Self.AgentType" Schema="dbo" store:Type="Tables" />
  306. <EntitySet Name="Material" EntityType="Self.Material" Schema="dbo" store:Type="Tables" />
  307. <EntitySet Name="MaterialCountHistory" EntityType="Self.MaterialCountHistory" Schema="dbo" store:Type="Tables" />
  308. <EntitySet Name="MaterialSupplier" EntityType="Self.MaterialSupplier" Schema="dbo" store:Type="Tables" />
  309. <EntitySet Name="MaterialType" EntityType="Self.MaterialType" Schema="dbo" store:Type="Tables" />
  310. <EntitySet Name="Product" EntityType="Self.Product" Schema="dbo" store:Type="Tables" />
  311. <EntitySet Name="ProductCostHistory" EntityType="Self.ProductCostHistory" Schema="dbo" store:Type="Tables" />
  312. <EntitySet Name="ProductMaterial" EntityType="Self.ProductMaterial" Schema="dbo" store:Type="Tables" />
  313. <EntitySet Name="ProductSale" EntityType="Self.ProductSale" Schema="dbo" store:Type="Tables" />
  314. <EntitySet Name="ProductType" EntityType="Self.ProductType" Schema="dbo" store:Type="Tables" />
  315. <EntitySet Name="Shop" EntityType="Self.Shop" Schema="dbo" store:Type="Tables" />
  316. <EntitySet Name="Supplier" EntityType="Self.Supplier" Schema="dbo" store:Type="Tables" />
  317. <AssociationSet Name="FK_Agent_AgentType" Association="Self.FK_Agent_AgentType">
  318. <End Role="AgentType" EntitySet="AgentType" />
  319. <End Role="Agent" EntitySet="Agent" />
  320. </AssociationSet>
  321. <AssociationSet Name="FK_AgentPriorityHistory_Agent" Association="Self.FK_AgentPriorityHistory_Agent">
  322. <End Role="Agent" EntitySet="Agent" />
  323. <End Role="AgentPriorityHistory" EntitySet="AgentPriorityHistory" />
  324. </AssociationSet>
  325. <AssociationSet Name="FK_Material_MaterialType" Association="Self.FK_Material_MaterialType">
  326. <End Role="MaterialType" EntitySet="MaterialType" />
  327. <End Role="Material" EntitySet="Material" />
  328. </AssociationSet>
  329. <AssociationSet Name="FK_MaterialCountHistory_Material" Association="Self.FK_MaterialCountHistory_Material">
  330. <End Role="Material" EntitySet="Material" />
  331. <End Role="MaterialCountHistory" EntitySet="MaterialCountHistory" />
  332. </AssociationSet>
  333. <AssociationSet Name="FK_MaterialSupplier_Material" Association="Self.FK_MaterialSupplier_Material">
  334. <End Role="Material" EntitySet="Material" />
  335. <End Role="MaterialSupplier" EntitySet="MaterialSupplier" />
  336. </AssociationSet>
  337. <AssociationSet Name="FK_MaterialSupplier_Supplier" Association="Self.FK_MaterialSupplier_Supplier">
  338. <End Role="Supplier" EntitySet="Supplier" />
  339. <End Role="MaterialSupplier" EntitySet="MaterialSupplier" />
  340. </AssociationSet>
  341. <AssociationSet Name="FK_Product_ProductType" Association="Self.FK_Product_ProductType">
  342. <End Role="ProductType" EntitySet="ProductType" />
  343. <End Role="Product" EntitySet="Product" />
  344. </AssociationSet>
  345. <AssociationSet Name="FK_ProductCostHistory_Product" Association="Self.FK_ProductCostHistory_Product">
  346. <End Role="Product" EntitySet="Product" />
  347. <End Role="ProductCostHistory" EntitySet="ProductCostHistory" />
  348. </AssociationSet>
  349. <AssociationSet Name="FK_ProductMaterial_Material" Association="Self.FK_ProductMaterial_Material">
  350. <End Role="Material" EntitySet="Material" />
  351. <End Role="ProductMaterial" EntitySet="ProductMaterial" />
  352. </AssociationSet>
  353. <AssociationSet Name="FK_ProductMaterial_Product" Association="Self.FK_ProductMaterial_Product">
  354. <End Role="Product" EntitySet="Product" />
  355. <End Role="ProductMaterial" EntitySet="ProductMaterial" />
  356. </AssociationSet>
  357. <AssociationSet Name="FK_ProductSale_Agent" Association="Self.FK_ProductSale_Agent">
  358. <End Role="Agent" EntitySet="Agent" />
  359. <End Role="ProductSale" EntitySet="ProductSale" />
  360. </AssociationSet>
  361. <AssociationSet Name="FK_ProductSale_Product" Association="Self.FK_ProductSale_Product">
  362. <End Role="Product" EntitySet="Product" />
  363. <End Role="ProductSale" EntitySet="ProductSale" />
  364. </AssociationSet>
  365. <AssociationSet Name="FK_Shop_Agent" Association="Self.FK_Shop_Agent">
  366. <End Role="Agent" EntitySet="Agent" />
  367. <End Role="Shop" EntitySet="Shop" />
  368. </AssociationSet>
  369. </EntityContainer>
  370. </Schema>