示例#1
0
        ///<Summary>Supply a datarow that contains all the database values needed for the appointment that is being added.</Summary>
        public void AddAppointment(DataRow row, DataTable tableApptFields, DataTable tablePatFields)
        {
            //if appointment is already on the pinboard, just select it.
            for (int i = 0; i < apptList.Count; i++)
            {
                if (apptList[i].DataRoww["AptNum"].ToString() == row["AptNum"].ToString())
                {
                    //Highlight it
                    selectedIndex          = i;
                    apptList[i].IsSelected = true;
                    Invalidate();
                    //throw new ApplicationException(Lan.g(this,"Appointment is already on the pinboard."));
                }
            }
            ContrApptSingle PinApptSingle = new ContrApptSingle();

            PinApptSingle.ThisIsPinBoard  = true;
            PinApptSingle.DataRoww        = row;
            PinApptSingle.TableApptFields = tableApptFields;
            PinApptSingle.TablePatFields  = tablePatFields;
            PinApptSingle.Size            = ApptSingleDrawing.SetSize(row);
            PinApptSingle.PatternShowing  = ApptSingleDrawing.GetPatternShowing(row["Pattern"].ToString());
            PinApptSingle.Width           = Width - 2;
            PinApptSingle.IsSelected      = true;
            PinApptSingle.Location        = new Point(0, 13 * apptList.Count);
            apptList.Add(PinApptSingle);
            selectedIndex = apptList.Count - 1;
            Invalidate();
        }
示例#2
0
 ///<summary>It is planned to move some of this logic to OnPaint and use a true double buffer.</summary>
 public void CreateShadow()
 {
     if (this.Parent is ContrApptSheet)
     {
         bool isVisible = ApptDrawing.GetIndexOp(OpNum) >= 0;
         if (!isVisible)
         {
             return;
         }
     }
     DisposeShadow();
     if (Width < 4)
     {
         return;
     }
     if (Height < 4)
     {
         return;
     }
     Shadow = new Bitmap(Width, Height);
     using (Graphics g = Graphics.FromImage(Shadow)) {
         ApptSingleDrawing.DrawEntireAppt(g, DataRoww, PatternShowing, Width, Height, IsSelected, ThisIsPinBoard, SelectedAptNum,
                                          ApptViewItemL.ApptRows, ApptViewItemL.ApptViewCur, TableApptFields, TablePatFields, 8, false);
         //In most cases, drawing will be taken care of by ContrApptSheet.DoubleBufferDraw().
         //However, BackgroundImage must be set here to draw the bitmap when when dragging.
         this.BackgroundImage = Shadow;
     }
 }
示例#3
0
        ///<summary>It is planned to move some of this logic to OnPaint and use a true double buffer.</summary>
        public void CreateShadow()
        {
            if (this.Parent is ContrApptSheet)
            {
                bool isVisible = ApptDrawing.GetIndexOp(OpNum) >= 0;
                if (!isVisible)
                {
                    return;
                }
            }
            DisposeShadow();
            if (Width < 4)
            {
                return;
            }
            if (Height < 4)
            {
                return;
            }
            Bitmap shadowNew = new Bitmap(Width, Height);

            using (Graphics g = Graphics.FromImage(shadowNew)) {
                ApptSingleDrawing.DrawEntireAppt(g, DataRoww, PatternShowing, Width, Height, IsSelected, ThisIsPinBoard, SelectedAptNum,
                                                 ApptViewItemL.ApptRows, ApptViewItemL.ApptViewCur, TableApptFields, TablePatFields, 8, false);
            }
            //In most cases, drawing will be taken care of by ContrApptSheet.DoubleBufferDraw().
            //However, BackgroundImage must be set here to draw the bitmap when when dragging.
            //If this was inside the using block, a GDI+ exception would sometimes be thrown because the graphics object would still be accessing the
            //image data when the image reference was changed.
            Shadow          = shadowNew;
            BackgroundImage = shadowNew;
        }
示例#4
0
 ///<summary>If an appt is already on the pinboard, and the information in it is change externally, this 'refreshes' the data.</summary>
 public void ResetData(DataRow row)
 {
     for (int i = 0; i < apptList.Count; i++)
     {
         if (apptList[i].DataRoww["AptNum"].ToString() == row["AptNum"].ToString())
         {
             apptList[i].DataRoww = row;
             apptList[i].Size     = ApptSingleDrawing.SetSize(row);
             apptList[i].Width    = Width - 2;
             //PinApptSingle.IsSelected=true;
             //PinApptSingle.Location=new Point(0,13*apptList.Count);
         }
     }
     Invalidate();
 }
示例#5
0
 ///<summary>It is planned to move some of this logic to OnPaint and use a true double buffer.</summary>
 public void CreateShadow()
 {
     if (this.Parent is ContrApptSheet)
     {
         bool isVisible = false;
         for (int j = 0; j < ApptDrawing.VisOps.Count; j++)
         {
             if (DataRoww["Op"].ToString() == ApptDrawing.VisOps[j].OperatoryNum.ToString())
             {
                 isVisible = true;
             }
         }
         if (!isVisible)
         {
             return;
         }
     }
     if (Shadow != null)
     {
         Shadow.Dispose();
         Shadow = null;
     }
     if (Width < 4)
     {
         return;
     }
     if (Height < 4)
     {
         return;
     }
     Shadow = new Bitmap(Width, Height);
     if (PatternShowing == null)
     {
         PatternShowing = "";
     }
     using (Graphics g = Graphics.FromImage(Shadow)) {
         ApptSingleDrawing.DrawEntireAppt(g, DataRoww, PatternShowing, Width, Height, IsSelected, ThisIsPinBoard, SelectedAptNum,
                                          ApptViewItemL.ApptRows, ApptViewItemL.ApptViewCur, TableApptFields, TablePatFields, 8, false);
         this.BackgroundImage = Shadow;
     }
 }
示例#6
0
        ///<summary>Set all fields of this control. This is an alternative to constructing an entirely new instance.
        ///All uses of this control currently construct as Visible=false so that is the default here.</summary>
        public void ResetData(DataRow rowApt, DataTable tableApptFields, DataTable tablePatFields, Point location, bool visible = false)
        {
            DataRoww        = rowApt;
            TableApptFields = tableApptFields;
            TablePatFields  = tablePatFields;
            Pattern         = PIn.String(DataRoww["Pattern"].ToString());
            PatternShowing  = ApptSingleDrawing.GetPatternShowing(Pattern);
            Location        = location;
            Size            = ApptSingleDrawing.SetSize(Pattern);
            //These controls are always drawn as their Shadow bitmap.
            //They never actually render as a control.
            //Always set Visible to false here so that parent panel/form doesn't account for them when drawings it's controls.
            //In the case where it is a draggable control or on the pinboard, then it will be set to Visible=true.
            Visible = visible;
            //These are used heavily so deserialize here once to save time when accessing.
            AptNum           = PIn.Long(DataRoww["AptNum"].ToString());
            PatNum           = PIn.Long(DataRoww["PatNum"].ToString());
            AptDateTime      = PIn.DateT(DataRoww["AptDateTime"].ToString());
            OpNum            = PIn.Long(DataRoww["Op"].ToString());
            ClinicNum        = PIn.Long(DataRoww["ClinicNum"].ToString());
            ProvNum          = PIn.Long(DataRoww["ProvNum"].ToString());
            ProvHyg          = PIn.Long(DataRoww["ProvHyg"].ToString());
            Confirmed        = PIn.Long(DataRoww["Confirmed"].ToString());
            IsHygiene        = PIn.Bool(DataRoww["IsHygiene"].ToString());
            GrossProduction  = PIn.Decimal(DataRoww["productionVal"].ToString());
            WriteoffPPO      = PIn.Decimal(DataRoww["writeoffPPO"].ToString());
            AdjustmentTotal  = PIn.Decimal(DataRoww["adjustmentTotal"].ToString());
            ImageFolder      = PIn.String(DataRoww["ImageFolder"].ToString());
            PatientName      = PIn.String(DataRoww["patientName"].ToString());
            AptDate          = PIn.String(DataRoww["aptDate"].ToString());
            AptDay           = PIn.String(DataRoww["aptDay"].ToString());
            AptLength        = PIn.String(DataRoww["aptLength"].ToString());
            AptTime          = PIn.String(DataRoww["aptTime"].ToString());
            Email            = PIn.String(DataRoww["Email"].ToString());
            Language         = PIn.String(DataRoww["language"].ToString());
            ReferralTo       = PIn.String(DataRoww["referralTo"].ToString());
            ReferralFrom     = PIn.String(DataRoww["referralFrom"].ToString());
            ApptModNote      = PIn.String(DataRoww["apptModNote"].ToString());
            FamFinUrgNote    = PIn.String(DataRoww["famFinUrgNote"].ToString());
            AddrNote         = PIn.String(DataRoww["addrNote"].ToString());
            Insurance        = PIn.String(DataRoww["insurance"].ToString());
            ContactMethods   = PIn.String(DataRoww["contactMethods"].ToString());
            WirelessPhone    = PIn.String(DataRoww["wirelessPhone"].ToString());
            WkPhone          = PIn.String(DataRoww["wkPhone"].ToString());
            HmPhone          = PIn.String(DataRoww["hmPhone"].ToString());
            Age              = PIn.String(DataRoww["age"].ToString());
            BillingType      = PIn.String(DataRoww["billingType"].ToString());
            ChartNumber      = PIn.String(DataRoww["chartNumber"].ToString());
            Note             = PIn.String(DataRoww["Note"].ToString());
            Procs            = PIn.String(DataRoww["procs"].ToString());
            Lab              = PIn.String(DataRoww["lab"].ToString());
            MedUrgNote       = PIn.String(DataRoww["MedUrgNote"].ToString());
            PreMedFlag       = PIn.String(DataRoww["preMedFlag"].ToString());
            ConfirmedFromDef = PIn.String(DataRoww["confirmed"].ToString());
            Production       = PIn.String(DataRoww["production"].ToString());
            Provider         = PIn.String(DataRoww["provider"].ToString());
            ApptStatus aptStatus;

            if (Enum.TryParse(PIn.String(DataRoww["AptStatus"].ToString()), out aptStatus))
            {
                AptStatus = aptStatus;
            }
            else
            {
                AptStatus = ApptStatus.None;
            }
            ApptPriority priority;

            if (Enum.TryParse(PIn.String(DataRoww["Priority"].ToString()), out priority))
            {
                Priority = priority;
            }
            else
            {
                Priority = ApptPriority.Normal;
            }
        }
示例#7
0
        ///<summary>Tests to see if this appointment will create a double booking. Returns arrayList with no items in it if no double bookings for this appt.  But if double booking, then it returns an arrayList of codes which would be double booked.  You must supply the appointment being scheduled as well as a list of all appointments for that day.  The list can include the appointment being tested if user is moving it to a different time on the same day.  The ProcsForOne list of procedures needs to contain the procedures for the apt becauese procsMultApts won't necessarily, especially if it's a planned appt on the pinboard.</summary>
        public static ArrayList GetDoubleBookedCodes(Appointment apt, DataTable dayTable, List <Procedure> procsMultApts, Procedure[] procsForOne)
        {
            ArrayList retVal = new ArrayList();          //codes
            //figure out which provider we are testing for
            long provNum;

            if (apt.IsHygiene)
            {
                provNum = apt.ProvHyg;
            }
            else
            {
                provNum = apt.ProvNum;
            }
            //compute the starting row of this appt
            int convertToY = (int)(((double)apt.AptDateTime.Hour * (double)60
                                    / (double)PrefC.GetLong(PrefName.AppointmentTimeIncrement)
                                    + (double)apt.AptDateTime.Minute
                                    / (double)PrefC.GetLong(PrefName.AppointmentTimeIncrement)
                                    ) * (double)ApptDrawing.LineH * ApptDrawing.RowsPerIncr);
            int    startIndex = convertToY / ApptDrawing.LineH;     //rounds down
            string pattern    = ApptSingleDrawing.GetPatternShowing(apt.Pattern);
            //keep track of which rows in the entire day would be occupied by provider time for this appt
            ArrayList aptProvTime = new ArrayList();

            for (int k = 0; k < pattern.Length; k++)
            {
                if (pattern.Substring(k, 1) == "X")
                {
                    aptProvTime.Add(startIndex + k);                  //even if it extends past midnight, we don't care
                }
            }
            //Now, loop through all the other appointments for the day, and see if any would overlap this one
            bool overlaps;

            Procedure[] procs;
            bool        doubleBooked = false;   //applies to all appts, not just one at a time.
            DateTime    aptDateTime;

            for (int i = 0; i < dayTable.Rows.Count; i++)
            {
                if (dayTable.Rows[i]["AptNum"].ToString() == apt.AptNum.ToString())              //ignore current apt in its old location
                {
                    continue;
                }
                //ignore other providers
                if (dayTable.Rows[i]["IsHygiene"].ToString() == "1" && dayTable.Rows[i]["ProvHyg"].ToString() != provNum.ToString())
                {
                    continue;
                }
                if (dayTable.Rows[i]["IsHygiene"].ToString() == "0" && dayTable.Rows[i]["ProvNum"].ToString() != provNum.ToString())
                {
                    continue;
                }
                if (dayTable.Rows[i]["AptStatus"].ToString() == ((int)ApptStatus.Broken).ToString())              //ignore broken appts
                {
                    continue;
                }
                aptDateTime = PIn.DateT(dayTable.Rows[i]["AptDateTime"].ToString());
                if (ApptDrawing.IsWeeklyView && aptDateTime.Date != apt.AptDateTime.Date)              //These appointments are on different days.
                {
                    continue;
                }
                //calculate starting row
                //this math is copied from another section of the program, so it's sloppy. Safer than trying to rewrite it:
                convertToY = (int)(((double)aptDateTime.Hour * (double)60
                                    / (double)PrefC.GetLong(PrefName.AppointmentTimeIncrement)
                                    + (double)aptDateTime.Minute
                                    / (double)PrefC.GetLong(PrefName.AppointmentTimeIncrement)
                                    ) * (double)ApptDrawing.LineH * ApptDrawing.RowsPerIncr);
                startIndex = convertToY / ApptDrawing.LineH;            //rounds down
                pattern    = ApptSingleDrawing.GetPatternShowing(dayTable.Rows[i]["Pattern"].ToString());
                //now compare it to apt
                overlaps = false;
                for (int k = 0; k < pattern.Length; k++)
                {
                    if (pattern.Substring(k, 1) == "X")
                    {
                        if (aptProvTime.Contains(startIndex + k))
                        {
                            overlaps     = true;
                            doubleBooked = true;
                        }
                    }
                }
                if (overlaps)
                {
                    //we need to add all codes for this appt to retVal
                    procs = Procedures.GetProcsOneApt(PIn.Long(dayTable.Rows[i]["AptNum"].ToString()), procsMultApts);
                    for (int j = 0; j < procs.Length; j++)
                    {
                        retVal.Add(ProcedureCodes.GetStringProcCode(procs[j].CodeNum));
                    }
                }
            }
            //now, retVal contains all double booked procs except for this appt
            //need to all procs for this appt.
            if (doubleBooked)
            {
                for (int j = 0; j < procsForOne.Length; j++)
                {
                    retVal.Add(ProcedureCodes.GetStringProcCode(procsForOne[j].CodeNum));
                }
            }
            return(retVal);
        }