public bool updateCaseTransStatus(long caseTransRecId, HMServiceStatus serviceStatus, bool createCharge, long appointmentRecId, string batchId, string caseId, long resourceRecId = 0)
        {
            bool ret = false;

            //HMCaseServiceClient client = null;

            //try
            //{
            //    client = new HMCaseServiceClient();

            //    CallContext callContext = new CallContext { Company = AppSettings.GetByKey("axCompany") };
            //    client.ClientCredentials.Windows.ClientCredential = new NetworkCredential { Domain = AppSettings.GetByKey("axDomain"), UserName = AppSettings.GetByKey("axUserName"), Password = AppSettings.GetByKey("axPassword") };
            //    if (!string.IsNullOrEmpty(caseId))
            //    {
            //        ret = client.updateCaseTransStatus(callContext, caseTransRecId, serviceStatus, createCharge, appointmentRecId, batchId, new Guid(caseId), resourceRecId);
            //    }
            //    else
            //    {
            //        ret = client.updateCaseTransStatus(callContext, caseTransRecId, serviceStatus, createCharge, appointmentRecId, batchId, Guid.Empty, resourceRecId);
            //    }
            //}
            //catch (System.ServiceModel.FaultException<AifFault> aiffaultException)
            //{
            //    throw ValidationException.create(aiffaultException.Message, aiffaultException.HelpLink, aiffaultException.Source);
            //}
            //catch (Exception ex)
            //{
            //    throw ex;
            //}
            //finally
            //{
            //    client.Close();
            //}

            //return ret;

            try
            {
                updateCaseTransStatusResponse obj;

                var endpointAddress = SoapHelper.GetEndPointAddress();
                var binding         = SoapHelper.GetBinding();

                var client  = new HMCaseServiceClient(binding, endpointAddress);
                var channel = client.InnerChannel;
                using (OperationContextScope operationContextScope = new OperationContextScope(channel))
                {
                    SoapHelper.channelHelper();
                    if (!string.IsNullOrEmpty(caseId))
                    {
                        obj = ((HMCaseService)channel).updateCaseTransStatus(new updateCaseTransStatus()
                        {
                            _caseTransRecId = caseTransRecId, _serviceStatus = serviceStatus, createCharge = createCharge, _apptRecId = appointmentRecId, _batchId = batchId, _caseId = new Guid(caseId), _resourceRecId = resourceRecId
                        });
                    }
                    else
                    {
                        obj = ((HMCaseService)channel).updateCaseTransStatus(new updateCaseTransStatus()
                        {
                            _caseTransRecId = caseTransRecId, _serviceStatus = serviceStatus, createCharge = createCharge, _apptRecId = appointmentRecId, _batchId = batchId, _caseId = Guid.Empty, _resourceRecId = resourceRecId
                        });
                    }

                    if (obj.result)
                    {
                        ret = obj.result;
                    }
                    else
                    {
                        throw new ValidationException(CommonRepository.getErrorMessage(obj.Infolog));
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(ret);
        }
        public bool updateCaseStatus(string caseId, HMCaseStatus caseStatus)
        {
            bool ret = false;

            //HMCaseServiceClient client = null;

            //try
            //{
            //    client = new HMCaseServiceClient();

            //    CallContext callContext = new CallContext { Company = AppSettings.GetByKey("axCompany") };
            //    client.ClientCredentials.Windows.ClientCredential = new NetworkCredential { Domain = AppSettings.GetByKey("axDomain"), UserName = AppSettings.GetByKey("axUserName"), Password = AppSettings.GetByKey("axPassword") };

            //    ret = client.updateCaseStatus(callContext, caseId, caseStatus);
            //}
            //catch (System.ServiceModel.FaultException<AifFault> aiffaultException)
            //{
            //    throw ValidationException.create(aiffaultException.Message, aiffaultException.HelpLink, aiffaultException.Source);
            //}
            //catch (Exception ex)
            //{
            //    throw ex;
            //}
            //finally
            //{
            //    client.Close();
            //}

            //return ret;

            try
            {
                var endpointAddress = SoapHelper.GetEndPointAddress();
                var binding         = SoapHelper.GetBinding();

                var client  = new HMCaseServiceClient(binding, endpointAddress);
                var channel = client.InnerChannel;

                using (OperationContextScope operationContextScope = new OperationContextScope(channel))
                {
                    SoapHelper.channelHelper();

                    updateCaseStatusResponse obj = ((HMCaseService)channel).updateCaseStatus(new updateCaseStatus()
                    {
                        _caseGUID = caseId, _caseStatus = caseStatus
                    });

                    if (obj.result)
                    {
                        ret = obj.result;
                    }
                    else
                    {
                        throw new ValidationException(CommonRepository.getErrorMessage(obj.Infolog));
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(ret);
        }
Example #3
0
        public long createPatient(HMPatientDataContract contract)
        {
            long ret = 0;

            //HMPatientServiceClient client = null;

            //try
            //{
            //    client = new HMPatientServiceClient();

            //    CallContext callContext = new CallContext { Company = AppSettings.GetByKey("axCompany") };
            //    client.ClientCredentials.Windows.ClientCredential = new NetworkCredential { Domain = AppSettings.GetByKey("axDomain"), UserName = AppSettings.GetByKey("axUserName"), Password = AppSettings.GetByKey("axPassword") };

            //    ret = client.createPatient(callContext, contract);
            //}
            //catch (System.ServiceModel.FaultException<AifFault> aiffaultException)
            //{
            //    throw ValidationException.create(aiffaultException.Message, aiffaultException.HelpLink, aiffaultException.Source);
            //}
            //catch (Exception ex)
            //{
            //    throw ex;
            //}
            //finally
            //{
            //    client.Close();
            //}

            try
            {
                var endpointAddress = SoapHelper.GetEndPointAddress();
                var binding         = SoapHelper.GetBinding();

                var client  = new HMPatientServiceClient(binding, endpointAddress);
                var channel = client.InnerChannel;
                using (OperationContextScope operationContextScope = new OperationContextScope(channel))
                {
                    SoapHelper.channelHelper();
                    createPatientResponse response = ((HMPatientService)channel).createPatient(new createPatient()
                    {
                        _contract = contract
                    });
                    if (response.result > 0)
                    {
                        // Helper.Files.SaveToCSV(response.result.ToString(), "ex", DateTime.Now, DateTime.Now);
                        ret = response.result;
                    }
                    else
                    {
                        new ValidationException(CommonRepository.getErrorMessage(response.Infolog));
                    }
                    //var result = ((HMPatientService)channel).getPatientBasicDetails(new getPatientBasicDetails() { _patientRecId = "0" }).result;
                }
            }
            catch (Exception ex)
            {
                //Helper.Files.SaveToCSV(ex.Message, "ex", DateTime.Now, DateTime.Now);
                throw ex;
            }

            return(ret);
        }