Beispiel #1
0
        public bool Mapping(DatabaseConstant.Action action, ref List <BC_MATK_MAPPING> lstMapping, ref List <ClientResponseDetail> listClientResponseDetail)
        {
            KhaiThacDuLieuServiceClient client   = null;
            KhaiThacDuLieuRequest       request  = null;
            KhaiThacDuLieuResponse      response = null;

            try
            {
                // Kiểm tra kết nối, server, service trước khi request
                Common.Utilities.IsRequestAllow(ApplicationConstant.SystemService.KhaiThacDuLieuService.layGiaTri());

                client   = KhaiThacDuLieuServiceClient(ApplicationConstant.SystemService.KhaiThacDuLieuService);
                request  = Common.Utilities.PrepareRequest(new KhaiThacDuLieuServiceRef.KhaiThacDuLieuRequest());
                response = new KhaiThacDuLieuServiceRef.KhaiThacDuLieuResponse();

                //Khởi tạo request
                request.Function       = DatabaseConstant.Function.KTDL_MAPPING_MAPPING;
                request.Action         = action;
                request.lstMaTKMapping = lstMapping.ToArray();

                // make a call to service client here
                response = client.KhaiThacDuLieu(request);

                //Kiểm tra kết quả trả về
                Common.Utilities.ValidResponse(request, response);

                if (response != null && response.ResponseStatus == ApplicationConstant.ResponseStatus.THANH_CONG)
                {
                    lstMapping = response.lstMaTKMapping.ToList();
                    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;
            }
        }
Beispiel #2
0
        public ApplicationConstant.ResponseStatus DuLieuChiTieu(DatabaseConstant.Action action, int idBaoCao, ref HT_BAOCAO htBaoCao, ref List <HT_BAOCAO_TSO> lstBaoCaoTso, ref DataSet ds, ref string responseMessage)
        {
            KhaiThacDuLieuServiceClient client   = null;
            KhaiThacDuLieuRequest       request  = null;
            KhaiThacDuLieuResponse      response = null;

            try
            {
                // Kiểm tra kết nối, server, service trước khi request
                Common.Utilities.IsRequestAllow(ApplicationConstant.SystemService.KhaiThacDuLieuService.layGiaTri());

                client   = KhaiThacDuLieuServiceClient(ApplicationConstant.SystemService.KhaiThacDuLieuService);
                request  = Common.Utilities.PrepareRequest(new KhaiThacDuLieuServiceRef.KhaiThacDuLieuRequest());
                response = new KhaiThacDuLieuServiceRef.KhaiThacDuLieuResponse();

                // Khởi tạo request
                request.Function       = DatabaseConstant.Function.KTDL_DM_DL_CT;
                request.Action         = action;
                request.idBaoCao       = idBaoCao;
                request.htBaoCao       = htBaoCao;
                request.lstHtBaoCaoTso = lstBaoCaoTso.ToArray();
                // Gửi yêu cầu tới Server
                response = client.KhaiThacDuLieu(request);

                // Kiểm tra kết quả trả về
                Common.Utilities.ValidResponse(request, response);

                htBaoCao     = response.htBaoCao;
                lstBaoCaoTso = response.lstHtBaoCaoTso != null?response.lstHtBaoCaoTso.ToList() : null;

                ds = response.dsDuLieuBaoCao;
                responseMessage = response.ResponseMessage;
                return(response.ResponseStatus);
            }
            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;
            }
        }