/// <summary>
        /// Author:         Charlene Remotigue
        /// Date Created:   18/01/2012
        /// Description:    get branch matrix
        /// </summary>
        protected void getBranchMatrix()
        {
            DataTable dt = null;

            try
            {
                uoHiddenFieldUser.Value = GlobalCode.Field2String(Session["UserName"]);
                AutomaticBookingBLL.SaveTempAutomaticBookings(DateTime.Parse(uoHiddenFieldStartDate.Value),
                                                              Int32.Parse(uoHiddenFieldUserBranch.Value), uoHiddenFieldUser.Value);

                GetSFHotelTravelDetails();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dt != null)
                {
                    dt.Dispose();
                }
            }
        }
        private void ApproveRequest()
        {
            IDataReader dr     = null;
            DataTable   dTable = null;

            try
            {
                string strFunction = "ApproveRequest";


                string ApproveByString  = GlobalCode.Field2String(Session["UserName"]);
                string InvalidTravelReq = "";

                foreach (ListViewItem item in uoHotelList.Items)
                {
                    CheckBox CheckSelect    = (CheckBox)item.FindControl("uoSelectCheckBox");
                    bool     IsApprovedBool = CheckSelect.Checked;

                    HiddenField uoHiddenFieldIsManual = (HiddenField)item.FindControl("uoHiddenFieldIsManual");
                    HiddenField uoPendingId           = (HiddenField)item.FindControl("uoHiddenFieldColIdBigInt");
                    DateTime    currentDate           = CommonFunctions.GetCurrentDateTime();

                    if (IsApprovedBool)
                    {
                        if (uoHiddenFieldIsManual.Value == "Yes")
                        {
                            dTable = HotelBLL.HotelApproveTransaction(uoPendingId.Value, GlobalCode.Field2String(Session["UserName"]));
                        }
                        else
                        {
                            String      UserId      = GlobalCode.Field2String(Session["UserName"]);
                            Label       Duration    = (Label)item.FindControl("uoLblDuration");
                            HiddenField TravelReqId = (HiddenField)item.FindControl("hfTRID");
                            HiddenField ManualReqId = (HiddenField)item.FindControl("hfMRID");
                            Label       RecLoc      = (Label)item.FindControl("uoLblRecLoc");
                            HiddenField VendorId    = (HiddenField)item.FindControl("hfVendor");
                            //HiddenField HiddenID = (HiddenField)item.FindControl("uoHiddenFieldColIdBigInt");
                            HiddenField BranchID     = (HiddenField)item.FindControl("hfBranch");
                            HiddenField RoomTypeId   = (HiddenField)item.FindControl("hfRoom");
                            HiddenField CheckIndate  = (HiddenField)item.FindControl("hfCheckIn");
                            HiddenField CheckOutDate = (HiddenField)item.FindControl("hfCheckOut");
                            //HiddenField HotelStatus= (HiddenField)item.FindControl("hfHotelStatus");
                            HiddenField SFStatus   = (HiddenField)item.FindControl("hfSFStatus");
                            HiddenField CityId     = (HiddenField)item.FindControl("hfCity");
                            HiddenField CountryId  = (HiddenField)item.FindControl("hfCountry");
                            HiddenField ContractId = (HiddenField)item.FindControl("hfContractID");
                            Label       Voucher    = (Label)item.FindControl("uoLblVoucher");
                            HiddenField DataSource = (HiddenField)item.FindControl("hfDatasource");
                            HiddenField PendingId  = (HiddenField)item.FindControl("uoHiddenFieldColIdBigInt");
                            HiddenField HotelName  = (HiddenField)item.FindControl("hfHotelName");
                            Label       E1ID       = (Label)item.FindControl("uoLblE1ID");
                            HiddenField Name       = (HiddenField)item.FindControl("hfName");

                            Boolean valid = true;
                            if (PendingId.Value == "0")
                            {
                                valid = AutomaticBookingBLL.ApproveBookings(Int32.Parse(TravelReqId.Value), RecLoc.Text, Int32.Parse(VendorId.Value),
                                                                            Int32.Parse(BranchID.Value), Int32.Parse(RoomTypeId.Value), DateTime.Parse(CheckIndate.Value), DateTime.Parse(CheckOutDate.Value),
                                                                            SFStatus.Value, Int32.Parse(CityId.Value), Int32.Parse(CountryId.Value), Voucher.Text, Int32.Parse(ContractId.Value),
                                                                            UserId, strFunction, Path.GetFileName(Request.Path), CommonFunctions.GetDateTimeGMT(currentDate), DateTime.Now);
                            }
                            else
                            {
                                HotelBLL.HotelApproveTransaction(PendingId.Value, UserId);
                            }

                            if (!valid)
                            {
                                InvalidTravelReq = InvalidTravelReq + TravelReqId.Value + ",";
                            }
                            else
                            {
                                //dr = VendorMaintenanceBLL.vehicleVendorBranchMaintenanceInformation(Int32.Parse(BranchID.Value));
                                //if (dr.Read())
                                //{
                                string sMsg = "Booking of seafarer <b>" + Name.Value + "</b> with E1 ID <b>" + E1ID.Text + "</b> has been approved. <br/><br/>";
                                sMsg += "Hotel Branch: " + HotelName.Value + "<br/>";
                                sMsg += "Checkin Date: " + CheckIndate.Value + "";
                                sMsg += "<br/><br/>Thank you.";
                                sMsg += "<br/><br/><i>Auto generated email.</i>";

                                //SendEmail("Travelmart: Pending Hotel Booking Approval", sMsg, CountryId.Value, BranchID.Value);
                                //}
                            }
                        }
                    }
                }
                if (InvalidTravelReq != "")
                {
                    AlertMessage("Some bookings were not approved. Please check the room allocations of the highlighed transactions.");
                    ViewState["InvalidRequest"] = InvalidTravelReq.TrimEnd(',').ToString();
                }
                else
                {
                    AlertMessage("Approved");
                }

                SetDefaults(3);
            }
            catch (Exception ex)
            {
                AlertMessage(ex.Message);
                throw ex;
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                    dr.Dispose();
                }
                if (dTable != null)
                {
                    dTable.Dispose();
                }
            }
        }