Пример #1
0
        protected void rptCruiseAvaibility_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var cruises       = DashBoardBLL.CruiseGetAll();
            var dateSearching = new DateTime();

            try
            {
                dateSearching = DateTime.ParseExact(txtDateSearching.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            }
            catch { }
            if (e.Item.ItemType == ListItemType.Header)
            {
                var ltrHeader = (Literal)e.Item.FindControl("ltrHeader");
                var header    = "";
                foreach (var cruise in cruises)
                {
                    header += "<th style='width:10%'>" + (cruise.Code != null ? cruise.Code.ToUpper() : "") + "</th>";
                }
                ltrHeader.Text = header;
            }
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var date      = (DateTime)e.Item.DataItem;
                var className = date.Date == dateSearching.Date ? "--high-light" : "";
                var ltrRow    = (Literal)e.Item.FindControl("ltrRow");
                var rowItems  = "<td class=" + className + ">" +
                                "<a href=BookingReport.aspx?NodeId=1&SectionId=15&date=" + date.ToString("dd/MM/yyyy") + ">" + date.ToString("dd/MM/yyyy") +
                                "</a>" +
                                "</td>";
                foreach (var cruise in cruises)
                {
                    var numberOfRoomAvaiable = RoomsAvaiableDTO.Where(x => DateTimeUtil.EqualsUpToSeconds(x.Date, date) && x.CruiseId == cruise.Id).First().NoRAvaiable;
                    if (numberOfRoomAvaiable > 0)
                    {
                        rowItems += "<td class='" + className + "'>" + numberOfRoomAvaiable + "</td>";
                    }
                    else
                    {
                        rowItems += "<td class='td__not-avaiable'>" + numberOfRoomAvaiable + "</td>";
                    }
                }
                ;
                var row = string.Format("<tr>{0}</tr>", rowItems);
                ltrRow.Text = row;
            }
        }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     CheckAccess();
     if (!IsPostBack)
     {
         var todayBookings = DashBoardBLL.BookingGetAllTodayBookings(CurrentUser);
         rptTodayBookings.DataSource = todayBookings;
         rptTodayBookings.DataBind();
         LoadCruiseAvaialability();
         var newBookings = DashBoardBLL.BookingGetAllNewBookings(CurrentUser);
         rptNewBookings.DataSource = newBookings;
         rptNewBookings.DataBind();
         LoadRecentMeetings();
         var lastActivityOfAgenciesNotVisited = DashBoardBLL.AgencyGetAllAgenciesNotVisitedInLast2Month(CurrentUser);
         rptAgencyNotVisited.DataSource = lastActivityOfAgenciesNotVisited;
         rptAgencyNotVisited.DataBind();
         var top10Agencies = DashBoardBLL.AgencyGetTop10(CurrentUser);
         rptTop10Partner.DataSource = top10Agencies;
         rptTop10Partner.DataBind();
         var agenciesSendNoBookings = DashBoardBLL.AgencyGetAllAgenciesSendNoBookingsLast3Month(CurrentUser);
         rptAgenciesSendNoBookings.DataSource = agenciesSendNoBookings;
         rptAgenciesSendNoBookings.DataBind();
         ddlMonthSearching.Items.AddRange(Enumerable.Range(1, 12).Select(x => new ListItem()
         {
             Text = DateTimeFormatInfo.CurrentInfo.GetAbbreviatedMonthName(x), Value = x.ToString()
         }).ToArray());
         ddlYearSearching.Items.AddRange(Enumerable.Range(2008, 50).Select(x => new ListItem()
         {
             Text = x.ToString(), Value = x.ToString()
         }).ToArray());
         ddlMonthSearching.SelectedValue = DateTime.Today.Month.ToString();
         ddlYearSearching.SelectedValue  = DateTime.Today.Year.ToString();
         LoadYourMonthArchivement();
         ddlCruise.DataSource     = DashBoardBLL.CruiseGetAll();
         ddlCruise.DataTextField  = "Name";
         ddlCruise.DataValueField = "Id";
         ddlCruise.DataBind();
         ScriptManager.GetCurrent(this.Page).RegisterPostBackControl(btnExport);
     }
 }