Advertisement
Guest User

Untitled

a guest
Jan 8th, 2017
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 44.76 KB | None | 0 0
  1. using MongoDB.Bson;
  2. using PaperSoftKernelAPI.DataStructures;
  3. using PaperSoftKernelAPI.Entities.Authorization;
  4. using PaperSoftKernelAPI.Entities.Authorization.Environment;
  5. using PaperSoftKernelAPI.Entities.Classification;
  6. using PaperSoftKernelAPI.Entities.Enumerators;
  7. using PaperSoftKernelAPI.Entities.Operations.BackOffice;
  8. using PaperSoftKernelAPI.Entities.Operations.Billboards;
  9. using PaperSoftKernelAPI.Entities.Operations.EForm;
  10. using PaperSoftKernelAPI.Entities.Operations.OnDocuments;
  11. using PaperSoftKernelAPI.Entities.Operations.Search;
  12. using PaperSoftKernelAPI.Entities.Operations.Upload;
  13. using PaperSoftKernelAPI.Services.Factories;
  14. using System;
  15. using System.Collections.Generic;
  16. using System.Linq;
  17. using System.Text;
  18. using System.Threading.Tasks;
  19.  
  20. namespace QAJackieDataGenerator.Sets.Business.Web
  21. {
  22. public class SetMacasProd : AbstractSet
  23. {
  24. public SetMacasProd(JackieFactorySupport pSupportShell, string pPrefix) : base(pSupportShell, pPrefix) { }
  25.  
  26. public SetMacasProd(JackieFactorySupport pSupportShell, string pPrefix, string pName) : base(pSupportShell, pPrefix, pName) { }
  27.  
  28. #region Settings
  29.  
  30. private static string _defaultPassword = "papersoft";
  31.  
  32. public static PpsClient _ClientDefault = new PpsClient()
  33. {
  34. Code = "DEMO",
  35. Name = "DEMO",
  36. Description = "For demonstrations",
  37. EnvironmentsConfigurations = new List<PpsClientEnvironmentConfiguration>()
  38. {
  39. new PpsClientEnvironmentConfiguration() {
  40. SessionTimeOut = 30,
  41. Envirmonment = SetUtils.EnvMobile
  42. },
  43. new PpsClientEnvironmentConfiguration() {
  44. SessionTimeOut = 30,
  45. Envirmonment = SetUtils.EnvWeb
  46. }
  47. }
  48. };
  49.  
  50. private static PpsDatabase pDestinationDatabase = new PpsDatabase()
  51. {
  52. ConnectionString = "Data Source=172.16.3.13\\sql2012;Initial Catalog=PaperSoft113_MACAS;User Id=sa;Password=Zeppelin1940;",
  53. InstanceName = "PaperSoft113_DEMO",
  54. Description = "PaperSoftt 113 DEMO"
  55. };
  56.  
  57. public static PpsPapersoftAddress pDestinationAddress = new PpsPapersoftAddress()
  58. {
  59. Database = pDestinationDatabase,
  60. ClientID = 1,
  61. ProcessID = Guid.NewGuid()
  62. };
  63.  
  64.  
  65. #endregion
  66.  
  67. public static string BaseOperationsHTTPEnd = "http://localhost:59726";
  68.  
  69. public static string PortalHttpEnd = "http://10.200.177.133:7500";
  70.  
  71. public static string BaseEnd = BaseOperationsHTTPEnd + "/WebBusinessService.svc/json/";
  72.  
  73. protected override void ValidSet(string pPrefix)
  74. {
  75. WriteEndPoints("Portal's Endpoint", PortalHttpEnd);
  76. WriteEndPoints("Operations's Endpoint", BaseEnd);
  77.  
  78. SupportShell.CreateNewAboutRepository().Add(SetUtils.CreateAbout(PortalHttpEnd));
  79. var operationRep = SupportShell.CreateNewOperationRepository();
  80.  
  81. //Groups and Roles
  82. /**
  83. * M-Commerce
  84. * Risk Management
  85. * Finance
  86. * IT&Billing
  87. **/
  88.  
  89. #region Action Names
  90.  
  91. var downloadDocument = new Dictionary<PaperSoftKernelAPI.Entities.Enumerators.LanguagesIdentifiers, string>();
  92. downloadDocument.Add(LanguagesIdentifiers.enGB, "Download");
  93. downloadDocument.Add(LanguagesIdentifiers.ptPT, "Descarregar");
  94.  
  95. var attachDocument = new Dictionary<PaperSoftKernelAPI.Entities.Enumerators.LanguagesIdentifiers, string>();
  96. attachDocument.Add(LanguagesIdentifiers.enGB, "Attach");
  97. attachDocument.Add(LanguagesIdentifiers.ptPT, "Anexar");
  98.  
  99. var viewDocument = new Dictionary<PaperSoftKernelAPI.Entities.Enumerators.LanguagesIdentifiers, string>();
  100. viewDocument.Add(LanguagesIdentifiers.enGB, "View");
  101. viewDocument.Add(LanguagesIdentifiers.ptPT, "Visualizar");
  102.  
  103. var search = new Dictionary<PaperSoftKernelAPI.Entities.Enumerators.LanguagesIdentifiers, string>();
  104. search.Add(LanguagesIdentifiers.enGB, "Search");
  105. search.Add(LanguagesIdentifiers.ptPT, "Pesquisa");
  106.  
  107. var reportDocument = new Dictionary<PaperSoftKernelAPI.Entities.Enumerators.LanguagesIdentifiers, string>();
  108. reportDocument.Add(LanguagesIdentifiers.enGB, "Report");
  109. reportDocument.Add(LanguagesIdentifiers.ptPT, "Relatório");
  110.  
  111. var importerCSV = new Dictionary<PaperSoftKernelAPI.Entities.Enumerators.LanguagesIdentifiers, string>();
  112. importerCSV.Add(LanguagesIdentifiers.enGB, "Recycle Agent");
  113. importerCSV.Add(LanguagesIdentifiers.ptPT, "Reciclar Agente");
  114.  
  115. var manageUsers = new Dictionary<PaperSoftKernelAPI.Entities.Enumerators.LanguagesIdentifiers, string>();
  116. manageUsers.Add(LanguagesIdentifiers.enGB, "User Management");
  117. manageUsers.Add(LanguagesIdentifiers.ptPT, "Gestão de Utilizadores");
  118.  
  119. var manageGroups = new Dictionary<PaperSoftKernelAPI.Entities.Enumerators.LanguagesIdentifiers, string>();
  120. manageGroups.Add(LanguagesIdentifiers.enGB, "Group Management");
  121. manageGroups.Add(LanguagesIdentifiers.ptPT, "Gestão de Grupos");
  122.  
  123. var manageRoles = new Dictionary<PaperSoftKernelAPI.Entities.Enumerators.LanguagesIdentifiers, string>();
  124. manageRoles.Add(LanguagesIdentifiers.enGB, "Role Management");
  125. manageRoles.Add(LanguagesIdentifiers.ptPT, "Gestão de Funções");
  126.  
  127. var configCsv = new Dictionary<PaperSoftKernelAPI.Entities.Enumerators.LanguagesIdentifiers, string>();
  128. configCsv.Add(LanguagesIdentifiers.enGB, "Csv Importer");
  129. configCsv.Add(LanguagesIdentifiers.ptPT, "Importar Csv");
  130.  
  131. var dragAndDrop = new Dictionary<PaperSoftKernelAPI.Entities.Enumerators.LanguagesIdentifiers, string>();
  132. dragAndDrop.Add(LanguagesIdentifiers.enGB, "Upload");
  133. dragAndDrop.Add(LanguagesIdentifiers.ptPT, "Enviar");
  134.  
  135. #endregion
  136.  
  137. #region Child Actions
  138.  
  139. var attachAction = CreateAttachAction(attachDocument, new List<string>() { "application/pdf" }, new List<string>() { "10000" }, "9009");
  140.  
  141. var viewActionAudit = CreateViewAction(viewDocument, true, true, true, null, new List<PpsOperation>()
  142. {
  143. //{
  144. // //CreateDownloadAction(downloadDocument)
  145. //}
  146. });
  147.  
  148. var viewAction = CreateViewAction(viewDocument, true, true, false, null, new List<PpsOperation>()
  149. {
  150. //{
  151. // //CreateDownloadAction(downloadDocument)
  152. //}
  153. });
  154.  
  155. var reportAction = CreateReportAction(reportDocument, "Report", ";", "csv", new List<int>() { 1, 2, 3, 4, 5 });
  156.  
  157. #endregion
  158.  
  159. #region Workflows
  160.  
  161. PpsOpWorkflowBillboard workflowStateAggregator= CreateWorkflowAction(
  162. new Dictionary<LanguagesIdentifiers, string>() {
  163. { LanguagesIdentifiers.enGB, "Error Aggregator" },
  164. { LanguagesIdentifiers.ptPT, "Erro Aggregator" }
  165. }, "1000", "10000", new List<PpsOperation>() { attachAction, viewActionAudit });
  166.  
  167. PpsOpWorkflowBillboard workflowStateMoneyProvider = CreateWorkflowAction(
  168. new Dictionary<LanguagesIdentifiers, string>() {
  169. { LanguagesIdentifiers.enGB, "Error Money" },
  170. { LanguagesIdentifiers.ptPT, "Erro Money" }
  171. }, "1001", "10000", new List<PpsOperation>() { attachAction, viewActionAudit });
  172.  
  173. PpsOpWorkflowBillboard workflowStateStandalone = CreateWorkflowAction(
  174. new Dictionary<LanguagesIdentifiers, string>() {
  175. { LanguagesIdentifiers.enGB, "Error Standalone" },
  176. { LanguagesIdentifiers.ptPT, "Erro Standalone" }
  177. }, "1002", "10000", new List<PpsOperation>() { attachAction, viewActionAudit });
  178.  
  179. PpsOpWorkflowBillboard workflowStateSubAgent = CreateWorkflowAction(
  180. new Dictionary<LanguagesIdentifiers, string>() {
  181. { LanguagesIdentifiers.enGB, "Error Sub Agent" },
  182. { LanguagesIdentifiers.ptPT, "Erro Sub Agent" }
  183. }, "1003", "10000", new List<PpsOperation>() { attachAction, viewActionAudit });
  184.  
  185. PpsOpWorkflowBillboard workflowStateB2c = CreateWorkflowAction(
  186. new Dictionary<LanguagesIdentifiers, string>() {
  187. { LanguagesIdentifiers.enGB, "Error B2c" },
  188. { LanguagesIdentifiers.ptPT, "Erro B2c" }
  189. }, "1004", "10000", new List<PpsOperation>() { attachAction, viewActionAudit });
  190.  
  191. PpsOpWorkflowBillboard workflowStateC2b = CreateWorkflowAction(
  192. new Dictionary<LanguagesIdentifiers, string>() {
  193. { LanguagesIdentifiers.enGB, "Error C2b" },
  194. { LanguagesIdentifiers.ptPT, "Erro C2b" }
  195. }, "1005", "10000", new List<PpsOperation>() { attachAction, viewActionAudit });
  196.  
  197. PpsOpWorkflowBillboard workflowStateSpecialAgent = CreateWorkflowAction(
  198. new Dictionary<LanguagesIdentifiers, string>() {
  199. { LanguagesIdentifiers.enGB, "Error Special Agent" },
  200. { LanguagesIdentifiers.ptPT, "Erro Special Agent" }
  201. }, "1006", "10000", new List<PpsOperation>() { attachAction, viewActionAudit });
  202.  
  203. #endregion
  204.  
  205. #region Search Actions
  206.  
  207. #region Search
  208.  
  209. Dictionary<int, string> searchableStates = new Dictionary<int,string>();
  210. searchableStates.Add(9001, "IMPORTED DOCUMENT");
  211. searchableStates.Add(10000, "INCOMPLETE");
  212. searchableStates.Add(10001, "VALID");
  213. searchableStates.Add(10002, "RECYCLED");
  214.  
  215. Dictionary<short, string> searchableTemplates = new Dictionary<short, string>();
  216.  
  217. searchableTemplates.Add(1000, "AGGREGATOR");
  218. searchableTemplates.Add(1001, "MONEY PROVIDER");
  219. searchableTemplates.Add(1002,"STANDALONE");
  220. searchableTemplates.Add(1003,"SUB-AGENT");
  221. searchableTemplates.Add(1004,"B2C");
  222. searchableTemplates.Add(1005,"C2B");
  223. searchableTemplates.Add(1006,"SPECIAL AGENT");
  224.  
  225. var searchOperationReportAndAudit = CreateTableSearchAction(search, searchableStates, searchableTemplates, 20, "9", "10000", new List<PpsOperation>() { viewActionAudit, reportAction, attachAction });
  226.  
  227. //var searchOperationReport = CreateTableSearchAction(search, searchableStates, searchableTemplates, 20, "9", "9008", new List<PpsOperation>() { viewAction, reportAction });
  228.  
  229. //var searchOperation = CreateTableSearchAction(search, searchableStates, searchableTemplates, 20, "9", "9008", new List<PpsOperation>() { viewActionAudit });
  230.  
  231. var csvImporter = new PpsOpImporterCsv()
  232. {
  233. Id = ObjectId.Parse("56cadeb891169035303382eb"),
  234. Route = _routeImporterCsv,
  235. Presentation = new Dictionary<PresentationZone, PpsPresentation>() {
  236. {
  237. PresentationZone.WebSidebar,
  238. new PpsPresentation()
  239. {
  240. Zone = PresentationZone.WebSidebar,
  241. Order = 1,
  242. Appearance = PresentationAppearance.Normal,
  243. Name = importerCSV,
  244. IconCss = PpsWebIcons.Upload.GetEnumDescription()
  245. }
  246. }
  247. },
  248. KeyField = "TILL_NUMBER",
  249. ListAvailableFields = new PpsDocumentData[1] {
  250. new PpsDocumentData()
  251. {
  252. //FieldId=5,
  253. Keyword = "TILL_NUMBER",
  254. Type = (int)FieldType.Text
  255. }
  256. },
  257. StatusUpdated = 10002,
  258. AvailableTokens = new char[2] { ',', ';' },
  259. FileNamingConvention = @"^.+(\.*CSV)$",
  260. ListProcess = new Guid[7] {
  261. Guid.Parse("8D459A97-223B-41C1-9E1E-15C26BF3231B"),
  262. Guid.Parse("783A108D-FCE6-437C-B52D-7D18B5A99749"),
  263. Guid.Parse("A902328E-BE31-44E1-973F-4F31F62DAA9C"),
  264. Guid.Parse("DE27736E-0F0F-42DD-8487-C44CEFBD046B"),
  265. Guid.Parse("D02DC736-2A00-486E-8084-73F20AEA51EC"),
  266. Guid.Parse("E482713B-ECDD-42E7-BA6B-A019B4A1FBA4"),
  267. Guid.Parse("3561B1C1-8599-494A-9F83-B978C01C0DE9")
  268. },
  269. //Token = ',',
  270. //PageAmountToSend=10,
  271. Environment = new List<PpsEnvironment>() { new PpsEnvironment() {
  272. Type = PpsEnvironmentType.Web
  273. } },
  274. PapersoftAddress = pDestinationAddress
  275. };
  276.  
  277. csvImporter.EndPoint = new PpsEndPoint()
  278. {
  279. Url = BaseEnd + "/User/Operations/" + csvImporter.Id.ToString()
  280. };
  281.  
  282. PpsOpManageUsers pManUser = new PpsOpManageUsers();
  283. pManUser.FecthOperation = true;
  284. pManUser.RecordsPerPage = 10;
  285. pManUser.Environment = new List<PpsEnvironment>() { new PpsEnvironment() {
  286. Type = PpsEnvironmentType.Web
  287. } };
  288.  
  289. pManUser.Route = _routeBackOfficeUser;
  290.  
  291. pManUser.EndPoint = new PpsEndPoint()
  292. {
  293. Url = BaseEnd + "/User/Operations/" + pManUser.Id.ToString()
  294. };
  295.  
  296. pManUser.PapersoftAddress = pDestinationAddress;
  297.  
  298. pManUser.Presentation = new Dictionary<PresentationZone, PpsPresentation>() {
  299. {
  300. PresentationZone.WebSidebar,
  301. new PpsPresentation()
  302. {
  303. Zone = PresentationZone.WebSidebar,
  304. Order = 1,
  305. Appearance = PresentationAppearance.Normal,
  306. Name = manageUsers,
  307. IconCss = PpsWebIcons.User.GetEnumDescription()
  308. }
  309. }
  310. };
  311.  
  312. pManUser.CanAdd = true;
  313. pManUser.CanDelete = true;
  314. pManUser.CanEdit = true;
  315.  
  316. PpsOpManageGroups pManGroup = new PpsOpManageGroups();
  317. pManGroup.FecthOperation = true;
  318. pManGroup.Environment = new List<PpsEnvironment>() { new PpsEnvironment() {
  319. Type = PpsEnvironmentType.Web
  320. } };
  321.  
  322. pManGroup.Route = _routeBackOfficeGroup; //
  323.  
  324. pManGroup.EndPoint = new PpsEndPoint()
  325. {
  326. Url = BaseEnd + "/User/Operations/" + pManGroup.Id.ToString()
  327. };
  328.  
  329. pManGroup.PapersoftAddress = pDestinationAddress;
  330.  
  331. pManGroup.Presentation = new Dictionary<PresentationZone, PpsPresentation>() {
  332. {
  333. PresentationZone.WebSidebar,
  334. new PpsPresentation()
  335. {
  336. Zone = PresentationZone.WebSidebar,
  337. Order = 1,
  338. Appearance = PresentationAppearance.Normal,
  339. Name = manageGroups, //
  340. IconCss = PpsWebIcons.GroupManagement.GetEnumDescription()
  341. }
  342. }
  343. };
  344. pManGroup.CanEdit = true;
  345. pManGroup.CanAdd = true;
  346. pManGroup.CanDelete = true;
  347. PpsOpManageRoles pManRole = new PpsOpManageRoles();
  348. pManRole.FecthOperation = true;
  349. pManRole.Environment = new List<PpsEnvironment>() { new PpsEnvironment() {
  350. Type = PpsEnvironmentType.Web
  351. } };
  352.  
  353. pManRole.Route = _routeBackOfficeRole; //
  354.  
  355. pManRole.EndPoint = new PpsEndPoint()
  356. {
  357. Url = BaseEnd + "/User/Operations/" + pManRole.Id.ToString()
  358. };
  359.  
  360. pManRole.PapersoftAddress = pDestinationAddress;
  361. pManRole.CanEdit = true;
  362. pManRole.Presentation = new Dictionary<PresentationZone, PpsPresentation>() {
  363. {
  364. PresentationZone.WebSidebar,
  365. new PpsPresentation()
  366. {
  367. Zone = PresentationZone.WebSidebar,
  368. Order = 1,
  369. Appearance = PresentationAppearance.Normal,
  370. Name = manageRoles, //
  371. IconCss = PpsWebIcons.RoleManagement.GetEnumDescription()
  372. }
  373. }
  374. };
  375.  
  376. PpsOpManageOperation<PpsOpImporterCsv> configImporter = new PpsOpManageOperation<PpsOpImporterCsv>(csvImporter.Id);
  377.  
  378. configImporter.FecthOperation = true;
  379. configImporter.Environment = new List<PpsEnvironment>() { new PpsEnvironment() {
  380. Type = PpsEnvironmentType.Web
  381. } };
  382.  
  383. configImporter.Route = _routeBackOfficeCsvOperation; //
  384.  
  385. configImporter.EndPoint = new PpsEndPoint()
  386. {
  387. Url = BaseEnd + "/User/Operations/Backoffice/GetOperation/" + configImporter.OperationToConfigureId.ToString()
  388. };
  389.  
  390.  
  391. configImporter.PapersoftAddress = pDestinationAddress;
  392.  
  393. configImporter.Presentation = new Dictionary<PresentationZone, PpsPresentation>() {
  394. {
  395. PresentationZone.WebSidebar,
  396. new PpsPresentation()
  397. {
  398. Zone = PresentationZone.WebSidebar,
  399. Order = 1,
  400. Appearance = PresentationAppearance.Normal,
  401. Name = importerCSV, //
  402. IconCss = PpsWebIcons.Upload.GetEnumDescription()
  403. }
  404. }
  405. };
  406.  
  407.  
  408. #endregion
  409.  
  410. #endregion
  411.  
  412. var opDragAndDrop = new PpsOpDragAndDrop();
  413. //opDragAndDrop.FecthOperation = true;
  414. opDragAndDrop.Environment = new List<PpsEnvironment>() { new PpsEnvironment() {
  415. Type = PpsEnvironmentType.Web
  416. } };
  417.  
  418. opDragAndDrop.Route = _routeDragAndDrop; //
  419.  
  420. opDragAndDrop.EndPoint = new PpsEndPoint()
  421. {
  422. Url = BaseEnd + "/User/Operations/" + opDragAndDrop.Id.ToString()
  423. };
  424.  
  425. opDragAndDrop.PapersoftAddress = pDestinationAddress;
  426.  
  427. opDragAndDrop.Presentation = new Dictionary<PresentationZone, PpsPresentation>() {
  428. {
  429. PresentationZone.WebSidebar,
  430. new PpsPresentation()
  431. {
  432. Zone = PresentationZone.WebSidebar,
  433. Order = 1,
  434. Appearance = PresentationAppearance.Normal,
  435. Name = dragAndDrop, //
  436. IconCss = PpsWebIcons.Upload.GetEnumDescription()
  437. }
  438. }
  439. };
  440.  
  441. operationRep.Add(opDragAndDrop);
  442. operationRep.Add(workflowStateAggregator);
  443. operationRep.Add(workflowStateB2c);
  444. operationRep.Add(workflowStateC2b);
  445. operationRep.Add(workflowStateMoneyProvider);
  446. operationRep.Add(workflowStateSpecialAgent);
  447. operationRep.Add(workflowStateStandalone);
  448. operationRep.Add(workflowStateSubAgent);
  449.  
  450. operationRep.Add(searchOperationReportAndAudit);
  451.  
  452. //operationRep.Add(searchOperationReport);
  453.  
  454. //operationRep.Add(searchOperation);
  455.  
  456. operationRep.Add(csvImporter);
  457.  
  458. operationRep.Add(pManUser);
  459. operationRep.Add(pManGroup);
  460. operationRep.Add(pManRole);
  461.  
  462. //operationRep.Add(configImporter);
  463.  
  464. #region Roles
  465.  
  466. //PpsRole roleAccessSearch = new PpsRole() {
  467. // Id = ObjectId.Parse("56cc9cef9116904a748dcb0f"),
  468. // Description = "Role.Access1",
  469. // Name = "Access 1",
  470. // Operations = new List<PpsOperation>() {
  471. // //searchOperation.ToSerialize()
  472. // }
  473. //};
  474.  
  475. PpsRole roleWorkflowAggr = new PpsRole() {
  476. Description = "Workflow - State Aggregator",
  477. Name = "State Aggregator",
  478. Operations = new List<PpsOperation>() {
  479. workflowStateAggregator.ToSerialize(),
  480. opDragAndDrop.ToSerialize()
  481. }
  482. };
  483.  
  484. PpsRole roleWorkflowMoney = new PpsRole()
  485. {
  486. Description = "Workflow - State Money",
  487. Name = "State Money",
  488. Operations = new List<PpsOperation>() {
  489. workflowStateMoneyProvider.ToSerialize(),
  490. }
  491. };
  492. PpsRole roleWorkflowStand = new PpsRole()
  493. {
  494. Description = "Workflow - State Standalone",
  495. Name = "State Standalone",
  496. Operations = new List<PpsOperation>() {
  497. workflowStateStandalone.ToSerialize(),
  498. }
  499. };
  500. PpsRole roleWorkflowSub = new PpsRole()
  501. {
  502. Description = "Workflow - State Sub Agent",
  503. Name = "State Sub Agent",
  504. Operations = new List<PpsOperation>() {
  505. workflowStateSubAgent.ToSerialize(),
  506. }
  507. };
  508. PpsRole roleWorkflowB2c = new PpsRole()
  509. {
  510. Description = "Workflow - State B2c",
  511. Name = "State B2C",
  512. Operations = new List<PpsOperation>() {
  513. workflowStateB2c.ToSerialize(),
  514. }
  515. };
  516. PpsRole roleWorkflowC2b = new PpsRole()
  517. {
  518. Description = "Workflow - State C2b",
  519. Name = "State C2b",
  520. Operations = new List<PpsOperation>() {
  521. workflowStateC2b.ToSerialize(),
  522. }
  523. };
  524.  
  525.  
  526. PpsRole roleAccessSearch = new PpsRole()
  527. {
  528. Description = "Search",
  529. Name = "Search",
  530. Operations = new List<PpsOperation>() {
  531. searchOperationReportAndAudit.ToSerialize(),
  532.  
  533.  
  534. }
  535. };
  536.  
  537. PpsRole RoleAgentRecycle = new PpsRole()
  538. {
  539. Description = "Agent Recycle",
  540. Name = "Agent Recycle ",
  541. Operations = new List<PpsOperation>() {
  542. csvImporter.ToSerialize()
  543. }
  544. };
  545.  
  546. PpsRole roleAdmin = new PpsRole() {
  547. Id = ObjectId.Parse("56cc9cef9116904a748dcb11"),
  548. Description = "Administration Role",
  549. Name = "Admin",
  550. Operations = new List<PpsOperation>() {
  551. pManUser.ToSerialize(),
  552. pManGroup.ToSerialize(),
  553. pManRole.ToSerialize(),
  554. }
  555. };
  556.  
  557. #endregion
  558.  
  559. #region Groups
  560.  
  561. //PpsGroup groupITBilling = new PpsGroup()
  562. //{
  563. // Name = "IT Billing",
  564. // Description = "Mcas IT Billing",
  565. // Client = _ClientDefault,
  566. // Roles = new List<PpsRole>() { }
  567. //};
  568.  
  569. //PpsGroup groupMFinance = new PpsGroup()
  570. //{
  571. // Name = "Finance",
  572. // Description = "Mcas Finance",
  573. // Client = _ClientDefault,
  574. // Roles = new List<PpsRole>() { }
  575. //};
  576.  
  577. PpsGroup groupAll = new PpsGroup() {
  578. Name = "Functionalities",
  579. Description = "Basic Macas Functionalities",
  580. Roles = new List<PpsRole>() { roleAccessSearch, roleWorkflowAggr, roleWorkflowB2c, roleWorkflowC2b, roleWorkflowMoney, roleWorkflowStand, roleWorkflowSub, RoleAgentRecycle },
  581. Client = _ClientDefault
  582. };
  583.  
  584. //PpsGroup groupRiskManagement = new PpsGroup() {
  585. // Name = "Risk Management",
  586. // Description = "Risk Management",
  587. // Roles = new List<PpsRole>() { roleAccessSearch, roleAccessAggr, roleAccessB2c, roleAccessC2b, roleAccessMoney, roleAccessStand, roleAccessSub },
  588. // Client = _ClientDefault
  589. //};
  590.  
  591. PpsGroup groupGod = new PpsGroup()
  592. {
  593. Id = ObjectId.Parse("56cc9dac91169017a88d0d95"),
  594. Name = "Admin",
  595. Description = "Administration Group",
  596. Roles = new List<PpsRole>() { roleAdmin },
  597. Client = _ClientDefault
  598. };
  599.  
  600. #endregion
  601.  
  602. SetUtils.CreateNewUserCascade(ObjectId.GenerateNewId(), "camille", "camille", SetUtils.defaultFemaleUserPicture, "antonio.silva@papersoft.pt", SetUtils.LangEnGB, _defaultPassword, true,false, "QA","", SetUtils.EmptyBlacklisted, new List<PpsGroup> { groupAll });
  603.  
  604. SetUtils.CreateNewUserCascade(ObjectId.GenerateNewId(), "admin", "admin", SetUtils.defaultFemaleUserPicture, "eurico.batista@papersoft-dms.com", SetUtils.LangEnGB, "admin", true, false, "QA", "", SetUtils.EmptyBlacklisted, new List<PpsGroup> { groupGod });
  605.  
  606. //SetUtils.CreateNewUserCascade(ObjectId.GenerateNewId(), "bruno", "bruno", SetUtils.defaultFemaleUserPicture, "bruno.roda@papersoft.pt", SetUtils.LangEnGB, "bruno", true, false, "QA", "", SetUtils.EmptyBlacklisted, new List<PpsGroup> { groupGod });
  607.  
  608. SetUtils.CreateNewUserCascade(ObjectId.GenerateNewId(), "Epembi", "Epembi", SetUtils.defaultFemaleUserPicture, "elie.pembi@vodacom.cd", SetUtils.LangEnGB, _defaultPassword, true, false, "QA", "", SetUtils.EmptyBlacklisted, new List<PpsGroup> { groupAll });
  609. SetUtils.CreateNewUserCascade(ObjectId.GenerateNewId(), "JMazenzo", "JMazenzo", SetUtils.defaultFemaleUserPicture, "JeandeDieu.Mazenzo@vodacom.cd", SetUtils.LangEnGB, _defaultPassword, true, false, "QA", "", SetUtils.EmptyBlacklisted, new List<PpsGroup> { groupAll });
  610. SetUtils.CreateNewUserCascade(ObjectId.GenerateNewId(), "Sfwasa", "Sfwasa", SetUtils.defaultFemaleUserPicture, "Steve.Fwasa@vodacom.cd", SetUtils.LangEnGB, _defaultPassword, true, false, "QA", "", SetUtils.EmptyBlacklisted, new List<PpsGroup> { groupAll });
  611. SetUtils.CreateNewUserCascade(ObjectId.GenerateNewId(), "FKazadi1", "FKazadi1", SetUtils.defaultFemaleUserPicture, "francis.KazadiMinga@vodacom.cd", SetUtils.LangEnGB, _defaultPassword, true, false, "QA", "", SetUtils.EmptyBlacklisted, new List<PpsGroup> { groupAll });
  612. SetUtils.CreateNewUserCascade(ObjectId.GenerateNewId(), "Rbakonda", "Rbakonda", SetUtils.defaultFemaleUserPicture, "Roger.Bakonda@vodacom.cd", SetUtils.LangEnGB, _defaultPassword, true, false, "QA", "", SetUtils.EmptyBlacklisted, new List<PpsGroup> { groupAll });
  613. SetUtils.CreateNewUserCascade(ObjectId.GenerateNewId(), "Jmabiala", "Jmabiala", SetUtils.defaultFemaleUserPicture, "Junior.Mabiala@vodacom.cd", SetUtils.LangEnGB, _defaultPassword, true, false, "QA", "", SetUtils.EmptyBlacklisted, new List<PpsGroup> { groupAll });
  614.  
  615. for(int i = 0; i < 100; i++) {
  616. SetUtils.CreateNewUserCascade(ObjectId.GenerateNewId(), "user" + i, "user" + i, SetUtils.defaultFemaleUserPicture, "user"+i+"@papersoft.com", SetUtils.LangEnGB, _defaultPassword, true, false, "QA", "", SetUtils.EmptyBlacklisted, new List<PpsGroup> { groupAll });
  617. }
  618.  
  619. WriteToConsole(string.Format("Total Users created: {0}", SupportShell.CreateNewUserRepository().Count()));
  620. WriteToConsole(string.Format("Total Groups created: {0}", SupportShell.CreateNewGroupRepository().Count()));
  621. WriteToConsole(string.Format("Total Operartions created: {0}", operationRep.Count()));
  622.  
  623. GenerateSetReport();
  624. }
  625.  
  626. private PpsOpWorkflowBillboard CreateWorkflowAction(Dictionary<LanguagesIdentifiers, string> pPresentationNames, string pFindByTemplateID, string pFindByState, List<PpsOperation> pChilds)
  627. {
  628. PpsOpWorkflowBillboard workflowBillboard = new PpsOpWorkflowBillboard();
  629. workflowBillboard.EndPoint = new PpsEndPoint()
  630. {
  631. Url = BaseEnd + "/User/Operations/" + workflowBillboard.Id.ToString()
  632. };
  633. workflowBillboard.PapersoftAddress = pDestinationAddress;
  634. workflowBillboard.Environment = new List<PpsEnvironment>()
  635. {
  636. new PpsEnvironment() {
  637. Type = PpsEnvironmentType.Web
  638. }
  639. };
  640.  
  641. workflowBillboard.Name = pPresentationNames;
  642. workflowBillboard.FecthOperation = true;
  643. workflowBillboard.Presentation.Add(PresentationZone.WebMain, new PpsPresentation()
  644. {
  645. Name = pPresentationNames,
  646. Appearance = PaperSoftKernelAPI.Entities.Enumerators.PresentationAppearance.Normal,
  647. Order = 0,
  648. IconCss = PpsWebIcons.System.GetEnumDescription(),
  649. Zone = PaperSoftKernelAPI.Entities.Enumerators.PresentationZone.WebMain,
  650. ValidateOnDisplay = false
  651. });
  652.  
  653. workflowBillboard.Route = _routeBillboard;
  654.  
  655. workflowBillboard.Retrieval = new PpsDocumentInference();
  656.  
  657. PpsDocumentInferenceData inferenceByTemplate = new PpsDocumentInferenceData();
  658. inferenceByTemplate.Type = DocumentInferenceDataOperation.Equal;
  659. inferenceByTemplate.Value = new List<string>() { pFindByTemplateID };
  660. inferenceByTemplate.FieldId = (int)SearchableDocumentMetadata.TemplateId;
  661.  
  662. var bstRetriveDocState = new BinaryTree<PpsDocumentInferenceNode>();
  663.  
  664. PpsDocumentInferenceFunction rootDocState = new PpsDocumentInferenceFunction();
  665. rootDocState.Type = DocumentInferenceOperation.And;
  666.  
  667. PpsDocumentInferenceData docState = new PpsDocumentInferenceData();
  668. docState.Type = DocumentInferenceDataOperation.Equal;
  669. docState.Value = new List<string>() { pFindByState };
  670. docState.FieldId = (int)SearchableDocumentMetadata.RdocStatus;
  671.  
  672. bstRetriveDocState.Root = new BinaryTreeNode<PpsDocumentInferenceNode>()
  673. {
  674. Value = rootDocState,
  675. Left = new BinaryTreeNode<PpsDocumentInferenceNode>()
  676. {
  677. Value = docState
  678. },
  679. Right = new BinaryTreeNode<PpsDocumentInferenceNode>()
  680. {
  681. Value = inferenceByTemplate
  682. }
  683. };
  684.  
  685. workflowBillboard.Retrieval.MetadataInclusion = bstRetriveDocState;
  686.  
  687. workflowBillboard.Childs = pChilds;
  688.  
  689. return workflowBillboard;
  690. }
  691.  
  692. /// <summary>
  693. /// to don't group set pGroupByBatchField to 'na'
  694. /// </summary>
  695. /// <param name="pPresentationNames"></param>
  696. /// <param name="pSearchableStates"></param>
  697. /// <param name="pSearchableTemplates"></param>
  698. /// <param name="pRecordsPerPage"></param>
  699. /// <param name="pGroupByBatchField"></param>
  700. /// <param name="pChilds"></param>
  701. /// <returns></returns>
  702. private PpsOpTableSearch CreateTableSearchAction(
  703. Dictionary<LanguagesIdentifiers, string> pPresentationNames, Dictionary<int, string> pSearchableStates, Dictionary<short, string> pSearchableTemplates,
  704. int pRecordsPerPage, string pGroupByBatchField, string pStateToExcludeGrouping, List<PpsOperation> pChilds)
  705. {
  706. var searchOperation = PpsOpTableSearch.InitSearchList();
  707.  
  708. searchOperation.Name = pPresentationNames;
  709. searchOperation.Route = _routeSearch;
  710.  
  711. Dictionary<int, string> searchableStates = pSearchableStates;
  712. Dictionary<short, string> searchableTemplates = pSearchableTemplates;
  713.  
  714. searchOperation.SearchableStates = searchableStates;
  715. searchOperation.SearchableTemplates = searchableTemplates;
  716.  
  717. searchOperation.TablePresentation.RecordsPerPage = pRecordsPerPage;
  718. if (pGroupByBatchField != "na")
  719. {
  720. searchOperation.GroupBy = new List<string>() { GroupByClauses.ByBatch.GetEnumDescription() + "-" + pGroupByBatchField };
  721.  
  722. searchOperation.BatchGroupExclusion = new BinaryTree<PpsDocumentInferenceNode>()
  723. {
  724. Root = new BinaryTreeNode<PpsDocumentInferenceNode>()
  725. {
  726. Value = new PpsDocumentInferenceFunction()
  727. {
  728. Type = DocumentInferenceOperation.And
  729. },
  730. Left = new BinaryTreeNode<PpsDocumentInferenceNode>()
  731. {
  732. Value = new PpsDocumentInferenceData()
  733. {
  734. Type = DocumentInferenceDataOperation.Equal,
  735. Value = new List<string>() { pStateToExcludeGrouping },
  736. FieldId = (int)SearchableDocumentMetadata.RdocStatus
  737. }
  738. }
  739. }
  740. };
  741. }
  742.  
  743. searchOperation.Environment = new List<PpsEnvironment>() { new PpsEnvironment() {
  744. Type = PpsEnvironmentType.Web
  745. } };
  746.  
  747. searchOperation.EndPoint = new PpsEndPoint()
  748. {
  749. Url = BaseEnd + "/User/Operations/" + searchOperation.Id.ToString()
  750. };
  751.  
  752. searchOperation.PapersoftAddress = pDestinationAddress;
  753.  
  754. searchOperation.Presentation = new Dictionary<PresentationZone, PpsPresentation>() {
  755. {
  756. PresentationZone.WebSidebar,
  757. new PpsPresentation()
  758. {
  759. Zone = PresentationZone.WebSidebar,
  760. Order = 1,
  761. Appearance = PresentationAppearance.Normal,
  762. Name = pPresentationNames,
  763. IconCss = PpsWebIcons.Search.GetEnumDescription()
  764. }
  765. }
  766. //{
  767. // PresentationZone.WebFirstBarRigth,
  768. // new PpsPresentation()
  769. // {
  770. // Zone = PresentationZone.WebFirstBarRigth,
  771. // Order = 1,
  772. // Appearance = PresentationAppearance.Normal,
  773. // Name = pPresentationNames,
  774. // IconCss = PpsWebIcons.Search.GetEnumDescription()
  775. // }
  776. //}
  777. };
  778.  
  779. searchOperation.Childs = pChilds;
  780.  
  781. return searchOperation;
  782. }
  783.  
  784. private PpsOpViewDocument CreateViewAction(Dictionary<LanguagesIdentifiers, string> pPresentationNames, bool pShowBlob, bool pShowMetadata, bool pShowAuditTrail, List<string> pAcceptedStates, List<PpsOperation> pChilds)
  785. {
  786. var viewAction = new PpsOpViewDocument()
  787. {
  788. Name = pPresentationNames,
  789. Presentation = new Dictionary<PresentationZone, PpsPresentation>() {
  790. { PresentationZone.WebRowLineAction, new PpsPresentation()
  791. {
  792. Name = pPresentationNames,
  793. Appearance = PresentationAppearance.Normal,
  794. Order = 0,
  795. IconCss = "view",
  796. Zone = PresentationZone.WebRowLineAction,
  797. ValidateOnDisplay = false
  798. }
  799. }
  800. },
  801. EndPoint = new PpsEndPoint()
  802. {
  803. Url = BaseEnd
  804. },
  805. PapersoftAddress = pDestinationAddress,
  806. Route = _routeView,
  807. Childs = pChilds,
  808. ShowAuditTrail = pShowAuditTrail,
  809. ShowImage = pShowBlob,
  810. ShowMetadata = pShowMetadata
  811. };
  812.  
  813. if (pAcceptedStates != null && pAcceptedStates.Any())
  814. {
  815. viewAction.Validation = new PpsDocumentInference()
  816. {
  817. MetadataInclusion = new BinaryTree<PpsDocumentInferenceNode>()
  818. {
  819. Root = new BinaryTreeNode<PpsDocumentInferenceNode>()
  820. {
  821. Value = new PpsDocumentInferenceFunction()
  822. {
  823. Type = DocumentInferenceOperation.And
  824. },
  825. Left = new BinaryTreeNode<PpsDocumentInferenceNode>()
  826. {
  827. Value = new PpsDocumentInferenceData()
  828. {
  829. Type = DocumentInferenceDataOperation.In,
  830. Value = pAcceptedStates,
  831. FieldId = (int)SearchableDocumentMetadata.RdocStatus
  832. }
  833. }
  834. }
  835. }
  836. };
  837. }
  838. return viewAction;
  839. }
  840.  
  841. private PpsOpAttachDocument CreateAttachAction(Dictionary<LanguagesIdentifiers, string> pPresentationNames, List<string> pAcceptedFileTypes, List<string> pAcceptedStates, string pFinalState)
  842. {
  843. var attachAction = new PpsOpAttachDocument()
  844. {
  845. Presentation = new Dictionary<PresentationZone, PpsPresentation>() {
  846. { PresentationZone.WebRowLineAction,
  847. new PpsPresentation() {
  848. Name = pPresentationNames,
  849. IconCss = EnumUtil.GetEnumDescription(PpsWebIcons.Attachmerge),
  850. Zone = PresentationZone.WebRowLineAction
  851. }
  852. }
  853. },
  854. EndPoint = new PpsEndPoint()
  855. {
  856. Url = BaseEnd + "/User/Operations/AttachDocument"
  857. },
  858. PapersoftAddress = pDestinationAddress,
  859. AcceptedFileTypes = pAcceptedFileTypes,
  860. MaxFiles = 1,
  861. //MaxFileSize = 5,
  862. Route = _routeAttach,
  863. Transformation = new BinaryTree<PpsDocumentInferenceNode>()
  864. {
  865. Root = new BinaryTreeNode<PpsDocumentInferenceNode>()
  866. {
  867. Value = new PpsDocumentInferenceData()
  868. {
  869. Value = new List<string>() { pFinalState },
  870. FieldId = (int)SearchableDocumentMetadata.RdocStatus
  871. }
  872. }
  873. },
  874. Validation = new PpsDocumentInference()
  875. {
  876. MetadataInclusion = new BinaryTree<PpsDocumentInferenceNode>()
  877. {
  878. Root = new BinaryTreeNode<PpsDocumentInferenceNode>()
  879. {
  880. Value = new PpsDocumentInferenceFunction()
  881. {
  882. Type = DocumentInferenceOperation.And
  883. },
  884. Left = new BinaryTreeNode<PpsDocumentInferenceNode>()
  885. {
  886. Value = new PpsDocumentInferenceData()
  887. {
  888. Type = DocumentInferenceDataOperation.In,
  889. Value = pAcceptedStates,
  890. FieldId = (int)SearchableDocumentMetadata.RdocStatus
  891. }
  892. }
  893. }
  894. }
  895. }
  896. };
  897.  
  898. return attachAction;
  899. }
  900.  
  901. private PpsOpDownloadDocument CreateDownloadAction(Dictionary<LanguagesIdentifiers, string> pPresentationNames)
  902. {
  903. var download = new PpsOpDownloadDocument()
  904. {
  905. Name = pPresentationNames,
  906. Presentation = new Dictionary<PresentationZone, PpsPresentation>() {
  907. { PresentationZone.WebViewBarRigth,
  908. new PpsPresentation() {
  909. Zone = PresentationZone.WebViewBarRigth,
  910. Name = pPresentationNames,
  911. IconCss = PpsWebIcons.Download.GetEnumDescription()
  912. }
  913. }
  914. },
  915. Route = _routeDownload,
  916. EndPoint = new PpsEndPoint()
  917. {
  918. Url = BaseEnd + "/User/Operations/DownloadDocument"
  919. },
  920. PapersoftAddress = pDestinationAddress
  921. };
  922. return download;
  923. }
  924.  
  925. private PpsOpReportDocument CreateReportAction(Dictionary<LanguagesIdentifiers, string> pPresentationNames, string pFilename, string pSeparator, string pExtension, List<int> pFieldsToPresent)
  926. {
  927. var report = new PpsOpReportDocument()
  928. {
  929. Presentation = new Dictionary<PresentationZone, PpsPresentation>() {
  930. { PresentationZone.WebSecBarRigth,
  931. new PpsPresentation() {
  932. Name = pPresentationNames,
  933. IconCss = EnumUtil.GetEnumDescription(PpsWebIcons.Process),
  934. Zone = PresentationZone.WebSecBarRigth
  935. }
  936. }
  937. },
  938. Route = _routeReport,
  939. PapersoftAddress = pDestinationAddress,
  940. EndPoint = new PpsEndPoint()
  941. {
  942. Url = BaseEnd + "/User/Operations/ReportDocument"
  943. },
  944. FileName = pFilename,
  945. Seperator = pSeparator,
  946. Extension = pExtension,
  947. FieldsToPresent = pFieldsToPresent
  948. };
  949. return report;
  950. }
  951.  
  952. protected override void InvalidSet(string pPrefix)
  953. {
  954. return;
  955. }
  956.  
  957. public override string ToString()
  958. {
  959. return string.Empty;
  960. }
  961. }
  962. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement