Example #1
0
        public static CustomerRet GetOrAddCustomerQuery(Patient patient, string QBCompanyFile)
        {
            var modxml = CustomerViewModel.BuildCustomerQueryRq(patient);


            var modres = QBPosContext.ProcessXML(modxml.OuterXml, QBCompanyFile);

            //if(sessionBegun == true)

            var lst = new List <CustomerRet>();

            lst.AddRange(GetQBCustomers(modres));
            if (lst.FirstOrDefault() == null)
            {
                var addreq = CustomerViewModel.BuildCustomerAddRq(patient);


                var res = QBPosContext.ProcessXML(addreq.OuterXml, QBCompanyFile);
                if (res != null)
                {
                    modxml = CustomerViewModel.BuildCustomerQueryRq(patient);
                    modres = QBPosContext.ProcessXML(modxml.OuterXml, QBCompanyFile);
                    lst.AddRange(GetQBCustomers(modres));
                }
            }

            return(lst.FirstOrDefault());
        }