예제 #1
0
        /// <summary>
        /// Insert a Help desk notification
        /// </summary>
        /// <param name="model"></param>
        /// <returns>ID of the record inserted</returns>
        public int Create(HelpDeskModel model)
        {
            var request = model.ToInsHelpDeskNotificationRequest();

            ValidateRequest(request);

            try
            {
                var ret = AdwService.GetRelatedCodes("SINF", model.Subject).ToCodeModelList();

                request.subjectArea = ret[0].Code;

                string lapCode = AdwService.GetRelatedCodeDescription("SULA", request.subjectArea, "TODO");//TODO:Fix
                if (!string.IsNullOrEmpty(lapCode))
                {
                    request.description = string.Format("{0}: {1}  ", lapCode, model.Description);
                }
                else
                {
                    request.description = string.Format("{0}  ", model.Description);
                }


                var service = Client.Create <IHelpDeskNotification>("HelpDeskNotification.svc");
                request.userType    = "Remote Services Client";
                request.callTakenBy = "Remote Services Web Form";
                request.status      = "New";
                request.module      = "HelpDeskService";
                request.priority    = "1-Super User";
                request.summary     = "a";
                request.subjectArea = request.subjectArea;
                var response = service.Insert(request);
                // Only responses with IResponseWithExecutionResult need to call ValidateResponse
                ValidateResponse(response);

                return(response.requestID);
            }
            catch (FaultException <ValidationFault> vf)
            {
                throw vf.ToServiceValidationException();
            }
            catch (FaultException fe)
            {
                throw fe.ToServiceValidationException();
            }
        }