示例#1
0
        ///<summary>Tests if the appt is in the allotted time frame and is in a visible operatory.  Returns false in order to skip drawing for apptointment printing.</summary>
        public static bool ApptWithinTimeFrame(DataRow dataRoww, DateTime beginTime, DateTime endTime, int colsPerPage, int pageColumn)
        {
            //Test if appts op is currently visible.
            bool visible = false;

            if (!ApptDrawing.IsWeeklyView)
            {
                for (int i = 0; i < colsPerPage; i++)
                {
                    if (i == ApptDrawing.VisOps.Count)
                    {
                        return(false);
                    }
                    int k = colsPerPage * pageColumn + i;
                    if (k >= ApptDrawing.VisOps.Count)
                    {
                        return(false);
                    }
                    if (k == ApptDrawing.GetIndexOp(PIn.Long(dataRoww["Op"].ToString())))
                    {
                        visible = true;
                        break;
                    }
                }
                if (!visible)                 //Op not visible so don't test time frame.
                {
                    return(false);
                }
            }
            //Test if any portion of appt is within time frame.
            TimeSpan aptTimeBegin = PIn.DateT(dataRoww["AptDateTime"].ToString()).TimeOfDay;
            TimeSpan aptTimeEnd   = aptTimeBegin.Add(new TimeSpan(0, dataRoww["Pattern"].ToString().Length *5, 0));
            int      aptHourBegin = aptTimeBegin.Hours;
            int      aptHourEnd   = aptTimeEnd.Hours;

            if (aptHourEnd == 0)
            {
                aptHourEnd = 24;
            }
            int beginHour = beginTime.Hour;
            int endHour   = endTime.Hour;

            if (endHour == 0)
            {
                endHour = 24;
            }
            if (aptHourBegin >= endHour || aptHourEnd < beginHour)
            {
                return(false);
            }
            return(true);
        }
示例#2
0
 ///<summary>Called from SetLocation to establish X position of control.</summary>
 public static int ConvertToX(DataRow dataRoww, int colsPerPage, int pageColumn)
 {
     if (ApptDrawing.IsWeeklyView)
     {
         //the next few lines are because we start on Monday instead of Sunday
         int dayofweek = (int)PIn.DateT(dataRoww["AptDateTime"].ToString()).DayOfWeek - 1;
         if (dayofweek == -1)
         {
             dayofweek = 6;
         }
         return((int)(ApptDrawing.TimeWidth
                      + ApptDrawing.ColDayWidth * (dayofweek) + 1
                      + (ApptDrawing.ColAptWidth * (ApptDrawing.GetIndexOp(PIn.Long(dataRoww["Op"].ToString())) - (colsPerPage * pageColumn)))));
     }
     else
     {
         return((int)(ApptDrawing.TimeWidth + ApptDrawing.ProvWidth * ApptDrawing.ProvCount
                      + ApptDrawing.ColWidth * (ApptDrawing.GetIndexOp(PIn.Long(dataRoww["Op"].ToString())) - (colsPerPage * pageColumn)) + 1));
         //Info.MyApt.Op))+1;
     }
 }