ModelAdapter.cs

Description du code

ModelAdapter.cs est un fichier du projet BiblioBrol.
Ce fichier est situé dans /var/www/bin/sniplets/bibliobrol/src/.

Projet BiblioBrol :

Gestion de media en CSharp.

Pour plus d'infos, vous pouvez consulter la brève analyse.

Code source ou contenu du fichier

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using be.gaudry.bibliobrol.model.dao;
  5. using be.gaudry.observer;
  6. using be.gaudry.model;
  7.  
  8. namespace be.gaudry.bibliobrol.model
  9. {
  10. /// <summary>
  11. /// Adapter for all model actions. Trade with dao.
  12. /// </summary>
  13. public class ModelAdapter : Observable
  14. {
  15. #region singleton
  16. static ModelAdapter instance = null;
  17. static readonly object padlock = new object();
  18. ModelAdapter()
  19. {
  20. notify(new Notification(Notification.VERBOSE.debug, "ModelAdapter singleton call", this));
  21. }
  22. public static ModelAdapter Instance
  23. {
  24. get
  25. {
  26. lock (padlock)
  27. {
  28. if (instance == null)
  29. {
  30. instance = new ModelAdapter();
  31. }
  32. return instance;
  33. }
  34. }
  35. }
  36. #endregion
  37.  
  38. #region static observer
  39. private static void setModified(String msg)
  40. {
  41. ModelAdapter.Instance.notify(new Notification(
  42. Notification.VERBOSE.modified,
  43. msg,
  44. ModelAdapter.Instance
  45. ));
  46. }
  47. #endregion
  48.  
  49. #region persistance
  50. /// <summary>
  51. /// Test if the application may use the system to store data
  52. /// </summary>
  53. /// <exception cref="PersistanceNotFoundException">If the persistance is not found or may not be used</exception>
  54. public static void isAvailablePersistance()
  55. {
  56. DAOFactory.Instance.getConfigDao().testPersistance();
  57. }
  58. #endregion
  59.  
  60. #region tasks
  61. /// <summary>
  62. /// Get the tasks
  63. /// </summary>
  64. /// <returns>List of tasks</returns>
  65. public static List<Task> getTasks()
  66. {
  67. return DAOFactory.Instance.getTaskDao().loadTasks();
  68. }
  69.  
  70. /// <summary>
  71. /// Modify a task
  72. /// </summary>
  73. /// <param name="currentTask">task to update</param>
  74. public static void updateTask(Task currentTask)
  75. {
  76. if (DAOFactory.Instance.getTaskDao().updateTask(currentTask))
  77. {
  78. setModified("updateTask");
  79. }
  80. }
  81.  
  82. /// <summary>
  83. /// Delete a task
  84. /// </summary>
  85. /// <param name="taskId">id of the task to delete</param>
  86. public static void deleteTask(int taskId)
  87. {
  88. if (DAOFactory.Instance.getTaskDao().deleteTask(taskId))
  89. {
  90. setModified("deleteTask");
  91. }
  92. }
  93. #endregion
  94.  
  95. #region brol
  96. /// <summary>
  97. /// Unlock a brol
  98. /// </summary>
  99. /// <param name="id">(int) id of the brol to unlock</param>
  100. public static void unlockBrol(int id)
  101. {
  102. DAOFactory.Instance.getBrolDao().unlockBrol(id);
  103. }
  104. /// <summary>
  105. /// load a brol from the persistant layer
  106. /// </summary>
  107. /// <param name="id">(int) id of the brol to load</param>
  108. /// <param name="edit">(bool) true if load to modify (edit mode)</param>
  109. /// <returns>(Brol) brol</returns>
  110. public static Brol getBrol(int id, bool edit)
  111. {
  112. return DAOFactory.Instance.getBrolDao().loadBrol(id, edit);
  113. }
  114. /// <summary>
  115. /// Insert a brol (i.e. a film) into the persistant layer
  116. /// </summary>
  117. /// <param name="brol">(Brol) brol to insert</param>
  118. /// <returns>(int) new brol id</returns>
  119. public static int insertBrol(Brol brol)
  120. {
  121. int r = DAOFactory.Instance.getBrolDao().insertBrol(brol);
  122. setModified("insertBrol");
  123. return r;
  124. }
  125. /// <summary>
  126. /// Delete a brol (i.e. a film) into the persistant layer
  127. /// </summary>
  128. /// <param name="brol">(Brol) brol to insert</param>
  129. /// <returns>(bool) true if deleted</returns>
  130. public static bool deleteBrol(Brol brol)
  131. {
  132. bool r = DAOFactory.Instance.getBrolDao().deleteBrol(brol);
  133. setModified("deleteBrol");
  134. return r;
  135. }
  136. /// <summary>
  137. /// Store new values for a brol.
  138. /// Verify if some categories or actors had been deleted, and delete it from the persistant layer.
  139. /// Add new categories or actors if exists.
  140. /// Update existing categories or actors.
  141. /// </summary>
  142. /// <param name="person">(Brol) brol with new values to store</param>
  143. /// <returns>(bool) true if update is done</returns>
  144. public static bool updateBrol(Brol brol)
  145. {
  146. bool r = DAOFactory.Instance.getBrolDao().updateBrol(brol);
  147. setModified("updateBrol");
  148. return r;
  149. }
  150. /// <summary>
  151. /// Get all brol types
  152. /// </summary>
  153. /// <returns>list of brol types</returns>
  154. public static List<BrolType> getBrolTypes()
  155. {
  156. return DAOFactory.Instance.getConfigDao().loadBrolTypes();
  157. }
  158.  
  159. /// <summary>
  160. /// Get categories for a brol type
  161. /// </summary>
  162. /// <param name="typeId">id of the brol type</param>
  163. /// <returns>list of categories</returns>
  164. public static List<BrolCategory> getCategories(int typeId)
  165. {
  166. return DAOFactory.Instance.getBrolDao().loadCategories(typeId);
  167. }
  168. #endregion
  169.  
  170. #region roles
  171. public static ActorRole getUserRole()
  172. {
  173. return DAOFactory.Instance.getPersonDao().getUserRole();
  174. }
  175. /// <summary>
  176. /// get all roles
  177. /// </summary>
  178. /// <returns>list of roles (ActorRole)</returns>
  179. public static List<ActorRole> getRoles()
  180. {
  181. return DAOFactory.Instance.getBrolDao().loadRoles();
  182. }
  183. /// <summary>
  184. /// get the default role for a person
  185. /// </summary>
  186. /// <param name="person"></param>
  187. /// <returns></returns>
  188. public static ActorRole getDefaultRole(Person person)
  189. {
  190. return DAOFactory.Instance.getBrolDao().loadDefaultRole(person);
  191. }
  192. /// <summary>
  193. /// set the default role for a person
  194. /// </summary>
  195. /// <param name="person"></param>
  196. /// <param name="role"></param>
  197. public static void setDefaultRole(Person person, ActorRole role)
  198. {
  199. DAOFactory.Instance.getBrolDao().setDefaultRole(person, role);
  200. }
  201. /// <summary>
  202. /// get the roles for a person
  203. /// </summary>
  204. /// <param name="person">person for witch we want the roles</param>
  205. /// <returns>list of roles (ActorRole)</returns>
  206. public static List<ActorRole> getRoles(Person person)
  207. {
  208. return DAOFactory.Instance.getBrolDao().loadRoles(person);
  209. }
  210.  
  211. /// <summary>
  212. /// get a roles with the id
  213. /// </summary>
  214. /// <param name="roleId">(int) id of the requested role</param>
  215. /// <returns>l(ActorRole) requested role</returns>
  216. public static ActorRole getRole(int roleId)
  217. {
  218. return DAOFactory.Instance.getBrolDao().loadRole(roleId);
  219. }
  220. /// <summary>
  221. /// get a roles with the name
  222. /// </summary>
  223. /// <param name="roleName">(string) name of the requested role</param>
  224. /// <returns>(ActorRole) requested role</returns>
  225. public static ActorRole loadRole(string roleName)
  226. {
  227. return DAOFactory.Instance.getBrolDao().loadRole(roleName);
  228. }
  229. /// <summary>
  230. /// get a list of roles with the same name
  231. /// </summary>
  232. /// <param name="roleName">(string) name of the requested roles</param>
  233. /// <returns>(List of ActorRole) requested roles</returns>
  234. public static List<ActorRole> loadRoles(string roleName)
  235. {
  236. return DAOFactory.Instance.getBrolDao().loadRoles(roleName);
  237. }
  238. /// <summary>
  239. /// Insert a new role. Don't check if the role name exists in the db. You must do it before.
  240. /// </summary>
  241. /// <param name="actor">(ActorRole) role to add</param>
  242. /// <returns></returns>
  243. public static bool insertRole(ActorRole role)
  244. {
  245. return DAOFactory.Instance.getBrolDao().insertRole(role);
  246. }
  247. #endregion
  248.  
  249. #region persons
  250.  
  251. #region get personsVos
  252. /// <summary>
  253. /// get a list of personsVos (value objects) for a role
  254. /// </summary>
  255. /// <param name="role">role where the persons may be</param>
  256. /// <returns>list of personsVos</returns>
  257. public static List<PersonLO> getPersonsVos(ActorRole role)
  258. {
  259. return DAOFactory.Instance.getPersonDao().loadPersonsVos(role);
  260. }
  261.  
  262. /// <summary>
  263. /// get a list of personsVos (value objects)
  264. /// </summary>
  265. /// <returns>list of personsVos</returns>
  266. public static List<PersonLO> getPersonsVos()
  267. {
  268. return DAOFactory.Instance.getPersonDao().loadVos();
  269. }
  270. /// <summary>
  271. /// Load a person from the persistant layer all persons matches (case insensitive) with lastName
  272. /// </summary>
  273. /// <param name="lastName">(String) lastName to match</param>
  274. /// <returns>List of persons with the same lastName</returns>
  275. public static List<PersonLO> getPersonsVos(String lastName)
  276. {
  277. return DAOFactory.Instance.getPersonDao().loadPersonsVos(lastName);
  278. }
  279. #endregion
  280.  
  281. #region user
  282.  
  283. /// <summary>
  284. /// Load a person from the persistant layer with an id arg.
  285. /// If this person shoud be modified, editing bool arg is true
  286. /// to avoid concurent modifications (nobody else can save this person).
  287. /// </summary>
  288. /// <param name="id">(int) Id of the selected person</param>
  289. /// <param name="editing">(bool) Shoud be modified or not</param>
  290. /// <returns>Selected person, or a new person if _ found</returns>
  291. public static User getUser(int persId)
  292. {
  293. return DAOFactory.Instance.getPersonDao().loadUser(persId);
  294. }
  295.  
  296. /// <summary>
  297. /// Insert or update a user
  298. /// </summary>
  299. /// <param name="user">user to insert or update</param>
  300. /// <returns>(int) id of the new person (-1 if a problem occurs in case of insert)</returns>
  301. public static int saveUser(User user)
  302. {
  303. return DAOFactory.Instance.getPersonDao().saveUser(user);
  304. }
  305.  
  306. /// <summary>
  307. /// Delete a user
  308. /// </summary>
  309. /// <param name="person">user to delete</param>
  310. /// <param name="deletePerson">true if the person must also be deleted</param>
  311. public static void deleteUser(User user, bool deletePerson)
  312. {
  313. DAOFactory.Instance.getPersonDao().deleteUser(user, deletePerson);
  314. }
  315. #endregion
  316.  
  317. #region getPerson
  318.  
  319. public static List<Person> getOwners()
  320. {
  321. return new List<Person>();
  322. }
  323. /// <summary>
  324. /// Load a person from the persistant layer with an id arg.
  325. /// If this person shoud be modified, editing bool arg is true
  326. /// to avoid concurent modifications (nobody else can save this person).
  327. /// </summary>
  328. /// <param name="id">(int) Id of the selected person</param>
  329. /// <param name="editing">(bool) Shoud be modified or not</param>
  330. /// <returns>Selected person, or a new person if _ found</returns>
  331. public static Person getPerson(int persId, bool edited)
  332. {
  333. return DAOFactory.Instance.getPersonDao().loadPerson(persId, edited);
  334. }
  335. /// <summary>
  336. /// Load a person from the persistant layer all persons matches (case insensitive) with lastName
  337. /// </summary>
  338. /// <param name="lastName">(String) lastName to match</param>
  339. /// <returns>List of persons with the same lastName</returns>
  340. public static List<Person> getPersons(String lastName)
  341. {
  342. return DAOFactory.Instance.getPersonDao().loadPersons(lastName);
  343. }
  344. #endregion
  345.  
  346. #region person actions
  347. /// <summary>
  348. /// Test if a person exists with the same name and firstname
  349. /// </summary>
  350. /// <param name="person">(Person) person to test</param>
  351. /// <returns>(int) id of the person found (-1 if not found)</returns>
  352. public static int personExists(Person person)
  353. {
  354. return DAOFactory.Instance.getPersonDao().personExists(person);
  355. }
  356.  
  357. /// <summary>
  358. /// Unlock a person (locked when loaded in update mode)
  359. /// </summary>
  360. /// <param name="personId">id of the locked person</param>
  361. public static bool unlockPerson(int personId)
  362. {
  363. return DAOFactory.Instance.getPersonDao().unlockPerson(personId);
  364. }
  365.  
  366. /// <summary>
  367. /// Insert a new person
  368. /// </summary>
  369. /// <param name="person">person to insert</param>
  370. /// <returns>(int) id of the new person (-1 if a problem occurs)</returns>
  371. public static int insertPerson(Person person)
  372. {
  373. int persId = DAOFactory.Instance.getPersonDao().insertPerson(person);
  374. setModified("insertPerson");
  375. return persId;
  376. }
  377.  
  378. /// <summary>
  379. /// Insert a new person and add it in the bibliobrolusers group
  380. /// </summary>
  381. /// <param name="person">person to insert</param>
  382. /// <returns>(int) id of the new person (-1 if a problem occurs)</returns>
  383. public static int insertBibliobrolUser(Person person)
  384. {
  385. int persId = DAOFactory.Instance.getPersonDao().insertBibliobrolUser(person);
  386. setModified("insertPerson");
  387. return persId;
  388. }
  389.  
  390. /// <summary>
  391. /// Update a person
  392. /// </summary>
  393. /// <param name="person">person to update</param>
  394. public static void updatePerson(Person person)
  395. {
  396. DAOFactory.Instance.getPersonDao().updatePerson(person);
  397. setModified("updatePerson");
  398. }
  399.  
  400. /// <summary>
  401. /// Delete a person
  402. /// </summary>
  403. /// <param name="person">person to delete</param>
  404. public static void deletePerson(Person person)
  405. {
  406. DAOFactory.Instance.getPersonDao().deletePerson(person);
  407. setModified("deletePerson");
  408. }
  409.  
  410. /// <summary>
  411. /// Load a person from the persistant layer with a lastname and a firstname.
  412. /// Search case insensitive.
  413. /// </summary>
  414. /// <param name="lastName">(string) lastname of the searched person</param>
  415. /// <param name="firstName">(string) firstname of the searched person</param>
  416. /// <returns>Persons found, or empty list</returns>
  417. public static List<Person> getPersons(string lastName, string firstName)
  418. {
  419. return DAOFactory.Instance.getPersonDao().loadPersons(lastName, firstName);
  420. }
  421. #endregion
  422.  
  423. #endregion
  424.  
  425. #region brol actions
  426. /// <summary>
  427. /// Execute batch actions (to add a lot of brols)
  428. /// </summary>
  429. /// <param name="insertMediabrol">true if we must insert a mediabrol for each brol</param>
  430. public static void executeBrolBatch(bool insertMediabrol)
  431. {
  432. DAOFactory.Instance.getBrolDao().executeBatch(insertMediabrol);
  433. }
  434. #endregion
  435.  
  436. #region MediaBrol
  437. /// <summary>
  438. /// load a datatable with selected fields of mediabrols
  439. /// </summary>
  440. /// <param name="mediabrolFields">fields of mediabrols to load</param>
  441. /// <param name="typeId">id of the brol type</param>
  442. /// <returns>datatable with mediabrols</returns>
  443. public static System.Data.DataTable loadDataTableVos(List<DAOUtils.MEDIABROL_FIELD> brolFields, int typeId)
  444. {
  445. return DAOFactory.Instance.getMediaBrolDao().loadDataTableVos(brolFields, typeId);
  446. }
  447.  
  448. /// <summary>
  449. /// load a datatable with selected fields of mediabrols
  450. /// </summary>
  451. /// <param name="mediabrolFields">fields of mediabrols to load</param>
  452. /// <param name="typeId">id of the brol type</param>
  453. /// <param name="categories">categories where may be the mediabrols</param>
  454. /// <returns>datatable with mediabrols</returns>
  455. public static System.Data.DataTable loadDataTableVos(List<DAOUtils.MEDIABROL_FIELD> brolFields, int typeId, List<BrolCategory> categories)
  456. {
  457. return DAOFactory.Instance.getMediaBrolDao().loadDataTableVos(brolFields, typeId, categories);
  458. }
  459.  
  460. /// <summary>
  461. /// load a datatable with selected fields of mediabrols
  462. /// </summary>
  463. /// <param name="mediabrolFields">fields of mediabrols to load</param>
  464. /// <param name="typeId">id of the brol type</param>
  465. /// <param name="categories">categories where may be the mediabrols</param>
  466. /// <param name="mediaId">id of the media</param>
  467. /// <returns>datatable with mediabrols</returns>
  468. public static System.Data.DataTable loadDataTableVos(List<DAOUtils.MEDIABROL_FIELD> brolFields, int typeId, List<BrolCategory> categories, int mediaId)
  469. {
  470. return DAOFactory.Instance.getMediaBrolDao().loadDataTableVos(brolFields, typeId, categories, mediaId);
  471. }
  472.  
  473. /// <summary>
  474. /// load a datatable with selected fields of mediabrols
  475. /// </summary>
  476. /// <param name="mediabrolFields">fields of mediabrols to load</param>
  477. /// <param name="typeId">id of the brol type</param>
  478. /// <param name="categories">categories where may be the mediabrols</param>
  479. /// <param name="mediaId">id of the media</param>
  480. /// <param name="title"></param>
  481. /// <returns>datatable with mediabrols</returns>
  482. public static System.Data.DataTable loadDataTableVos(List<DAOUtils.MEDIABROL_FIELD> brolFields, int typeId, List<BrolCategory> categories, int mediaId, string title)
  483. {
  484. return DAOFactory.Instance.getMediaBrolDao().loadDataTableVos(brolFields, typeId, categories, mediaId, title);
  485. }
  486.  
  487. /// <summary>
  488. /// load a mediabrol
  489. /// </summary>
  490. /// <param name="id">id of the mediabrol</param>
  491. /// <param name="editing">true if we will edit values (lock the record)</param>
  492. /// <returns>selected mediabrol</returns>
  493. public static MediaBrol loadMediaBrol(int id, bool editing)
  494. {
  495. return DAOFactory.Instance.getMediaBrolDao().loadMediaBrol(id, editing);
  496. }
  497.  
  498. /// <summary>
  499. /// Load medias for a brol type
  500. /// </summary>
  501. /// <param name="typeId">id of the brol type</param>
  502. /// <returns>list of medias</returns>
  503. public static List<Media> loadMedias(int typeId)
  504. {
  505. return DAOFactory.Instance.getMediaBrolDao().loadMedias(typeId);
  506. }
  507.  
  508. /// <summary>
  509. /// load qualities for a brol type
  510. /// </summary>
  511. /// <param name="brolType">id of the brol type</param>
  512. /// <returns>list of qualities</returns>
  513. public static List<Quality> loadQualities(BrolType brolType)
  514. {
  515. return DAOFactory.Instance.getMediaBrolDao().loadQualities(brolType);
  516. }
  517.  
  518. /// <summary>
  519. /// Delete a mediabrol
  520. /// </summary>
  521. /// <param name="mediabrol">mediabrol to delete</param>
  522. public static void deleteMediaBrol(MediaBrol mediabrol)
  523. {
  524. DAOFactory.Instance.getMediaBrolDao().deleteMediaBrol(mediabrol);
  525. setModified("deleteMediaBrol");
  526. }
  527.  
  528. /// <summary>
  529. /// Delete a mediabrol
  530. /// </summary>
  531. /// <param name="mediabrolId">id of the mediabrol</param>
  532. /// <param name="title"></param>
  533. /// <param name="deleteBrol">true if we want also delete the associated brol</param>
  534. public static void deleteMediaBrol(int mediabrolId, String title, bool deleteBrol)
  535. {
  536. DAOFactory.Instance.getMediaBrolDao().deleteMediaBrol(mediabrolId, title, deleteBrol);
  537. setModified("deleteMediaBrol");
  538. }
  539.  
  540. /// <summary>
  541. /// Update a mediabrol
  542. /// </summary>
  543. /// <param name="mediabrol">mediabrol to update</param>
  544. public static void updateMediaBrol(MediaBrol mediabrol)
  545. {
  546. DAOFactory.Instance.getMediaBrolDao().updateMediaBrol(mediabrol);
  547. setModified("updateMediaBrol");
  548. }
  549.  
  550. /// <summary>
  551. /// Insert a mediabrol
  552. /// </summary>
  553. /// <param name="mediabrol">mediabrol to insert</param>
  554. /// <returns>id of the new mediabrol</returns>
  555. public static int insertMediaBrol(MediaBrol mediabrol)
  556. {
  557. int r = DAOFactory.Instance.getMediaBrolDao().insertMediaBrol(mediabrol);
  558. setModified("insertMediaBrol");
  559. return r;
  560. }
  561. #endregion
  562.  
  563. #region borrows
  564. #region modify borrows
  565. /// <summary>
  566. /// Start a borrow
  567. /// </summary>
  568. /// <param name="mediabrolId">id of the borrowed mediabrol</param>
  569. /// <param name="borrowerId">id of the borrower</param>
  570. public static bool startBorrow(int mediabrolId, int borrowerId)
  571. {
  572. if (DAOFactory.Instance.getMediaBrolDao().startBorrow(mediabrolId, borrowerId))
  573. {
  574. setModified("startBorrow");
  575. return true;
  576. }
  577. return false;
  578. }
  579.  
  580. /// <summary>
  581. /// Stop a borrow (set end date)
  582. /// </summary>
  583. /// <param name="borrowId">id of the borrow</param>
  584. public static void stopBorrow(int borrowId)
  585. {
  586. DAOFactory.Instance.getMediaBrolDao().stopBorrow(borrowId);
  587. setModified("stopBorrow");
  588. }
  589.  
  590. /// <summary>
  591. /// Update borrow, set endDate to now
  592. /// </summary>
  593. /// <param name="mediabrol">(MediaBrol) borrowed mediabrol</param>
  594. /// <returns>(bool) true if stopped</returns>
  595. public static void stopBorrow(MediaBrol mediabrol)
  596. {
  597. DAOFactory.Instance.getMediaBrolDao().stopBorrow(mediabrol);
  598. setModified("stopBorrow");
  599. }
  600.  
  601. /// <summary>
  602. /// update a borrow
  603. /// </summary>
  604. /// <param name="borrow">borrow to update</param>
  605. public static void updateBorrow(Borrow borrow)
  606. {
  607. DAOFactory.Instance.getMediaBrolDao().updateBorrow(borrow);
  608. setModified("updateBorrow");
  609. }
  610.  
  611. /// <summary>
  612. /// Delete all borrows for a mediabrol
  613. /// </summary>
  614. /// <param name="mediabrolId">id of the mediabrol</param>
  615. /// <param name="forceDelete">set true to force to delete if the borrow is not closed</param>
  616. public static void cleanBorrows(int mediabrolId, bool forceDelete)
  617. {
  618. DAOFactory.Instance.getMediaBrolDao().cleanBorrows(mediabrolId, forceDelete);
  619. setModified("cleanBorrows");
  620. }
  621.  
  622. /// <summary>
  623. /// Delete a borrow
  624. /// </summary>
  625. /// <param name="selectedBorrowId">id of the borrow to delete</param>
  626. public static void cleanBorrow(int selectedBorrowId)
  627. {
  628. DAOFactory.Instance.getMediaBrolDao().cleanBorrow(selectedBorrowId);
  629. setModified("cleanBorrow");
  630. }
  631. #endregion
  632.  
  633. #region load borrows
  634. /// <summary>
  635. /// Load borrows for a mediabrol
  636. /// </summary>
  637. /// <param name="mediabrolId">id of the mediabrol</param>
  638. /// <param name="borrowFields">fields to load</param>
  639. /// <returns>datatable with borrows</returns>
  640. public static System.Data.DataTable loadBorrows(int mediabrolId, List<DAOUtils.BORROW_FIELD> borrowFields)
  641. {
  642. return ModelAdapter.loadBorrows(mediabrolId, borrowFields, 0);
  643. }
  644.  
  645. /// <summary>
  646. /// Load borrows for a mediabrol
  647. /// </summary>
  648. /// <param name="mediabrolId">id of the mediabrol</param>
  649. /// <param name="borrowFields">fields to load</param>
  650. /// <param name="typeId"></param>
  651. /// <returns>datatable with borrows</returns>
  652. public static System.Data.DataTable loadBorrows(int mediabrolId, List<DAOUtils.BORROW_FIELD> borrowFields, int typeId)
  653. {
  654. return ModelAdapter.loadBorrows(mediabrolId, borrowFields, typeId, true);
  655. }
  656.  
  657. /// <summary>
  658. /// Load borrows for a mediabrol
  659. /// </summary>
  660. /// <param name="mediabrolId">id of the mediabrol</param>
  661. /// <param name="borrowFields">fields to load</param>
  662. /// <param name="typeId"></param>
  663. /// <param name="closed"></param>
  664. /// <returns>datatable with borrows</returns>
  665. public static System.Data.DataTable loadBorrows(int mediabrolId, List<DAOUtils.BORROW_FIELD> borrowFields, int typeId, bool closed)
  666. {
  667. return ModelAdapter.loadBorrows(mediabrolId, borrowFields, typeId, closed, "");
  668. }
  669.  
  670. /// <summary>
  671. /// Load borrows for a mediabrol
  672. /// </summary>
  673. /// <param name="mediabrolId">id of the mediabrol</param>
  674. /// <param name="borrowFields">fields to load</param>
  675. /// <param name="typeId"></param>
  676. /// <param name="closed"></param>
  677. /// <param name="title"></param>
  678. /// <returns>datatable with borrows</returns>
  679. public static System.Data.DataTable loadBorrows(int mediabrolId, List<DAOUtils.BORROW_FIELD> borrowFields, int typeId, bool closed, string title)
  680. {
  681. return DAOFactory.Instance.getMediaBrolDao().loadBorrows(mediabrolId, borrowFields, typeId, closed, title);
  682. }
  683.  
  684. /// <summary>
  685. /// Load a borrow
  686. /// </summary>
  687. /// <param name="borrowId">id of the borrow</param>
  688. /// <returns>selected borrow</returns>
  689. public static Borrow loadBorrow(int borrowId)
  690. {
  691. return DAOFactory.Instance.getMediaBrolDao().loadBorrow(borrowId);
  692. }
  693. #endregion
  694. #endregion
  695.  
  696. #region import export
  697. /// <summary>
  698. /// Export mediabrols into an xml file
  699. /// </summary>
  700. /// <param name="mediabrolIds">ids of the mediabrols to export</param>
  701. /// <param name="path">Exportation file path</param>
  702. public static void exportXMLMediaBrol(int[] mediabrolIds, String path)
  703. {
  704. DAOFactory.Instance.getExporterDao().exportXMLMediaBrol(mediabrolIds, path);
  705. }
  706.  
  707. /// <summary>
  708. /// Export mediabrols into a serialized file
  709. /// </summary>
  710. /// <param name="mediabrolIds">ids of the mediabrols to export</param>
  711. /// <param name="path">Exportation file path</param>
  712. /// <param name="exportMediabrol"></param>
  713. /// <param name="exportAllBrols"></param>
  714. /// <param name="anonymous"></param>
  715. public static void exportBinaryMediaBrol(int[] mediabrolIds, String path, bool exportMediabrol, bool exportAllBrols, bool anonymous)
  716. {
  717. DAOFactory.Instance.getExporterDao().exportBinaryMediaBrol(mediabrolIds, path, exportMediabrol, exportAllBrols, anonymous);
  718. }
  719.  
  720. /// <summary>
  721. /// Export mediabrols into a serialized file
  722. /// </summary>
  723. /// <param name="mediabrolIds">ids of the mediabrols to export</param>
  724. /// <param name="path">Exportation file path</param>
  725. /// <param name="exportMediabrol"></param>
  726. /// <param name="exportAllBrols"></param>
  727. /// <param name="anonymous"></param>
  728. public static void exportBinaryMediaBrolTest(int[] mediabrolIds, String path, bool exportMediabrol, bool exportAllBrols, bool anonymous)
  729. {
  730. DAOFactory.Instance.getExporterDao().exportBinaryMediaBrolTest(mediabrolIds, path, exportMediabrol, exportAllBrols, anonymous);
  731. }
  732.  
  733. /// <summary>
  734. /// Add an observer into the exporter (observable) observers list
  735. /// </summary>
  736. /// <param name="observer">observer to add</param>
  737. public static void addImportExporterObserver(IObserver observer)
  738. {
  739. DAOFactory.Instance.getExporterDao().addObserver(observer);
  740. DAOFactory.Instance.getImporterDao().addObserver(observer);
  741. }
  742.  
  743. /// <summary>
  744. /// Remove an observer from the exporter (observable) observers list
  745. /// </summary>
  746. /// <param name="observer">observer to remove</param>
  747. public static void removeImportExporterObserver(IObserver observer)
  748. {
  749. DAOFactory.Instance.getExporterDao().removeObserver(observer);
  750. DAOFactory.Instance.getImporterDao().removeObserver(observer);
  751. }
  752.  
  753. /// <summary>
  754. /// Import mediabrols objects from a serialized file
  755. /// </summary>
  756. /// <param name="path">path of the importation file</param>
  757. public static void importBinaryMediaBrol(String path)
  758. {
  759. DAOFactory.Instance.getImporterDao().importBinaryMediaBrol(path);
  760. setModified("importBinaryMediaBrol");
  761. }
  762.  
  763. /// <summary>
  764. /// Get a list of images from a serialized file
  765. /// </summary>
  766. /// <param name="path">path of the importation file</param>
  767. /// <returns>List of images</returns>
  768. public static List<System.Drawing.Image> importImages(string path)
  769. {
  770. return DAOFactory.Instance.getImporterDao().importImages(path);
  771. }
  772.  
  773. /// <summary>
  774. /// Export mediabrols in an Excel Sheet, or in CSV file
  775. /// </summary>
  776. /// <param name="mediabrolIds">ids of the mediabrols to export</param>
  777. /// <param name="path">path of the exportation file</param>
  778. /// <param name="type">Type of the exportation (csv or sheet)</param>
  779. public static void exportExcelMediaBrol(int[] mediabrolIds, String path, int type)
  780. {
  781. DAOFactory.Instance.getExporterDao().exportExcelMediaBrol(mediabrolIds, path, type);
  782. }
  783. #endregion
  784.  
  785. #region stats
  786. /// <summary>
  787. /// Get counters
  788. /// </summary>
  789. /// <returns>Counter object</returns>
  790. public static Counter getCounters()
  791. {
  792. return DAOFactory.Instance.getStatsDao().loadCounters();
  793. }
  794.  
  795. /// <summary>
  796. /// Get stats for actor roles
  797. /// </summary>
  798. /// <returns>Stat object</returns>
  799. public static Stat getStatsActorRoles()
  800. {
  801. return DAOFactory.Instance.getStatsDao().loadActorRoles();
  802. }
  803.  
  804. /// <summary>
  805. /// Get stats for current borrows
  806. /// </summary>
  807. /// <returns>Stat object</returns>
  808. public static Stat getStatsCurrentBorrows()
  809. {
  810. return DAOFactory.Instance.getStatsDao().loadCurrentBorrows();
  811. }
  812.  
  813. /// <summary>
  814. /// Get stats for all borrows
  815. /// </summary>
  816. /// <returns>Stat object</returns>
  817. public static Stat getStatsAllBorrows()
  818. {
  819. return DAOFactory.Instance.getStatsDao().loadAllBorrows();
  820. }
  821.  
  822. /// <summary>
  823. /// Get stats for brols by types
  824. /// </summary>
  825. /// <returns>Stat object</returns>
  826. public static Stat getStatsBrolTypes()
  827. {
  828. return DAOFactory.Instance.getStatsDao().loadBrolTypes();
  829. }
  830.  
  831. /// <summary>
  832. /// Get stats for mediabrols by types
  833. /// </summary>
  834. /// <returns>Stat object</returns>
  835. public static Stat getStatsMediaBrolTypes()
  836. {
  837. return DAOFactory.Instance.getStatsDao().loadMediaBrolTypes();
  838. }
  839. #endregion
  840.  
  841. #region serie
  842. /// <summary>
  843. /// Get the serie
  844. /// </summary>
  845. /// <returns>List of serie</returns>
  846. public static List<Serie> getSeries()
  847. {
  848. return DAOFactory.Instance.getSerieDao().loadSeries();
  849. }
  850.  
  851. /// <summary>
  852. /// Modify a Serie
  853. /// </summary>
  854. /// <param name="currentTask">Serie to update</param>
  855. public static bool updateSerie(Serie serie)
  856. {
  857. bool test = DAOFactory.Instance.getSerieDao().updateSerie(serie);
  858. if (test)
  859. {
  860. setModified("updateSerie");
  861. }
  862. return test;
  863. }
  864.  
  865. /// <summary>
  866. /// Delete a Serie
  867. /// </summary>
  868. /// <param name="taskId">id of the Serie to delete</param>
  869. public static bool deleteSerie(int serieId)
  870. {
  871. bool test = DAOFactory.Instance.getSerieDao().deleteSerie(serieId);
  872. if (test)
  873. {
  874. setModified("deleteSerie");
  875. }
  876. return test;
  877. }
  878. #endregion
  879. }
  880. }

Structure et Fichiers du projet

Afficher/masquer...


Répertoires contenus dans /var/www/bin/sniplets/bibliobrol/src/model/ 
IcôneNomTailleModification
IcôneNomTailleModification
| _ Répertoire parent0 octets1734871120 22/12/2024 13:38:40
| _identity0 octets1541007175 31/10/2018 18:32:55
| _eid0 octets1541007175 31/10/2018 18:32:55
| _LightObjects0 octets1541007175 31/10/2018 18:32:55
| _comparators0 octets1541007174 31/10/2018 18:32:54
| _aws0 octets1541007173 31/10/2018 18:32:53
| _enums0 octets1541007175 31/10/2018 18:32:55
| _dao0 octets1541007174 31/10/2018 18:32:54
Fichiers contenus dans /var/www/bin/sniplets/bibliobrol/src/model/ 
IcôneNomTailleModificationAction
IcôneNomTailleModificationAction
Afficher le fichier .cs|.csPhone.cs4.32 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csPerson.cs5.49 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csActor.cs3.86 Ko31/10/2018 18:32:23-refusé-
Afficher le fichier .cs|.csBrolType.cs1.05 Ko31/10/2018 18:32:23-refusé-
Afficher le fichier .cs|.csGenericContainer.cs1.41 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csStatus.cs1.24 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csQuality.cs2.2 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csIBrol.cs252 octets31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csIIdentityFull.cs1.18 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csBrol.cs10.49 Ko31/10/2018 18:32:23-refusé-
Afficher le fichier .cs|.csUser.cs5.17 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csMedia.cs2.04 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csCounter.cs1.17 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csSerieItem.cs1.42 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csIIdentityLight.cs333 octets31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csBorrow.cs2.45 Ko31/10/2018 18:32:23-refusé-
Afficher le fichier .cs|.csTask.cs3.01 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csMediaBrol.cs4.97 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csBrolCategory.cs856 octets31/10/2018 18:32:23-refusé-
Afficher le fichier .cs|.csGenericStateContainer.cs777 octets31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csSerie.cs688 octets31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csModelAdapter.cs33.51 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csActorRole.cs2.72 Ko31/10/2018 18:32:23-refusé-

Utilisation de l'explorateur de code

  • Navigation :
    • Un clic sur une icône de répertoire ouvre ce répertoire pour en afficher les fichiers.
    • Lorsque le répertoire en cours ne contient pas de sous-répertoires il est possible de remonter vers le répertoire parent.
    • La structure de répertoires en treetable (tableau en forme d'arborescence) n'est plus possibledans cette version.
    • Un clic sur une icône de fichier ouvre ce fichier pour en afficher le code avec la coloration syntaxique adaptée en fonction du langage principal utilisé dans le fichier.
  • Affichage :
    • Il est possible de trier les répertoires ou les fichiers selon certains critères (nom, taille, date).
  • Actions :
    • Les actions possible sur les fichiers dépendent de vos droits d'utilisateur sur le site. Veuillez activer le mode utilisateur pour activer les actions.

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 16/10/2009, zuletzt geändert 26/10/2018
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/cs-bibliobrol-source-rf-model//ModelAdapter.cs.html

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.