Ignore:
Timestamp:
Feb 21, 2011, 9:21:24 AM (13 years ago)
Author:
Sam Habiel
Message:

Remove CGSchedLib.OutputArray everywhere. Used to be needed in VS 2003; not anymore as you can see tables now.
CalendarGrid:

  • Make MinSince80 and TimesOverlap static functions for use by other classes since they are done over and over again.

CGAppointments:

  • Documentation updates

CGAVDocument:

CGDocument:

CGDocumentManager:

CGSchedLib: Lots of Changes

CGView:

  • OnUpdateScheduleCallback now has try catch when it this.Invokes the original form so that it won't crash if the form has been closed before it gets called.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocument.cs

    r1084 r1095  
    173173        /// <summary>
    174174        /// Update schedule based on info in RPMS
     175        /// <returns>Clears and repopluates m_appointments</returns>
    175176        /// </summary>
    176177        private bool RefreshDaysSchedule()
     
    200201                m_dLastRefresh = DateTime.Now;
    201202
     203                //Clear appointments associated with this document
    202204                this.m_appointments.ClearAllAppointments();
    203205
     
    205207                rAppointmentSchedule = CGSchedLib.CreateAppointmentSchedule(m_DocManager, m_sResourcesArray, this.m_dStartDate, this.m_dEndDate);
    206208
    207                 // Datatable dumper into Debug Log (nice to know that this exists)
    208                 CGSchedLib.OutputArray(rAppointmentSchedule, "rAppointmentSchedule");
    209 
    210 
     209                // loop through datatable: Create CGAppointment and add to CGAppointments
    211210                foreach (DataRow r in rAppointmentSchedule.Rows)
    212211                {
     
    422421            try
    423422            {
    424                 if (this.m_DocManager.ConnectInfo.Connected == false)
    425                 {
    426                     m_DocManager.ConnectInfo.LoadConnectInfo();
    427                 }
    428 
    429423                ArrayList saryApptTypes = new ArrayList();
    430                 int nApptTypeID = 0;
    431 
     424               
    432425                //Refresh Availability schedules
    433426                DataTable rAvailabilitySchedule;
    434427                rAvailabilitySchedule = CGSchedLib.CreateAvailabilitySchedule(m_DocManager, m_sResourcesArray, this.m_dStartDate, this.m_dEndDate, saryApptTypes,/**/ m_ScheduleType, "0");
    435                 CGSchedLib.OutputArray(rAvailabilitySchedule, "rAvailabilitySchedule");
    436 
     428
     429                ////NEW
     430                //NOTE: This lock makes sure that availabilities aren't queried for slots when the array is an intermediate
     431                //state. The other place that has this lock is SlotsAvailable function.
     432                lock (this.m_pAvArray)
     433                {
     434                    m_pAvArray.Clear();
     435                    foreach (DataRow rTemp in rAvailabilitySchedule.Rows)
     436                    {
     437                        DateTime dStart = (DateTime)rTemp["START_TIME"];
     438                        DateTime dEnd = (DateTime)rTemp["END_TIME"];
     439
     440                        //TODO: Fix this slots datatype problem
     441                        string sSlots = rTemp["SLOTS"].ToString();
     442                        int nSlots = Convert.ToInt16(sSlots);
     443
     444                        string sResourceList = rTemp["RESOURCE"].ToString();
     445                        string sAccessRuleList = rTemp["ACCESS_TYPE"].ToString();
     446                        string sNote = rTemp["NOTE"].ToString();
     447
     448                        int nApptTypeID;
     449
     450                        if ((nSlots < -1000) || (sAccessRuleList == ""))
     451                        {
     452                            nApptTypeID = 0;
     453                        }
     454                        else
     455                        {
     456                            nApptTypeID = Int32.Parse(rTemp["ACCESS_TYPE"].ToString());
     457                        }
     458
     459                        AddAvailability(dStart, dEnd, nApptTypeID, nSlots, sResourceList, sAccessRuleList, sNote);
     460                    }
     461                }
     462                return true;
     463               
     464                /* NOT USED
    437465                //Refresh Type Schedule
    438466                string sResourceName = "";
     
    442470                    sResourceName = m_sResourcesArray[j].ToString();
    443471                    DataTable dtTemp = CGSchedLib.CreateAssignedTypeSchedule(m_DocManager, sResourceName, this.m_dStartDate, this.m_dEndDate, m_ScheduleType);
    444                     CGSchedLib.OutputArray(dtTemp, "dtTemp");
     472
    445473                    if (j == 0)
    446474                    {
     
    452480                    }
    453481                }
    454                 CGSchedLib.OutputArray(rTypeSchedule, "rTypeSchedule");
    455482
    456483                DateTime dStart;
     
    523550
    524551
    525                         AddAvailability(dStart, dEnd, nApptTypeID, nSlots, false, sResourceList, sAccessRuleList, sNote);
     552                        //AddAvailability(dStart, dEnd, nApptTypeID, nSlots, sResourceList, sAccessRuleList, sNote);
    526553                    }//end foreach datarow rTemp
    527554                }//end lock
    528555                return true;
     556             */
    529557            }
    530558            catch (Exception ex)
     
    552580        /// <param name="sNote"></param>
    553581        /// <returns></returns>
    554         public int AddAvailability(DateTime StartTime, DateTime EndTime, int nType, int nSlots, bool UpdateView, string sResourceList, string sAccessRuleList, string sNote)
     582        public int AddAvailability(DateTime StartTime, DateTime EndTime, int nType, int nSlots, string sResourceList, string sAccessRuleList, string sNote)
    555583        {
    556584            //adds it to the object array
     
    588616            int nIndex = 0;
    589617            nIndex = m_pAvArray.Add(pNewAv);
    590             if (UpdateView == true)
    591             {
    592                 this.UpdateAllViews();
    593             }
     618
    594619            return nIndex;
    595620        }
Note: See TracChangeset for help on using the changeset viewer.