/// <summary> /// Créer le client pour communiquer avec le webservice /// Ajoute le certificat pour la communication /// </summary> /// <returns></returns> private PMADRService.PMADRSERVICEPortClient CreateClient() { PMADRService.PMADRSERVICEPortClient Client = new PMADRService.PMADRSERVICEPortClient(); X509Certificate2 Certificate = CreateCertificate(); Client.ClientCredentials.ClientCertificate.Certificate = Certificate; return(Client); }
/// <summary> /// Ajoute le fichier pdf de l'analyse à l'ordre concerné (SAP) /// </summary> /// <param name="OrderNbs"></param> /// <param name="UserId"></param> public void AddAttachementToOrder(string OrderNbs, string UserId, int RiskId, Dictionary <string, string> RisqueAndValue) { PMADRService.PMADRSERVICEPortClient Client = CreateClient(); PMADRService.GetOrderattachmentResponse OrderAttachement = Client.GetOrderattachment(new PMADRService.GetOrderattachment() { OperationCallData = CreateOperation(), InputDataAttachment = new PMADRService.CreateAttachment[] { CreateAttachement(OrderNbs, UserId, RiskId, RisqueAndValue) } }); }
/// <summary> /// Ajoute le fihcier pdf de l'analyse dans le plan (SAP) /// </summary> /// <param name="OrderNbs">Numéro d'ordre</param> /// <param name="UserId">Id du user</param> /// <param name="Plan">Numéro du plan de maintance</param> public void AddAttachementToPlan(string UserId, string Plan, string RiskLevel, Dictionary <string, string> RisqueAndValue) { PMADRService.PMADRSERVICEPortClient Client = CreateClient(); PMADRService.GetMPItemattachmentResponse PlanAttachement = Client.GetMPItemattachment(new PMADRService.GetMPItemattachment() { OperationCallData = CreateOperation(), InputMPIAttachment = new PMADRService.CreateMPIAttachment[] { CreatePMAttachement(UserId, Plan, RiskLevel, RisqueAndValue) } }); }
/// <summary> /// Va chercher les ordres en fonction du workcenter /// </summary> /// <param name="WorkCenter">Le workcenter de l'utilisateur</param> /// <param name="Criticality">Le niveau de criticité</param> public IEnumerable <ADR_SAPOrders> GetOrders(string WorkCenter, string Criticality) { PMADRService.PMADRSERVICEPortClient Client = CreateClient(); PMADRService.GetOrderdetailsResponse OrdersDetails = Client.GetOrderdetails(new PMADRService.GetOrderdetails { OperationCallData = CreateOperation(), InputDataOrderdetails = new PMADRService.OrderDataI[] { CreateOrderData(WorkCenter, Criticality) } }); return(ParseOrders(OrdersDetails)); }