Changeset 1097 for Scheduling/trunk/cs/bsdx0200GUISourceCode/CGSchedLib.cs
- Timestamp:
- Mar 3, 2011, 4:44:18 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/cs/bsdx0200GUISourceCode/CGSchedLib.cs
r1095 r1097 1 1 using System; 2 2 using System.Data; 3 //using System.Data.OleDb;4 3 using System.Collections; 5 4 using System.Diagnostics; 6 5 using System.Drawing; 7 using IndianHealthService.BMXNet;8 6 9 7 namespace IndianHealthService.ClinicalScheduling … … 24 22 /// Gets appointments from VISTA to display in Grid 25 23 /// </summary> 26 /// <param name="docManager"> </param>27 /// <param name="saryResNames"> </param>28 /// <param name="StartTime"> </param>29 /// <param name="EndTime"> </param>24 /// <param name="docManager">God Class</param> 25 /// <param name="saryResNames">Resource Names Array</param> 26 /// <param name="StartTime">Self Explanatory</param> 27 /// <param name="EndTime">Self Explanatory</param> 30 28 /// <returns></returns> 31 29 public static DataTable CreateAppointmentSchedule(CGDocumentManager docManager, ArrayList saryResNames, DateTime StartTime, DateTime EndTime) 32 30 { 33 string sResName = ""; 34 for (int i = 0; i < saryResNames.Count; i++) 35 { 36 sResName += saryResNames[i]; 37 if ((i+1) < saryResNames.Count) 38 sResName += "|"; 39 } 40 41 31 string sResName = string.Join("|", saryResNames.ToArray()); 42 32 string sStart = FMDateTime.Create(StartTime).DateOnly.FMDateString; 43 33 string sEnd = FMDateTime.Create(EndTime).FMDateString; … … 45 35 DataTable dtRet = docManager.RPMSDataTable(sSql, "AppointmentSchedule"); 46 36 return dtRet; 47 48 37 } 49 38 … … 57 46 /// <param name="EndTime">Self-Explanatory</param> 58 47 /// <param name="saryApptTypes">Array of Access Type IDs</param> 59 /// <param name="stType"> </param>60 /// <param name="sSearchInfo"> </param>48 /// <param name="stType">Not used</param> 49 /// <param name="sSearchInfo">Specific Search Parameters</param> 61 50 /// <returns></returns> 62 public static DataTable CreateAvailabilitySchedule(CGDocumentManager docManager, 63 ArrayList saryResourceNames, DateTime StartTime, DateTime EndTime, 64 ArrayList saryApptTypes,/**/ ScheduleType stType, string sSearchInfo) 65 { 66 DataTable rsOut; 67 rsOut = new DataTable("AvailabilitySchedule"); 68 69 DataTable rsSlotSchedule; 70 DataTable rsApptSchedule; 71 DataTable rsTemp1; 72 73 int nSize = saryResourceNames.Count; 74 if (nSize == 0) 75 { 76 return rsOut; 77 } 78 79 string sResName; 51 public static DataTable CreateAvailabilitySchedule(CGDocumentManager docManager, 52 ArrayList saryResourceNames, DateTime StartTime, DateTime EndTime, 53 ArrayList saryApptTypes,/**/ ScheduleType stType, string sSearchInfo) 54 { 55 DataTable rsOut = new DataTable("AvailabilitySchedule"); 56 if (saryResourceNames.Count == 0) return rsOut; 57 string sResNames = string.Join("|", saryResourceNames.ToArray()); 58 string sApptTypeIDs = string.Join("|", saryApptTypes.ToArray()); 59 string sStart = FMDateTime.Create(StartTime).DateOnly.FMDateString; 60 string sEnd = FMDateTime.Create(EndTime).FMDateString; 61 string sSql = "BSDX CREATE ASGND SLOT SCHED^" + sResNames + "^" + sStart + "^" + sEnd + "^" + sApptTypeIDs + "^" + sSearchInfo; //+ "^" + sSTType ; 62 rsOut = docManager.RPMSDataTable(sSql, "AssignedSlotSchedule"); 63 64 return rsOut; 65 } 66 67 /*NOT USED ANYMORE 80 68 //TODO: Optimize: no need to keep looping through resources. 81 69 // for each resource … … 84 72 sResName = saryResourceNames[i].ToString(); 85 73 //Gets all the slots (or Availabities, or AV Blocks if you like) 86 rsSlotSchedule = CGSchedLib.CreateAssignedSlotSchedule(docManager, sResName, StartTime, EndTime, saryApptTypes,/**/ stType, sSearchInfo); 87 74 rsSlotSchedule = CGSchedLib.CreateAssignedSlotSchedule(docManager, sResName, StartTime, EndTime, saryApptTypes, stType, sSearchInfo); 75 rsTemp1 = rsSlotSchedule; 76 88 77 //if we have slots 89 90 78 if (rsSlotSchedule.Rows.Count > 0 ) 79 { 91 80 // Get appointment count to substract from the slots 92 81 rsApptSchedule = CGSchedLib.CreateAppointmentSlotSchedule(docManager, sResName, StartTime, EndTime, stType); 93 82 94 83 // Perform the substraction 95 96 97 84 rsTemp1 = CGSchedLib.SubtractSlotsRS2(rsSlotSchedule, rsApptSchedule, sResName); 85 86 } 98 87 //otherwise, just return the slot schedule we have. 99 else 100 { 101 rsTemp1 = rsSlotSchedule; 102 103 } 88 else 89 { 90 rsTemp1 = rsSlotSchedule; 91 92 } 93 104 94 105 95 // if only one resource was passed in, its availablility is what we want … … 117 107 return rsOut; 118 108 } 119 109 */ 120 110 121 111 /* NOT USED ANYMORE!!! … … 281 271 /// D00030START_TIME^D00030END_TIME^I00010SLOTS^T00030RESOURCE^T00010ACCESS_TYPE^T00250NOTE^I00030AVAILABILITYID 282 272 /// </returns> 283 public static DataTable CreateAssignedSlotSchedule(CGDocumentManager docManager, string sResourceName, DateTime StartTime, 284 DateTime EndTime, ArrayList rsaryApptTypeIDs, /**/ ScheduleType stType, string sSearchInfo) 273 /* 274 * public static DataTable CreateAssignedSlotSchedule(CGDocumentManager docManager, string sResourceName, DateTime StartTime, 275 DateTime EndTime, ArrayList rsaryApptTypeIDs, ScheduleType stType, string sSearchInfo) 285 276 { 286 277 //Appointment type ids is now always "" so that all appointment types are returned. 287 string sApptTypeIDs = ""; 288 289 //flatten types by '|' 290 int nSize = rsaryApptTypeIDs.Count; //nSize is used to decide where to put the '|' sent in the RPC as we flatten sApptTypeIDs 291 for (int i=0; i < nSize; i++) 292 { 293 sApptTypeIDs += rsaryApptTypeIDs[i]; 294 if (i < (nSize-1)) 295 sApptTypeIDs += "|"; 296 } 297 278 string sApptTypeIDs = string.Join("|", rsaryApptTypeIDs.ToArray()); 298 279 string sStart = FMDateTime.Create(StartTime).DateOnly.FMDateString; 299 280 string sEnd = FMDateTime.Create(EndTime).FMDateString; … … 303 284 return dtRet; 304 285 } 305 286 */ 287 288 /* 306 289 public static DataTable CreateCopyTable() 307 290 { … … 358 341 return dtCopy; 359 342 } 343 */ 360 344 361 345 /// <summary> … … 368 352 /// <param name="stType"></param> 369 353 /// <returns>DataTable with 4 columns: START_TIME, END_TIME, SLOTS, RESOURCE </returns> 370 public static DataTable CreateAppointmentSlotSchedule(CGDocumentManager docManager, string sResourceName, DateTime StartTime, DateTime EndTime, ScheduleType stType) 354 /* 355 public static DataTable CreateAppointmentSlotSchedule(CGDocumentManager docManager, string sResourceName, DateTime StartTime, DateTime EndTime, ScheduleType stType) 371 356 { 372 357 //Change Dates to FM Format … … 424 409 ScheduleFromArray(cdtArray, StartTime, EndTime, ref ctbApptSchedule); 425 410 426 /*So far, we have the following:411 So far, we have the following: 427 412 * dtRet -> List of Appointments Start and End times, one row per appointment 428 413 * cdtArray -> Linear 1 dimensional Array of dtRet Start and End times, sorted … … 432 417 * 2 appts as 10:10-10:30 and 10:20-10:40 get converted into 10:10-10:20, 433 418 * 10:20-10:30, 10:30-10:40). 434 */419 435 420 436 421 //Find number of TimeBlocks in ctbApptSchedule that overlap the TimeBlocks in ctbAppointments … … 498 483 499 484 } 500 485 */ 486 487 /* 501 488 public static int BlocksOverlap(CGAvailability rBlock, ArrayList rTBArray) 502 489 { … … 542 529 return nCount; 543 530 } 531 */ 544 532 545 533 /// <summary> … … 552 540 /// <returns>true or false</returns> 553 541 /// <remarks>Draws 2 rectangles and sees if they overlap using minutes from 1980 as the start point</remarks> 554 public static bool TimesOverlap(DateTime dStart1, DateTime dEnd1, DateTime dStart2, DateTime dEnd2) 542 /* 543 public static bool TimesOverlap(DateTime dStart1, DateTime dEnd1, DateTime dStart2, DateTime dEnd2) 555 544 { 556 545 Rectangle rect1 = new Rectangle(); … … 568 557 return bRet; 569 558 } 570 559 */ 560 561 /* 571 562 public static void ConsolidateBlocks(ArrayList rTBArray) 572 563 { … … 607 598 } 608 599 while (!((bDirty == false) || (rTBArray.Count == 1))); 609 } 600 } */ 610 601 611 602 /// <summary> … … 616 607 /// <param name="sResource"></param> 617 608 /// <returns></returns> 618 public static DataTable SubtractSlotsRS2(DataTable rsBlocks1, DataTable rsBlocks2, string sResource) 609 /* 610 public static DataTable SubtractSlotsRS2(DataTable rsBlocks1, DataTable rsBlocks2, string sResource) 619 611 { 620 612 //Subtract slots in rsBlocks2 from rsBlocks1 … … 680 672 681 673 } 682 674 */ 675 676 /* 683 677 public static DataTable UnionBlocks(DataTable rs1, DataTable rs2) 684 678 { … … 714 708 return rsCopy; 715 709 } 716 710 */ 711 712 /* 717 713 public static DataTable IntersectBlocks(DataTable rs1, DataTable rs2) 718 714 { … … 770 766 // rect2.Height = CGSchedLib.MinSince80(dEnd2) - rect2.Y; 771 767 if ( 772 /*(rect2.IntersectsWith(rect1) == true) */768 /*(rect2.IntersectsWith(rect1) == true) 773 769 (CGSchedLib.TimesOverlap(dStart1, dEnd1, dStart2, dEnd2) == true) 774 770 && … … 797 793 return rsCopy; 798 794 }//end IntersectBlocks 799 795 */ 796 800 797 /// <summary> 801 798 /// Number of minutes since Jan 1 1980 … … 803 800 /// <param name="d">Date to compare</param> 804 801 /// <returns>Minutes as integer</returns> 805 public static int MinSince80(DateTime d) 802 /* 803 public static int MinSince80(DateTime d) 806 804 { 807 805 //Returns the total minutes between d and 1 Jan 1980 … … 814 812 return nMinutes; 815 813 } 816 814 */ 815 816 /* 817 817 /// <summary> 818 818 /// Converts an Array of Times like this: … … 909 909 910 910 }//end ScheduleFromArray 911 912 //long CResourceLink::SlotsInBlock(CTimeBlock &rTimeBlock, _RecordsetPtr rsBlock) 911 */ 912 913 /* 914 //long CResourceLink::SlotsInBlock(CTimeBlock &rTimeBlock, _RecordsetPtr rsBlock) 913 915 public static int SlotsInBlock(CGAvailability rTimeBlock, DataTable rsBlock) 914 916 { … … 952 954 return nSlots; 953 955 }//end SlotsInBlock 954 956 */ 957 958 /* 955 959 public static string ClinicInBlock(CGAvailability rTimeBlock, DataTable rsBlock) 956 960 { … … 991 995 return sClinic; 992 996 }//end ClinicInBlock 993 997 */ 998 999 /* 994 1000 public static bool ResourceRulesInBlock(CGAvailability rTimeBlock, DataTable rsBlock, ref string sResourceList, ref string sAccessRuleList, ref string sNote) 995 1001 { … … 1059 1065 return true; 1060 1066 }//End ResourceRulesInBlock 1067 */ 1061 1068 1062 1069
Note:
See TracChangeset
for help on using the changeset viewer.