public bool HanMucKhachHangChiTiet(DatabaseConstant.Action action, ref HM_HAN_MUC_KHACH_HANG_CTIET objHanMucKhachHangChiTiet, ref List <ClientResponseDetail> listClientResponseDetail) { HanMucServiceClient client = null; HanMucRequest request = null; HanMucResponse response = null; try { // Kiểm tra kết nối, server, service trước khi request Common.Utilities.IsRequestAllow(ApplicationConstant.SystemService.HanMucService.layGiaTri()); client = HanMucServiceClient(ApplicationConstant.SystemService.HanMucService); request = Common.Utilities.PrepareRequest(new HanMucServiceRef.HanMucRequest()); response = new HanMucServiceRef.HanMucResponse(); //Khởi tạo request request.Function = DatabaseConstant.Function.HM_CTIET_CT; request.Action = action; request.objHanMucKhachHangChiTiet = objHanMucKhachHangChiTiet; // make a call to service client here response = client.HanMuc(request); //Kiểm tra kết quả trả về Common.Utilities.ValidResponse(request, response); if (response != null && response.ResponseStatus == ApplicationConstant.ResponseStatus.THANH_CONG) { objHanMucKhachHangChiTiet = response.objHanMucKhachHangChiTiet; return(true); } else { listClientResponseDetail = Common.Utilities.convertToClientResponseDetail(response); return(false); } } catch (Exception ex) { LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); throw ex; } finally { if (client.State == CommunicationState.Faulted) { client.Abort(); } else { client.Close(); } client = null; request = null; response = null; } }
/// <summary> /// Khởi tạo service HanMucService /// </summary> /// <param name="service"></param> /// <returns></returns> private HanMucServiceClient HanMucServiceClient(ApplicationConstant.SystemService service) { EndpointAddress endpointAddress = Common.Utilities.getEndpointAddress(service.layGiaTri()); BasicHttpBinding basicHttpBinding = Common.Utilities.getBasicHttpBinding(service.layGiaTri()); HanMucServiceClient Client = new HanMucServiceClient(basicHttpBinding, endpointAddress); foreach (var operationDescription in Client.Endpoint.Contract.Operations) { DataContractSerializerOperationBehavior dcsob = operationDescription.Behaviors.Find <DataContractSerializerOperationBehavior>(); if (dcsob != null) { dcsob.MaxItemsInObjectGraph = 2147483646; } } return(Client); }