Example #1
0
        /// <summary></summary>
        public static void SendData(Program ProgramCur, Patient pat)
        {
            string path = Programs.GetProgramPath(ProgramCur);

            if (pat == null)
            {
                //There are two options here, depending on the bridge
                //1. Launch program without any patient.
                try {
                    Process.Start(path);                    //should start AaTemplate without bringing up a pt.
                }
                catch {
                    MessageBox.Show(path + " is not available.");
                }
                //2. Tell user to pick a patient first.
                MsgBox.Show("AaTemplate", "Please select a patient first.");
                //return in both cases
                return;
            }
            //It's common to build a string
            string str = "";

            //ProgramProperties.GetPropVal() is the way to get program properties.
            if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0")
            {
                str += "Id=" + pat.PatNum.ToString() + " ";
            }
            else
            {
                str += "Id=" + Tidy(pat.ChartNumber) + " ";
            }
            //Nearly always tidy the names in one way or another
            str += Tidy(pat.LName) + " ";
            //If birthdates are optional, only send them if they are valid.
            if (pat.Birthdate.Year > 1880)
            {
                str += pat.Birthdate.ToString("MM/dd/yyyy");
            }
            //This patterns shows a way to handle gender unknown when gender is optional.
            if (pat.Gender == PatientGender.Female)
            {
                str += "F ";
            }
            else if (pat.Gender == PatientGender.Male)
            {
                str += "M ";
            }
            try {
                Process.Start(path, str);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        ///<summary>Launches the program using a combination of command line characters and the patient.Cur data.</summary>
        public static void SendData(Program ProgramCur, Patient pat)
        {
            string path = Programs.GetProgramPath(ProgramCur);
            List <ProgramProperty> ForProgram = ProgramProperties.GetForProgram(ProgramCur.ProgramNum);

            if (pat != null)
            {
                //We remove double-quotes from the first and last name of the patient so extra double-quotes don't
                //cause confusion in the command line parameters for Apteryx.
                string info = "\"" + pat.LName.Replace("\"", "") + ", " + pat.FName.Replace("\"", "") + "::";
                if (pat.SSN.Length == 9 && pat.SSN != "000000000")            //SSN is optional.  eCW customers often use 000-00-0000 for any patient that does not have an SSN (mostly young children).
                {
                    info += pat.SSN.Substring(0, 3) + "-"
                            + pat.SSN.Substring(3, 2) + "-"
                            + pat.SSN.Substring(5, 4);
                }
                //Patient id can be any string format
                ProgramProperty PPCur = ProgramProperties.GetCur(ForProgram, "Enter 0 to use PatientNum, or 1 to use ChartNum");
                if (PPCur.PropertyValue == "0")
                {
                    info += "::" + pat.PatNum.ToString();
                }
                else
                {
                    info += "::" + pat.ChartNumber;
                }
                info += "::" + pat.Birthdate.ToShortDateString() + "::";
                if (pat.Gender == PatientGender.Female)
                {
                    info += "F";
                }
                else
                {
                    info += "M";
                }
                info += "\"";
                try{
                    //commandline default is /p
                    ODFileUtils.ProcessStart(path, ProgramCur.CommandLine + info);
                }
                catch {
                    MessageBox.Show(path + " is not available, or there is an error in the command line options.");
                }
            }            //if patient is loaded
            else
            {
                try{
                    ODFileUtils.ProcessStart(path);                    //should start Apteryx without bringing up at pt.
                }
                catch {
                    MessageBox.Show(path + " is not available.");
                }
            }
        }
Example #3
0
    private CompiledCodeProperties Compile(ProgramProperties programProperties)
    {
        switch (programProperties.Languages)
        {
        case SupportedProgrammingLanguages.Languages.Csharp:
            return(CallCsharpCompiler(programProperties));

        default:
            return(CallCsharpCompiler(programProperties));
        }
    }
Example #4
0
    private ExecutedCodeProperties Execute(ProgramProperties programProperties)
    {
        switch (programProperties.Languages)
        {
        case SupportedProgrammingLanguages.Languages.Csharp:
            return(CallCsharpExecuter(programProperties, _excecutedCodeProperties));

        default:
            return(CallCsharpExecuter(programProperties, _excecutedCodeProperties));
        }
    }
Example #5
0
        ///<summary>Launches the program using command line.</summary>
        public static void SendData(Program ProgramCur, Patient pat)
        {
            string  path = Programs.GetProgramPath(ProgramCur);
            Process pibridge;
            List <ProgramProperty> ForProgram = ProgramProperties.GetForProgram(ProgramCur.ProgramNum);

            try{
                if (pat != null)
                {
                    ProgramProperty PPCur = ProgramProperties.GetCur(ForProgram, "Enter 0 to use PatientNum, or 1 to use ChartNum");
                    string          id    = "";
                    if (PPCur.PropertyValue == "0")
                    {
                        id = pat.PatNum.ToString();
                    }
                    else
                    {
                        id = pat.ChartNumber;
                    }
                    string lname = pat.LName.Replace("\"", "").Replace(",", "");
                    string fname = pat.FName.Replace("\"", "").Replace(",", "");
                    if (pat.Birthdate.Year < 1880)
                    {
                        throw new ODException(Lans.g("Progeny", "Invalid birthdate for") + " " + pat.GetNameFL());
                    }
                    //Progeny software uses local computer's date format settings, per PIBridge.exe documentation (launch exe to view).
                    string birthdate = pat.Birthdate.ToShortDateString();
                    pibridge = new Process();
                    pibridge.StartInfo.CreateNoWindow  = false;
                    pibridge.StartInfo.UseShellExecute = true;
                    pibridge.StartInfo.FileName        = path;
                    //Double-quotes are removed from id and name to prevent malformed command. ID could have double-quote if chart number.
                    pibridge.StartInfo.Arguments = "cmd=open id=\"" + id.Replace("\"", "") + "\" first=\"" + fname.Replace("\"", "") + "\" last=\""
                                                   + lname.Replace("\"", "") + "\" dob=\"" + birthdate.Replace("\"", "") + "\"";
                    ODFileUtils.ProcessStart(pibridge);
                }                //if patient is loaded
                else
                {
                    //Should start Progeny without bringing up a pt.
                    pibridge = new Process();
                    pibridge.StartInfo.CreateNoWindow  = false;
                    pibridge.StartInfo.UseShellExecute = true;
                    pibridge.StartInfo.FileName        = path;
                    pibridge.StartInfo.Arguments       = "cmd=start";
                    ODFileUtils.ProcessStart(pibridge);
                }
            }
            catch (ODException ex) {
                MessageBox.Show(ex.Message);
            }
            catch {
                MessageBox.Show(path + " is not available.");
            }
        }
Example #6
0
 ///<summary>Launches the program as a comObject, and passes CADI OLE commands to the program.
 ///See https://stackoverflow.com/questions/29787825/how-to-interact-with-another-programs-with-ole-automation-in-c </summary>
 public void SendData(Program ProgramCur, Patient pat)
 {
     try {
         if (_comObject == null)
         {
             Type progType = Type.GetTypeFromProgID(PROGRAM_ID);
             _comObject = Activator.CreateInstance(progType);
             //register the handle of this window with CADI to listen for application closing events
             int result = _comObject.OleClientWindowHandle(_windowHandle, OLECLIENTNOTIFY_APPLICATIONEXIT, WM_CLOSE, 0, 0);
             if (result != 0)                    //0=success; 14=Invalid argument; -1=Unspecified error.
             {
                 throw new Exception("Unable to communicate with CADI. Verify it is installed and try again.");
             }
         }
         if (pat == null)
         {
             return;
         }
         //Set patient info
         _comObject.OleBringToFrontApp();
         _comObject.OleBeginTransaction();
         string id = "";
         if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, ProgramProperties.PropertyDescs.PatOrChartNum) == "0")
         {
             id = pat.PatNum.ToString();
         }
         else
         {
             id = pat.ChartNumber;
         }
         _comObject.OleSetPatientName(pat.LName + ", " + pat.FName);
         _comObject.OleSetPatientDateOfBirth(pat.Birthdate.Subtract(TDATE_START).TotalDays);
         _comObject.OleSetPatientBiologicalAge(pat.Age);
         _comObject.OleSetPatientSex(pat.Gender == PatientGender.Female ? "F" : "M");
         //Send patient images file path
         string imagePath = ProgramProperties.GetPropVal(ProgramCur.ProgramNum, ProgramProperties.PropertyDescs.ImageFolder);
         _comObject.OleLoadPicLib(CodeBase.ODFileUtils.CombinePaths(imagePath, id));
         _comObject.OleEndTransaction();
     }
     catch (COMException) {            //_comObject cannot be referenced except to set to null in this context. Anything else would throw an exception.
         _comObject = null;
         CloseWindow();
         throw new Exception("Unable to access CADI. Verify it is installed and try again.");
     }
     catch (Exception e) {             //Not a COMException so it is ok to reference the _comObject.
         bool throwFriendly = _comObject == null;
         CloseWindow();
         if (throwFriendly)
         {
             throw new Exception("Unable to open CADI. Verify it is installed and try again.");
         }
         throw e;
     }
 }
Example #7
0
        ///<summary>Sends data for Patient.Cur to the InfoFile and launches the program.</summary>
        public static void SendData(Program ProgramCur, Patient pat)
        {
            string          path       = Programs.GetProgramPath(ProgramCur);
            ArrayList       ForProgram = ProgramProperties.GetForProgram(ProgramCur.ProgramNum);
            ProgramProperty PPCur      = ProgramProperties.GetCur(ForProgram, "InfoFile path");
            string          infoFile   = PPCur.PropertyValue;

            if (pat != null)
            {
                try {
                    //patientID can be any string format, max 8 char.
                    //There is no validation to ensure that length is 8 char or less.
                    PPCur = ProgramProperties.GetCur(ForProgram, "Enter 0 to use PatientNum, or 1 to use ChartNum");
                    string id = "";
                    if (PPCur.PropertyValue == "0")
                    {
                        id = pat.PatNum.ToString();
                    }
                    else
                    {
                        id = pat.ChartNumber;
                    }
                    using (StreamWriter sw = new StreamWriter(infoFile, false)) {
                        sw.WriteLine(pat.LName + ", " + pat.FName
                                     + "  " + pat.Birthdate.ToShortDateString()
                                     + "  (" + id + ")");
                        sw.WriteLine("PN=" + id);
                        //sw.WriteLine("PN="+pat.PatNum.ToString());
                        sw.WriteLine("LN=" + pat.LName);
                        sw.WriteLine("FN=" + pat.FName);
                        sw.WriteLine("BD=" + pat.Birthdate.ToShortDateString());
                        if (pat.Gender == PatientGender.Female)
                        {
                            sw.WriteLine("SX=F");
                        }
                        else
                        {
                            sw.WriteLine("SX=M");
                        }
                    }
                    Process.Start(path, "@" + infoFile);
                } catch {
                    MessageBox.Show(path + " is not available.");
                }
            }            //if patient is loaded
            else
            {
                try {
                    Process.Start(path);                    //should start Dexis without bringing up a pt.
                } catch {
                    MessageBox.Show(path + " is not available.");
                }
            }
        }
Example #8
0
 public CsharpCodeExecuter(ProgramProperties programProperties, ExecutedCodeProperties excecutedCodeProperties)
 {
     if (excecutedCodeProperties.CompiledCodeProp.IsCompiledSuccessfully == false ||
         excecutedCodeProperties.CompiledCodeProp.SuccessfulluyCompiledObject == null)
     {
         throw new Exception("Can't execute a unsuccessfull compiled assembly or a null assembly object.");
     }
     _assembly = excecutedCodeProperties.CompiledCodeProp.SuccessfulluyCompiledObject as Assembly;
     _excecutedCodeProperties = excecutedCodeProperties;
     _programProperties       = programProperties;
 }
Example #9
0
        /// <summary></summary>
        public static void SendData(Program ProgramCur, Patient pat)
        {
            if (pat == null)
            {
                MsgBox.Show("Guru", "Please select a patient first.");
                return;
            }
            int errorNum = MVStart();

            if (errorNum != 0)
            {
                MsgBox.Show("Guru", "An error has occured.");
                return;
            }
            MVPatient mvPatient = new MVPatient();

            mvPatient.LastName  = Tidy(pat.LName, 64);
            mvPatient.FirstName = Tidy(pat.FName, 64);
            if (pat.Gender == PatientGender.Male)
            {
                mvPatient.Sex = Tidy("M", 1);
            }
            else if (pat.Gender == PatientGender.Female)
            {
                mvPatient.Sex = Tidy("F", 1);
            }
            else if (pat.Gender == PatientGender.Unknown)
            {
                mvPatient.Sex = Tidy("0", 1);
            }
            mvPatient.BirthDate = Tidy(pat.Birthdate.ToString("MMddyyyy"), 8);
            if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0")
            {
                mvPatient.ID = Tidy(pat.PatNum.ToString(), 64);
            }
            else
            {
                mvPatient.ID = Tidy(pat.ChartNumber.ToString(), 64);
            }
            if (pat.ImageFolder == "")           //Could happen if the images module has not been visited for a new patient.
            {
                Patient patOld = pat.Copy();
                pat.ImageFolder = pat.LName + pat.FName + pat.PatNum;
                Patients.Update(pat, patOld);
            }
            string imagePath = CodeBase.ODFileUtils.CombinePaths(ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Guru image path"), pat.ImageFolder);

            mvPatient.Directory = Tidy(imagePath, 259);
            if (MVSendPatient(mvPatient) != 0)
            {
                MsgBox.Show("Guru", "An error has occured.");
            }
        }
Example #10
0
        ///<summary>Launches the program using a combination of command line characters and the patient.Cur data.</summary>
        public static void SendData(Program ProgramCur, Patient pat)
        {
            ArrayList ForProgram = ProgramProperties.GetForProgram(ProgramCur.ProgramNum);

            if (pat != null)
            {
                //We remove double-quotes from the first and last name of the patient so extra double-quotes don't
                //cause confusion in the command line parameters for Apteryx.
                string info = "\"" + pat.LName.Replace("\"", "") + ", " + pat.FName.Replace("\"", "") + "::";
                if (pat.SSN.Length == 9)
                {
                    info += pat.SSN.Substring(0, 3) + "-"
                            + pat.SSN.Substring(3, 2) + "-"
                            + pat.SSN.Substring(5, 4);
                }
                //Patient id can be any string format
                ProgramProperty PPCur = ProgramProperties.GetCur(ForProgram, "Enter 0 to use PatientNum, or 1 to use ChartNum");
                if (PPCur.PropertyValue == "0")
                {
                    info += "::" + pat.PatNum.ToString();
                }
                else
                {
                    info += "::" + pat.ChartNumber;
                }
                info += "::" + pat.Birthdate.ToShortDateString() + "::";
                if (pat.Gender == PatientGender.Female)
                {
                    info += "F";
                }
                else
                {
                    info += "M";
                }
                info += "\"";
                try{
                    //commandline default is /p
                    Process.Start(ProgramCur.Path, ProgramCur.CommandLine + info);
                }
                catch {
                    MessageBox.Show(ProgramCur.Path + " is not available, or there is an error in the command line options.");
                }
            }            //if patient is loaded
            else
            {
                try{
                    Process.Start(ProgramCur.Path);                    //should start Apteryx without bringing up a pt.
                }
                catch {
                    MessageBox.Show(ProgramCur.Path + " is not available.");
                }
            }
        }
        public override async Task <bool> UpdateItemsAsync(int maxItems, UpdateReason updateReason)
        {
            if (!TryInitTvHandler() || _tvHandler.ScheduleControl == null)
            {
                return(false);
            }

            if (!updateReason.HasFlag(UpdateReason.Forced) && !updateReason.HasFlag(UpdateReason.PeriodicMinute))
            {
                return(true);
            }

            var scheduleResult = await _tvHandler.ScheduleControl.GetSchedulesAsync();

            if (!scheduleResult.Success)
            {
                return(false);
            }

            var schedules        = scheduleResult.Result;
            var scheduleSortList = new List <Tuple <ISchedule, ProgramProperties> >();

            foreach (ISchedule schedule in schedules)
            {
                var programResult = await _tvHandler.ScheduleControl.GetProgramsForScheduleAsync(schedule);

                if (!programResult.Success || programResult.Result.Count == 0)
                {
                    continue;
                }
                ProgramProperties programProperties = new ProgramProperties();
                programProperties.SetProgram(programResult.Result.OrderBy(p => p.StartTime).First());
                scheduleSortList.Add(new Tuple <ISchedule, ProgramProperties>(schedule, programProperties));
            }
            scheduleSortList.Sort(ChannelAndProgramStartTimeComparison);

            var scheduleList = new List <Tuple <ISchedule, ProgramProperties> >(scheduleSortList.Take(maxItems));

            if (_currentSchedules.Select(s => s.Item1.ScheduleId).SequenceEqual(scheduleList.Select(s => s.Item1.ScheduleId)))
            {
                return(true);
            }

            ListItem[] items = scheduleList.Select(s => CreateScheduleItem(s.Item1, s.Item2)).ToArray();
            lock (_allItems.SyncRoot)
            {
                _currentSchedules = scheduleList;
                _allItems.Clear();
                CollectionUtils.AddAll(_allItems, items);
            }
            _allItems.FireChange();
            return(true);
        }
Example #12
0
        /// <summary></summary>
        public static void SendData(Program ProgramCur, Patient pat)
        {
            string path = Programs.GetProgramPath(ProgramCur);

            if (pat == null)           //Launch program without any patient.
            {
                try {
                    ODFileUtils.ProcessStart(path);
                }
                catch {
                    MessageBox.Show(path + " is not available.");
                }
                return;
            }
            //Documentation for command line arguments is very vague.
            //See \\serverfiles\Storage\OPEN DENTAL\Programmers Documents\Bridge Info\RemoteExecuter for documentation on how this is being used by NADG
            List <string> listArgs = new List <string>();

            listArgs.Add(ProgramCur.CommandLine);
            listArgs.Add("-first=\"" + Tidy(pat.FName) + "\"");
            listArgs.Add("-last=\"" + Tidy(pat.LName) + "\"");
            if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0")
            {
                listArgs.Add("-id=\"" + pat.PatNum.ToString() + "\"");
            }
            else
            {
                listArgs.Add("-id=\"" + Tidy(pat.ChartNumber) + "\"");
            }
            //Required. Should update automatically based on pat id, in the case where first bridged with b-date 01/01/0001, although we don't know for sure
            listArgs.Add("-DOB=\"" + pat.Birthdate.ToString("yyyy-MM-dd") + "\"");
            if (pat.Gender == PatientGender.Female)
            {
                //Probably what they use for female, based on their example for male, although we do not know for sure because the specification does not say.
                listArgs.Add("-sex=\"f\"");
            }
            else if (pat.Gender == PatientGender.Male)
            {
                listArgs.Add("-sex=\"m\"");                //This option is valid, because it is part of the example inside the specification.
            }
            else
            {
                //Probably what they use for unknown (if unknown is even an option), based on their example for male, although we do not know for sure because
                //the specification does not say.
                listArgs.Add("-sex=\"u\"");
            }
            try {
                ODFileUtils.ProcessStart(path, string.Join(" ", listArgs));
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Example #13
0
        private static ProgramListItem GetNoProgramPlaceholder(int channelId, IProgram previousProgram = null)
        {
            IProgram          placeHolder       = GetNoProgram(channelId, previousProgram);
            ProgramProperties programProperties = new ProgramProperties
            {
                Title     = placeHolder.Title,
                StartTime = placeHolder.StartTime,
                EndTime   = placeHolder.EndTime
            };

            return(new ProgramListItem(programProperties));
        }
Example #14
0
        ///<summary></summary>
        public static void SendData(Program ProgramCur, Patient pat)
        {
            string path = Programs.GetProgramPath(ProgramCur);

            //filepath.exe -patid 123 -fname John -lname Doe -dob 01/25/1962 -ssn 123456789 -gender M
            if (pat == null)
            {
                MessageBox.Show("Please select a patient first");
                return;
            }
            string info = "-patid ";

            if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0")
            {
                info += pat.PatNum.ToString() + " ";
            }
            else
            {
                info += pat.ChartNumber + " ";
            }
            info += "-fname " + Tidy(pat.FName) + " "
                    + "-lname " + Tidy(pat.LName) + " ";
            if (pat.Birthdate.Year > 1880)
            {
                info += "-dob " + pat.Birthdate.ToShortDateString() + " ";
            }
            else
            {
                info += "-dob  ";
            }
            if (pat.SSN.Replace("0", "").Trim() != "")          //An SSN which is all zeros will be treated as a blank SSN.  Needed for eCW, since eCW sets SSN to 000-00-0000 if the patient does not have an SSN.
            {
                info += "-ssn " + pat.SSN + " ";
            }
            else
            {
                info += "-ssn  ";
            }
            if (pat.Gender == PatientGender.Female)
            {
                info += "-gender F";
            }
            else
            {
                info += "-gender M";
            }
            try {
                ODFileUtils.ProcessStart(path, info);
            }
            catch {
                MessageBox.Show(path + " is not available.");
            }
        }
Example #15
0
        ///<summary>Financial transaction segment.</summary>
        private void FT1(List <Procedure> listProcs, bool justPDF)
        {
            if (justPDF)
            {
                return;                //FT1 segment is not necessary when sending only a PDF.
            }
            ProcedureCode procCode;

            for (int i = 0; i < listProcs.Count; i++)
            {
                seg = new SegmentHL7(SegmentNameHL7.FT1);
                seg.SetField(0, "FT1");
                seg.SetField(1, (i + 1).ToString());
                seg.SetField(4, listProcs[i].ProcDate.ToString("yyyyMMdd"));
                seg.SetField(5, listProcs[i].ProcDate.ToString("yyyyMMdd"));
                seg.SetField(6, "CG");
                seg.SetField(10, "1.0");
                seg.SetField(16, "");               //location code and description???
                seg.SetField(19, listProcs[i].DiagnosticCode);
                Provider prov = Providers.GetProv(listProcs[i].ProvNum);
                seg.SetField(20, prov.EcwID, prov.LName, prov.FName, prov.MI);            //performed by provider.
                seg.SetField(21, prov.EcwID, prov.LName, prov.FName, prov.MI);            //ordering provider.
                seg.SetField(22, listProcs[i].ProcFee.ToString("F2"));
                procCode = ProcedureCodes.GetProcCode(listProcs[i].CodeNum);
                if (procCode.ProcCode.Length > 5 && procCode.ProcCode.StartsWith("D"))
                {
                    seg.SetField(25, procCode.ProcCode.Substring(0, 5));                  //Remove suffix from all D codes.
                }
                else
                {
                    seg.SetField(25, procCode.ProcCode);
                }
                if (procCode.TreatArea == TreatmentArea.ToothRange)
                {
                    seg.SetField(26, listProcs[i].ToothRange, "");
                }
                else if (procCode.TreatArea == TreatmentArea.Surf)              //probably not necessary
                {
                    seg.SetField(26, Tooth.ToInternat(listProcs[i].ToothNum), Tooth.SurfTidyForClaims(listProcs[i].Surf, listProcs[i].ToothNum));
                }
                //this property will not exist if using Oracle, eCW will never use Oracle
                else if (procCode.TreatArea == TreatmentArea.Quad && ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.eClinicalWorks), "IsQuadAsToothNum") == "1")
                {
                    seg.SetField(26, listProcs[i].Surf, "");
                }
                else
                {
                    seg.SetField(26, Tooth.ToInternat(listProcs[i].ToothNum), listProcs[i].Surf);
                }
                msg.Segments.Add(seg);
            }
        }
Example #16
0
        ///<summary>Launches the program using a combination of command line characters and the patient.Cur data.
        ///Arguments: tscan.exe [-fFirstname [-mMiddlename] -lLastname -iPatientid [-dBirthday] [-jBirthmonth] [-yBirthyear] [-gGender]]
        ///Example: tscan.exe -fBrent -lThompson -iBT1000 -d07 -j02 -y1962 -g2</summary>
        public static void SendData(Program ProgramCur, Patient pat)
        {
            string path = Programs.GetProgramPath(ProgramCur);

            if (pat == null)
            {
                try {
                    Process.Start(path);                    //should start Tscan without bringing up a pt.
                }
                catch {
                    MessageBox.Show(path + " is not available.");
                }
                return;
            }
            string info = "-f" + Tidy(pat.FName) + " "; //First name can only be alpha-numeric, so we remove non-alpha-numeric characters.

            if (Tidy(pat.MiddleI) != "")                //Only send middle name if available, since it is optional.
            {
                info += "-m" + Tidy(pat.MiddleI) + " "; //Middle name can only be alpha-numeric, so we remove non-alpha-numeric characters.
            }
            info += "-l" + Tidy(pat.LName) + " ";       //Last name can only be alpha-numeric, so we remove non-alpha-numeric characters.
            if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0")
            {
                info += "-i" + pat.PatNum.ToString() + " ";
            }
            else
            {
                info += "-i" + Tidy(pat.ChartNumber) + " ";          //Patient id only alpha-numeric as required.
            }
            //Birthdate is optional, so we only send if valid.
            if (pat.Birthdate.Year > 1880)
            {
                info += "-d" + pat.Birthdate.Day.ToString().PadLeft(2, '0') + " ";   //The example in specification shows days with two digits, so we pad.
                info += "-j" + pat.Birthdate.Month.ToString().PadLeft(2, '0') + " "; //The example in specification shows months with two digits, so we pad.
                info += "-y" + pat.Birthdate.Year.ToString() + " ";                  //The example specification shows years 4 digits long.
            }
            //Gender is optional, so we only send if not Unknown.
            if (pat.Gender == PatientGender.Female)
            {
                info += "-g1 ";
            }
            else if (pat.Gender == PatientGender.Male)
            {
                info += "-g2 ";
            }
            try {
                Process.Start(path, info);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
        private void FillProgramsList()
        {
            _programsList.Clear();

            bool isSingle = false;
            bool isSeries = false;

            foreach (IProgram program in _programs)
            {
                IChannel channel;
                if (!_tvHandler.ChannelAndGroupInfo.GetChannel(program.ChannelId, out channel))
                {
                    channel = null;
                }
                // Use local variable, otherwise delegate argument is not fixed
                ProgramProperties programProperties = new ProgramProperties();
                IProgram          currentProgram    = program;
                programProperties.SetProgram(currentProgram, channel);

                if (ProgramComparer.Instance.Equals(_selectedProgram, program))
                {
                    isSingle = programProperties.IsScheduled;
                    isSeries = programProperties.IsSeriesScheduled;
                }

                ProgramListItem item = new ProgramListItem(programProperties)
                {
                    Command = new MethodDelegateCommand(() => CreateOrDeleteSchedule(currentProgram))
                };
                item.AdditionalProperties["PROGRAM"] = currentProgram;
                item.Selected = _lastProgramId == program.ProgramId; // Restore focus
                if (channel != null)
                {
                    item.SetLabel("ChannelName", channel.Name);
                    item.SetLabel("ChannelLogoType", channel.GetFanArtMediaType());
                }

                _programsList.Add(item);
            }

            // "Record" buttons are related to properties, for schedules we need to keep them to "Cancel record" state.
            if (_isScheduleMode)
            {
                isSingle = isSeries = _selectedSchedule != null;
            }

            IsSingleRecordingScheduled = isSingle;
            IsSeriesRecordingScheduled = isSeries;

            _programsList.FireChange();
        }
Example #18
0
        ///<summary>Launches the program using command line.</summary>
        public static void SendData(Program ProgramCur, Patient pat)
        {
            string path = Programs.GetProgramPath(ProgramCur);
            //Usage: [Application Path]PerioPal "PtChart; PtName ; PtBday; PtMedAlert;"
            List <ProgramProperty> ForProgram = ProgramProperties.GetForProgram(ProgramCur.ProgramNum);;

            if (pat == null)
            {
                return;
            }
            string          info  = "\"";
            ProgramProperty PPCur = ProgramProperties.GetCur(ForProgram, "Enter 0 to use PatientNum, or 1 to use ChartNum");;

            if (PPCur.PropertyValue == "0")
            {
                info += pat.PatNum.ToString();
            }
            else
            {
                info += Cleanup(pat.ChartNumber);
            }
            info += ";"
                    + Cleanup(pat.LName) + ";"
                    + Cleanup(pat.FName) + ";"
                    + pat.Birthdate.ToShortDateString() + ";";
            bool hasMedicalAlert = false;

            if (pat.MedUrgNote != "")
            {
                hasMedicalAlert = true;
            }
            if (pat.Premed)
            {
                hasMedicalAlert = true;
            }
            if (hasMedicalAlert)
            {
                info += "Y;";
            }
            else
            {
                info += "N;";
            }
            //MessageBox.Show(info);
            try{
                ODFileUtils.ProcessStart(path, info);
            }
            catch {
                MessageBox.Show(path + " " + info + " is not available.");
            }
        }
Example #19
0
        ///<summary>Sends data for Patient.Cur by command line interface.</summary>
        public static void SendData(Program ProgramCur, Patient pat)
        {
            string path = Programs.GetProgramPath(ProgramCur);

            if (pat == null)
            {
                MsgBox.Show("VixWinNumbered", "Please select a patient first.");
                return;
            }
            string ppImagePath = ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Image Path");

            if (ppImagePath.Trim() == "")
            {
                MsgBox.Show("VixWinNumbered", "Missing Image Path.");
                return;
            }
            string subDirNumbers = (pat.PatNum % 100).ToString().PadLeft(2, '0');       //Take the rightmost 2 numbers, preceeding with 0 if patnum<10
            string fullPath      = ODFileUtils.CombinePaths(ppImagePath.Trim(), subDirNumbers, pat.PatNum.ToString());

            if (!Directory.Exists(fullPath))
            {
                try {
                    Directory.CreateDirectory(fullPath);
                }
                catch {
                    MessageBox.Show(Lan.g("VixWinNumbered", "Patient image path could not be created.  This usually indicates a permission issue.  Path") + ":\r\n"
                                    + fullPath);
                    return;
                }
            }
            //Example: c:\vixwin\vixwin -I 123ABC -N Bill^Smith -P X:\VXImages\02\196402\
            string info = "-I ";

            if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0")
            {
                info += pat.PatNum.ToString();
            }
            else
            {
                info += pat.ChartNumber;                                                    //max 64 char
            }
            info += " -N " + pat.FName.Replace(" ", "") + "^" + pat.LName.Replace(" ", ""); //no spaces allowed
            info += " -P " + fullPath;                                                      //This is the Numbered Mode subdirectory
            try {
                Process.Start(path, info);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message + "\r\nFile and command line:\r\n" + path + " " + info);
            }
        }
Example #20
0
        ///<summary>Generates a single Unit Test ProgramProperty. This method refreshes the cache.</summary>
        public static ProgramProperty CreateProgramProperty(long programNum, string propertyDesc, long clinicNum, string propertyValue = "",
                                                            string computerName = "")
        {
            ProgramProperty prop = new ProgramProperty();

            prop.ProgramNum    = programNum;
            prop.PropertyDesc  = propertyDesc;
            prop.PropertyValue = propertyValue;
            prop.ComputerName  = computerName;
            prop.ClinicNum     = clinicNum;
            ProgramProperties.Insert(prop);
            ProgramProperties.RefreshCache();
            return(prop);
        }
        private static ProgramListItem GetNoProgramPlaceholder()
        {
            ILocalization loc   = ServiceRegistration.Get <ILocalization>();
            DateTime      today = FormatHelper.GetDay(DateTime.Now);

            ProgramProperties programProperties = new ProgramProperties(today, today.AddDays(1))
            {
                Title     = loc.ToString("[SlimTvClient.NoProgram]"),
                StartTime = today,
                EndTime   = today.AddDays(1)
            };

            return(new ProgramListItem(programProperties));
        }
Example #22
0
            ///<summary>Interface the XWeb Gateway and return an instance of XWebResponse. Goes to db and/or cache to get patient info and ProgramProperties for XWeb.</summary>
            public XWebResponse GenerateOutput()
            {
                Patient pat = OpenDentBusiness.Patients.GetPat(_patNum);

                if (pat == null)
                {
                    throw new ODException("Patient not found for PatNum: " + _patNum.ToString(), ODException.ErrorCodes.XWebProgramProperties);
                }
                _patNum  = pat.PatNum;
                _provNum = pat.PriProv;
                //Explicitly set ClinicNum=0, since a pat's ClinicNum will remain set if the user enabled clinics, assigned patients to clinics, and then
                //disabled clinics because we use the ClinicNum to determine which PayConnect or XCharge/XWeb credentials to use for payments.
                _clinicNum = 0;
                if (PrefC.HasClinicsEnabled)
                {
                    _clinicNum = pat.ClinicNum;
                }
                if (!OpenDentBusiness.PrefC.HasClinicsEnabled)                  //Patient.ClinicNum is unreliable if clinics have been turned off.
                {
                    _clinicNum = 0;
                }
                OpenDentBusiness.WebTypes.Shared.XWeb.WebPaymentProperties xwebProperties;
                ProgramProperties.GetXWebCreds(_clinicNum, out xwebProperties);
                if (ChargeSource == ChargeSource.PatientPortal && !xwebProperties.IsPaymentsAllowed)
                {
                    throw new ODException("Clinic or Practice has online payments disabled", ODException.ErrorCodes.XWebProgramProperties);
                }
                _xWebID     = xwebProperties.XWebID;
                _authKey    = xwebProperties.AuthKey;
                _terminalID = xwebProperties.TerminalID;
                XWebResponse response = CreateGatewayResponse(UploadData(GatewayInput, _gatewayUrl));

                response.PatNum            = _patNum;
                response.ProvNum           = _provNum;
                response.ClinicNum         = _clinicNum;
                response.DateTUpdate       = DateTime.Now;
                response.TransactionType   = _transactionType.ToString();
                response.TransactionStatus = XWebTransactionStatus.HpfPending;
                PostProcessOutput(response);
                if (InsertResponseIntoDb)
                {
                    XWebResponses.Insert(response);
                }
                if (WakeupMonitorThread)
                {
                    OnWakeupMonitor(response, new EventArgs());
                }
                return(response);
            }
Example #23
0
        ///<summary>Launches Patterson Imaging, logs user in, and opens current patient.</summary>
        public static void SendData(Program ProgramCur, Patient pat)
        {
            string path = Programs.GetProgramPath(ProgramCur);

            if (pat == null)
            {
                return;
            }
            string strPathToIni = ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "System path to Patterson Imaging ini");

            if (!strPathToIni.ToLower().EndsWith(".ini"))             //A customer specified an exe path here once, and then the exe file was overwritten.
            {
                MsgBox.Show("Patterson", "System path to Patterson Imaging ini is invalid in program link setup.");
                return;
            }
            Provider prov = Providers.GetProv(pat.PriProv);
            string   ssn  = Tidy(pat.SSN.ToString(), 9);

            if (ssn.Replace("-", "").Replace("0", "").Trim() == "")
            {
                ssn = "";              //We do not send if the ssn is all zeros, because Patterson treats ssn like a primary key if present. If more than one patient have the same ssn, then they are treated as the same patient.
            }
            try {
                VBbridges.Patterson.Launch(
                    Tidy(pat.FName, 40),
                    "",                    //Tidy(pat.MiddleI,1),//When there is no SSN and the name changes, Patterson creates a whole new patient record, which is troublesome for our customers.
                    Tidy(pat.LName, 40),
                    "",                    //Tidy(pat.Preferred,40),//When there is no SSN and the name changes, Patterson creates a whole new patient record, which is troublesome for our customers.
                    Tidy(pat.Address, 40),
                    Tidy(pat.City, 30),
                    Tidy(pat.State, 2),
                    Tidy(pat.Zip, 10),
                    ssn,                                                                                          //This only works with ssn in america with no punctuation
                    Tidy((pat.Gender == PatientGender.Male?"M":(pat.Gender == PatientGender.Female?"F":" ")), 1), //uses "M" for male "F" for female and " " for unkown
                    Tidy(pat.Birthdate.ToShortDateString(), 11),
                    LTidy(pat.PatNum.ToString(), 5),
                    LTidy(prov.ProvNum.ToString(), 3),
                    //LTidy(pat.PatNum.ToString(),5),//Limit is 5 characters, but that would only be exceeded if they are using random primary keys or they have a lot of data, neither case is common.
                    //LTidy(prov.ProvNum.ToString(),3),//Limit is 3 characters, but that would only be exceeded if they are using random primary keys or they have a lot of data, neither case is common.
                    Tidy(prov.FName, 40),
                    Tidy(prov.LName, 40),
                    path,
                    strPathToIni
                    );
            }
            catch {
                MessageBox.Show("Error launching Patterson Imaging.");
            }
        }
        private ListItem CreateProgramItem(IProgram program, IChannel channel)
        {
            ProgramProperties programProperties = new ProgramProperties();

            programProperties.SetProgram(program, channel);

            ProgramListItem item = new ProgramListItem(programProperties)
            {
                Command = new AsyncMethodDelegateCommand(() => SlimTvModelBase.TuneChannel(channel)),
            };

            item.SetLabel("ChannelName", channel.Name);
            item.AdditionalProperties["PROGRAM"] = program;
            return(item);
        }
        private ProgramListItem BuildProgramListItem(IProgram program, IChannel channel)
        {
            ProgramProperties programProperties = new ProgramProperties();
            IProgram          currentProgram    = program;

            programProperties.SetProgram(currentProgram, channel);

            ProgramListItem item = new ProgramListItem(programProperties)
            {
                Command = new MethodDelegateCommand(() => ShowProgramActions(currentProgram))
            };

            item.AdditionalProperties["PROGRAM"] = currentProgram;
            return(item);
        }
Example #26
0
    public static ProgramProperties GetProgramPropertiesForExecution(string codeText, string allProgramInputs)
    {
        ProgramProperties programProperties = new ProgramProperties();

        programProperties.CodeText         = codeText;
        programProperties.Languages        = SupportedProgrammingLanguages.Languages.Csharp;
        programProperties.Classname        = FindNextWord(codeText, "class");
        programProperties.Functionname     = "Main";
        programProperties.Namespacename    = FindNextWord(codeText, "namespace");
        programProperties.Arguments        = "";
        programProperties.AllProgramInputs = allProgramInputs;
        programProperties.IsStaticFunction = true;

        return(programProperties);
    }
Example #27
0
    /// <summary>
    /// Compile & execute code, return compilation status, return error message for failure and result after successfull execution
    /// </summary>
    public ExecutedCodeProperties InitiateCodeExecution(ProgramProperties programProperties,
                                                        CompiledCodeProperties compiledCodeProperties)
    {
        if (compiledCodeProperties == null)
        {
            throw new NullReferenceException("ExecutedCodeProperties can't be null");
        }

        if (!compiledCodeProperties.IsCompiledSuccessfully || compiledCodeProperties.SuccessfulluyCompiledObject == null)
        {
            throw new Exception("Ensure that code has been already compiled successfully.");
        }
        _excecutedCodeProperties.CompiledCodeProp = compiledCodeProperties;
        return(Execute(programProperties));
    }
Example #28
0
        // AAD External Call declaration for Owandy bridge (nd)

        //static extern long SendMessage(long hWnd, long Msg, long wParam, string lParam);
        ///<summary>Launches the program using command line, then passes some data using Windows API.</summary>
        public static void SendData(Program ProgramCur, Patient pat)
        {
            string path = Programs.GetProgramPath(ProgramCur);
            List <ProgramProperty> listProgProperties = ProgramProperties.GetForProgram(ProgramCur.ProgramNum);
            //ProgramProperties.GetForProgram();
            string info;

            if (pat != null)
            {
                try {
                    //formHandle = Parent.Handle;
                    System.Diagnostics.Process.Start(path, ProgramCur.CommandLine);                   //"C /LINK "+ formHandle;
                    if (!IsWindow(hwndLink))
                    {
                        hwndLink = FindWindow("MjLinkWndClass", null);
                    }
                    // info = "/P:1,DEMO,Patient1";
                    //Patient id:
                    string          patId       = "";
                    ProgramProperty propertyCur = ProgramProperties.GetCur(listProgProperties, "Enter 0 to use PatientNum, or 1 to use ChartNum");;
                    if (propertyCur.PropertyValue == "0")
                    {
                        patId = POut.Long(pat.PatNum);
                    }
                    else
                    {
                        patId = POut.String(pat.ChartNumber);
                    }
                    info = "/P:" + patId + "," + pat.LName + "," + pat.FName;
                    if (IsWindow(hwndLink) == true)
                    {
                        IntPtr lResp = SendMessage(hwndLink, WM_SETTEXT, 0, info);
                    }
                }
                catch {
                    MessageBox.Show(path + " is not available, or there is an error in the command line options.");
                }
            }            //if patient is loaded
            else
            {
                try {
                    Process.Start(path);                    //should start Owandy without bringing up a pt.
                }
                catch {
                    MessageBox.Show(path + " is not available.");
                }
            }
        }
Example #29
0
        /*
         * Example Argument.ini
         *     [Patient Info = 00]
         *     PATIENT_APPLYNO=0120525150324003
         *     PATIENT_ID=20120525
         *     PATIENT_NAME=김유성
         *     PATIENT_ENAME=
         *     PATIENT_SEX=M
         *     PATIENT_AGE=30
         *     PATIENT_BIRTH_DATE=19831020
         *     PATIENT_ADDR=
         *     PATIENT_PID=
         *     PATIENT_IPDOPD=
         *     PATIENT_DOCTOR=
         *     PATIENT_PHON1=
         *     PATIENT_PHON2=
         *     PATIENT_EXAMNAME=TESTEXAM
         *     INPUT_DATE=20120531
         */

        ///<summary>Launches the program using a command line tools.</summary>
        public static void SendData(Program ProgramCur, Patient pat)
        {
            string path = Programs.GetProgramPath(ProgramCur);

            try {
                if (pat != null)
                {
                    List <ProgramProperty> listProgramProperties = ProgramProperties.GetForProgram(ProgramCur.ProgramNum);
                    ProgramProperty        propIniFileLocation   = ProgramProperties.GetCur(listProgramProperties, "System path to HDX WILL Argument ini file");
                    string patientId  = pat.PatNum.ToString();
                    string patientId2 = pat.ChartNumber.ToString();
                    if (ProgramProperties.GetPropValFromList(listProgramProperties, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "1")
                    {
                        patientId  = pat.ChartNumber;
                        patientId2 = pat.PatNum.ToString();
                    }
                    string        filename = propIniFileLocation.PropertyValue;
                    StringBuilder txt      = new StringBuilder();
                    txt.AppendLine("[Patient Info = 00]");
                    txt.AppendLine("PATIENT_APPLYNO=" + MiscData.GetNowDateTimeWithMilli().ToString("yyyyMMddhhmmssfff").Right(16));
                    txt.AppendLine("PATIENT_ID=" + patientId);
                    txt.AppendLine("PATIENT_NAME=" + pat.FName + " " + pat.LName);
                    txt.AppendLine("PATIENT_ENAME=");
                    txt.AppendLine("PATIENT_SEX=" + pat.Gender.ToString().Left(1));
                    txt.AppendLine("PATIENT_AGE=" + pat.Age);
                    txt.AppendLine("PATIENT_BIRTH_DATE=" + pat.Birthdate.ToString("yyyyMMdd"));
                    txt.AppendLine("PATIENT_ADDR=" + pat.Address);
                    txt.AppendLine("PATIENT_PID=" + patientId2);
                    txt.AppendLine("PATIENT_IPDOPD=");
                    txt.AppendLine("PATIENT_DOCTOR=" + Providers.GetFormalName(pat.PriProv));
                    txt.AppendLine("PATIENT_PHON1=" + pat.WirelessPhone);
                    txt.AppendLine("PATIENT_PHON2=" + pat.HmPhone);
                    txt.AppendLine("PATIENT_EXAMNAME=");
                    txt.AppendLine("INPUT_DATE=" + MiscData.GetNowDateTime().ToString("yyyyMMdd"));
                    ODFileUtils.WriteAllTextThenStart(filename, txt.ToString(), path);
                    return;
                }
            }
            catch (Exception e) {
                MessageBox.Show(e.Message);
            }
            try {
                ODFileUtils.ProcessStart(path);
            }
            catch (Exception e) {
                MessageBox.Show(path + " is not available.");
            }
        }
Example #30
0
        private static void ProcessFile(string fullPath)
        {
            string filename = Path.GetFileName(fullPath);
            List <ProgramProperty> ForProgram = ProgramProperties.GetForProgram(Programs.GetProgramNum(ProgramName.iCat));
            ProgramProperty        PPCur      = ProgramProperties.GetCur(ForProgram, "XML output file path");
            string xmlOutputFile = PPCur.PropertyValue;

            if (!File.Exists(xmlOutputFile))
            {
                //No xml file, so nothing to process.
                return;
            }
            try {
                string      patId  = filename.Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries)[0];
                XmlDocument docOut = new XmlDocument();
                docOut.Load(xmlOutputFile);
                XmlElement elementPatients = docOut.DocumentElement;
                if (elementPatients == null)               //if no Patients element, then document is corrupt or new
                {
                    return;
                }
                //figure out if patient is in the list------------------------------------------
                XmlElement elementPat = null;
                for (int i = 0; i < elementPatients.ChildNodes.Count; i++)
                {
                    if (elementPatients.ChildNodes[i].SelectSingleNode("ID").InnerXml == patId)
                    {
                        elementPat = (XmlElement)elementPatients.ChildNodes[i];
                    }
                }
                if (elementPat == null)
                {
                    //patient not in xml document
                    return;
                }
                elementPatients.RemoveChild(elementPat);
                XmlWriterSettings settings = new XmlWriterSettings();
                settings.Indent      = true;
                settings.IndentChars = "   ";
                XmlWriter writer = XmlWriter.Create(xmlOutputFile, settings);
                docOut.Save(writer);
                writer.Close();
                File.Delete(fullPath);
            }
            catch {
                return;
            }
        }