Example #1
0
        ///<summary></summary>
        public static TimeAdjust[] Refresh(int empNum, DateTime fromDate, DateTime toDate)
        {
            string command =
                "SELECT * from timeadjust WHERE"
                + " EmployeeNum = '" + POut.PInt(empNum) + "'"
                + " AND TimeEntry >= " + POut.PDate(fromDate)
                //adding a day takes it to midnight of the specified toDate
                + " AND TimeEntry <= " + POut.PDate(toDate.AddDays(1));

            command += " ORDER BY TimeEntry";
            DataTable table = General.GetTable(command);

            TimeAdjust[] List = new TimeAdjust[table.Rows.Count];
            for (int i = 0; i < List.Length; i++)
            {
                List[i] = new TimeAdjust();
                List[i].TimeAdjustNum = PIn.PInt(table.Rows[i][0].ToString());
                List[i].EmployeeNum   = PIn.PInt(table.Rows[i][1].ToString());
                List[i].TimeEntry     = PIn.PDateT(table.Rows[i][2].ToString());
                List[i].RegHours      = TimeSpan.FromHours(PIn.PDouble(table.Rows[i][3].ToString()));
                List[i].OTimeHours    = TimeSpan.FromHours(PIn.PDouble(table.Rows[i][4].ToString()));
                List[i].Note          = PIn.PString(table.Rows[i][5].ToString());
            }
            return(List);
        }
Example #2
0
        public static FormPat GetOne(int formPatNum)
        {
            string    command = "SELECT * FROM formpat WHERE FormPatNum=" + POut.PInt(formPatNum);
            DataTable table   = General.GetTable(command);

            if (table.Rows.Count == 0)
            {
                return(null);               //should never happen.
            }
            FormPat form = new FormPat();

            form.FormPatNum   = formPatNum;
            form.PatNum       = PIn.PInt(table.Rows[0][1].ToString());
            form.FormDateTime = PIn.PDateT(table.Rows[0][2].ToString());
            form.QuestionList = new List <Question>();
            command           = "SELECT * FROM question WHERE FormPatNum=" + POut.PInt(formPatNum);
            table             = General.GetTable(command);
            Question quest;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                quest             = new Question();
                quest.QuestionNum = PIn.PInt(table.Rows[i][0].ToString());
                quest.PatNum      = PIn.PInt(table.Rows[i][1].ToString());
                quest.ItemOrder   = PIn.PInt(table.Rows[i][2].ToString());
                quest.Description = PIn.PString(table.Rows[i][3].ToString());
                quest.Answer      = PIn.PString(table.Rows[i][4].ToString());
                quest.FormPatNum  = PIn.PInt(table.Rows[i][5].ToString());
                form.QuestionList.Add(quest);
            }
            return(form);
        }
Example #3
0
        /*
         * ///<summary>This button won't even be visible unless there is an email to view.</summary>
         * private void butEmail_Click(object sender, System.EventArgs e) {
         *      EmailMessage message=EmailMessages.Refresh(CommlogCur.EmailMessageNum);
         *      //If a date is entered, user will not be able to click Send
         *      FormEmailMessageEdit FormE=new FormEmailMessageEdit(message);
         *      FormE.ShowDialog();
         *      CommlogCur=Commlogs.GetOne(CommlogCur.CommlogNum);
         * }*/

        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDateTime.Text == ""
                //|| textAmount.errorProvider1.GetError(textAmount)!=""
                )
            {
                MessageBox.Show(Lan.g(this, "Please enter a date first."));
                return;
            }
            try{
                DateTime.Parse(textDateTime.Text);
            }
            catch {
                MessageBox.Show(Lan.g(this, "Date and time invalid."));
                return;
            }
            CommlogCur.CommDateTime = PIn.PDateT(textDateTime.Text);
            //there will always be a commtype selected.
            CommlogCur.CommType       = (CommItemType)(listType.SelectedIndex + 1);
            CommlogCur.Mode_          = (CommItemMode)listMode.SelectedIndex;
            CommlogCur.SentOrReceived = (CommSentOrReceived)listSentOrReceived.SelectedIndex;
            CommlogCur.Note           = textNote.Text;
            if (IsNew)
            {
                Commlogs.Insert(CommlogCur);
            }
            else
            {
                Commlogs.Update(CommlogCur);
                //SecurityLogs.MakeLogEntry("Adjustment Edit",Adjustments.cmd.CommandText);
            }
            DialogResult = DialogResult.OK;
        }
Example #4
0
        private static List <Schedule> RefreshAndFill(string command)
        {
            DataTable       table  = General.GetTableEx(command);
            List <Schedule> retVal = new List <Schedule>();
            //Schedule[] List=new Schedule[table.Rows.Count];
            Schedule sched;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                sched              = new Schedule();
                sched.ScheduleNum  = PIn.PInt(table.Rows[i][0].ToString());
                sched.SchedDate    = PIn.PDate(table.Rows[i][1].ToString());
                sched.StartTime    = PIn.PDateT(table.Rows[i][2].ToString());
                sched.StopTime     = PIn.PDateT(table.Rows[i][3].ToString());
                sched.SchedType    = (ScheduleType)PIn.PInt(table.Rows[i][4].ToString());
                sched.ProvNum      = PIn.PInt(table.Rows[i][5].ToString());
                sched.BlockoutType = PIn.PInt(table.Rows[i][6].ToString());
                sched.Note         = PIn.PString(table.Rows[i][7].ToString());
                sched.Status       = (SchedStatus)PIn.PInt(table.Rows[i][8].ToString());
                sched.Op           = PIn.PInt(table.Rows[i][9].ToString());
                sched.EmployeeNum  = PIn.PInt(table.Rows[i][10].ToString());
                retVal.Add(sched);
            }
            return(retVal);
        }
Example #5
0
        ///<summary>Fills the specified array of Appointments using the supplied SQL command.</summary>
        private static Appointment[] FillList(string command)
        {
            DataTable table = General.GetTable(command);

            Appointment[] list = new Appointment[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                list[i]                 = new Appointment();
                list[i].AptNum          = PIn.PInt(table.Rows[i][0].ToString());
                list[i].PatNum          = PIn.PInt(table.Rows[i][1].ToString());
                list[i].AptStatus       = (ApptStatus)PIn.PInt(table.Rows[i][2].ToString());
                list[i].Pattern         = PIn.PString(table.Rows[i][3].ToString());
                list[i].Confirmed       = PIn.PInt(table.Rows[i][4].ToString());
                list[i].AddTime         = PIn.PInt(table.Rows[i][5].ToString());
                list[i].Op              = PIn.PInt(table.Rows[i][6].ToString());
                list[i].Note            = PIn.PString(table.Rows[i][7].ToString());
                list[i].ProvNum         = PIn.PInt(table.Rows[i][8].ToString());
                list[i].ProvHyg         = PIn.PInt(table.Rows[i][9].ToString());
                list[i].AptDateTime     = PIn.PDateT(table.Rows[i][10].ToString());
                list[i].NextAptNum      = PIn.PInt(table.Rows[i][11].ToString());
                list[i].UnschedStatus   = PIn.PInt(table.Rows[i][12].ToString());
                list[i].Lab             = (LabCase)PIn.PInt(table.Rows[i][13].ToString());
                list[i].IsNewPatient    = PIn.PBool(table.Rows[i][14].ToString());
                list[i].ProcDescript    = PIn.PString(table.Rows[i][15].ToString());
                list[i].Assistant       = PIn.PInt(table.Rows[i][16].ToString());
                list[i].InstructorNum   = PIn.PInt(table.Rows[i][17].ToString());
                list[i].SchoolClassNum  = PIn.PInt(table.Rows[i][18].ToString());
                list[i].SchoolCourseNum = PIn.PInt(table.Rows[i][19].ToString());
                list[i].GradePoint      = PIn.PFloat(table.Rows[i][20].ToString());
                list[i].ClinicNum       = PIn.PInt(table.Rows[i][21].ToString());
                list[i].IsHygiene       = PIn.PBool(table.Rows[i][22].ToString());
            }
            return(list);
        }
Example #6
0
        ///<summary>Used when viewing securityLog from the security admin window.  PermTypes can be length 0 to get all types.</summary>
        public static SecurityLog[] Refresh(DateTime dateFrom, DateTime dateTo, Permissions permType, int patNum,
                                            int userNum)
        {
            string command = "SELECT * FROM securitylog "
                             + "WHERE LogDateTime >= " + POut.PDate(dateFrom) + " "
                             + "AND LogDateTime <= " + POut.PDate(dateTo.AddDays(1));

            if (patNum != 0)
            {
                command += " AND PatNum= '" + POut.PInt(patNum) + "'";
            }
            if (permType != Permissions.None)
            {
                command += " AND PermType=" + POut.PInt((int)permType);
            }
            if (userNum != 0)
            {
                command += " AND UserNum=" + POut.PInt(userNum);
            }
            DataTable table = General.GetTable(command);

            SecurityLog[] List = new SecurityLog[table.Rows.Count];
            for (int i = 0; i < List.Length; i++)
            {
                List[i] = new SecurityLog();
                List[i].SecurityLogNum = PIn.PInt(table.Rows[i][0].ToString());
                List[i].PermType       = (Permissions)PIn.PInt(table.Rows[i][1].ToString());
                List[i].UserNum        = PIn.PInt(table.Rows[i][2].ToString());
                List[i].LogDateTime    = PIn.PDateT(table.Rows[i][3].ToString());
                List[i].LogText        = PIn.PString(table.Rows[i][4].ToString());
                List[i].PatNum         = PIn.PInt(table.Rows[i][5].ToString());
            }
            return(List);
        }
Example #7
0
        public static List <LabCase> FillFromCommand(string command)
        {
            DataTable      table = General.GetTable(command);
            LabCase        lab;
            List <LabCase> retVal = new List <LabCase>();

            for (int i = 0; i < table.Rows.Count; i++)
            {
                lab                 = new LabCase();
                lab.LabCaseNum      = PIn.PInt(table.Rows[i][0].ToString());
                lab.PatNum          = PIn.PInt(table.Rows[i][1].ToString());
                lab.LaboratoryNum   = PIn.PInt(table.Rows[i][2].ToString());
                lab.AptNum          = PIn.PInt(table.Rows[i][3].ToString());
                lab.PlannedAptNum   = PIn.PInt(table.Rows[i][4].ToString());
                lab.DateTimeDue     = PIn.PDateT(table.Rows[i][5].ToString());
                lab.DateTimeCreated = PIn.PDateT(table.Rows[i][6].ToString());
                lab.DateTimeSent    = PIn.PDateT(table.Rows[i][7].ToString());
                lab.DateTimeRecd    = PIn.PDateT(table.Rows[i][8].ToString());
                lab.DateTimeChecked = PIn.PDateT(table.Rows[i][9].ToString());
                lab.ProvNum         = PIn.PInt(table.Rows[i][10].ToString());
                lab.Instructions    = PIn.PString(table.Rows[i][11].ToString());
                retVal.Add(lab);
            }
            return(retVal);
        }
Example #8
0
        //there are no methods for deleting or changing log entries because that will never be allowed.



        ///<summary>Used when viewing various audit trails of specific types.</summary>
        public static SecurityLog[] Refresh(int patNum, Permissions[] permTypes)
        {
            string types = "";

            for (int i = 0; i < permTypes.Length; i++)
            {
                if (i > 0)
                {
                    types += " OR";
                }
                types += " PermType=" + POut.PInt((int)permTypes[i]);
            }
            string command = "SELECT * FROM securitylog "
                             + "WHERE PatNum= '" + POut.PInt(patNum) + "' "
                             + "AND (" + types + ")";
            DataTable table = General.GetTable(command);

            SecurityLog[] List = new SecurityLog[table.Rows.Count];
            for (int i = 0; i < List.Length; i++)
            {
                List[i] = new SecurityLog();
                List[i].SecurityLogNum = PIn.PInt(table.Rows[i][0].ToString());
                List[i].PermType       = (Permissions)PIn.PInt(table.Rows[i][1].ToString());
                List[i].UserNum        = PIn.PInt(table.Rows[i][2].ToString());
                List[i].LogDateTime    = PIn.PDateT(table.Rows[i][3].ToString());
                List[i].LogText        = PIn.PString(table.Rows[i][4].ToString());
                List[i].PatNum         = PIn.PInt(table.Rows[i][5].ToString());
            }
            return(List);
        }
Example #9
0
 private bool SaveCur()
 {
     if (textDateTask.errorProvider1.GetError(textDateTask) != ""
         )
     {
         MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
         return(false);
     }
     Cur.TaskStatus    = checkTaskStatus.Checked;
     Cur.DateTimeEntry = PIn.PDateT(textDateTimeEntry.Text);
     Cur.Descript      = textDescript.Text;
     Cur.DateTask      = PIn.PDate(textDateTask.Text);
     Cur.DateType      = (TaskDateType)listDateType.SelectedIndex;
     if (!checkFromNum.Checked)            //user unchecked the box. Never allowed to check if initially unchecked
     {
         Cur.FromNum = 0;
     }
     //ObjectType already handled
     //Cur.KeyNum already handled
     try{
         Tasks.InsertOrUpdate(Cur, IsNew);
     }
     catch (Exception ex) {
         MessageBox.Show(ex.Message);
         return(false);
     }
     return(true);
 }
Example #10
0
        private void FormScheduleDayEdit_Load(object sender, System.EventArgs e)
        {
            DateTime time;

            for (int i = 0; i < 24; i++)
            {
                time = DateTime.Today + TimeSpan.FromHours(7) + TimeSpan.FromMinutes(30 * i);
                comboStart.Items.Add(time.ToShortTimeString());
                comboStop.Items.Add(time.ToShortTimeString());
            }
            comboStart.Text = SchedCur.StartTime.ToShortTimeString();
            comboStop.Text  = SchedCur.StopTime.ToShortTimeString();
            textNote.Text   = SchedCur.Note;
            if (SchedCur.StartTime.TimeOfDay == PIn.PDateT("12 AM").TimeOfDay &&
                SchedCur.StopTime.TimeOfDay == PIn.PDateT("12 AM").TimeOfDay)
            {
                comboStop.Visible  = false;
                comboStart.Visible = false;
                label1.Visible     = false;
                label2.Visible     = false;
                textNote.Select();
            }
            else
            {
                comboStart.Select();
            }
        }
Example #11
0
        ///<summary>Gets data for the history grid in the SendClaims window.</summary>
        public static DataTable RefreshHistory(DateTime dateFrom, DateTime dateTo)
        {
            string command = "Select CONCAT(CONCAT(patient.LName,', '),patient.FName) AS PatName,carrier.CarrierName,"
                             + "clearinghouse.Description AS Clearinghouse,DateTimeTrans,etrans.OfficeSequenceNumber,"
                             + "etrans.CarrierTransCounter,Etype,etrans.ClaimNum,etrans.EtransNum "
                             + "FROM etrans "
                             + "LEFT JOIN carrier ON etrans.CarrierNum=carrier.CarrierNum "
                             + "LEFT JOIN patient ON patient.PatNum=etrans.PatNum "
                             + "LEFT JOIN clearinghouse ON clearinghouse.ClearinghouseNum=etrans.ClearinghouseNum WHERE ";

            if (FormChooseDatabase.DBtype == DatabaseType.Oracle)
            {
                command += "TO_";
            }
            command += "DATE(DateTimeTrans) >= " + POut.PDate(dateFrom) + " AND ";
            if (FormChooseDatabase.DBtype == DatabaseType.Oracle)
            {
                command += "TO_";
            }
            command += "DATE(DateTimeTrans) <= " + POut.PDate(dateTo) + " "
                       + "ORDER BY DateTimeTrans";
            DataTable table = General.GetTable(command);
            DataTable tHist = new DataTable("Table");

            tHist.Columns.Add("patName");
            tHist.Columns.Add("CarrierName");
            tHist.Columns.Add("Clearinghouse");
            tHist.Columns.Add("dateTimeTrans");
            tHist.Columns.Add("OfficeSequenceNumber");
            tHist.Columns.Add("CarrierTransCounter");
            tHist.Columns.Add("etype");
            tHist.Columns.Add("Etype");
            tHist.Columns.Add("ClaimNum");
            tHist.Columns.Add("EtransNum");
            DataRow row;
            string  etype;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                row                         = tHist.NewRow();
                row["patName"]              = table.Rows[i]["PatName"].ToString();
                row["CarrierName"]          = table.Rows[i]["CarrierName"].ToString();
                row["Clearinghouse"]        = table.Rows[i]["Clearinghouse"].ToString();
                row["dateTimeTrans"]        = PIn.PDateT(table.Rows[i]["DateTimeTrans"].ToString()).ToShortDateString();
                row["OfficeSequenceNumber"] = table.Rows[i]["OfficeSequenceNumber"].ToString();
                row["CarrierTransCounter"]  = table.Rows[i]["CarrierTransCounter"].ToString();
                row["Etype"]                = table.Rows[i]["Etype"].ToString();
                etype                       = Lan.g("enumEtransType", ((EtransType)PIn.PInt(table.Rows[i]["Etype"].ToString())).ToString());
                if (etype.EndsWith("_CA"))
                {
                    etype = etype.Substring(0, etype.Length - 3);
                }
                row["etype"]     = etype;
                row["ClaimNum"]  = table.Rows[i]["ClaimNum"].ToString();
                row["EtransNum"] = table.Rows[i]["EtransNum"].ToString();
                tHist.Rows.Add(row);
            }
            return(tHist);
        }
Example #12
0
        ///<summary>Gets the current date/Time direcly from the server.  Mostly used to prevent uesr from altering the workstation date to bypass security.</summary>
        public static DateTime GetNowDateTime()
        {
            string command = "SELECT NOW()";

            if (FormChooseDatabase.DBtype == DatabaseType.Oracle)
            {
                command = "SELECT CURRENT_TIMESTAMP FROM DUAL";
            }
            DataTable table = General.GetTable(command);

            return(PIn.PDateT(table.Rows[0][0].ToString()));
        }
Example #13
0
        ///<summary>Gets one email message from the database.</summary>
        public static EmailMessage GetOne(int msgNum)
        {
            string commands = "SELECT * FROM emailmessage WHERE EmailMessageNum = " + POut.PInt(msgNum)
                              + ";SELECT * FROM emailattach WHERE EmailMessageNum = " + POut.PInt(msgNum);
            DataSet ds = null;

            try {
                if (RemotingClient.OpenDentBusinessIsLocal)
                {
                    ds = GeneralB.GetDataSet(commands);
                }
                else
                {
                    DtoGeneralGetDataSet dto = new DtoGeneralGetDataSet();
                    dto.Commands = commands;
                    ds           = RemotingClient.ProcessQuery(dto);
                }
            }
            catch (Exception e) {
                MessageBox.Show(e.Message);
            }
            DataTable    table = ds.Tables[0];
            EmailMessage Cur   = new EmailMessage();

            if (table.Rows.Count == 0)
            {
                return(null);
            }
            //for(int i=0;i<table.Rows.Count;i++){
            Cur.EmailMessageNum = PIn.PInt(table.Rows[0][0].ToString());
            Cur.PatNum          = PIn.PInt(table.Rows[0][1].ToString());
            Cur.ToAddress       = PIn.PString(table.Rows[0][2].ToString());
            Cur.FromAddress     = PIn.PString(table.Rows[0][3].ToString());
            Cur.Subject         = PIn.PString(table.Rows[0][4].ToString());
            Cur.BodyText        = PIn.PString(table.Rows[0][5].ToString());
            Cur.MsgDateTime     = PIn.PDateT(table.Rows[0][6].ToString());
            Cur.SentOrReceived  = (CommSentOrReceived)PIn.PInt(table.Rows[0][7].ToString());
            table           = ds.Tables[1];
            Cur.Attachments = new List <EmailAttach>();
            EmailAttach attach;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                attach = new EmailAttach();
                attach.EmailAttachNum    = PIn.PInt(table.Rows[i][0].ToString());
                attach.EmailMessageNum   = PIn.PInt(table.Rows[i][1].ToString());
                attach.DisplayedFileName = PIn.PString(table.Rows[i][2].ToString());
                attach.ActualFileName    = PIn.PString(table.Rows[i][3].ToString());
                Cur.Attachments.Add(attach);
            }
            return(Cur);
        }
        ///<summary>Called from SetLocation to establish Y position of control.  Also called from ContrAppt.RefreshDay when determining provBar markings. Does not round to the nearest row.</summary>
        public int ConvertToY()
        {
            DateTime aptDateTime = PIn.PDateT(DataRoww["AptDateTime"].ToString());
            int      retVal      = (int)(((double)aptDateTime.Hour * (double)60
                                          / (double)PrefB.GetInt("AppointmentTimeIncrement")
                                          + (double)aptDateTime.Minute
                                          / (double)PrefB.GetInt("AppointmentTimeIncrement")
                                          ) * (double)ContrApptSheet.Lh * ContrApptSheet.RowsPerIncr);

            //if(ContrApptSheet.TwoRowsPerIncrement){
            //	retVal=retVal*2;
            //}
            return(retVal);           //(Info.MyApt.AptDateTime.Hour*6+)*ContrApptSheet.Lh;
        }
 ///<summary>Called from SetLocation to establish X position of control.</summary>
 private int ConvertToX()
 {
     if (ContrApptSheet.IsWeeklyView)
     {
         return(ContrApptSheet.TimeWidth
                + ContrApptSheet.ColDayWidth * ((int)PIn.PDateT(DataRoww["AptDateTime"].ToString()).DayOfWeek - 1) + 1
                + (int)(ContrApptSheet.ColAptWidth * (float)ApptViewItems.GetIndexOp(PIn.PInt(DataRoww["Op"].ToString()))));
     }
     else
     {
         return(ContrApptSheet.TimeWidth + ContrApptSheet.ProvWidth * ContrApptSheet.ProvCount
                + ContrApptSheet.ColWidth * (ApptViewItems.GetIndexOp(PIn.PInt(DataRoww["Op"].ToString()))) + 1);
         //Info.MyApt.Op))+1;
     }
 }
Example #16
0
        public static DataTable RefreshOneStudent(int provNum)
        {
            DataTable table = new DataTable();
            DataRow   row;

            //columns that start with lowercase are altered for display rather than being raw data.
            table.Columns.Add("appointment");
            table.Columns.Add("course");
            table.Columns.Add("done");
            table.Columns.Add("patient");
            table.Columns.Add("ReqStudentNum");
            table.Columns.Add("requirement");
            string command = "SELECT AptDateTime,CourseID,reqStudent.Descript ReqDescript,"
                             + "schoolcourse.Descript CourseDescript,reqstudent.DateCompleted, "
                             + "patient.LName,patient.FName,patient.MiddleI,patient.Preferred,ProcDescript,reqstudent.ReqStudentNum "
                             + "FROM reqstudent "
                             + "LEFT JOIN schoolcourse ON reqstudent.SchoolCourseNum=schoolcourse.SchoolCourseNum "
                             + "LEFT JOIN patient ON reqstudent.PatNum=patient.PatNum "
                             + "LEFT JOIN appointment ON reqstudent.AptNum=appointment.AptNum "
                             + "WHERE reqstudent.ProvNum=" + POut.PInt(provNum)
                             + " ORDER BY CourseID,ReqDescript";
            DataTable raw = General.GetTable(command);
            DateTime  AptDateTime;
            DateTime  dateCompleted;

            for (int i = 0; i < raw.Rows.Count; i++)
            {
                row         = table.NewRow();
                AptDateTime = PIn.PDateT(raw.Rows[i]["AptDateTime"].ToString());
                if (AptDateTime.Year > 1880)
                {
                    row["appointment"] = AptDateTime.ToShortDateString() + " " + AptDateTime.ToShortTimeString()
                                         + " " + raw.Rows[i]["ProcDescript"].ToString();
                }
                row["course"] = raw.Rows[i]["CourseID"].ToString();              //+" "+raw.Rows[i]["CourseDescript"].ToString();
                dateCompleted = PIn.PDate(raw.Rows[i]["DateCompleted"].ToString());
                if (dateCompleted.Year > 1880)
                {
                    row["done"] = "X";
                }
                row["patient"] = PatientB.GetNameLF(raw.Rows[i]["LName"].ToString(), raw.Rows[i]["FName"].ToString(),
                                                    raw.Rows[i]["Preferred"].ToString(), raw.Rows[i]["MiddleI"].ToString());
                row["ReqStudentNum"] = raw.Rows[i]["ReqStudentNum"].ToString();
                row["requirement"]   = raw.Rows[i]["ReqDescript"].ToString();
                table.Rows.Add(row);
            }
            return(table);
        }
Example #17
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textDateTime.Text == ""
         //|| textAmount.errorProvider1.GetError(textAmount)!=""
         )
     {
         MessageBox.Show(Lan.g(this, "Please enter a date first."));
         return;
     }
     try{
         DateTime.Parse(textDateTime.Text);
     }
     catch {
         MessageBox.Show(Lan.g(this, "Date and time invalid."));
         return;
     }
     if (!checkIsStatementSent.Checked && listType.SelectedIndex == -1)
     {
         MsgBox.Show(this, "Please select a type.");
         return;
     }
     CommlogCur.CommDateTime = PIn.PDateT(textDateTime.Text);
     //there may not be a commtype selected.
     if (listType.SelectedIndex == -1)
     {
         CommlogCur.CommType = 0;
     }
     else
     {
         CommlogCur.CommType = DefB.Short[(int)DefCat.CommLogTypes][listType.SelectedIndex].DefNum;
     }
     CommlogCur.Mode_           = (CommItemMode)listMode.SelectedIndex;
     CommlogCur.SentOrReceived  = (CommSentOrReceived)listSentOrReceived.SelectedIndex;
     CommlogCur.Note            = textNote.Text;
     CommlogCur.IsStatementSent = checkIsStatementSent.Checked;
     if (IsNew)
     {
         Commlogs.Insert(CommlogCur);
     }
     else
     {
         Commlogs.Update(CommlogCur);
         //SecurityLogs.MakeLogEntry("Adjustment Edit",Adjustments.cmd.CommandText);
     }
     DialogResult = DialogResult.OK;
 }
Example #18
0
        ///<summary>For now, all transactions are retrieved singly.  Returns null if no match found.</summary>
        private static Transaction RefreshAndFill(string command)
        {
            DataTable table = General.GetTable(command);

            if (table.Rows.Count == 0)
            {
                return(null);
            }
            Transaction trans = new Transaction();

            trans = new Transaction();
            trans.TransactionNum = PIn.PInt(table.Rows[0][0].ToString());
            trans.DateTimeEntry  = PIn.PDateT(table.Rows[0][1].ToString());
            trans.UserNum        = PIn.PInt(table.Rows[0][2].ToString());
            trans.DepositNum     = PIn.PInt(table.Rows[0][3].ToString());
            trans.PayNum         = PIn.PInt(table.Rows[0][4].ToString());
            return(trans);
        }
Example #19
0
        ///<summary>Surround with try/catch.  If there are any dependencies, then this will throw an exception.  This is currently only called from FormCarrierEdit.</summary>
        public static void Delete(Carrier Cur)
        {
            //look for dependencies in insplan table.
            string command = "SELECT CONCAT(CONCAT(LName,', '),FName) FROM patient,insplan"
                             + " WHERE patient.PatNum=insplan.Subscriber"
                             + " AND insplan.CarrierNum = '" + POut.PInt(Cur.CarrierNum) + "'"
                             + " ORDER BY LName,FName";
            DataTable table = General.GetTable(command);
            string    strInUse;

            if (table.Rows.Count > 0)
            {
                strInUse = "";              //new string[table.Rows.Count];
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    if (i > 0)
                    {
                        strInUse += ", ";
                    }
                    strInUse += PIn.PString(table.Rows[i][0].ToString());
                }
                throw new ApplicationException(Lan.g("Carriers", "Not allowed to delete carrier because it is in use.  Subscribers using this carrier include ") + strInUse);
            }
            //look for dependencies in etrans table.
            command = "SELECT DateTimeTrans FROM etrans WHERE CarrierNum=" + POut.PInt(Cur.CarrierNum)
                      + " OR CarrierNum2=" + POut.PInt(Cur.CarrierNum);
            table = General.GetTable(command);
            if (table.Rows.Count > 0)
            {
                strInUse = "";
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    if (i > 0)
                    {
                        strInUse += ", ";
                    }
                    strInUse += PIn.PDateT(table.Rows[i][0].ToString()).ToShortDateString();
                }
                throw new ApplicationException(Lan.g("Carriers", "Not allowed to delete carrier because it is in use in the etrans table.  Dates of claim sent history include ") + strInUse);
            }
            command = "DELETE from carrier WHERE CarrierNum = " + POut.PInt(Cur.CarrierNum);
            General.NonQ(command);
        }
Example #20
0
        ///<summary></summary>
        public static Etrans GetEtrans(int etransNum)
        {
            string    command = "SELECT * FROM etrans WHERE EtransNum=" + POut.PInt(etransNum);
            DataTable table   = General.GetTable(command);
            Etrans    etrans  = new Etrans();

            etrans.EtransNum            = PIn.PInt(table.Rows[0][0].ToString());
            etrans.DateTimeTrans        = PIn.PDateT(table.Rows[0][1].ToString());
            etrans.ClearinghouseNum     = PIn.PInt(table.Rows[0][2].ToString());
            etrans.Etype                = (EtransType)PIn.PInt(table.Rows[0][3].ToString());
            etrans.ClaimNum             = PIn.PInt(table.Rows[0][4].ToString());
            etrans.OfficeSequenceNumber = PIn.PInt(table.Rows[0][5].ToString());
            etrans.CarrierTransCounter  = PIn.PInt(table.Rows[0][6].ToString());
            etrans.CarrierTransCounter2 = PIn.PInt(table.Rows[0][7].ToString());
            etrans.CarrierNum           = PIn.PInt(table.Rows[0][8].ToString());
            etrans.CarrierNum2          = PIn.PInt(table.Rows[0][9].ToString());
            etrans.PatNum               = PIn.PInt(table.Rows[0][10].ToString());
            etrans.MessageText          = PIn.PString(table.Rows[0][11].ToString());
            return(etrans);
        }
Example #21
0
        private static Schedule[] RefreshAndFill(string command)
        {
            DataTable table = General.GetTableEx(command);

            Schedule[] List = new Schedule[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                List[i]              = new Schedule();
                List[i].ScheduleNum  = PIn.PInt(table.Rows[i][0].ToString());
                List[i].SchedDate    = PIn.PDate(table.Rows[i][1].ToString());
                List[i].StartTime    = PIn.PDateT(table.Rows[i][2].ToString());
                List[i].StopTime     = PIn.PDateT(table.Rows[i][3].ToString());
                List[i].SchedType    = (ScheduleType)PIn.PInt(table.Rows[i][4].ToString());
                List[i].ProvNum      = PIn.PInt(table.Rows[i][5].ToString());
                List[i].BlockoutType = PIn.PInt(table.Rows[i][6].ToString());
                List[i].Note         = PIn.PString(table.Rows[i][7].ToString());
                List[i].Status       = (SchedStatus)PIn.PInt(table.Rows[i][8].ToString());
                List[i].Op           = PIn.PInt(table.Rows[i][9].ToString());
            }
            return(List);
        }
Example #22
0
        ///<summary>Gets all scheddefaults and stores them in a static array.</summary>
        public static void Refresh()
        {
            string command =
                "SELECT * from scheddefault "
                + "ORDER BY SchedType,"      //this keeps the painting in the correct order
                + "StartTime";               //this helps in the monthly display
            DataTable table = General.GetTable(command);

            List = new SchedDefault[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                List[i] = new SchedDefault();
                List[i].SchedDefaultNum = PIn.PInt(table.Rows[i][0].ToString());
                List[i].DayOfWeek       = PIn.PInt(table.Rows[i][1].ToString());
                List[i].StartTime       = PIn.PDateT(table.Rows[i][2].ToString());
                List[i].StopTime        = PIn.PDateT(table.Rows[i][3].ToString());
                List[i].SchedType       = (ScheduleType)PIn.PInt(table.Rows[i][4].ToString());
                List[i].ProvNum         = PIn.PInt(table.Rows[i][5].ToString());
                List[i].BlockoutType    = PIn.PInt(table.Rows[i][6].ToString());
                List[i].Op = PIn.PInt(table.Rows[i][7].ToString());
            }
        }
Example #23
0
        private static Signal[] RefreshAndFill(string command)
        {
            //we don't want an error message to show, because that can cause a cascade of a large number of error messages.
            DataTable table = null;

            try {
                if (RemotingClient.OpenDentBusinessIsLocal)
                {
                    table = GeneralB.GetTable(command).Tables[0];
                }
                else
                {
                    DtoGeneralGetTable dto = new DtoGeneralGetTable();
                    dto.Command = command;
                    table       = RemotingClient.ProcessQuery(dto).Tables[0];
                }
            }
            catch {
                //MessageBox.Show(e.Message);
                return(new Signal[0]);
            }
            Signal[] List = new Signal[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                List[i]             = new Signal();
                List[i].SignalNum   = PIn.PInt(table.Rows[i][0].ToString());
                List[i].FromUser    = PIn.PString(table.Rows[i][1].ToString());
                List[i].ITypes      = (InvalidTypes)PIn.PInt(table.Rows[i][2].ToString());
                List[i].DateViewing = PIn.PDate(table.Rows[i][3].ToString());
                List[i].SigType     = (SignalType)PIn.PInt(table.Rows[i][4].ToString());
                List[i].SigText     = PIn.PString(table.Rows[i][5].ToString());
                List[i].SigDateTime = PIn.PDateT(table.Rows[i][6].ToString());
                List[i].ToUser      = PIn.PString(table.Rows[i][7].ToString());
                List[i].AckTime     = PIn.PDateT(table.Rows[i][8].ToString());
            }
            Array.Sort(List);
            return(List);
        }
Example #24
0
        ///<summary>isBreaks is ignored if getAll is true.</summary>
        public static ClockEvent[] Refresh(int empNum, DateTime fromDate, DateTime toDate, bool getAll, bool isBreaks)
        {
            string command =
                "SELECT * from clockevent WHERE"
                + " EmployeeNum = '" + POut.PInt(empNum) + "'"
                + " AND TimeDisplayed >= " + POut.PDate(fromDate)
                //adding a day takes it to midnight of the specified toDate
                + " AND TimeDisplayed <= " + POut.PDate(toDate.AddDays(1));

            if (!getAll)
            {
                if (isBreaks)
                {
                    command += " AND ClockStatus = '2'";
                }
                else
                {
                    command += " AND (ClockStatus = '0' OR ClockStatus = '1')";
                }
            }
            command += " ORDER BY TimeDisplayed";
            DataTable table = General.GetTable(command);

            ClockEvent[] List = new ClockEvent[table.Rows.Count];
            for (int i = 0; i < List.Length; i++)
            {
                List[i] = new ClockEvent();
                List[i].ClockEventNum = PIn.PInt(table.Rows[i][0].ToString());
                List[i].EmployeeNum   = PIn.PInt(table.Rows[i][1].ToString());
                List[i].TimeEntered   = PIn.PDateT(table.Rows[i][2].ToString());
                List[i].TimeDisplayed = PIn.PDateT(table.Rows[i][3].ToString());
                List[i].ClockIn       = PIn.PBool(table.Rows[i][4].ToString());
                List[i].ClockStatus   = (TimeClockStatus)PIn.PInt(table.Rows[i][5].ToString());
                List[i].Note          = PIn.PString(table.Rows[i][6].ToString());
            }
            return(List);
        }
Example #25
0
        /// <summary>Gets all task lists with the give object type.  Used in TaskListSelect when assigning an object to a task list.</summary>
        public static TaskList[] GetForObjectType(TaskObjectType oType)
        {
            string command =
                "SELECT * FROM tasklist "
                + "WHERE ObjectType=" + POut.PInt((int)oType)
                + " ORDER BY Descript";
            DataTable table = General.GetTable(command);

            TaskList[] List = new TaskList[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                List[i]               = new TaskList();
                List[i].TaskListNum   = PIn.PInt(table.Rows[i][0].ToString());
                List[i].Descript      = PIn.PString(table.Rows[i][1].ToString());
                List[i].Parent        = PIn.PInt(table.Rows[i][2].ToString());
                List[i].DateTL        = PIn.PDate(table.Rows[i][3].ToString());
                List[i].IsRepeating   = PIn.PBool(table.Rows[i][4].ToString());
                List[i].DateType      = (TaskDateType)PIn.PInt(table.Rows[i][5].ToString());
                List[i].FromNum       = PIn.PInt(table.Rows[i][6].ToString());
                List[i].ObjectType    = (TaskObjectType)PIn.PInt(table.Rows[i][7].ToString());
                List[i].DateTimeEntry = PIn.PDateT(table.Rows[i][8].ToString());
            }
            return(List);
        }
Example #26
0
        ///<summary>Gets a filtered list of all labcases.</summary>
        public static DataTable Refresh(DateTime aptStartDate, DateTime aptEndDate)
        {
            DataTable table = new DataTable();
            DataRow   row;

            //columns that start with lowercase are altered for display rather than being raw data.
            table.Columns.Add("aptDateTime");
            table.Columns.Add("lab");
            table.Columns.Add("LabCaseNum");
            table.Columns.Add("patient");
            table.Columns.Add("phone");
            table.Columns.Add("ProcDescript");
            table.Columns.Add("status");
            string command = "SELECT AptDateTime,DateTimeChecked,DateTimeRecd,DateTimeSent,"
                             + "LabCaseNum,laboratory.Description,LName,FName,Preferred,MiddleI,Phone,ProcDescript "
                             + "FROM labcase,appointment,patient,laboratory "
                             + "WHERE labcase.AptNum=appointment.AptNum "
                             + "AND labcase.PatNum=patient.PatNum "
                             + "AND labcase.LaboratoryNum=laboratory.LaboratoryNum "
                             + "AND AptDateTime > " + POut.PDate(aptStartDate) + " "
                             + "AND AptDateTime < " + POut.PDate(aptEndDate.AddDays(1)) + " "
                             + "ORDER BY AptDateTime";
            DataTable raw = General.GetTable(command);
            DateTime  AptDateTime;
            DateTime  date;

            for (int i = 0; i < raw.Rows.Count; i++)
            {
                row                = table.NewRow();
                AptDateTime        = PIn.PDateT(raw.Rows[i]["AptDateTime"].ToString());
                row["aptDateTime"] = AptDateTime.ToShortDateString() + " " + AptDateTime.ToShortTimeString();
                row["lab"]         = raw.Rows[i]["Description"].ToString();
                row["LabCaseNum"]  = raw.Rows[i]["LabCaseNum"].ToString();
                row["patient"]     = PatientB.GetNameLF(raw.Rows[i]["LName"].ToString(), raw.Rows[i]["FName"].ToString(),
                                                        raw.Rows[i]["Preferred"].ToString(), raw.Rows[i]["MiddleI"].ToString());
                row["phone"]        = raw.Rows[i]["Phone"].ToString();
                row["ProcDescript"] = raw.Rows[i]["ProcDescript"].ToString();
                date = PIn.PDateT(raw.Rows[i]["DateTimeChecked"].ToString());
                if (date.Year > 1880)
                {
                    row["status"] = Lan.g("FormLabCases", "Quality Checked");
                }
                else
                {
                    date = PIn.PDateT(raw.Rows[i]["DateTimeRecd"].ToString());
                    if (date.Year > 1880)
                    {
                        row["status"] = Lan.g("FormLabCases", "Received");
                    }
                    else
                    {
                        date = PIn.PDateT(raw.Rows[i]["DateTimeSent"].ToString());
                        if (date.Year > 1880)
                        {
                            row["status"] = Lan.g("FormLabCases", "Sent");                         //sent but not received
                        }
                        else
                        {
                            row["status"] = Lan.g("FormLabCases", "Not Sent");
                        }
                    }
                }
                table.Rows.Add(row);
            }
            return(table);
        }
Example #27
0
        ///<summary>Used in FormConfirmList</summary>
        public static DataTable GetConfirmList(DateTime dateFrom, DateTime dateTo)
        {
            DataTable table = new DataTable();
            DataRow   row;

            //columns that start with lowercase are altered for display rather than being raw data.
            table.Columns.Add("AddrNote");
            table.Columns.Add("AptNum");
            table.Columns.Add("age");
            table.Columns.Add("aptDateTime");
            table.Columns.Add("confirmed");
            table.Columns.Add("contactMethod");
            table.Columns.Add("Guarantor");
            table.Columns.Add("medNotes");
            table.Columns.Add("Note");
            table.Columns.Add("patientName");
            table.Columns.Add("PatNum");
            table.Columns.Add("ProcDescript");
            List <DataRow> rows    = new List <DataRow>();
            string         command = "SELECT patient.PatNum,"                                         //0
                                     + "patient.LName,"                                               //1-LName
                                     + "patient.FName,patient.Preferred,patient.LName, "              //2-patientName
                                     + "Guarantor,AptDateTime,Birthdate,HmPhone,"                     //3-6
                                     + "WkPhone,WirelessPhone,ProcDescript,Confirmed,Note,"           //7-11
                                     + "AddrNote,AptNum,MedUrgNote,PreferConfirmMethod,Email,Premed " //12-14
                                     + "FROM patient,appointment "
                                     + "WHERE patient.PatNum=appointment.PatNum "
                                     + "AND AptDateTime > " + POut.PDate(dateFrom) + " "
                                     + "AND AptDateTime < " + POut.PDate(dateTo.AddDays(1)) + " "
                                     + "AND (AptStatus=1 " //scheduled
                                     + "OR AptStatus=4) "  //ASAP
                                     + "ORDER BY AptDateTime";
            DataTable     rawtable = General.GetTable(command);
            DateTime      dateT;
            Patient       pat;
            ContactMethod contmeth;

            for (int i = 0; i < rawtable.Rows.Count; i++)
            {
                row                = table.NewRow();
                row["AddrNote"]    = rawtable.Rows[i]["AddrNote"].ToString();
                row["AptNum"]      = rawtable.Rows[i]["AptNum"].ToString();
                row["age"]         = Shared.DateToAge(PIn.PDate(rawtable.Rows[i]["Birthdate"].ToString())).ToString();      //we don't care about m/y.
                dateT              = PIn.PDateT(rawtable.Rows[i]["AptDateTime"].ToString());
                row["aptDateTime"] = dateT.ToShortDateString() + "\r\n" + dateT.ToShortTimeString();
                row["confirmed"]   = DefB.GetName(DefCat.ApptConfirmed, PIn.PInt(rawtable.Rows[i]["Confirmed"].ToString()));
                contmeth           = (ContactMethod)PIn.PInt(rawtable.Rows[i]["PreferConfirmMethod"].ToString());
                if (contmeth == ContactMethod.None || contmeth == ContactMethod.HmPhone)
                {
                    row["contactMethod"] = Lan.g("FormConfirmList", "Hm:") + rawtable.Rows[i]["HmPhone"].ToString();
                }
                if (contmeth == ContactMethod.WkPhone)
                {
                    row["contactMethod"] = Lan.g("FormConfirmList", "Wk:") + rawtable.Rows[i]["WkPhone"].ToString();
                }
                if (contmeth == ContactMethod.WirelessPh)
                {
                    row["contactMethod"] = Lan.g("FormConfirmList", "Cell:") + rawtable.Rows[i]["WirelessPhone"].ToString();
                }
                if (contmeth == ContactMethod.Email)
                {
                    row["contactMethod"] = rawtable.Rows[i]["Email"].ToString();
                }
                if (contmeth == ContactMethod.DoNotCall || contmeth == ContactMethod.SeeNotes)
                {
                    row["contactMethod"] = Lan.g("enumContactMethod", contmeth.ToString());
                }
                row["Guarantor"] = rawtable.Rows[i]["Guarantor"].ToString();
                row["medNotes"]  = "";
                if (rawtable.Rows[i]["Premed"].ToString() == "1")
                {
                    row["medNotes"] = Lan.g("FormConfirmList", "Premedicate");
                }
                if (rawtable.Rows[i]["MedUrgNote"].ToString() != "")
                {
                    if (row["medNotes"].ToString() != "")
                    {
                        row["medNotes"] += "\r\n";
                    }
                    row["medNotes"] += rawtable.Rows[i]["MedUrgNote"].ToString();
                }
                row["Note"]        = rawtable.Rows[i]["Note"].ToString();
                pat                = new Patient();
                pat.LName          = rawtable.Rows[i]["LName"].ToString();
                pat.FName          = rawtable.Rows[i]["FName"].ToString();
                pat.Preferred      = rawtable.Rows[i]["Preferred"].ToString();
                row["patientName"] = pat.LName + "\r\n";
                if (pat.Preferred != "")
                {
                    row["patientName"] += "'" + pat.Preferred + "'";
                }
                else
                {
                    row["patientName"] += pat.FName;
                }
                //pat.GetNameLF();
                row["PatNum"]       = rawtable.Rows[i]["PatNum"].ToString();
                row["ProcDescript"] = rawtable.Rows[i]["ProcDescript"].ToString();
                rows.Add(row);
            }
            //Array.Sort(orderDate,RecallList);
            //return RecallList;
            for (int i = 0; i < rows.Count; i++)
            {
                table.Rows.Add(rows[i]);
            }
            return(table);
        }
Example #28
0
        ///<summary>Returns a 7 column data table in a calendar layout so all you have to do is draw it on the screen.  If includePractice is true, then practice notes and holidays will be included.</summary>
        public static DataTable GetPeriod(DateTime dateStart, DateTime dateEnd, int[] provNums, int[] empNums, bool includePractice)
        {
            DataTable table = new DataTable();
            DataRow   row;

            table.Columns.Add("sun");
            table.Columns.Add("mon");
            table.Columns.Add("tues");
            table.Columns.Add("wed");
            table.Columns.Add("thurs");
            table.Columns.Add("fri");
            table.Columns.Add("sat");
            if (provNums.Length == 0 && empNums.Length == 0 && !includePractice)
            {
                return(table);
            }
            string command = "SELECT Abbr,employee.FName,Note,SchedDate,SchedType,Status,StartTime,StopTime "
                             + "FROM schedule "
                             + "LEFT JOIN provider ON schedule.ProvNum=provider.ProvNum "
                             + "LEFT JOIN employee ON schedule.EmployeeNum=employee.EmployeeNum "
                             + "WHERE SchedDate >= " + POut.PDate(dateStart) + " "
                             + "AND SchedDate <= " + POut.PDate(dateEnd) + " "
                             + "AND (";
            string orClause = "";          //this is guaranteed to be non empty by the time the command is assembled.

            if (includePractice)
            {
                orClause = "SchedType=0 ";
            }
            for (int i = 0; i < provNums.Length; i++)
            {
                if (orClause != "")
                {
                    orClause += "OR ";
                }
                orClause += "schedule.ProvNum=" + POut.PInt(provNums[i]) + " ";
            }
            for (int i = 0; i < empNums.Length; i++)
            {
                if (orClause != "")
                {
                    orClause += "OR ";
                }
                orClause += "schedule.EmployeeNum=" + POut.PInt(empNums[i]) + " ";
            }
            command += orClause + ") ";
            //if(FormChooseDatabase.DBtype==DatabaseType.Oracle){
            //	command+="";
            //}
            //else{
            command += "ORDER BY SchedDate,employee.FName,provider.ItemOrder,StartTime";
            //}
            DataTable raw = General.GetTable(command);
            DateTime  dateSched;
            DateTime  startTime;
            DateTime  stopTime;
            int       rowsInGrid = GetRowCal(dateStart, dateEnd) + 1; //because 0-based

            for (int i = 0; i < rowsInGrid; i++)
            {
                row = table.NewRow();
                table.Rows.Add(row);
            }
            dateSched = dateStart;
            while (dateSched <= dateEnd)
            {
                table.Rows[GetRowCal(dateStart, dateSched)][(int)dateSched.DayOfWeek] =
                    dateSched.ToString("MMM d");
                dateSched = dateSched.AddDays(1);
            }
            int rowI;

            for (int i = 0; i < raw.Rows.Count; i++)
            {
                dateSched = PIn.PDate(raw.Rows[i]["SchedDate"].ToString());
                startTime = PIn.PDateT(raw.Rows[i]["StartTime"].ToString());
                stopTime  = PIn.PDateT(raw.Rows[i]["StopTime"].ToString());
                rowI      = GetRowCal(dateStart, dateSched);
                if (i != 0 &&          //not first row
                    raw.Rows[i - 1]["Abbr"].ToString() == raw.Rows[i]["Abbr"].ToString() &&                //same provider as previous row
                    raw.Rows[i - 1]["FName"].ToString() == raw.Rows[i]["FName"].ToString() &&                //same employee as previous row
                    raw.Rows[i - 1]["SchedDate"].ToString() == raw.Rows[i]["SchedDate"].ToString())                   //and same date as previous row
                {
                    table.Rows[rowI][(int)dateSched.DayOfWeek] += ", ";
                    if (startTime.TimeOfDay == PIn.PDateT("12 AM").TimeOfDay &&
                        stopTime.TimeOfDay == PIn.PDateT("12 AM").TimeOfDay)
                    {
                        if (raw.Rows[i]["Status"].ToString() == "2")                       //if holiday
                        {
                            table.Rows[rowI][(int)dateSched.DayOfWeek] += Lan.g("Schedules", "Holiday:");
                        }
                    }
                    else
                    {
                        table.Rows[rowI][(int)dateSched.DayOfWeek] += startTime.ToString("h:mm") + "-" + stopTime.ToString("h:mm");
                    }
                }
                else
                {
                    table.Rows[rowI][(int)dateSched.DayOfWeek] += "\r\n";
                    if (startTime.TimeOfDay == PIn.PDateT("12 AM").TimeOfDay &&
                        stopTime.TimeOfDay == PIn.PDateT("12 AM").TimeOfDay)
                    {
                        if (raw.Rows[i]["Status"].ToString() == "2")                                      //if holiday
                        {
                            table.Rows[rowI][(int)dateSched.DayOfWeek] += Lan.g("Schedules", "Holiday:"); //+raw.Rows[i]["Note"].ToString();
                        }
                        else                                                                              //note
                        {
                            if (raw.Rows[i]["Abbr"].ToString() != "")
                            {
                                table.Rows[rowI][(int)dateSched.DayOfWeek] += raw.Rows[i]["Abbr"].ToString() + " ";
                            }
                            if (raw.Rows[i]["FName"].ToString() != "")
                            {
                                table.Rows[rowI][(int)dateSched.DayOfWeek] += raw.Rows[i]["FName"].ToString() + " ";
                            }
                            //table.Rows[rowI][(int)dateSched.DayOfWeek]+=raw.Rows[i]["Note"].ToString();
                        }
                    }
                    else
                    {
                        if (raw.Rows[i]["Abbr"].ToString() != "")
                        {
                            table.Rows[rowI][(int)dateSched.DayOfWeek] += raw.Rows[i]["Abbr"].ToString() + " ";
                        }
                        if (raw.Rows[i]["FName"].ToString() != "")
                        {
                            table.Rows[rowI][(int)dateSched.DayOfWeek] += raw.Rows[i]["FName"].ToString() + " ";
                        }
                        table.Rows[rowI][(int)dateSched.DayOfWeek] +=
                            startTime.ToString("h:mm") + "-" + stopTime.ToString("h:mm");
                    }
                }
                if (raw.Rows[i]["Note"].ToString() != "")
                {
                    table.Rows[rowI][(int)dateSched.DayOfWeek] += " " + raw.Rows[i]["Note"].ToString();
                }
            }
            return(table);
        }
Example #29
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;
        }
Example #30
0
        ///<summary>Gets all tasks for a given taskList.  But the 5 trunks don't have parents: For main trunk use date.Min and TaskListNum=0.  For Repeating trunk use date.Min isRepeating and TaskListNum=0.  For the 3 dated trunks, use a date and a dateType.  Date and TaskListNum are mutually exclusive.  Also used to get all repeating tasks for one dateType without any heirarchy: supply listNum=-1.</summary>
        public static Task[] Refresh(int listNum, DateTime date, TaskDateType dateType, bool isRepeating)
        {
            DateTime dateFrom = DateTime.MinValue;
            DateTime dateTo   = DateTime.MaxValue;

            string where = "";
            if (date.Year > 1880)
            {
                //date supplied always indicates one of 3 dated trunks.
                //the value of listNum is completely ignored
                if (dateType == TaskDateType.Day)
                {
                    dateFrom = date;
                    dateTo   = date;
                }
                else if (dateType == TaskDateType.Week)
                {
                    dateFrom = date.AddDays(-(int)date.DayOfWeek);
                    dateTo   = dateFrom.AddDays(6);
                }
                else if (dateType == TaskDateType.Month)
                {
                    dateFrom = new DateTime(date.Year, date.Month, 1);
                    dateTo   = dateFrom.AddMonths(1).AddDays(-1);
                }
                where = "DateTask >= " + POut.PDate(dateFrom)
                        + " AND DateTask <= " + POut.PDate(dateTo) + " "
                        + "AND DateType=" + POut.PInt((int)dateType) + " ";
            }
            else                  //no date supplied.
            {
                if (listNum == 0) //main trunk or repeating trunk
                {
                    where = "TaskListNum=" + POut.PInt(listNum)
                            + " AND DateTask < '1880-01-01'"
                            + " AND IsRepeating=" + POut.PBool(isRepeating) + " ";
                }
                else if (listNum == -1 && isRepeating)               //all repeating items with no heirarchy
                {
                    where = "IsRepeating=1 "
                            + "AND DateType=" + POut.PInt((int)dateType) + " ";
                }
                else                  //any child
                {
                    where = "TaskListNum=" + POut.PInt(listNum) + " ";
                    //+" AND IsRepeating="+POut.PBool(isRepeating)+" ";
                }
            }
            string command =
                "SELECT * FROM task "
                + "WHERE " + where
                + "ORDER BY DateTimeEntry";
            DataTable table = General.GetTable(command);

            Task[] List = new Task[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                List[i]               = new Task();
                List[i].TaskNum       = PIn.PInt(table.Rows[i][0].ToString());
                List[i].TaskListNum   = PIn.PInt(table.Rows[i][1].ToString());
                List[i].DateTask      = PIn.PDate(table.Rows[i][2].ToString());
                List[i].KeyNum        = PIn.PInt(table.Rows[i][3].ToString());
                List[i].Descript      = PIn.PString(table.Rows[i][4].ToString());
                List[i].TaskStatus    = PIn.PBool(table.Rows[i][5].ToString());
                List[i].IsRepeating   = PIn.PBool(table.Rows[i][6].ToString());
                List[i].DateType      = (TaskDateType)PIn.PInt(table.Rows[i][7].ToString());
                List[i].FromNum       = PIn.PInt(table.Rows[i][8].ToString());
                List[i].ObjectType    = (TaskObjectType)PIn.PInt(table.Rows[i][9].ToString());
                List[i].DateTimeEntry = PIn.PDateT(table.Rows[i][10].ToString());
            }
            return(List);
        }