Changeset 1070


Ignore:
Timestamp:
Jan 18, 2011, 9:15:22 AM (13 years ago)
Author:
Sam Habiel
Message:

LoadingSplash: New Form that does... pretty much nothing. Just shows a splash when updating data from server.
CGView:

CGDocumentManager:

CGDocument:

Location:
Scheduling/trunk/cs/bsdx0200GUISourceCode
Files:
3 added
7 edited

Legend:

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

    r1065 r1070  
    113113                        {
    114114                                this.m_dSelectedDate = value;
    115                                 bool bRet = false;
    116                                 if (m_sResourcesArray.Count == 1)
    117                                 {
    118                                         bRet = this.WeekNeedsRefresh(1, m_dSelectedDate, out this.m_dStartDate, out this.m_dEndDate);
    119                                 }
    120                                 else
    121                                 {
    122                                         this.m_dStartDate = m_dSelectedDate;
    123                                         this.m_dEndDate = m_dSelectedDate;
    124                                         this.m_dEndDate = this.m_dEndDate.AddHours(23);
    125                                         this.m_dEndDate = this.m_dEndDate.AddMinutes(59);
    126                                         this.m_dEndDate = this.m_dEndDate.AddSeconds(59);
    127                                 }
    128 
    129                                 bRet = RefreshSchedule();
    130115                        }
    131116                }
     
    303288                }
    304289
    305                 private void SetDate(DateTime dDate)
    306                 {
    307                         bool bRet = false;
    308                         if (m_ScheduleType == ScheduleType.Resource)
    309                         {
    310                                 bRet = this.WeekNeedsRefresh(2,dDate, out this.m_dStartDate, out this.m_dEndDate);
    311                         }
    312                         else
    313                         {
    314                                 this.m_dStartDate = dDate;
    315                                 this.m_dEndDate = dDate;
    316                                 this.m_dEndDate = this.m_dEndDate.AddHours(23);
    317                                 this.m_dEndDate = this.m_dEndDate.AddMinutes(59);
    318                                 this.m_dEndDate = this.m_dEndDate.AddSeconds(59);
    319                         }
     290                public void RefreshDocument()
     291                {
     292            bool bRet = false;
     293            if (m_sResourcesArray.Count == 1)
     294            {
     295                bRet = this.WeekNeedsRefresh(1, m_dSelectedDate, out this.m_dStartDate, out this.m_dEndDate);
     296            }
     297            else
     298            {
     299                this.m_dStartDate = m_dSelectedDate;
     300                this.m_dEndDate = m_dSelectedDate;
     301                this.m_dEndDate = this.m_dEndDate.AddHours(23);
     302                this.m_dEndDate = this.m_dEndDate.AddMinutes(59);
     303                this.m_dEndDate = this.m_dEndDate.AddSeconds(59);
     304            }
    320305
    321306                        bRet = RefreshSchedule();
    322                         this.UpdateAllViews();
    323                 }
    324 
    325                 public void RefreshDocument()
    326                 {
    327                         bool bRet = RefreshSchedule();
    328307                        this.UpdateAllViews();
    329308                }
     
    356335                                CGView view = null;
    357336                                //If this document already has a view, the use it
     337                //SAM: Why do this again???
    358338                                Hashtable h = CGDocumentManager.Current.Views;         
    359339                                CGDocument d;
     
    590570                        //TODO:  Test that resource is not currently in list, that it IS a resource, etc
    591571                        this.m_sResourcesArray.Add(sResource);
    592             //UpdateAllViews: Redraws all the open views. But does not call server.
    593                         this.UpdateAllViews();
     572            //SAM: removing: Remove UpdateAllViews: Redraws all the open views. But does not call server.
     573                        //this.UpdateAllViews();
    594574                }
    595575
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocumentManager.cs

    r1065 r1070  
    198198
    199199            //Create the first empty document
     200            //SAM: Good place for break point
    200201            CGDocument doc = new CGDocument();
    201202            doc.DocManager = _current;
     
    281282                #region Methods & Events
    282283
    283        
    284                 private void StartSplash(object form)
    285                 {
    286             ((DSplash)form).ShowDialog();
    287                 }
    288 
    289284        /// <summary>
    290285        /// See InitializeApp(bool) below
     
    325320
    326321            //Start new thread for the Splash screen.
    327             Thread threadSplash = new Thread(new ParameterizedThreadStart(StartSplash));
     322            Thread threadSplash = new Thread(new ParameterizedThreadStart(frm => ((DSplash)frm).ShowDialog()));
    328323            threadSplash.IsBackground = true; //expendable thread -- exit even if still running.
    329324            threadSplash.Name = "Splash Thread";
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs

    r1069 r1070  
    651651            this.tvSchedules.Sorted = true;
    652652            this.tvSchedules.TabIndex = 1;
    653             this.tvSchedules.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.tvSchedules_BeforeSelect);
    654653            this.tvSchedules.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvSchedules_AfterSelect);
    655654            this.tvSchedules.Click += new System.EventHandler(this.tvSchedules_Click);
     
    820819            this.calendarGrid1.TabIndex = 0;
    821820            this.calendarGrid1.TimeScale = 20;
    822             this.calendarGrid1.CGAppointmentAdded += new CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentAdded);
    823             this.calendarGrid1.CGAppointmentChanged += new CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentChanged);
    824             this.calendarGrid1.CGSelectionChanged += new CalendarGrid.CGSelectionChangedHandler(this.calendarGrid1_CGSelectionChanged);
     821            this.calendarGrid1.CGAppointmentChanged += new IndianHealthService.ClinicalScheduling.CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentChanged);
     822            this.calendarGrid1.CGAppointmentAdded += new IndianHealthService.ClinicalScheduling.CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentAdded);
     823            this.calendarGrid1.CGSelectionChanged += new IndianHealthService.ClinicalScheduling.CalendarGrid.CGSelectionChangedHandler(this.calendarGrid1_CGSelectionChanged);
    825824            this.calendarGrid1.DoubleClick += new System.EventHandler(this.calendarGrid1_DoubleClick);
    826825            //
     
    14941493                }
    14951494
    1496 
     1495        /// <summary>
     1496        /// Opens a view of the Schedule a user requested to open at a specific date
     1497        /// </summary>
     1498        /// <param name="sSelectedTreeResourceArray">A set of resources to open (?pending more investigation)</param>
     1499        /// <param name="dDate">Date at which to show the Grid</param>
    14971500                private void OpenSelectedSchedule(ArrayList sSelectedTreeResourceArray, DateTime dDate)
    14981501                {
    14991502                        //If resource already open, then navigate to its window
    1500             //XXX: Why is this doc definition here? Should be under else scope
    1501             //XXX: Use Bananna peeling instead of if/else
    1502                         CGDocument doc;
    15031503                        CGView v =this.DocManager.GetViewByResource(sSelectedTreeResourceArray);
    15041504                        if (v != null)
     
    15061506                                v.Activate();
    15071507                                v.dateTimePicker1.Value = dDate;
     1508                return;
     1509                        }
     1510
     1511                        //If this Document has no resources then use it (happens when the GUI has nothing open, typically after log-in)
     1512                        //Else, create a new document
     1513            CGDocument doc;
     1514            if (this.Document.m_sResourcesArray.Count == 0)
     1515                        {
     1516                doc = this.Document;
    15081517                        }
    15091518                        else
    15101519                        {
    1511                                 //If not already open, open it
    1512                                 //If current document has a resource, then open a new window
    1513                                 //with the selected resource.
    1514                                 //Otherwise just use the current document.
    1515                                 if (this.Document.m_sResourcesArray.Count > 0)
    1516                                 {
    1517                                         doc = new CGDocument();
    1518                                         doc.DocManager = this.DocManager;
    1519                                 }
    1520                                 else
    1521                                 {
    1522                                         doc = this.Document;
    1523                                 }
    1524                                 for (int j=0; j < sSelectedTreeResourceArray.Count; j++)
    1525                                 {
    1526                     // Investigate this. This draws the grid when there is nothing to draw!!!
    1527                                         doc.AddResource((string) sSelectedTreeResourceArray[j]);
    1528                                 }
    1529 
    1530                                 doc.DocName = this.m_sDocName;
     1520                doc = new CGDocument();
     1521                doc.DocManager = this.DocManager;                               
     1522                        }
     1523
     1524            //Add resources to Document
     1525                        for (int j=0; j < sSelectedTreeResourceArray.Count; j++)
     1526                        {
     1527                                doc.AddResource((string) sSelectedTreeResourceArray[j]);
     1528                        }
     1529
     1530                        doc.DocName = this.m_sDocName;
    15311531                               
    1532                 try
    1533                                 {
    1534                                         doc.OnOpenDocument();
    1535                                 }
     1532            try
     1533                        {
     1534                                doc.OnOpenDocument();
     1535                        }
    15361536                               
    1537                 catch (Exception ex)
    1538                                 {
    1539                                         MessageBox.Show("Unable to open " + m_sDocName + " schedule.  " +  ex.Message, "Clinical Scheduling");
    1540                                         this.m_DocManager.CloseAllViews(doc);
    1541                                         return;
    1542                                 }
    1543                                 v =this.DocManager.GetViewByResource(sSelectedTreeResourceArray);
    1544                                 v.dateTimePicker1.Value = dDate;
    1545 
    1546                                 //Get preferred time scale from resource info
    1547                                 //If more than one resource, get smallest time scale
    1548                                 CalendarGrid cg = v.CGrid;
    1549                                 DataTable dt = this.DocManager.GlobalDataSet.Tables["Resources"];
    1550                                 DataView dv = new DataView(dt, "", "RESOURCE_NAME ASC", DataViewRowState.OriginalRows);
    1551                                 int nScale = 60;
    1552                                 int nTest=0;
    1553                                 string sResource;
    1554                                 int nDataRow;
    1555                                 DataRowView drv;
    1556                                 for (int j=0; j < sSelectedTreeResourceArray.Count; j++)
    1557                                 {
    1558                                         sResource = (string) sSelectedTreeResourceArray[j];
    1559                                         nDataRow = dv.Find(sResource);
    1560                                         Debug.Assert(nDataRow != -1);
    1561                                         drv = dv[nDataRow];
    1562                                         if (drv["TIMESCALE"].ToString() == "")
    1563                                         {
    1564                                                 nTest = 15; //15 minute default
    1565                                         }
    1566                                         else
    1567                                         {
    1568                                                 nTest = (int) drv["TIMESCALE"];
    1569                                         }
    1570                                         nScale = (nTest < nScale)?nTest : nScale ;
    1571                                 }
    1572 
    1573                                 cg.TimeScale = nScale;
    1574 
    1575                                 cg.PositionGrid(7);
    1576 
    1577                                 //Get the OverBook and ModifySchedule permissions from ResourceUser table
    1578                                 //and populate the hashtables
    1579                                 string  sOverbook;
    1580                                 string  sModSchedule;
    1581                                 string  sModAppts;
    1582                                 bool    bOverbook;
    1583                                 bool    bModSchedule;
    1584                                 bool    bModAppts;
    1585                                 v.m_htOverbook = new Hashtable(sSelectedTreeResourceArray.Count);
    1586                                 v.m_htModifySchedule = new Hashtable(sSelectedTreeResourceArray.Count);
    1587                                 v.m_htChangeAppts = new Hashtable(sSelectedTreeResourceArray.Count);
    1588                                 dt = this.DocManager.GlobalDataSet.Tables["ResourceUser"];
    1589                                 dv = new DataView(dt, "", "RESOURCENAME ASC", DataViewRowState.OriginalRows);
    1590                                 dv.RowFilter = "USERNAME = '" + this.DocManager.ConnectInfo.UserName + "'";
    1591                                 for (int j=0; j < dv.Count; j++)
    1592                                 {
    1593                                         drv = dv[j];
    1594                                         sResource = drv["RESOURCENAME"].ToString();
    1595                                         sOverbook = drv["OVERBOOK"].ToString();
    1596                                         bOverbook = (sOverbook == "YES")?true:false;
    1597                                         sModSchedule = drv["MODIFY_SCHEDULE"].ToString();
    1598                                         bModSchedule = (sModSchedule == "YES")?true:false;
    1599                                         sModAppts = drv["MODIFY_APPOINTMENTS"].ToString();
    1600                                         bModAppts = (sModAppts == "YES")?true:false;
    1601                                         v.m_htOverbook[sResource] = bOverbook;
    1602                                         v.m_htModifySchedule[sResource] = bModSchedule;
    1603                                         v.m_htChangeAppts[sResource] = bModAppts;
    1604                                 }
    1605 
    1606                                 //For programmers and scheduling managers, set all permissions for all resources
    1607                                 if (this.DocManager.ScheduleManager == true)
    1608                                 {
    1609                                         dt = this.DocManager.GlobalDataSet.Tables["Resources"];
    1610                                         foreach (DataRow dr in dt.Rows)
    1611                                         {
    1612                                                 sResource = dr["RESOURCE_NAME"].ToString();
    1613                                                 v.m_htOverbook[sResource] = true;
    1614                                                 v.m_htModifySchedule[sResource] = true;
    1615                                                 v.m_htChangeAppts[sResource] = true;
    1616                                         }
    1617                                 }
    1618 
    1619                                 v.calendarGrid1.SetOverlapTable();
    1620                                 v.calendarGrid1.Refresh();
    1621                         }
     1537            catch (Exception ex)
     1538                        {
     1539                                MessageBox.Show("Unable to open " + m_sDocName + " schedule.  " +  ex.Message, "Clinical Scheduling");
     1540                                this.m_DocManager.CloseAllViews(doc);
     1541                                return;
     1542                        }
     1543
     1544            //We are doing this--Again?
     1545                        v =this.DocManager.GetViewByResource(sSelectedTreeResourceArray);
     1546                        v.dateTimePicker1.Value = dDate;
     1547
     1548                        //Get preferred time scale from resource info
     1549                        //If more than one resource, get smallest time scale
     1550                        CalendarGrid cg = v.CGrid;
     1551                        DataTable dt = this.DocManager.GlobalDataSet.Tables["Resources"];
     1552                        DataView dv = new DataView(dt, "", "RESOURCE_NAME ASC", DataViewRowState.OriginalRows);
     1553                        int nScale = 60;
     1554                        int nTest=0;
     1555                        string sResource;
     1556                        int nDataRow;
     1557                        DataRowView drv;
     1558                        for (int j=0; j < sSelectedTreeResourceArray.Count; j++)
     1559                        {
     1560                                sResource = (string) sSelectedTreeResourceArray[j];
     1561                                nDataRow = dv.Find(sResource);
     1562                                Debug.Assert(nDataRow != -1);
     1563                                drv = dv[nDataRow];
     1564                                if (drv["TIMESCALE"].ToString() == "")
     1565                                {
     1566                                        nTest = 15; //15 minute default
     1567                                }
     1568                                else
     1569                                {
     1570                                        nTest = (int) drv["TIMESCALE"];
     1571                                }
     1572                                nScale = (nTest < nScale)?nTest : nScale ;
     1573                        }
     1574
     1575                        cg.TimeScale = nScale;
     1576
     1577                        cg.PositionGrid(7);
     1578
     1579                        //Get the OverBook and ModifySchedule permissions from ResourceUser table
     1580                        //and populate the hashtables
     1581                        string  sOverbook;
     1582                        string  sModSchedule;
     1583                        string  sModAppts;
     1584                        bool    bOverbook;
     1585                        bool    bModSchedule;
     1586                        bool    bModAppts;
     1587                        v.m_htOverbook = new Hashtable(sSelectedTreeResourceArray.Count);
     1588                        v.m_htModifySchedule = new Hashtable(sSelectedTreeResourceArray.Count);
     1589                        v.m_htChangeAppts = new Hashtable(sSelectedTreeResourceArray.Count);
     1590                        dt = this.DocManager.GlobalDataSet.Tables["ResourceUser"];
     1591                        dv = new DataView(dt, "", "RESOURCENAME ASC", DataViewRowState.OriginalRows);
     1592                        dv.RowFilter = "USERNAME = '" + this.DocManager.ConnectInfo.UserName + "'";
     1593                        for (int j=0; j < dv.Count; j++)
     1594                        {
     1595                                drv = dv[j];
     1596                                sResource = drv["RESOURCENAME"].ToString();
     1597                                sOverbook = drv["OVERBOOK"].ToString();
     1598                                bOverbook = (sOverbook == "YES")?true:false;
     1599                                sModSchedule = drv["MODIFY_SCHEDULE"].ToString();
     1600                                bModSchedule = (sModSchedule == "YES")?true:false;
     1601                                sModAppts = drv["MODIFY_APPOINTMENTS"].ToString();
     1602                                bModAppts = (sModAppts == "YES")?true:false;
     1603                                v.m_htOverbook[sResource] = bOverbook;
     1604                                v.m_htModifySchedule[sResource] = bModSchedule;
     1605                                v.m_htChangeAppts[sResource] = bModAppts;
     1606                        }
     1607
     1608                        //For programmers and scheduling managers, set all permissions for all resources
     1609                        if (this.DocManager.ScheduleManager == true)
     1610                        {
     1611                                dt = this.DocManager.GlobalDataSet.Tables["Resources"];
     1612                                foreach (DataRow dr in dt.Rows)
     1613                                {
     1614                                        sResource = dr["RESOURCE_NAME"].ToString();
     1615                                        v.m_htOverbook[sResource] = true;
     1616                                        v.m_htModifySchedule[sResource] = true;
     1617                                        v.m_htChangeAppts[sResource] = true;
     1618                                }
     1619                        }
     1620
     1621                        v.calendarGrid1.SetOverlapTable();
     1622                        v.calendarGrid1.Refresh();
    16221623                }
    16231624
     
    24912492        }
    24922493
    2493                 private void tvSchedules_BeforeSelect(object sender, System.Windows.Forms.TreeViewCancelEventArgs e)
    2494                 {
    2495 
    2496                 }
    2497 
    24982494                private void tvSchedules_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
    24992495                {
     
    30953091        void RequestRefreshGrid()
    30963092        {
    3097             DateTime dDate = dateTimePicker1.Value;
    3098             dDate = dDate.Date;
    3099             // This below is responsible for redrawing the grid when you change the date.
     3093            DateTime dDate = dateTimePicker1.Value.Date;
     3094            // Change Date on Document
    31003095            this.Document.SelectedDate = dDate;
     3096           
     3097            //Splash when loading and change Cursor
     3098            this.Cursor = Cursors.WaitCursor;
     3099            LoadSplash();
     3100
     3101            this.Cursor = Cursors.Default;
     3102            this.Document.RefreshDocument();
    31013103           
    31023104            if (this.Document.Resources.Count == 1)
     
    31153117                this.StartDate = this.Document.SelectedDate;
    31163118            }
    3117             //Is this needed?
     3119
     3120            //Is this needed? -- Yes it is. There is a bug in the drawing code for the calendar
     3121            //First time it draws, it draws appointments, but not availability slots
     3122            //Second time it draws, it both appointments and availabilites
     3123            //XXX: Need to investigate
    31183124            this.Document.UpdateAllViews();
    3119             //Is this needed?
    3120             this.calendarGrid1.Invalidate();
     3125
     3126            StopSplash();
     3127            this.Cursor = Cursors.Default;
     3128        }
     3129
     3130        LoadingSplash _loadingSplash; // Splash object a data point in class
     3131
     3132        /// <summary>
     3133        /// Loads a splash that says "Loading"
     3134        /// </summary>
     3135        private void LoadSplash()
     3136        {
     3137            _loadingSplash = new LoadingSplash();
     3138            _loadingSplash.StartPosition = FormStartPosition.CenterScreen;  //XXX: Don't like this, but will do for now.
     3139            _loadingSplash.UseWaitCursor = true;    // tell user we are working
     3140            Thread threadSplash = new Thread(new ThreadStart(() => _loadingSplash.ShowDialog())); // lambda
     3141            threadSplash.IsBackground = true; //expendable thread -- exit even if still running.
     3142            threadSplash.Name = "Loading Thread";
     3143            threadSplash.Start();
     3144        }
     3145
     3146        private void StopSplash()
     3147        {
     3148            _loadingSplash.RemoteClose();
    31213149        }
    31223150
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj

    r1065 r1070  
    6767    <ConfigurationOverrideFile>
    6868    </ConfigurationOverrideFile>
    69     <DefineConstants>TRACE;DEBUG</DefineConstants>
     69    <DefineConstants>DEBUG;TRACE</DefineConstants>
    7070    <DocumentationFile>
    7171    </DocumentationFile>
     
    178178    <Compile Include="CGAppointment.cs" />
    179179    <Compile Include="CGAppointmentChangedArgs.cs" />
    180     <Compile Include="CGAppointmentChangedHandler.cs" />
    181180    <Compile Include="CGAppointments.cs" />
    182181    <Compile Include="CGAvailability.cs" />
     
    199198    </Compile>
    200199    <Compile Include="CGSelectionChangedArgs.cs" />
    201     <Compile Include="CGSelectionChangedHandler.cs" />
    202200    <Compile Include="CGView.cs">
    203201      <SubType>Form</SubType>
     
    296294      <DependentUpon>DMassSlotDelete.cs</DependentUpon>
    297295    </Compile>
     296    <Compile Include="LoadingSplash.cs">
     297      <SubType>Form</SubType>
     298    </Compile>
     299    <Compile Include="LoadingSplash.Designer.cs">
     300      <DependentUpon>LoadingSplash.cs</DependentUpon>
     301    </Compile>
    298302    <Compile Include="Options.cs" />
    299303    <Compile Include="Printing.cs" />
     
    402406      <DependentUpon>DSplash.cs</DependentUpon>
    403407      <SubType>Designer</SubType>
     408    </EmbeddedResource>
     409    <EmbeddedResource Include="LoadingSplash.resx">
     410      <DependentUpon>LoadingSplash.cs</DependentUpon>
    404411    </EmbeddedResource>
    405412    <EmbeddedResource Include="UCPatientAppts.resx">
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj.user

    r1062 r1070  
    3737    </RemoteDebugMachine>
    3838    <StartAction>Project</StartAction>
    39     <StartArguments>/s=172.16.16.108 /p=9250 /a=abeer12 /v=abc,4321</StartArguments>
     39    <StartArguments>
     40    </StartArguments>
    4041    <StartPage>
    4142    </StartPage>
     
    5657    </RemoteDebugMachine>
    5758    <StartAction>Project</StartAction>
    58     <StartArguments>/s=172.16.17.51 /p=9260 /a=shabiel12 /v=abc,123!</StartArguments>
     59    <StartArguments>
     60    </StartArguments>
    5961    <StartPage>
    6062    </StartPage>
Note: See TracChangeset for help on using the changeset viewer.