Пример #1
0
        public TextTO getZipcodeForCity(string city, string stateAbbr)
        {
            TextTO result = new TextTO();

            if (city == "")
            {
                result.fault = new FaultTO("Missing city");
            }
            else if (stateAbbr == "")
            {
                result.fault = new FaultTO("Missing stateAbbr");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao dao =
                    new gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao(mySession.MdwsConfiguration.SqlConnectionString);
                string zip = dao.getZipcode(city, stateAbbr);
                result = new TextTO(zip);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #2
0
        public TextTO getAdHocHealthSummaryByDisplayName(string sitecode, string displayName)
        {
            TextTO result = new TextTO();

            if (displayName == "")
            {
                result.fault = new FaultTO("Missing display name");
            }
            if (result.fault != null)
            {
                return(result);
            }
            try
            {
                result.text = ClinicalApi.getAdHocHealthSummaryByDisplayName(mySession.ConnectionSet.getConnection(sitecode), displayName);
                if (result.text == null)
                {
                    result.fault = new FaultTO("Site " + sitecode + " does not have " + displayName + " enabled! Please contact the site for remediation.");
                }
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #3
0
        public TextTO getConsultNote(string siteId, string consultId)
        {
            TextTO result = new TextTO();

            if (!mySession.ConnectionSet.IsAuthorized)
            {
                result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }
            else if (String.IsNullOrEmpty(siteId))
            {
                result.fault = new FaultTO("Missing siteId");
            }
            else if (String.IsNullOrEmpty(consultId))
            {
                result.fault = new FaultTO("Missing consultId");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                string s = Consult.getConsultNote(mySession.ConnectionSet.getConnection(siteId), consultId);
                result = new TextTO(s);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Пример #4
0
        public TextTO getSurgeryReportText(string siteId, string rptId)
        {
            TextTO result = new TextTO();

            if (!mySession.ConnectionSet.IsAuthorized)
            {
                result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }
            else if (siteId == "")
            {
                result.fault = new FaultTO("Missing siteId");
            }
            else if (rptId == "")
            {
                result.fault = new FaultTO("Missing rptId");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                ClinicalApi api = new ClinicalApi();
                string      s   = api.getSurgeryReportText(mySession.ConnectionSet.getConnection(siteId), rptId);
                result = new TextTO(s);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Пример #5
0
        public ClosestFacilityTO getNearestFacility(string city, string stateAbbr)
        {
            ClosestFacilityTO result = new ClosestFacilityTO();

            if (city == "")
            {
                result.fault = new FaultTO("Missing city");
            }
            else if (!State.isValidAbbr(stateAbbr))
            {
                result.fault = new FaultTO("Invalid stateAbbr");
            }
            if (result.fault != null)
            {
                return(result);
            }
            try
            {
                TextTO zipcode = getZipcodeForCity(city, stateAbbr);
                if (zipcode.fault != null)
                {
                    result.fault = zipcode.fault;
                    return(result);
                }
                result = getNearestFacility(zipcode.text);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #6
0
        public TextTO getMedicationDetail(string siteId, string medId)
        {
            TextTO result = new TextTO();

            if (!mySession.ConnectionSet.IsAuthorized)
            {
                result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }
            else if (siteId == "")
            {
                result.fault = new FaultTO("Missing siteId");
            }
            else if (medId == "")
            {
                result.fault = new FaultTO("Missing medId");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                string s = Medication.getMedicationDetail(mySession.ConnectionSet.getConnection(siteId), medId);
                result = new TextTO(s);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Пример #7
0
        public TextTO getHthVitalsAsXML(String appPwd, String icn)
        {
            TextTO result = new TextTO();

            if (mySession == null || mySession.SiteTable == null || mySession.SiteTable.getSite("201") == null ||
                mySession.SiteTable.getSite("201").Sources == null || mySession.SiteTable.getSite("201").Sources[0] == null)
            {
                result.fault = new FaultTO("No CDS endpoint (site 201) in sites file!");
            }
            if (result.fault != null)
            {
                return(result);
            }

            CdsConnection cxn = new CdsConnection(mySession.SiteTable.getSite("201").Sources[0]);
            CdsVitalsDao  dao = new CdsVitalsDao(cxn);

            try
            {
                result.text = dao.getHthVitals(icn); // function is probably ignoring these params
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return(result);
        }
Пример #8
0
        public TextTO getNoteEncounterString(string sitecode, string noteId)
        {
            TextTO result = new TextTO();
            string msg    = MdwsUtils.isAuthorizedConnection(mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (noteId == "")
            {
                result.fault = new FaultTO("Missing noteId");
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn = mySession.ConnectionSet.getConnection(sitecode);
                NoteApi            api = new NoteApi();
                result.text = api.getNoteEncounterString(cxn, noteId);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #9
0
        public TextTO getNote(string siteId, string noteId)
        {
            TextTO result = new TextTO();

            string msg = MdwsUtils.isAuthorizedConnection(_mySession, siteId);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (siteId == "")
            {
                result.fault = new FaultTO("Missing siteId");
            }
            else if (noteId == "")
            {
                result.fault = new FaultTO("Missing noteId");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                NoteApi api = new NoteApi();
                string  s   = api.getNoteText(_mySession.ConnectionSet.getConnection(siteId), noteId);
                result = new TextTO(s);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Пример #10
0
        public TextTO cancelImagingExam(String examIdentifier, String reasonIen, bool cancelAssociatedOrder, String holdDescription)
        {
            TextTO result = new TextTO();

            String sessionCheck = MdwsUtils.isAuthorizedConnection(_mySession);

            if (!String.Equals(sessionCheck, "OK", StringComparison.CurrentCultureIgnoreCase))
            {
                result.fault = new FaultTO(sessionCheck);
            }

            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                new RadiologyApi().cancelExam(_mySession.ConnectionSet.BaseConnection, examIdentifier, reasonIen, cancelAssociatedOrder, holdDescription);
                result.text = "OK";
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }

            return(result);
        }
Пример #11
0
        public TextTO getNoteText(string sitecode, string noteIEN)
        {
            TextTO result = new TextTO();
            string msg    = MdwsUtils.isAuthorizedConnection(_mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (noteIEN == "")
            {
                result.fault = new FaultTO("Missing noteIEN");
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = _mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn = _mySession.ConnectionSet.getConnection(sitecode);
                result.text = _api.getNoteText(cxn, noteIEN);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #12
0
        public TextTO delete(String recordId, String file)
        {
            TextTO result = new TextTO();

            if (String.IsNullOrEmpty(recordId))
            {
                result.fault = new FaultTO("Missing record ID");
            }
            else if (String.IsNullOrEmpty(file))
            {
                result.fault = new FaultTO("Missing file");
            }

            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                CrudOperation co = new ToolsApi().delete(mySession.ConnectionSet.BaseConnection, recordId, file);
                //result.rpc = new RpcTO(co.RPC);
                result.text = "OK";
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return(result);
        }
Пример #13
0
        public TextTO getVariableValue(string sitecode, string arg)
        {
            TextTO result = new TextTO();
            string msg    = MdwsUtils.isAuthorizedConnection(mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn = mySession.ConnectionSet.getConnection(sitecode);
                ToolsApi           api = new ToolsApi();
                string             s   = api.getVariableValue(cxn, arg);
                result = new TextTO(s);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #14
0
        /// <summary>
        /// Make a patient inquiry call (address, contact numbers, NOK, etc. information)
        /// </summary>
        /// <returns>TextTO with selected patient inquiry text</returns>
        public TextTO patientInquiry()
        {
            TextTO result = new TextTO();

            if (!mySession.ConnectionSet.IsAuthorized)
            {
                result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }
            else if (String.IsNullOrEmpty(mySession.ConnectionSet.getConnection(mySession.ConnectionSet.BaseSiteId).Pid))
            {
                result.fault = new FaultTO("Need to select patient");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                AbstractConnection cxn             = mySession.ConnectionSet.getConnection(mySession.ConnectionSet.BaseSiteId);
                string             selectedPatient = cxn.Pid;
                PatientApi         api             = new PatientApi();
                string             resultText      = api.patientInquiry(cxn, selectedPatient);
                result = new TextTO(resultText);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #15
0
        public TextTO getOrderStatusForPatient(string pid, string orderableItemId)
        {
            TextTO result = new TextTO();

            if (!(MdwsUtils.isAuthorizedConnection(mySession) == "OK"))
            {
                result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }
            else if (String.IsNullOrEmpty(pid))
            {
                result.fault = new FaultTO("Empty PID");
            }
            else if (String.IsNullOrEmpty(orderableItemId))
            {
                result.fault = new FaultTO("Empty Orderable Item ID");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                string s = Order.getOrderStatusForPatient(mySession.ConnectionSet.BaseConnection, pid, orderableItemId);
                result = new TextTO(s);
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return(result);
        }
Пример #16
0
        public TextTO getLabReportsAsXML(string appPwd, string patientICN, string fromDate, string toDate)
        {
            TextTO result = new TextTO();

            if (mySession == null || mySession.SiteTable == null || mySession.SiteTable.getSite("201") == null ||
                mySession.SiteTable.getSite("201").Sources == null || mySession.SiteTable.getSite("201").Sources[0] == null)
            {
                result.fault = new FaultTO("No CDS endpoint (site 201) in sites file!");
            }
            if (result.fault != null)
            {
                return(result);
            }

            CdsConnection cxn = new CdsConnection(mySession.SiteTable.getSite("201").Sources[0]);

            cxn.Pid = patientICN;
            CdsLabsDao dao = new CdsLabsDao(cxn);

            try
            {
                // TODO - validate app password
                result.text = dao.getAllLabReports(fromDate, toDate, 0); // function is probably ignoring these params
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return(result);
        }
Пример #17
0
        public TextTO getAllergiesAsXML(string appPwd, string patientICN)
        {
            TextTO result = new TextTO();

            if (mySession == null || mySession.SiteTable == null || mySession.SiteTable.getSite("201") == null ||
                mySession.SiteTable.getSite("201").Sources == null || mySession.SiteTable.getSite("201").Sources[0] == null)
            {
                result.fault = new FaultTO("No CDS endpoint (site 201) in sites file!");
            }
            if (result.fault != null)
            {
                return(result);
            }

            CdsConnection cxn = new CdsConnection(mySession.SiteTable.getSite("201").Sources[0]);

            cxn.Pid = patientICN;
            CdsClinicalDao dao = new CdsClinicalDao(cxn);

            try
            {
                result.text = dao.getAllergiesAsXML();
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return(result);
        }
Пример #18
0
        public TextTO getAppointmentText(string siteId, string apptId)
        {
            TextTO result = new TextTO();

            if (!mySession.ConnectionSet.IsAuthorized)
            {
                result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }
            else if (siteId == "")
            {
                result.fault = new FaultTO("Missing siteId");
            }
            else if (apptId == "")
            {
                result.fault = new FaultTO("Missing apptId");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                EncounterApi api = new EncounterApi();
                string       s   = api.getAppointmentText(mySession.ConnectionSet.getConnection(siteId), apptId);
                result = new TextTO(s);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Пример #19
0
        public TextTO signOrder(String orderId, String providerDuz, String locationIen, String eSig)
        {
            TextTO result       = new TextTO();
            String sessionCheck = MdwsUtils.isAuthorizedConnection(_mySession);

            if (!String.Equals(sessionCheck, "OK", StringComparison.CurrentCultureIgnoreCase))
            {
                result.fault = new FaultTO(sessionCheck);
            }

            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                new RadiologyApi().signOrder(_mySession.ConnectionSet.BaseConnection, orderId, providerDuz, locationIen, eSig);
                result.text = "OK";
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return(result);
        }
Пример #20
0
        public TextTO signNote(string sitecode, string noteId, string userId, string esig)
        {
            TextTO result = new TextTO();
            string msg    = MdwsUtils.isAuthorizedConnection(_mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (noteId == "")
            {
                result.fault = new FaultTO("Missing noteId");
            }
            else if (esig == "")
            {
                result.fault = new FaultTO("Missing esig");
            }
            if (userId == "")
            {
                if (_mySession.User.Uid == "")
                {
                    result.fault = new FaultTO("Missing userId");
                }
                else
                {
                    userId = _mySession.User.Uid;
                }
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = _mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn = _mySession.ConnectionSet.getConnection(sitecode);
                NoteApi            api = new NoteApi();
                string             s   = api.signNote(cxn, noteId, userId, esig);
                if (s != "OK")
                {
                    result.fault = new FaultTO(s);
                }
                else
                {
                    result = new TextTO(s);
                }
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #21
0
 public TextTO isValidEsig(string sitecode, string esig)
 {
     if (sitecode == "")
     {
         TextTO result = new TextTO();
         result.fault = new FaultTO("Missing sitecode");
         return(result);
     }
     return(isValidEsig(mySession.ConnectionSet.getConnection(sitecode), esig));
 }
Пример #22
0
        public void delete(String vistaFile, String iens)
        {
            TextTO result = _svc.delete(iens, vistaFile);

            if (result.fault != null)
            {
                throw new Exception(result.fault.message);
            }
            // success!
            //result.text = "OK"
        }
Пример #23
0
        public String create(Dictionary <String, String> fieldsAndValues, String vistaFile, String iens)
        {
            // sample serialized Dictionary<String, String>: [{\"Key\":\"Key01\",\"Value\":\"Value01\"},{\"Key\":\"Key02\",\"Value\":\"Value02\"},{\"Key\":\"Key03\",\"Value\":\"Value03\"}]
            string dictString = JsonUtils.Serialize <Dictionary <String, String> >(fieldsAndValues); // to make the API simple, we serialize our dictionary to a string. JSON serialization is widely available in all major programming languages. It would also be trivial to implement your own serializer that passed the format MDWS wants
            TextTO result     = _svc.create(dictString, vistaFile, iens);

            if (result.fault != null)
            {
                throw new Exception(result.fault.message);
            }
            return(result.text); // IEN of new record
        }
Пример #24
0
        public TextTO sendEmail(string from, string to, string subject, string body, string isBodyHTML, string username, string password)
        {
            TextTO result = new TextTO();

            if (String.IsNullOrEmpty(from) || String.IsNullOrEmpty(to) ||
                String.IsNullOrEmpty(subject) || String.IsNullOrEmpty(body))
            {
                result.fault = new FaultTO("Must supply all parameters", "Supply a value for each of the arguments");
            }
            if (result.fault != null)
            {
                return(result);
            }

            string host                  = "smtp.va.gov";
            int    port                  = 25;
            bool   enableSsl             = false;
            bool   useDefaultCredentials = false;

            try
            {
                MailMessage message = new MailMessage();
                message.From = new MailAddress(from);
                if (!String.IsNullOrEmpty(isBodyHTML))
                {
                    message.IsBodyHtml = isBodyHTML.ToUpper().Equals("TRUE") ? true : false;
                }
                message.Body    = body;
                message.Subject = subject;
                //to contains comma seperated email addresses
                message.To.Add(to);

                SmtpClient smtpClient = new SmtpClient(host, port);
                smtpClient.EnableSsl             = enableSsl;
                smtpClient.UseDefaultCredentials = useDefaultCredentials;

                if (!useDefaultCredentials && !String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(password))
                {
                    smtpClient.Credentials = new NetworkCredential(username, password);
                }

                smtpClient.Send(message);
                result.text = "OK";
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc.Message);
            }
            return(result);
        }
Пример #25
0
        public TextTO getFacadeVersion()
        {
            TextTO result = new TextTO();

            try
            {
                System.Reflection.FieldInfo fi = this.GetType().GetField("VERSION");
                result.text = ((string)fi.GetValue(this));
            }
            catch (Exception)
            {
                result.fault = new FaultTO("This facade does not contain any version information");
            }
            return(result);
        }
Пример #26
0
        public TextTO update(VistaRecordTO record)
        {
            TextTO result = new TextTO();

            if (record == null || record.fields == null || record.fields.Length < 1)
            {
                result.fault = new FaultTO("The record must have at least 1 field");
            }
            if (record.file == null || String.IsNullOrEmpty(record.file.number))
            {
                result.fault = new FaultTO("You must specify the file number in which this record should be created");
            }
            foreach (VistaFieldTO field in record.fields)
            {
                if (field == null || String.IsNullOrEmpty(field.number) || String.IsNullOrEmpty(field.value))
                {
                    result.fault = new FaultTO("All fields must have a number and value");
                    break;
                }
            }
            if (String.IsNullOrEmpty(record.iens))
            {
                result.fault = new FaultTO("You must supply the IENS string for the record being updated");
            }

            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                Dictionary <String, String> keysAndValues = new Dictionary <string, string>();
                foreach (VistaFieldTO field in record.fields)
                {
                    keysAndValues.Add(field.number, field.value);
                }
                CrudOperation co = new ToolsApi().update(mySession.ConnectionSet.BaseConnection, keysAndValues, record.iens, record.file.number);
                //result.rpc = new RpcTO(co.RPC);
                result.text = "OK";
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return(result);
        }
Пример #27
0
        public TextTO getHealthSummary(string pwd, string sitecode, string mpiPid, string displayName)
        {
            TextTO result = new TextTO();

            if (String.IsNullOrEmpty(sitecode))
            {
                result.fault = new FaultTO("Missing sitecode");
            }
            else if (mpiPid == "")
            {
                result.fault = new FaultTO("Missing mpiPid");
            }
            else if (displayName == "")
            {
                result.fault = new FaultTO("Missing displayName");
            }
            if (result.fault != null)
            {
                return(result);
            }

            AccountLib acctLib = new AccountLib(mySession);

            try
            {
                // Visit as DoD user...
                SiteArray sites = acctLib.patientVisit(pwd, sitecode, mpiPid, false);
                if (sites.fault != null)
                {
                    result.fault = sites.fault;
                    return(result);
                }

                // Get the labs...
                ClinicalLib clinicalLib = new ClinicalLib(mySession);
                result = clinicalLib.getAdHocHealthSummaryByDisplayName(sitecode, displayName);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            finally
            {
                mySession.close();
            }
            return(result);
        }
Пример #28
0
        public Stream create(System.IO.Stream postBody, String siteId, String pwd)
        {
            if (!String.Equals(pwd, _mySession.MdwsConfiguration.AllConfigs["CRUD"]["Password"]))
            {
                return(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(JsonUtils.Serialize <TextTO>(new TextTO()
                {
                    fault = new FaultTO("Incorrect password")
                }))));
            }
            if (!String.Equals("true", _mySession.MdwsConfiguration.AllConfigs["CRUD"]["EnableCreate"], StringComparison.CurrentCultureIgnoreCase))
            {
                return(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(JsonUtils.Serialize <TextTO>(new TextTO()
                {
                    fault = new FaultTO("Create not enabled")
                }))));
            }

            MySession     newSession       = new MySession();
            VistaRecordTO deserializedBody = null;

            try
            {
                String body = "";
                using (StreamReader sr = new StreamReader(postBody))
                {
                    body = sr.ReadToEnd();
                }
                deserializedBody = JsonUtils.Deserialize <VistaRecordTO>(body);
            }
            catch (Exception exc)
            {
                TextTO fault = new TextTO()
                {
                    fault = new FaultTO(exc)
                };
                return(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(JsonUtils.Serialize <TextTO>(fault))));
            }

            TextTO result = (TextTO)QueryTemplate.getQuery(QueryType.STATELESS, siteId)
                            .execute(newSession, new Func <VistaRecordTO, TextTO>(new ToolsLib(newSession).create),
                                     new object[] { deserializedBody });

            return(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(JsonUtils.Serialize <TextTO>(result))));
        }
Пример #29
0
        //public UserTO getUserInfo(string DUZ)
        //{
        //    return getUserInfo(mySession.cxnMgr.LoginConnection, DUZ);
        //}

        //public UserTO getUserInfo(string sitecode, string DUZ)
        //{
        //    if (sitecode == "")
        //    {
        //        UserTO result = new UserTO();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return getUserInfo(mySession.cxns.getConnection(sitecode), DUZ);
        //}

        //internal UserTO getUserInfo(AbstractConnection cxn, string DUZ)
        //{
        //    UserTO result = new UserTO();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        User u = api.getUserInfo(cxn, DUZ);
        //        result = new UserTO(u);
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        //public UserSecurityKeyArray getSecurityKeys(string DUZ)
        //{
        //    return getSecurityKeys(mySession.cxnMgr.LoginConnection, DUZ);
        //}

        //public UserSecurityKeyArray getSecurityKeys(string sitecode, string DUZ)
        //{
        //    if (sitecode == "")
        //    {
        //        UserSecurityKeyArray result = new UserSecurityKeyArray();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return getSecurityKeys(mySession.cxns.getConnection(sitecode), DUZ);
        //}

        //internal UserSecurityKeyArray getSecurityKeys(AbstractConnection cxn, string DUZ)
        //{
        //    UserSecurityKeyArray result = new UserSecurityKeyArray();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        UserSecurityKey[] keys = api.getSecurityKeys(cxn, DUZ);
        //        result = new UserSecurityKeyArray(keys);
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        //public TextTO addSecurityKeyForContext(string DUZ, string context)
        //{
        //    return addSecurityKeyForContext(mySession.cxnMgr.LoginConnection, DUZ, context);
        //}

        //public TextTO addSecurityKeyForContext(string sitecode, string DUZ, string context)
        //{
        //    if (sitecode == "")
        //    {
        //        TextTO result = new TextTO();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return addSecurityKeyForContext(mySession.cxns.getConnection(sitecode), DUZ, context);
        //}

        //internal TextTO addSecurityKeyForContext(Connection cxn, string DUZ, string context)
        //{
        //    TextTO result = new TextTO();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    else if (context == "")
        //    {
        //        result.fault = new FaultTO("Missing context");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        string s = api.addSecurityKeyForContext(cxn, DUZ, context);
        //        result = new TextTO(s);
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        //public TextTO addSecurityKey(string DUZ, string securityKey)
        //{
        //    return addSecurityKey(mySession.cxnMgr.LoginConnection, DUZ, securityKey);
        //}

        //public TextTO addSecurityKey(string sitecode, string DUZ, string securityKey)
        //{
        //    if (sitecode == "")
        //    {
        //        TextTO result = new TextTO();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return addSecurityKey(mySession.cxns.getConnection(sitecode), DUZ, securityKey);
        //}

        //internal TextTO addSecurityKey(Connection cxn, string DUZ, string securityKey)
        //{
        //    TextTO result = new TextTO();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    else if (securityKey == "")
        //    {
        //        result.fault = new FaultTO("Missing security key");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        string s = api.addSecurityKey(cxn, DUZ, securityKey);
        //        result = new TextTO(s);
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        //public TextTO removeSecurityKey(string DUZ, string securityKey)
        //{
        //    return removeSecurityKey(mySession.cxnMgr.LoginConnection, DUZ, securityKey);
        //}

        //public TextTO removeSecurityKey(string sitecode, string DUZ, string securityKey)
        //{
        //    if (sitecode == "")
        //    {
        //        TextTO result = new TextTO();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return removeSecurityKey(mySession.cxns.getConnection(sitecode), DUZ, securityKey);
        //}

        //internal TextTO removeSecurityKey(Connection cxn, string DUZ, string securityKey)
        //{
        //    TextTO result = new TextTO();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    else if (securityKey == "")
        //    {
        //        result.fault = new FaultTO("Missing security key");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        string s = api.removeSecurityKey(cxn, DUZ, securityKey);
        //        result = new TextTO(s);
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        //public UserOptionArray getMenuOptions(string DUZ)
        //{
        //    return getMenuOptions(mySession.cxnMgr.LoginConnection, DUZ);
        //}

        //public UserOptionArray getMenuOptions(string sitecode, string DUZ)
        //{
        //    if (sitecode == "")
        //    {
        //        UserOptionArray result = new UserOptionArray();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return getMenuOptions(mySession.cxns.getConnection(sitecode), DUZ);
        //}

        //internal UserOptionArray getMenuOptions(Connection cxn, string DUZ)
        //{
        //    UserOptionArray result = new UserOptionArray();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        UserOption[] o = api.getMenuOptions(cxn, DUZ);
        //        result = new UserOptionArray(o);
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        //public UserOptionArray getDelegatedOptions(string DUZ)
        //{
        //    return getDelegatedOptions(mySession.cxnMgr.LoginConnection, DUZ);
        //}

        //public UserOptionArray getDelegatedOptions(string sitecode, string DUZ)
        //{
        //    if (sitecode == "")
        //    {
        //        UserOptionArray result = new UserOptionArray();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return getDelegatedOptions(mySession.cxns.getConnection(sitecode), DUZ);
        //}

        //internal UserOptionArray getDelegatedOptions(Connection cxn, string DUZ)
        //{
        //    UserOptionArray result = new UserOptionArray();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        UserOption[] o = api.getDelegatedOptions(cxn, DUZ);
        //        result = new UserOptionArray(o);
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        //public TextTO addMenuOption(string context, string DUZ)
        //{
        //    return addMenuOption(mySession.cxnMgr.LoginConnection, context, DUZ);
        //}

        //public TextTO addMenuOption(string sitecode, string context, string DUZ)
        //{
        //    if (sitecode == "")
        //    {
        //        TextTO result = new TextTO();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return addMenuOption(mySession.cxns.getConnection(sitecode), context, DUZ);
        //}

        //internal TextTO addMenuOption(Connection cxn, string context, string DUZ)
        //{
        //    TextTO result = new TextTO();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    else if (context == "")
        //    {
        //        result.fault = new FaultTO("Missing context");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        string s = api.addMenuOption(cxn, context, DUZ);
        //        result = new TextTO(s);
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        //public TextTO addDelegatedOption(string context, string DUZ)
        //{
        //    return addDelegatedOption(mySession.cxnMgr.LoginConnection, context, DUZ);
        //}

        //public TextTO addDelegatedOption(string sitecode, string context, string DUZ)
        //{
        //    if (sitecode == "")
        //    {
        //        TextTO result = new TextTO();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return addDelegatedOption(mySession.cxns.getConnection(sitecode), context, DUZ);
        //}

        //internal TextTO addDelegatedOption(Connection cxn, string context, string DUZ)
        //{
        //    TextTO result = new TextTO();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    else if (context == "")
        //    {
        //        result.fault = new FaultTO("Missing context");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        string s = api.addDelegatedOption(cxn, context, DUZ);
        //        result = new TextTO(s);
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        //public TextTO removeMenuOption(string optNum, string DUZ)
        //{
        //    return removeMenuOption(mySession.cxnMgr.LoginConnection, optNum, DUZ);
        //}

        //public TextTO removeMenuOption(string sitecode, string optNum, string DUZ)
        //{
        //    if (sitecode == "")
        //    {
        //        TextTO result = new TextTO();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return removeMenuOption(mySession.cxns.getConnection(sitecode), optNum, DUZ);
        //}

        //internal TextTO removeMenuOption(Connection cxn, string optNum, string DUZ)
        //{
        //    TextTO result = new TextTO();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    else if (optNum == "")
        //    {
        //        result.fault = new FaultTO("Missing optNum");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        api.removeMenuOption(cxn, optNum, DUZ);
        //        result = new TextTO("OK");
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        //public TextTO removeDelegatedOption(string optNum, string DUZ)
        //{
        //    return removeDelegatedOption(mySession.cxnMgr.LoginConnection, optNum, DUZ);
        //}

        //public TextTO removeDelegatedOption(string sitecode, string optNum, string DUZ)
        //{
        //    if (sitecode == "")
        //    {
        //        TextTO result = new TextTO();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return removeDelegatedOption(mySession.cxns.getConnection(sitecode), optNum, DUZ);
        //}

        //internal TextTO removeDelegatedOption(Connection cxn, string optNum, string DUZ)
        //{
        //    TextTO result = new TextTO();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    else if (optNum == "")
        //    {
        //        result.fault = new FaultTO("Missing optNum");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        api.removeDelegatedOption(cxn, optNum, DUZ);
        //        result = new TextTO("OK");
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        public TextTO isValidEsig(string esig)
        {
            TextTO result = new TextTO();
            string msg    = MdwsUtils.isAuthorizedConnection(mySession);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (String.IsNullOrEmpty(esig))
            {
                result.fault = new FaultTO("No E-Signature provided.", "Need to provide an E-Signature code");
            }
            if (result.fault != null)
            {
                return(result);
            }
            return(isValidEsig(mySession.ConnectionSet.BaseConnection, esig));
        }
Пример #30
0
        public TextTO isCosignerRequired(string sitecode, string noteDefinitionIEN, string authorDUZ)
        {
            TextTO result = new TextTO();
            string msg    = MdwsUtils.isAuthorizedConnection(_mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (noteDefinitionIEN == "")
            {
                result.fault = new FaultTO("Missing noteDefinitionIEN");
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = _mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn = _mySession.ConnectionSet.getConnection(sitecode);
                bool f = false;
                if (authorDUZ == "")
                {
                    f = _api.isCosignerRequired(cxn, _mySession.User.Uid, noteDefinitionIEN);
                }
                else
                {
                    f = _api.isCosignerRequired(cxn, _mySession.User.Uid, noteDefinitionIEN, authorDUZ);
                }
                result.text = (f ? "Y" : "N");
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }