Example #1
0
        public static void SendData(Program ProgramCur, Patient pat)
        {
            if (pat == null)
            {
                MsgBox.Show("EvaSoft", "You must select a patient first.");
                return;
            }
            Process[] evaSoftInstances = Process.GetProcessesByName("EvaSoft");
            if (evaSoftInstances.Length == 0)
            {
                MsgBox.Show("EvaSoft", "EvaSoft is not running. EvaSoft must be running before the bridge will work.");
                return;
            }
            List <ProgramProperty> ForProgram = ProgramProperties.GetForProgram(ProgramCur.ProgramNum);
            UdpClient udpClient  = new UdpClient();
            string    udpMessage = "REQUEST01123581321~~~0.1b~~~pmaddpatient~~~";
            //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")
            {
                udpMessage += pat.PatNum.ToString();
            }
            else
            {
                udpMessage += pat.ChartNumber.Replace(",", "").Trim();   //Remove any commas. Not likely to exist, but just to be safe.
            }
            udpMessage += "," + pat.FName.Replace(",", "").Trim();       //Remove commas from data, because they are the separator.
            udpMessage += "," + pat.LName.Replace(",", "").Trim();       //Remove commas from data, because they are the separator.
            udpMessage += "," + pat.Birthdate.ToString("MM/dd/yyyy");
            udpMessage += "," + ((pat.Gender == PatientGender.Female)?"female":"male");
            udpMessage += "," + (pat.Address + " " + pat.Address2).Replace(",", "").Trim(); //Remove commas from data, because they are the separator.
            udpMessage += "," + pat.City.Replace(",", "").Trim();                           //Remove commas from data, because they are the separator.
            udpMessage += "," + pat.State.Replace(",", "").Trim();                          //Remove commas from data, because they are the separator.
            udpMessage += "," + pat.Zip.Replace(",", "").Trim();                            //Remove commas from data, because they are the separator.
            byte[] udpMessageBytes = Encoding.ASCII.GetBytes(udpMessage);
            udpClient.Send(udpMessageBytes, udpMessageBytes.Length, "localhost", 35678);
        }
Example #2
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" ||
                textDateTo.errorProvider1.GetError(textDateTo) != ""
                )
            {
                MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
                return;
            }
            DateTime FromDate;
            DateTime ToDate;

            if (textDateFrom.Text == "")
            {
                MessageBox.Show(Lan.g(this, "From Date cannot be left blank."));
                return;
            }
            FromDate = PIn.Date(textDateFrom.Text);
            if (textDateTo.Text == "")
            {
                ToDate = DateTime.MaxValue.AddDays(-1);
            }
            else
            {
                ToDate = PIn.Date(textDateTo.Text);
            }
            //Create the file and first row--------------------------------------------------------
            List <ProgramProperty> ForProgram = ProgramProperties.GetForProgram(ProgramCur.ProgramNum);
            ProgramProperty        PPCur      = ProgramProperties.GetCur(ForProgram, "Export Path");
            string fileName = PPCur.PropertyValue + "Appt.txt";

            if (!Directory.Exists(PPCur.PropertyValue))
            {
                Directory.CreateDirectory(PPCur.PropertyValue);
            }
            StreamWriter sr = File.CreateText(fileName);

            sr.WriteLine("\"LastName\",\"FirstName\",\"PatientNumber\",\"HomePhone\",\"WorkNumber\","
                         + "\"EmailAddress\",\"SendEmail\",\"Address\",\"Address2\",\"City\",\"State\",\"Zip\","
                         + "\"ApptDate\",\"ApptTime\",\"ApptReason\",\"DoctorNumber\",\"DoctorName\",\"IsNewPatient\",\"WirelessPhone\"");
            DataTable table     = HouseCallsQueries.GetHouseCalls(FromDate, ToDate);
            bool      usePatNum = false;

            PPCur = ProgramProperties.GetCur(ForProgram, "Enter 0 to use PatientNum, or 1 to use ChartNum");;
            if (PPCur.PropertyValue == "0")
            {
                usePatNum = true;
            }
            DateTime aptDT;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][0].ToString())) + "\",");     //0-LastName
                if (table.Rows[i][2].ToString() != "")                                         //if Preferred Name exists
                {
                    sr.Write("\"" + Dequote(PIn.String(table.Rows[i][2].ToString())) + "\","); //2-PrefName
                }
                else
                {
                    sr.Write("\"" + Dequote(PIn.String(table.Rows[i][1].ToString())) + "\",");                //1-FirstName
                }
                if (usePatNum)
                {
                    sr.Write("\"" + table.Rows[i][3].ToString() + "\",");                //3-PatNum
                }
                else
                {
                    sr.Write("\"" + Dequote(PIn.String(table.Rows[i][4].ToString())) + "\","); //4-ChartNumber
                }
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][5].ToString())) + "\",");     //5-HomePhone
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][6].ToString())) + "\",");     //6-WorkNumber
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][7].ToString())) + "\",");     //7-EmailAddress
                if (table.Rows[i][7].ToString() != "")                                         //if an email exists
                {
                    sr.Write("\"T\",");                                                        //SendEmail
                }
                else
                {
                    sr.Write("\"F\",");
                }
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][8].ToString())) + "\",");  //8-Address
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][9].ToString())) + "\",");  //9-Address2
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][10].ToString())) + "\","); //10-City
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][11].ToString())) + "\","); //11-State
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][12].ToString())) + "\","); //12-Zip
                aptDT = PIn.DateT(table.Rows[i][13].ToString());
                sr.Write("\"" + aptDT.ToString("MM/dd/yyyy") + "\",");                      //13-ApptDate
                sr.Write("\"" + aptDT.ToString("hh:mm tt") + "\",");                        //13-ApptTime eg 01:30 PM
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][14].ToString())) + "\","); //14-ApptReason
                sr.Write("\"" + table.Rows[i][15].ToString() + "\",");                      //15-DoctorNumber. might possibly be 0
                //15-DoctorName. Can handle 0 without any problem.
                sr.Write("\"" + Dequote(Providers.GetLName(PIn.Long(table.Rows[i][15].ToString()))) + "\",");
                if (table.Rows[i][16].ToString() == "1")   //16-IsNewPatient
                {
                    sr.Write("\"T\",");                    //SendEmail
                }
                else
                {
                    sr.Write("\"F\",");
                }
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][17].ToString())) + "\""); //17-WirelessPhone
                sr.WriteLine();                                                            //Must be last.
            }
            sr.Close();
            MessageBox.Show("Done");
            DialogResult = DialogResult.OK;
        }
Example #3
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" ||
                textDateTo.errorProvider1.GetError(textDateTo) != ""
                )
            {
                MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
                return;
            }
            DateTime FromDate;
            DateTime ToDate;

            if (textDateFrom.Text == "")
            {
                MessageBox.Show(Lan.g(this, "From Date cannot be left blank."));
                return;
            }
            FromDate = PIn.PDate(textDateFrom.Text);
            if (textDateTo.Text == "")
            {
                ToDate = DateTime.MaxValue.AddDays(-1);
            }
            else
            {
                ToDate = PIn.PDate(textDateTo.Text);
            }
            //Create the file and first row--------------------------------------------------------
            ArrayList       ForProgram = ProgramProperties.GetForProgram(ProgramCur.ProgramNum);
            ProgramProperty PPCur      = ProgramProperties.GetCur(ForProgram, "Export Path");
            string          fileName   = PPCur.PropertyValue + "Appt.txt";

            if (!Directory.Exists(PPCur.PropertyValue))
            {
                Directory.CreateDirectory(PPCur.PropertyValue);
            }
            StreamWriter sr = File.CreateText(fileName);

            sr.WriteLine("\"LastName\",\"FirstName\",\"PatientNumber\",\"HomePhone\",\"WorkNumber\","
                         + "\"EmailAddress\",\"SendEmail\",\"Address\",\"Address2\",\"City\",\"State\",\"Zip\","
                         + "\"ApptDate\",\"ApptTime\",\"ApptReason\",\"DoctorNumber\",\"DoctorName\",\"IsNewPatient\"");
            //now, the query--------------------------------------------------------------------------
            //Appointment Reminder Fields- numbers are as they come back from db-----------------------
            //0-LastName
            //1-FirstName (or we substitute 2-Preferred Name if exists)
            // PatientNumber (Can be 3-PatNum or 4-ChartNumber, depending on what user selected)
            //5-HomePhone
            //6-WorkNumber
            //7-EmailAddress
            // SendEmail (this will be true if email address exists. Might change later)
            //8-Address
            //9-Address2 (although they did not offer this as an option)
            //10-City
            //11-State
            //12-Zip
            //13-ApptDate
            //13-ApptTime
            //14-ApptReason (procedures descriptions-user can't edit)
            //15-DoctorNumber (for the Doctor, we currently use the patient primary provider. Otherwise, we would run into trouble with appointments assigned to a specific hygienist.)
            //15-DoctorName
            //16-IsNewPatient
            string command = @"SELECT patient.LName,patient.FName,patient.Preferred
				,patient.PatNum,patient.ChartNumber,patient.HmPhone,patient.WkPhone
				,patient.Email,patient.Address,patient.Address2,patient.City,patient.State
				,patient.Zip
				,appointment.AptDateTime,appointment.ProcDescript
				,patient.PriProv
				,appointment.IsNewPatient
				FROM patient,appointment 
				WHERE patient.PatNum=appointment.PatNum "
                             + "AND (appointment.AptStatus=1 OR appointment.AptStatus=4) "        //sched or ASAP
                             + "AND appointment.AptDateTime > " + POut.PDate(FromDate)            //> midnight
                             + " AND appointment.AptDateTime < " + POut.PDate(ToDate.AddDays(1)); //< midnight
            DataTable table     = General.GetTable(command);
            bool      usePatNum = false;

            PPCur = ProgramProperties.GetCur(ForProgram, "Enter 0 to use PatientNum, or 1 to use ChartNum");;
            if (PPCur.PropertyValue == "0")
            {
                usePatNum = true;
            }
            DateTime aptDT;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                sr.Write("\"" + Dequote(PIn.PString(table.Rows[i][0].ToString())) + "\",");     //0-LastName
                if (table.Rows[i][2].ToString() != "")                                          //if Preferred Name exists
                {
                    sr.Write("\"" + Dequote(PIn.PString(table.Rows[i][2].ToString())) + "\","); //2-PrefName
                }
                else
                {
                    sr.Write("\"" + Dequote(PIn.PString(table.Rows[i][1].ToString())) + "\",");                //1-FirstName
                }
                if (usePatNum)
                {
                    sr.Write("\"" + table.Rows[i][3].ToString() + "\",");                //3-PatNum
                }
                else
                {
                    sr.Write("\"" + Dequote(PIn.PString(table.Rows[i][4].ToString())) + "\","); //4-ChartNumber
                }
                sr.Write("\"" + Dequote(PIn.PString(table.Rows[i][5].ToString())) + "\",");     //5-HomePhone
                sr.Write("\"" + Dequote(PIn.PString(table.Rows[i][6].ToString())) + "\",");     //6-WorkNumber
                sr.Write("\"" + Dequote(PIn.PString(table.Rows[i][7].ToString())) + "\",");     //7-EmailAddress
                if (table.Rows[i][7].ToString() != "")                                          //if an email exists
                {
                    sr.Write("\"T\",");                                                         //SendEmail
                }
                else
                {
                    sr.Write("\"F\",");
                }
                sr.Write("\"" + Dequote(PIn.PString(table.Rows[i][8].ToString())) + "\",");  //8-Address
                sr.Write("\"" + Dequote(PIn.PString(table.Rows[i][9].ToString())) + "\",");  //9-Address2
                sr.Write("\"" + Dequote(PIn.PString(table.Rows[i][10].ToString())) + "\","); //10-City
                sr.Write("\"" + Dequote(PIn.PString(table.Rows[i][11].ToString())) + "\","); //11-State
                sr.Write("\"" + Dequote(PIn.PString(table.Rows[i][12].ToString())) + "\","); //12-Zip
                aptDT = PIn.PDateT(table.Rows[i][13].ToString());
                sr.Write("\"" + aptDT.ToString("MM/dd/yyyy") + "\",");                       //13-ApptDate
                sr.Write("\"" + aptDT.ToString("hh:mm tt") + "\",");                         //13-ApptTime eg 01:30 PM
                sr.Write("\"" + Dequote(PIn.PString(table.Rows[i][14].ToString())) + "\","); //14-ApptReason
                sr.Write("\"" + table.Rows[i][15].ToString() + "\",");                       //15-DoctorNumber. might possibly be 0
                //15-DoctorName. Can handle 0 without any problem.
                sr.Write("\"" + Dequote(Providers.GetLName(PIn.PInt(table.Rows[i][15].ToString()))) + "\",");
                if (table.Rows[i][16].ToString() == "1")      //16-IsNewPatient
                {
                    sr.WriteLine("\"T\"");                    //SendEmail
                }
                else
                {
                    sr.WriteLine("\"F\"");
                }
            }
            sr.Close();
            MessageBox.Show("Done");
            DialogResult = DialogResult.OK;
        }