示例#1
0
        private GeneraIncidenciaRequestDTO CreateRequest(IOrganizationService _service, String _strUrgency, String _strServiceCI, String _strDescription, String _strCategory1
                                                         , String _strCategory2, String _strCategory3, String _strCaseId)
        {
            //TO DO: Cambiar los string por los parámetros del request.

            var user  = Utilities.Util.GetCrmConfiguration(_service, "PsbServiceRemedyUserName");
            var clave = Utilities.Util.GetCrmConfiguration(_service, "PsbServiceRemedyUserPassword");

            //Impact
            //1-Extensive/Widespread      1000
            //2-Significant/Large         2000
            //3-Moderate/Limited          3000
            //4-Minor/Localized           4000

            //Urgency
            //1-Critical                  1000
            // 2-High                      2000
            // 3-Medium                    3000
            // 4-Low                       4000

            //Servicio a consumir tipo PSB

            GeneraIncidenciaRequestDTO obj = new GeneraIncidenciaRequestDTO();

            obj.request = new Request()
            {
                Password            = user,
                UserName            = clave,
                Urgency             = _strUrgency,              //strUrgency (1)
                ServiceCI           = "",                       //strServiceCI
                Impact              = "1-Extensive/Widespread", //DEFAULT
                Action              = "CREATE",                 //DEFAULT
                Description         = _strDescription,          //strDescription
                CategorizationTier1 = _strCategory1,            //strCategory1
                CategorizationTier2 = _strCategory2,            //strCategory2
                CategorizationTier3 = _strCategory3,            //strCategory3
                RecordType          = "CASE",                   //DEFAULT
                RecordID            = _strCaseId                //strCaseId
            };


            return(obj);
        }
示例#2
0
        public GeneraIncidenciaResponseDTO CallPsbServiceAmxPeruGeneraIncidencia(IOrganizationService service, String _strUrgency, String _strServiceCI, String _strDescription, String _strCategory1
                                                                                 , String _strCategory2, String _strCategory3, String _strTaskId)
        {
            try
            {
                string operation = "AmxPeruGeneraIncidenciaExternal";
                //TO DO: Enable comments
                string sUri = Utilities.Util.GetCrmConfiguration(service, "PsbEndpoint");
                sUri += operation;

                GeneraIncidenciaRequestDTO request = CreateRequest(service, _strUrgency, _strServiceCI, _strDescription, _strCategory1, _strCategory2, _strCategory3
                                                                   , _strTaskId);

                // Call the member.
                IPSBServices psb = new PSBServices.PSBServices();
                return(psb.GeneraIncidencia(service, request, sUri));
            }
            catch
            {
                throw;
            }
        }
示例#3
0
        //INT-CHQ 2-002
        public GeneraIncidenciaResponseDTO GeneraIncidencia(IOrganizationService _service, GeneraIncidenciaRequestDTO requestDTO, string url)
        {
            //string requestToJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestDTO);
            Util util = new Util();
            GeneraIncidenciaResponseDTO response = new GeneraIncidenciaResponseDTO();

            try
            {
                string request;
                request = @"{
                            ""request"":{
                            ""$type"":""AmxPeruPSBActivities.Activities.External.GeneraIncidenciaRequestDTO, AmxPeruPSBActivities""" + ",";

                request += "\"Password\": " + "\"" + requestDTO.request.Password + "\"" + ",";
                request += "\"UserName\": " + "\"" + requestDTO.request.UserName + "\"" + ",";
                request += "\"Urgency\": " + "\"" + requestDTO.request.Urgency + "\"" + ",";
                request += "\"ServiceCI\": " + "\"" + requestDTO.request.ServiceCI + "\"" + ",";
                request += "\"Impact\": " + "\"" + requestDTO.request.Impact + "\"" + ",";
                request += "\"Action\": " + "\"" + requestDTO.request.Action + "\"" + ",";
                request += "\"Description\": " + "\"" + requestDTO.request.Description + "\"" + ",";
                request += "\"CategorizationTier1\": " + "\"" + requestDTO.request.CategorizationTier1 + "\"" + ",";
                request += "\"CategorizationTier2\": " + "\"" + requestDTO.request.CategorizationTier2 + "\"" + ",";
                request += "\"CategorizationTier3\": " + "\"" + requestDTO.request.CategorizationTier3 + "\"" + ",";
                request += "\"RecordType\": " + "\"" + requestDTO.request.RecordType + "\"" + ",";
                request += "\"RecordID\":" + "\"" + requestDTO.request.RecordID + "\"" + "}" + "}";

                response = Newtonsoft.Json.JsonConvert.DeserializeObject <GeneraIncidenciaResponseDTO>(util.SendRestRequest(_service, request, url));

                #region 04_HardCode
                //response.CurrentBookmark = null;
                //response.Output.response.ProblemId = "INC000001227281";
                //response.Output.response.Status = 0;
                //response.Output.response.CodeResponse = "0";
                //response.Output.response.DescriptionResponse = "Transaccion OK";
                //response.Output.response.ErrorLocation = "";
                //response.CanRollback = false;
                //response.RunDate = Convert.ToDateTime("2018-06-27T12:07:08.453821Z");
                //response.WorkflowName = "AmxPeruGeneraIncidenciaExternal";
                //response.WorkflowVersion = "1.0.0.0";
                //response.Status = 4;
                #endregion

                return(response);
            }
            catch (Exception)
            {
                //TO DO:Manejo de excepciones o logging.
                throw;
            }
        }