/// <summary> /// Gets the row index for the result table to which this room booking refers. /// </summary> /// <param name="ARow">room booking row</param> /// <param name="AReportDetail">Indicator of the details of the report. Possible options: Brief, Full, Detail</param> /// <param name="ASituation">The current report situation</param> /// <returns></returns> private int GetRowIndexForRoom(PcRoomAllocRow ARow, string AReportDetail, ref TRptSituation ASituation) { // Check if this room is already in the table String RoomName = ARow.BuildingCode; if (AReportDetail != "Brief") { RoomName = ARow.BuildingCode + " / " + ARow.RoomNumber; } int RoomRow = -1; for (int Counter = 0; Counter < FAccommodationTable.Rows.Count; ++Counter) { if (FAccommodationTable.Rows[Counter][0].ToString() == RoomName) { RoomRow = Counter; break; } } if (RoomRow == -1) { DataRow NewRow = FAccommodationTable.NewRow(); NewRow[0] = RoomName; NewRow["Venue"] = TAccommodationReportCalculation.GetPartnerShortName(ARow.VenueKey, ref ASituation); FAccommodationTable.Rows.Add(NewRow); RoomRow = FAccommodationTable.Rows.Count - 1; } return(RoomRow); }
/// <summary> /// Adds the dates of one partner to the accommodation report /// </summary> /// <param name="AShortTermRow">The short term application row of the current partner</param> /// <param name="AAttendeeRow">The attendee row of the current partner</param> /// <param name="AStartDate">Start date of the conference</param> /// <param name="AEndDate">End date of the conference</param> /// <param name="AFromDate">Start date of the report</param> /// <param name="AToDate">End date of the report</param> /// <param name="AReportDetail">Indicator of the details of the report. Possible options: Brief, Full, Detail</param> /// <param name="ASituation">The current report situation</param> /// <returns></returns> private bool AddPartnerToAccom(PmShortTermApplicationRow AShortTermRow, PcAttendeeRow AAttendeeRow, DateTime AStartDate, DateTime AEndDate, DateTime AFromDate, DateTime AToDate, string AReportDetail, ref TRptSituation ASituation) { // if we have an actual arrival and departure date from the attendee row use it. if (AAttendeeRow != null) { if (!AAttendeeRow.IsActualArrNull()) { AShortTermRow.Arrival = AAttendeeRow.ActualArr; } if (!AAttendeeRow.IsActualDepNull()) { AShortTermRow.Departure = AAttendeeRow.ActualDep; } } if (AShortTermRow.IsArrivalNull()) { AShortTermRow.Arrival = AStartDate; } if (AShortTermRow.IsDepartureNull()) { AShortTermRow.Departure = AEndDate; } if ((AShortTermRow.Arrival <= AToDate) && (AShortTermRow.Departure >= AFromDate)) { // this short term application covers the dates we examine PcRoomAllocTable TempTable = new PcRoomAllocTable(); PcRoomAllocTable RoomAllocTable; PcRoomAllocRow TemplateRow = TempTable.NewRowTyped(false); TemplateRow.PartnerKey = AShortTermRow.PartnerKey; TemplateRow.ConferenceKey = AShortTermRow.StConfirmedOption; RoomAllocTable = PcRoomAllocAccess.LoadUsingTemplate(TemplateRow, ASituation.GetDatabaseConnection().Transaction); char Gender; int Age; string PartnerName; GetGenderAndAge(AShortTermRow.PartnerKey, AStartDate, out Gender, out Age, ref ASituation); PartnerName = TAccommodationReportCalculation.GetPartnerShortName(AShortTermRow.PartnerKey, ref ASituation); foreach (DataRow Row in RoomAllocTable.Rows) { CheckRoomAllocation((PcRoomAllocRow)Row, AShortTermRow, AFromDate, AToDate, AReportDetail, Gender, Age, PartnerName, ref ASituation); } if (RoomAllocTable.Rows.Count == 0) { AddNoRoomBooking(AShortTermRow, AFromDate, AToDate, Gender, PartnerName); } } return(true); }