Exemplo n.º 1
0
        protected void rptGroups_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is QuestionGroup)
            {
                QuestionGroup group = (QuestionGroup)e.Item.DataItem;
                ValueBinder.BindLiteral(e.Item, "litGroupName", group.Name);
                TextBox txtComment = (TextBox)e.Item.FindControl("txtComment");

                Repeater rptQuestions = (Repeater)e.Item.FindControl("rptQuestions");
                _currentOptions         = group.Selections;
                rptQuestions.DataSource = group.Questions;
                rptQuestions.DataBind();

                foreach (AnswerGroup grp in _currentSheet.Groups)
                {
                    if (grp.Group.Id == group.Id)
                    {
                        txtComment.Text = grp.Comment;
                        break;
                    }
                }

                if (group.Questions.Count > 0)
                {
                    _hasQuestion = true;
                    Repeater rptOptions = (Repeater)e.Item.FindControl("rptOptions");
                    rptOptions.DataSource = _currentOptions;
                    rptOptions.DataBind();
                }
                else
                {
                    _hasQuestion = false;
                }
            }
        }
        protected void rptStatus_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is BookingHistory)
            {
                var history = (BookingHistory)e.Item.DataItem;

                if (_prev != null)
                {
                    if (_prev.Status == history.Status)
                    {
                        e.Item.Visible = false;
                        return;
                    }
                }

                ValueBinder.BindLiteral(e.Item, "litTime", history.Date.ToString("dd-MMM-yyyy HH:mm"));
                ValueBinder.BindLiteral(e.Item, "litUser", history.User.FullName);
                ValueBinder.BindLiteral(e.Item, "litTo", history.Status.ToString());
                if (_prev != null)
                {
                    ValueBinder.BindLiteral(e.Item, "litFrom", _prev.Status.ToString());
                }
                _prev = history;
            }
        }
        protected void rptRooms_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is BookingHistory)
            {
                var history = (BookingHistory)e.Item.DataItem;

                if (history.NewRoom != null)
                {
                    if (history.OldRoom == history.NewRoom)
                    {
                        e.Item.Visible = false;
                        return;
                    }


                    ValueBinder.BindLiteral(e.Item, "litTime", history.Date.ToString("dd-MMM-yyyy HH:mm"));
                    ValueBinder.BindLiteral(e.Item, "litUser", history.User.FullName);
                    ValueBinder.BindLiteral(e.Item, "litFrom", history.OldRoom != null ? history.OldRoom.Name : "");
                    ValueBinder.BindLiteral(e.Item, "litTo", history.NewRoom.Name);
                }
                else
                {
                    e.Item.Visible = false;
                }
            }
        }
Exemplo n.º 4
0
        protected void rptOperators_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is User)
            {
                var user = (User)e.Item.DataItem;
                ValueBinder.BindLiteral(e.Item, "litName", user.FullName);

                var litCount = e.Item.FindControl("litCount") as Literal;
                if (litCount != null)
                {
                    int total = Module.TotalCustomer(_date, _date, user);

                    if (!_totalMap.ContainsKey(user.Id))
                    {
                        _totalMap.Add(user.Id, 0);
                    }
                    _totalMap[user.Id] += total;

                    ValueBinder.BindLiteral(e.Item, "litCount", total.ToString());
                }

                var litTotal = e.Item.FindControl("litTotal") as Literal;
                if (litTotal != null)
                {
                    litTotal.Text = _totalMap[user.Id].ToString();
                }
            }
        }
Exemplo n.º 5
0
        protected void rptDates_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is BookingHistory)
            {
                var history = (BookingHistory)e.Item.DataItem;

                if (_prev != null)
                {
                    if (_prev.StartDate == history.StartDate)
                    {
                        e.Item.Visible = false;
                        return;
                    }
                }

                try
                {
                    ValueBinder.BindLiteral(e.Item, "litTime", history.Date.ToString("dd-MMM-yyyy HH:mm"));
                    ValueBinder.BindLiteral(e.Item, "litUser", history.User.FullName);
                    ValueBinder.BindLiteral(e.Item, "litTo", history.StartDate.ToString("dd/MM/yyyy"));
                }
                catch (Exception) { }

                if (_prev != null)
                {
                    try
                    {
                        ValueBinder.BindLiteral(e.Item, "litFrom", _prev.StartDate.ToString("dd/MM/yyyy"));
                    }
                    catch (Exception) { }
                }
                _prev = history;
            }
        }
 protected void rptQuestionsReport_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.DataItem is Question)
     {
         _currentQuestion = (Question)e.Item.DataItem;
         ValueBinder.BindLiteral(e.Item, "litQuestion", _currentQuestion.Name);
         Repeater rptAnswerData = (Repeater)e.Item.FindControl("rptAnswerData");
         rptAnswerData.DataSource = _currentQuestion.Group.Selections;
         rptAnswerData.DataBind();
     }
 }
 protected void rptOptions_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.DataItem is Question)
     {
         Question     question = (Question)e.Item.DataItem;
         AnswerOption op       = _currentGroup.AnswerSheet.GetOption(question);
         if (op.Option > 0)
         {
             ValueBinder.BindLiteral(e.Item, "litOption", _currentGroup.Group.Selections[op.Option - 1]);
         }
     }
 }
        protected void rptVoucherList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is VoucherBatch)
            {
                var batch = (VoucherBatch)e.Item.DataItem;

                if (batch.Agency != null)
                {
                    ValueBinder.BindLiteral(e.Item, "litAgency", batch.Agency.Name);
                }
                ValueBinder.BindLiteral(e.Item, "litTotal", batch.Quantity);
                var criterion = Expression.And(Expression.Eq("Deleted", false),
                                               Expression.And(Expression.Eq("Batch.Id", batch.Id),
                                                              Expression.Not(Expression.Eq("Status", StatusType.Cancelled)))
                                               );
                var bookingUsedBatchVoucher = Module.GetObject <Booking>(criterion, 0, 0);
                int countVoucherUsed        = 0;
                if (bookingUsedBatchVoucher != null)
                {
                    foreach (Booking booking in bookingUsedBatchVoucher)
                    {
                        countVoucherUsed = countVoucherUsed + booking.VoucherCode.Split(new char[] { ';' }).Length;
                    }
                }
                ValueBinder.BindLiteral(e.Item, "litRemain", batch.Quantity - countVoucherUsed);

                if (countVoucherUsed > 0)
                {
                    var hplBookings = (HyperLink)e.Item.FindControl("hplBookings");
                    hplBookings.Visible     = true;
                    hplBookings.NavigateUrl = string.Format("BookingList.aspx?NodeId={0}&SectionId={1}&batchid={2}",
                                                            Node.Id, Section.Id, batch.Id);
                }

                ValueBinder.BindLiteral(e.Item, "litValidUntil", batch.ValidUntil.ToString("dd/MM/yyyy"));
                if (!string.IsNullOrEmpty(batch.ContractFile))
                {
                    var hplContract = (HyperLink)e.Item.FindControl("hplContract");
                    hplContract.Text        = @"Download file";
                    hplContract.NavigateUrl = batch.ContractFile;
                }

                var hplName = (HyperLink)e.Item.FindControl("hplName");
                hplName.Text        = batch.Name;
                hplName.NavigateUrl = string.Format("VoucherEdit.aspx?NodeId={0}&SectionId={1}&batchid={2}", Node.Id,
                                                    Section.Id, batch.Id);

                var hplEdit = (HyperLink)e.Item.FindControl("hplEdit");
                hplEdit.NavigateUrl = string.Format("VoucherEdit.aspx?NodeId={0}&SectionId={1}&batchid={2}", Node.Id,
                                                    Section.Id, batch.Id);
            }
        }
        protected void rptContacts_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is AgencyContact)
            {
                var contact = (AgencyContact)e.Item.DataItem;

                if (!contact.Enabled)
                {
                    e.Item.Visible = false;
                    return;
                }

                var ltrName = (Literal)e.Item.FindControl("ltrName");
                ltrName.Text = contact.Name;

                var hplName = (HyperLink)e.Item.FindControl("hplName");
                hplName.NavigateUrl = "javascript:";

                if (_editPermission)
                {
                    string url = string.Format("AgencyContactEdit.aspx?NodeId={0}&SectionId={1}&contactid={2}",
                                               Node.Id, Section.Id, contact.Id);
                    hplName.Attributes.Add("onclick", CMS.ServerControls.Popup.OpenPopupScript(url, "Contact", 300, 400));
                }

                var linkEmail = (HyperLink)e.Item.FindControl("hplEmail");
                linkEmail.Text        = contact.Email;
                linkEmail.NavigateUrl = string.Format("mailto:{0}", contact.Email);

                ValueBinder.BindLiteral(e.Item, "litPosition", contact.Position);
                ValueBinder.BindLiteral(e.Item, "litPhone", contact.Phone);

                if (contact.IsBooker)
                {
                    ValueBinder.BindLiteral(e.Item, "litBooker", "Booker");
                }

                var lbtDelete = (LinkButton)e.Item.FindControl("lbtDelete");
                lbtDelete.Visible         = _editPermission;
                lbtDelete.CommandArgument = contact.Id.ToString();

                {
                    var hplCreateMeeting = (HyperLink)e.Item.FindControl("hplCreateMeeting");
                    hplCreateMeeting.NavigateUrl = "javascript:";
                    string url = string.Format("EditMeeting.aspx?NodeId={0}&SectionId={1}&contact={2}",
                                               Node.Id, Section.Id, contact.Id);
                    hplCreateMeeting.Attributes.Add("onclick",
                                                    CMS.ServerControls.Popup.OpenPopupScript(url, "Contract", 300, 400));
                }
            }
        }
        protected void rptAnswerData_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is string)
            {
                string str    = e.Item.DataItem.ToString();
                int    choice = _currentQuestion.Group.Selections.IndexOf(str) + 1;
                // Đếm số choice = 1
                int total;
                int count = Module.ChoiceReport(Request.QueryString, _currentQuestion, choice, out total);

                ValueBinder.BindLiteral(e.Item, "litCount", count);
                ValueBinder.BindLiteral(e.Item, "litPercentage", ((double)count * 100 / total).ToString("#0.##") + "%");
            }
        }
Exemplo n.º 11
0
        protected void rptQuestion_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is Question)
            {
                Question question = (Question)e.Item.DataItem;
                ValueBinder.BindLiteral(e.Item, "litQuestion", question.Content);

                _currentQuestion = question;

                Repeater rptOptions = (Repeater)e.Item.FindControl("rptOptions");
                rptOptions.DataSource = _currentOptions;
                rptOptions.DataBind();
            }
        }
        protected void rptPendings_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is Booking)
            {
                var booking = (Booking)e.Item.DataItem;
                var hplCode = e.Item.FindControl("hplCode") as HyperLink;
                if (hplCode != null)
                {
                    hplCode.Text        = string.Format(BookingFormat, booking.Id);
                    hplCode.NavigateUrl = string.Format("BookingView.aspx?NodeId={0}&SectionId={1}&bi={2}",
                                                        Node.Id, Section.Id, booking.Id);
                }

                var hplAgency = e.Item.FindControl("hplAgency") as HyperLink;
                if (hplAgency != null)
                {
                    hplAgency.Text        = booking.Agency.Name;
                    hplAgency.NavigateUrl = string.Format("AgencyEdit.aspx?NodeId={0}&SectionId={1}&AgencyId={2}",
                                                          Node.Id, Section.Id, booking.Agency.Id);
                }

                ValueBinder.BindLiteral(e.Item, "litRooms", booking.RoomName);
                ValueBinder.BindLiteral(e.Item, "litTrip", booking.Trip.Name);
                //ValueBinder.BindLiteral(e.Item, "litPartner", booking.Agency.Name);
                if (booking.Deadline.HasValue)
                {
                    ValueBinder.BindLiteral(e.Item, "litPending", booking.Deadline.Value.ToString("HH:mm dd/MM/yyyy"));
                }

                var lblCreatedBy = e.Item.FindControl("lblCreatedBy") as Label;
                if (lblCreatedBy != null)
                {
                    lblCreatedBy.Text = booking.CreatedBy.FullName;
                    ValueBinder.BindLiteral(e.Item, "litCreatedBy", booking.CreatedBy.FullName);
                    ValueBinder.BindLiteral(e.Item, "litCreatorPhone", booking.CreatedBy.Website);
                    ValueBinder.BindLiteral(e.Item, "litCreatorEmail", booking.CreatedBy.Email);
                }
                if (booking.Agency.Sale != null)
                {
                    ValueBinder.BindLabel(e.Item, "lblSaleInCharge", booking.Agency.Sale.FullName);
                    ValueBinder.BindLiteral(e.Item, "litSale", booking.Agency.Sale.FullName);
                    ValueBinder.BindLiteral(e.Item, "litSalePhone", booking.Agency.Sale.Website);
                    ValueBinder.BindLiteral(e.Item, "litSaleEmail", booking.Agency.Sale.Email);
                }
            }
        }
Exemplo n.º 13
0
        protected void rptFiles_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is string)
            {
                string filename = Path.GetFileName(e.Item.DataItem.ToString());
                ValueBinder.BindLiteral(e.Item, "litFileName", filename);

                var hplDownload = e.Item.FindControl("hplDownload") as HyperLink;
                if (hplDownload != null)
                {
                    hplDownload.NavigateUrl = "/UserFiles/VoucherTemplates/" + filename;
                }

                var lbtDelete = e.Item.FindControl("lbtDelete") as LinkButton;
                if (lbtDelete != null)
                {
                    lbtDelete.CommandArgument = filename;
                }
            }
        }
 protected void rptPaymentHistory_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.DataItem is Transaction)
     {
         var transaction = (Transaction)e.Item.DataItem;
         ValueBinder.BindLiteral(e.Item, "litTime", transaction.CreatedDate.ToString("dd/MM/yyyy HH:mm"));
         ValueBinder.BindLiteral(e.Item, "litPayBy", transaction.AgencyName);
         ValueBinder.BindLiteral(e.Item, "litAmountUSD", transaction.USDAmount.ToString("#,0.#"));
         ValueBinder.BindLiteral(e.Item, "litAmountVND", transaction.VNDAmount.ToString("#,0.#"));
         ValueBinder.BindLiteral(e.Item, "litRate", transaction.AppliedRate > 0 ? transaction.AppliedRate.ToString("#,0.#") : "");
         ValueBinder.BindLiteral(e.Item, "litCreatedBy", transaction.CreatedBy.UserName);
         ValueBinder.BindLiteral(e.Item, "litNote", transaction.Note);
         var hplGroupCode = e.Item.FindControl("hplGroupCode") as HyperLink;
         if (hplGroupCode != null)
         {
             if (transaction.TransactionGroup != null)
             {
                 hplGroupCode.Text        = transaction.TransactionGroup.Id.ToString();
                 hplGroupCode.NavigateUrl = Request.Url.GetLeftPart(UriPartial.Path) +
                                            QueryStringBuildByCriterion(transaction.Id.ToString());
                 hplGroupCode.Attributes.Add("data-placement", "bottom");
                 hplGroupCode.Attributes.Add("data-toggle", "tooltip");
                 hplGroupCode.Attributes.Add("title", string.Format("code {0} total usd: {1} , vnd: {2}. {3}",
                                                                    transaction.TransactionGroup.Id, transaction.USDAmount.ToString("#,0.#"),
                                                                    transaction.TransactionGroup.VNDAmount.ToString("#,0.#")
                                                                    , transaction.TransactionGroup.Note));
             }
             else
             {
                 hplGroupCode.Text = transaction.Booking.BookingIdOS;
             }
         }
         _totalUSD += transaction.USDAmount;
         _totalVND += transaction.VNDAmount;
     }
     else if (e.Item.ItemType == ListItemType.Footer)
     {
         ValueBinder.BindLiteral(e.Item, "litTotalUSD", _totalUSD.ToString("#,0.#"));
         ValueBinder.BindLiteral(e.Item, "litTotalVND", _totalVND.ToString("#,0.#"));
     }
 }
Exemplo n.º 15
0
        protected void rptPaymentHistory_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is Transaction)
            {
                var transaction = (Transaction)e.Item.DataItem;
                ValueBinder.BindLiteral(e.Item, "litTime", transaction.CreatedDate.ToString("dd/MM/yyyy HH:mm"));
                ValueBinder.BindLiteral(e.Item, "litPayBy", transaction.AgencyName);
                ValueBinder.BindLiteral(e.Item, "litAmountUSD", transaction.USDAmount.ToString("#,0.#"));
                ValueBinder.BindLiteral(e.Item, "litAmountVND", transaction.VNDAmount.ToString("#,0.#"));
                ValueBinder.BindLiteral(e.Item, "litCreatedBy", transaction.CreatedBy.UserName);
                ValueBinder.BindLiteral(e.Item, "litNote", transaction.Note);

                _totalUSD += transaction.USDAmount;
                _totalVND += transaction.VNDAmount;
            }
            else if (e.Item.ItemType == ListItemType.Footer)
            {
                ValueBinder.BindLiteral(e.Item, "litTotalUSD", _totalUSD.ToString("#,0.#"));
                ValueBinder.BindLiteral(e.Item, "litTotalVND", _totalVND.ToString("#,0.#"));
            }
        }
        protected void rptBookingRooms_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is BookingRoom)
            {
                var room = (BookingRoom)e.Item.DataItem;
                ValueBinder.BindLiteral(e.Item, "litType", string.Format("{0} {1}", room.RoomClass.Name, room.RoomType.Name));
                ValueBinder.BindLiteral(e.Item, "litCustomer", room.CustomerName);
                var chkLockRoom = (CheckBox)e.Item.FindControl("chkLockRoom");

                if (room.Room != null)
                {
                    ValueBinder.BindLiteral(e.Item, "litRoomName", room.Room.Name);
                    var txtRoomNumber = (TextBox)e.Item.FindControl("txtRoomNumber");
                    txtRoomNumber.Text  = room.Room.Id.ToString();
                    chkLockRoom.Checked = room.IsLocked;

                    // nếu là sale in charge hoặc admin thì cho phép lock
                    if (UserIdentity.HasPermission(AccessLevel.Administrator) || room.Book.Agency.Sale == null || room.Book.Agency.Sale.Id == UserIdentity.Id)
                    {
                        chkLockRoom.Enabled = true;
                    }
                    else
                    {
                        chkLockRoom.Enabled = false;
                        if (room.IsLocked)
                        {
                            txtRoomNumber.ReadOnly = true;
                        }
                    }
                }

                var hplBookingId = e.Item.FindControl("hplBookingId") as HyperLink;
                if (hplBookingId != null)
                {
                    hplBookingId.Text        = string.Format("[{0}]", room.Book.BookingIdOS);
                    hplBookingId.NavigateUrl = string.Format("BookingView.aspx?NodeId={0}&SectionId={1}&bi={2}",
                                                             Node.Id, Section.Id, room.Book.Id);
                }
            }
        }
Exemplo n.º 17
0
        protected void rptPriceTables_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var table = e.Item.DataItem as SailsPriceTable;

            if (table != null)
            {
                if (table.StartDate != null)
                {
                    ValueBinder.BindLiteral(e.Item, "litValidFrom", table.StartDate.Value.ToString("dd/MM/yyyy"));
                }
                if (table.EndDate != null)
                {
                    ValueBinder.BindLiteral(e.Item, "litValidTo", table.EndDate.Value.ToString("dd/MM/yyyy"));
                }
                var hplEdit = e.Item.FindControl("hplEdit") as HyperLink;
                if (hplEdit != null)
                {
                    hplEdit.NavigateUrl = string.Format("PriceTableConfig.aspx?SectionId={0}&NodeId={1}&tableid={2}",
                                                        Section.Id, Node.Id, table.Id);
                }
            }
        }
        protected void rptContracts_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is AgencyContract)
            {
                var contract = (AgencyContract)e.Item.DataItem;

                ValueBinder.BindLiteral(e.Item, "litName", contract.ContractName);
                ValueBinder.BindLiteral(e.Item, "litExpired", contract.ExpiredDate.ToString("dd/MM/yyyy"));
                if (contract.CreateDate != null)
                {
                    ValueBinder.BindLiteral(e.Item, "litCreatedDate", contract.CreateDate.Value.ToString("dd/MM/yyyy"));
                }

                if (contract.Received == true)
                {
                    ValueBinder.BindLiteral(e.Item, "litReceived", "Yes");
                }
                else
                {
                    ValueBinder.BindLiteral(e.Item, "litReceived", "No");
                }

                var hplDownload = (HyperLink)e.Item.FindControl("hplDownload");
                hplDownload.NavigateUrl = contract.FilePath;
                //hplDownload.NavigateUrl = contract.FileName;
                hplDownload.Text = contract.FileName;

                var linkEdit = (HyperLink)e.Item.FindControl("hplEdit");

                var url = string.Format("AgencyContractEdit.aspx?NodeId={0}&SectionId={1}&contractid={2}",
                                        Node.Id, Section.Id, contract.Id);
                linkEdit.NavigateUrl = "javascript:";
                linkEdit.Attributes.Add("onclick", CMS.ServerControls.Popup.OpenPopupScript(url, "Contract", 300, 400));
                linkEdit.Visible = _editPermission;
            }
        }
Exemplo n.º 19
0
 protected void rptDates_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Header)
     {
         var rptOperators = (Repeater)e.Item.FindControl("rptOperators");
         rptOperators.DataSource = Operators;
         rptOperators.DataBind();
     }
     else if (e.Item.ItemType == ListItemType.Footer)
     {
         var rptOperators = (Repeater)e.Item.FindControl("rptOperators");
         rptOperators.DataSource = Operators;
         rptOperators.DataBind();
     }
     else
     {
         var date = (DateTime)e.Item.DataItem;
         ValueBinder.BindLiteral(e.Item, "litDate", date.ToString("dd/MM/yyyy"));
         var rptOperators = (Repeater)e.Item.FindControl("rptOperators");
         _date = date;
         rptOperators.DataSource = Operators;
         rptOperators.DataBind();
     }
 }
        protected void rptGroups_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is EventCode)
            {
                var code         = (EventCode)e.Item.DataItem;
                var hplEventCode = e.Item.FindControl("hplEventCode") as HyperLink;
                if (hplEventCode != null)
                {
                    hplEventCode.Text        = string.Format("{0}{1:ddMMyy}-{2:00}", code.SailExpense.Trip.TripCode, code.SailExpense.Date, code.Group);
                    hplEventCode.NavigateUrl =
                        string.Format("EventEdit.aspx?NodeId={0}&SectionId={1}&expenseid={2}&group={3}", Node.Id,
                                      Section.Id, code.SailExpense.Id, code.Group);
                }

                var hplDate = e.Item.FindControl("hplDate") as HyperLink;
                if (hplDate != null)
                {
                    hplDate.Text        = code.SailExpense.Date.ToString("dd/MM/yyyy");
                    hplDate.NavigateUrl = string.Format("BookingReport.aspx?NodeId={0}&SectionID={1}&Date={2}&tripid={3}", Node.Id,
                                                        Section.Id, code.SailExpense.Date.ToOADate(), code.SailExpense.Trip.Id);
                }

                var hplTrip = e.Item.FindControl("hplTrip") as HyperLink;
                if (hplTrip != null)
                {
                    hplTrip.Text = code.SailExpense.Trip.Name;
                }

                int    pax               = 0;
                double revenuePaid       = 0;
                double revenueReceivable = 0;
                double revenueTotal      = 0;

                double expensePaid    = 0;
                double expensePayable = 0;
                double expenseTotal   = 0;
                foreach (Booking booking in code.Bookings)
                {
                    pax += booking.Pax;

                    double paid = booking.Total * booking.CurrencyRate - booking.TotalReceivable;
                    revenuePaid       += paid;
                    revenueReceivable += booking.TotalReceivable;
                    revenueTotal      += booking.Total * booking.CurrencyRate;
                }

                foreach (ExpenseService service in code.SailExpense.Services)
                {
                    if (service.Group == code.Group)
                    {
                        expensePaid    += service.Paid;
                        expensePayable += service.Cost - service.Paid;
                        expenseTotal   += service.Cost;
                    }
                }

                if (pax == 0 && expenseTotal == 0 && revenueTotal == 0)
                {
                    e.Item.Visible = false;
                    return;
                }

                ValueBinder.BindLiteral(e.Item, "litPax", pax);
                ValueBinder.BindLiteral(e.Item, "litRevenuePaid", revenuePaid.ToString("#,0.#"));
                ValueBinder.BindLiteral(e.Item, "litReceivable", revenueReceivable.ToString("#,0.#"));
                ValueBinder.BindLiteral(e.Item, "litRevenue", revenueTotal.ToString("#,0.#"));
                ValueBinder.BindLiteral(e.Item, "litExpensePaid", expensePaid.ToString("#,0.#"));
                ValueBinder.BindLiteral(e.Item, "litPayable", expensePayable.ToString("#,0.#"));
                ValueBinder.BindLiteral(e.Item, "litExpense", expenseTotal.ToString("#,0.#"));
                ValueBinder.BindLiteral(e.Item, "litProfit", (revenuePaid - expenseTotal).ToString("#,0.#"));
            }
        }
        protected void rptExpenseServices_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is ExpenseService)
            {
                var service = (ExpenseService)e.Item.DataItem;

                //if (service.Cost == 0 || service.Type.IsMonthly || service.Type.IsYearly)
                if (service.Type.IsMonthly || service.Type.IsYearly)
                {
                    e.Item.Visible = false;
                    return;
                }
                var hplDate = e.Item.FindControl("hplDate") as HyperLink;
                if (hplDate != null)
                {
                    hplDate.Text = service.Expense.Date.ToString("dd/MM/yyyy");
                }

                var hplTripCode = e.Item.FindControl("hplTripCode") as HyperLink;
                if (hplTripCode != null)
                {
                    hplTripCode.Text        = string.Format("{0}{1}-{2:00}", service.Expense.Trip.TripCode, service.Expense.Date.ToString("ddMMyy"), service.Group);
                    hplTripCode.NavigateUrl =
                        string.Format("EventEdit.aspx?NodeId={0}&SectionId={1}&expenseid={2}&group={3}", Node.Id,
                                      Section.Id, service.Expense.Id, service.Group);
                }

                var hplPartner = e.Item.FindControl("hplPartner") as HyperLink;
                if (hplPartner != null)
                {
                    if (service.Supplier != null)
                    {
                        hplPartner.Text        = service.Supplier.Name;
                        hplPartner.NavigateUrl =
                            string.Format("PayableList.aspx?NodeId={0}&SectionId={1}&from={3}&to={4}&supplierid={2}", Node.Id, Section.Id,
                                          service.Supplier.Id, Request.QueryString["from"], Request.QueryString["to"]);
                    }
                }

                var hplService = e.Item.FindControl("hplService") as HyperLink;
                if (hplService != null)
                {
                    hplService.Text        = service.Type.Name;
                    hplService.NavigateUrl = string.Format("PayableList.aspx?NodeId={0}&SectionId={1}", Node.Id, Section.Id);
                }

                var litTotal = e.Item.FindControl("litTotal") as Literal;
                if (litTotal != null)
                {
                    litTotal.Text  = service.Cost.ToString("#,0.#");
                    _expenseTotal += service.Cost;
                }

                Literal litPaid = e.Item.FindControl("litPaid") as Literal;
                if (litPaid != null)
                {
                    litPaid.Text  = service.Paid.ToString("#,0.#");
                    _expensePaid += service.Paid;
                }

                Literal litPayable = e.Item.FindControl("litPayable") as Literal;
                if (litPayable != null)
                {
                    litPayable.Text = (service.Cost - service.Paid).ToString("#,0.#");
                    _payable       += service.Cost - service.Paid;
                }

                if (service.PaidDate.HasValue)
                {
                    ValueBinder.BindLiteral(e.Item, "litPaidOn", service.PaidDate.Value);
                }
            }

            if (e.Item.ItemType == ListItemType.Footer)
            {
                Literal litTotal = e.Item.FindControl("litTotal") as Literal;
                if (litTotal != null)
                {
                    litTotal.Text = _expenseTotal.ToString("#,0.#");
                }

                Literal litPaid = e.Item.FindControl("litPaid") as Literal;
                if (litPaid != null)
                {
                    litPaid.Text = _expensePaid.ToString("#,0.#");
                }

                Literal litPayable = e.Item.FindControl("litPayable") as Literal;
                if (litPayable != null)
                {
                    litPayable.Text = _payable.ToString("#,0.#");
                }
            }
        }
        protected void rptBookingList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is Booking)
            {
                Booking booking = (Booking)e.Item.DataItem;

                #region -- Thông tin chung --
                HyperLink hplCode = e.Item.FindControl("hplCode") as HyperLink;
                if (hplCode != null)
                {
                    hplCode.Text        = string.Format(BookingFormat, booking.Id);
                    hplCode.NavigateUrl = string.Format("BookingView.aspx?NodeId={0}&SectionId={1}&BookingId={2}",
                                                        Node.Id, Section.Id, booking.Id);
                }

                HyperLink hplCruise = e.Item.FindControl("hplCruise") as HyperLink;
                if (hplCruise != null)
                {
                    if (booking.Cruise != null)
                    {
                        hplCruise.Text        = booking.Cruise.Name;
                        hplCruise.NavigateUrl = string.Format("CommissionPayment.aspx?NodeId={0}&SectionId={1}&cruiseid={2}", Node.Id,
                                                              Section.Id,
                                                              booking.Cruise.Id);
                    }
                }

                #region -- Others --

                Literal litDate = e.Item.FindControl("litDate") as Literal;
                if (litDate != null)
                {
                    litDate.Text = booking.StartDate.ToString("dd/MM/yyyy");
                }

                HyperLink hyperLink_Partner = e.Item.FindControl("hyperLink_Partner") as HyperLink;
                if (hyperLink_Partner != null)
                {
                    if (booking.Agency != null)
                    {
                        hyperLink_Partner.Text = booking.Agency.Name;
                        DateTime from;
                        DateTime to;
                        try
                        {
                            from = DateTime.ParseExact(txtFrom.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                            to   = DateTime.ParseExact(txtTo.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                            hyperLink_Partner.NavigateUrl =
                                string.Format(
                                    "CommissionPayment.aspx?NodeId={0}&SectionId={1}&agencyid={2}&from={3}&to={4}", Node.Id,
                                    Section.Id, booking.Agency.Id, from.ToOADate(), to.ToOADate());
                        }
                        catch
                        {
                            hyperLink_Partner.NavigateUrl =
                                string.Format("CommissionPayment.aspx?NodeId={0}&SectionId={1}&AgencyId={2}", Node.Id,
                                              Section.Id,
                                              booking.Agency.Id);
                        }
                    }
                    else
                    {
                        hyperLink_Partner.Text = SailsModule.NOAGENCY;
                    }
                }

                Literal litService = e.Item.FindControl("litService") as Literal;
                if (litService != null)
                {
                    litService.Text = booking.Trip.TripCode;
                }

                #endregion

                #region -- Number of pax --

                Label label_NoOfAdult = e.Item.FindControl("label_NoOfAdult") as Label;
                if (label_NoOfAdult != null)
                {
                    label_NoOfAdult.Text = booking.Adult.ToString();
                }

                Label label_NoOfChild = e.Item.FindControl("label_NoOfChild") as Label;
                if (label_NoOfChild != null)
                {
                    label_NoOfChild.Text = booking.Child.ToString();
                }

                Label label_NoOfBaby = e.Item.FindControl("label_NoOfBaby") as Label;
                if (label_NoOfBaby != null)
                {
                    label_NoOfBaby.Text = booking.Baby.ToString();
                }

                _adult += booking.Adult;
                _child += booking.Child;
                _baby  += booking.Baby;

                #endregion
                #endregion

                #region -- Paid/Total --

                Label label_TotalPrice = e.Item.FindControl("label_TotalPrice") as Label;
                if (label_TotalPrice != null)
                {
                    if (booking.Commission > 0)
                    {
                        label_TotalPrice.Text = booking.Commission.ToString("#,###");
                    }
                    else
                    {
                        label_TotalPrice.Text = @"0";
                    }
                }

                Label lblTotalPriceVND = e.Item.FindControl("lblTotalPriceVND") as Label;
                if (lblTotalPriceVND != null)
                {
                    if (booking.CommissionVND > 0)
                    {
                        lblTotalPriceVND.Text = booking.CommissionVND.ToString("#,###");
                    }
                    else
                    {
                        lblTotalPriceVND.Text = @"0";
                    }
                }


                #endregion

                #region -- Editable --

                HtmlAnchor aPayment = e.Item.FindControl("aPayment") as HtmlAnchor;
                if (aPayment != null)
                {
                    string url = string.Format("CommissionEdit.aspx?NodeId={0}&SectionId={1}&BookingId={2}", Node.Id,
                                               Section.Id, booking.Id);
                    aPayment.Attributes.Add("onclick",
                                            CMS.ServerControls.Popup.OpenPopupScript(url, "Payment", 300, 400));
                }

                Literal litPaid = e.Item.FindControl("litPaid") as Literal;
                if (litPaid != null)
                {
                    litPaid.Text = booking.ComUSDpayed.ToString("#,0.#");
                }

                Literal litPaidBase = e.Item.FindControl("litPaidBase") as Literal;
                if (litPaidBase != null)
                {
                    litPaidBase.Text = booking.ComVNDpayed.ToString("#,0.#");
                }

                Literal litCurrentRate = e.Item.FindControl("litCurrentRate") as Literal;
                if (litCurrentRate != null)
                {
                    if (booking.ComRate > 0)
                    {
                        litCurrentRate.Text = booking.ComRate.ToString("#,0.#");
                    }
                    else
                    {
                        booking.ComRate     = GetCurrentRate();
                        litCurrentRate.Text = booking.ComRate.ToString("#,0.#");
                    }
                }

                Literal litReceivable = e.Item.FindControl("litReceivable") as Literal;
                if (litReceivable != null)
                {
                    litReceivable.Text = booking.CommissionLeft.ToString("#,0.#");
                }
                _total      += booking.Commission;
                _totalVND   += booking.CommissionVND;
                _paid       += booking.ComUSDpayed;
                _paidBase   += booking.ComVNDpayed;
                _receivable += booking.CommissionLeft;

                #endregion

                #region -- Tô màu --

                HtmlTableRow trItem = e.Item.FindControl("trItem") as HtmlTableRow;
                if (trItem != null)
                {
                    string color = string.Empty;
                    if (booking.Agency != null && booking.Agency.PaymentPeriod != PaymentPeriod.Monthly)
                    {
                        color = SailsModule.WARNING;
                    }
                    if (booking.IsPaymentNeeded)
                    {
                        color = SailsModule.IMPORTANT;
                    }
                    if (booking.ComPaid)
                    {
                        color = SailsModule.GOOD;
                    }
                    if (!string.IsNullOrEmpty(color))
                    {
                        trItem.Attributes.Add("style", "background-color:" + color);
                    }
                }

                #endregion

                Literal litSaleInCharge = e.Item.FindControl("litSaleInCharge") as Literal;
                if (litSaleInCharge != null)
                {
                    if (booking.Agency != null && booking.Agency.Sale != null)
                    {
                        litSaleInCharge.Text = booking.Agency.Sale.UserName;
                    }
                }

                Literal litTACode = e.Item.FindControl("litTACode") as Literal;
                if (litTACode != null)
                {
                    if (!string.IsNullOrEmpty(booking.AgencyCode))
                    {
                        litTACode.Text = booking.AgencyCode;
                    }
                }

                Literal litBooker = e.Item.FindControl("litBooker") as Literal;
                if (litBooker != null)
                {
                    if (booking.Booker != null)
                    {
                        litBooker.Text = booking.Booker.Name;
                    }
                }

                if (booking.ComPaidDate.HasValue)
                {
                    ValueBinder.BindLiteral(e.Item, "litPaidOn", booking.ComPaidDate.Value);
                }
            }
            else
            {
                if (e.Item.ItemType == ListItemType.Footer)
                {
                    #region -- get control --

                    Label   label_NoOfAdult     = (Label)e.Item.FindControl("label_NoOfAdult");
                    Label   label_NoOfChild     = (Label)e.Item.FindControl("label_NoOfChild");
                    Label   label_NoOfBaby      = (Label)e.Item.FindControl("label_NoOfBaby");
                    Label   label_TotalPrice    = (Label)e.Item.FindControl("label_TotalPrice");
                    Label   label_TotalPriceVND = (Label)e.Item.FindControl("label_TotalPriceVND");
                    Literal litPaid             = (Literal)e.Item.FindControl("litPaid");
                    Literal litPaidBase         = (Literal)e.Item.FindControl("litPaidBase");
                    Literal litReceivable       = (Literal)e.Item.FindControl("litReceivable");

                    #endregion

                    #region -- set value --

                    label_NoOfAdult.Text     = _adult.ToString();
                    label_NoOfChild.Text     = _child.ToString();
                    label_NoOfBaby.Text      = _baby.ToString();
                    label_TotalPrice.Text    = _total.ToString("#,###");
                    label_TotalPriceVND.Text = _totalVND.ToString("#,###");
                    if (_paid > 0)
                    {
                        litPaid.Text = _paid.ToString("#,###");
                    }
                    else
                    {
                        litPaid.Text = "0";
                    }

                    litPaidBase.Text = _paidBase.ToString("#,0.#");

                    if (_receivable > 0)
                    {
                        litReceivable.Text = _receivable.ToString("#,###");
                    }
                    else
                    {
                        litReceivable.Text = "0";
                    }

                    #endregion

                    HtmlAnchor aPayment = e.Item.FindControl("aPayment") as HtmlAnchor;
                    if (aPayment != null)
                    {
                        string from = Request.QueryString["from"];
                        string to   = Request.QueryString["to"];
                        if (string.IsNullOrEmpty(from))
                        {
                            var date = DateTime.Today.AddDays(-DateTime.Today.Day + 1);
                            from = date.ToOADate().ToString();
                            to   = date.AddMonths(1).AddDays(-1).ToOADate().ToString();
                        }
                        string url;
                        if (Request.QueryString["agencyid"] != null)
                        {
                            url =
                                string.Format(
                                    "CommissionEdit.aspx?NodeId={0}&SectionId={1}&agencyid={4}&from={2}&to={3}",
                                    Node.Id, Section.Id, from, to, Request.QueryString["agencyid"]);
                        }
                        else if (Request.QueryString["agencyname"] != null)
                        {
                            url =
                                string.Format(
                                    "CommissionEdit.aspx?NodeId={0}&SectionId={1}&agencyname={4}&from={2}&to={3}",
                                    Node.Id, Section.Id, from, to, Request.QueryString["agencyname"]);
                        }
                        else
                        {
                            url = string.Format("CommissionEdit.aspx?NodeId={0}&SectionId={1}&from={2}&to={3}", Node.Id,
                                                Section.Id, from, to);
                        }
                        aPayment.Attributes.Add("onclick",
                                                CMS.ServerControls.Popup.OpenPopupScript(url, "Payment", 300, 400));
                    }
                }
            }
        }
        protected void rptAgencies_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is vAgency)
            {
                vAgency   agency  = (vAgency)e.Item.DataItem;
                HyperLink hplName = e.Item.FindControl("hplName") as HyperLink;
                if (hplName != null)
                {
                    hplName.Text        = agency.Name;
                    hplName.NavigateUrl = string.Format("AgencyView.aspx{0}&AgencyId={1}", GetBaseQueryString(), agency.Id);
                }

                HtmlAnchor aName = e.Item.FindControl("aName") as HtmlAnchor;
                if (aName != null)
                {
                    aName.InnerHtml = agency.Name;
                    aName.Attributes.CssStyle.Add("cursor", "pointer");

                    string script = string.Format("Done('{0}','{1}')", agency.Name.Replace("'", @"\'"), agency.Id);
                    aName.Attributes.Add("onclick", script);
                }

                HyperLink hplEdit = e.Item.FindControl("hplEdit") as HyperLink;
                if (hplEdit != null)
                {
                    hplEdit.NavigateUrl = string.Format("AgencyEdit.aspx{0}&AgencyId={1}", GetBaseQueryString(), agency.Id);
                }

                Literal litRole = e.Item.FindControl("litRole") as Literal;
                if (litRole != null)
                {
                    var hyperLink = e.Item.FindControl("hplPriceSetting") as HyperLink;
                    if (hyperLink != null)
                    {
                        if (agency.Role != null)
                        {
                            litRole.Text      = agency.Role.Name;
                            hyperLink.Visible = false;
                        }
                        else
                        {
                            litRole.Text      = "Customize Role";
                            hyperLink.Visible = true;
                        }
                    }
                    else
                    {
                        Debug.WriteLine("hplPriceSetting = null");
                    }
                }

                Literal litContract = e.Item.FindControl("litContract") as Literal;
                if (litContract != null)
                {
                    switch (agency.ContractStatus)
                    {
                    case 0:
                        litContract.Text = @"No contract";
                        break;

                    case 1:
                        litContract.Text = @"Expired";
                        break;

                    case 2:
                        litContract.Text = @"Contract in valid";
                        break;

                    case 3:
                        litContract.Text = @"Expire soon";
                        break;

                    case 4:
                        litContract.Text = @"Contract sent";
                        break;
                    }
                }

                var trItem = e.Item.FindControl("trItem") as HtmlTableRow;
                if (trItem != null)
                {
                    switch (agency.ContractStatus)
                    {
                    case 0:     // No contract
                        trItem.Attributes.Add("class", "danger");
                        break;

                    case 1:     // Contract expired
                        trItem.Attributes.Add("class", "active");
                        break;

                    case 2:     // Có hợp đồng và chưa hết hạn trong vòng 30 ngày
                        trItem.Attributes.Add("class", "success");
                        break;

                    case 3:     // Có hợp đồng nhưng sẽ hết hạn trong vòng 30 ngày
                        trItem.Attributes.Add("class", "warning");
                        break;

                    case 4:
                        trItem.Attributes.CssStyle.Add("background-color", "greenyellow");
                        break;
                    }
                }

                if (agency.ContractStatus != 0)
                {
                    if (string.IsNullOrEmpty(agency.Contract))
                    {
                        HyperLink hplContract = e.Item.FindControl("hplContract") as HyperLink;
                        if (hplContract != null)
                        {
                            hplContract.Visible = false;
                        }
                    }
                    else
                    {
                        HyperLink hplContract = e.Item.FindControl("hplContract") as HyperLink;
                        if (hplContract != null)
                        {
                            hplContract.Text        = @"[View]";
                            hplContract.NavigateUrl = agency.Contract;
                        }
                    }
                }

                ValueBinder.BindLiteral(e.Item, "litPayment", agency.PaymentPeriod);

                var litIndex = e.Item.FindControl("litIndex") as Literal;
                if (litIndex != null)
                {
                    litIndex.Text = (e.Item.ItemIndex + pagerBookings.PageSize * pagerBookings.CurrentPageIndex + 1) + ".";
                }

                var litSale = e.Item.FindControl("litSale") as Literal;
                if (litSale != null)
                {
                    if (agency.Sale != null)
                    {
                        litSale.Text = agency.Sale.UserName;
                    }
                }

                var hplPriceSetting = e.Item.FindControl("hplPriceSetting") as HyperLink;
                if (hplPriceSetting != null)
                {
                    hplPriceSetting.NavigateUrl =
                        string.Format("PriceConfiguration.aspx?NodeId={0}&SectionId={1}&agentid={2}", Node.Id, Section.Id,
                                      agency.Id);
                }

                HtmlTableCell tdLastBooking = e.Item.FindControl("tdLastBooking") as HtmlTableCell;
                if (tdLastBooking != null)
                {
                    if (agency.LastBooking.HasValue)
                    {
                        tdLastBooking.InnerHtml = string.Format("{0} (<a href='{1}'>list</a>) ",
                                                                agency.LastBooking.Value.ToString("dd/MM/yyyy"),
                                                                string.Format(
                                                                    "BookingList.aspx?NodeId={0}&SectionId={1}&ai={2}",
                                                                    Node.Id, Section.Id, agency.Id));
                    }
                    else
                    {
                        tdLastBooking.InnerText = "Never";
                    }
                }
            }
        }
Exemplo n.º 24
0
        protected void rptFeedbacks_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is AnswerSheet && e.Item.DataItem != null)
            {
                try
                {
                    var ddlSend = (DropDownList)e.Item.FindControl("ddlSend");
                    var sheet   = (AnswerSheet)e.Item.DataItem;
                    ValueBinder.BindLiteral(e.Item, "litName", sheet.Name);
                    if (sheet.Booking != null)
                    {
                        ValueBinder.BindLiteral(e.Item, "litCode", string.Format(BookingFormat, sheet.Booking.Id));
                    }
                    ValueBinder.BindLiteral(e.Item, "litName", sheet.Name);
                    if (sheet.IsSent)
                    {
                        ValueBinder.BindLiteral(e.Item, "litStatus", "Sent");
                        ddlSend.SelectedValue = "0";
                    }
                    else if (string.IsNullOrEmpty(sheet.Email))
                    {
                        ValueBinder.BindLiteral(e.Item, "litStatus", "No email address");
                    }
                    else
                    {
                        ValueBinder.BindLiteral(e.Item, "litStatus", "Not yet");
                    }

                    DropDownList ddlTemplates = (DropDownList)e.Item.FindControl("ddlTemplates");
                    ddlTemplates.Items.Clear();

                    int good = 0;
                    int all  = 0;
                    // Kiểm tra số good choice
                    foreach (AnswerOption option in sheet.Options)
                    {
                        if (option.Option == option.Question.Group.GoodChoice && option.Question != null)
                        {
                            good++;
                        }
                        all++;
                    }

                    foreach (string file in _files)
                    {
                        string filename = Path.GetFileName(file);
                        if (!string.IsNullOrEmpty(filename))
                        {
                            try
                            {
                                string name = Path.GetFileName(file);
                                ddlTemplates.Items.Add(new ListItem(name, file));
                            }
                            catch
                            {
                                continue;
                            }
                        }
                    }

                    double percent = ((double)good) / all * 100;
                    if (percent > 70)
                    {
                        ddlTemplates.Items.FindByText("thankyou.htm").Selected = true;
                    }
                    else if (percent > 30)
                    {
                        ddlTemplates.Items.FindByText("good.htm").Selected = true;
                    }
                    else
                    {
                        ddlSend.SelectedValue = "0";
                    }
                    ValueBinder.BindLiteral(e.Item, "litOverall", percent.ToString("0.##") + "% excellent");
                }
                catch (Exception ex)
                {
                    ValueBinder.BindLiteral(e.Item, "litOverall", ex.Message);
                    return;
                }
            }
        }
Exemplo n.º 25
0
        protected void rptRoomClass_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            {
                RoomClass roomClass = (RoomClass)e.Item.DataItem;

                #region -- Header --

                //// Đối với header, thêm danh sách roomType thông thường
                //using (Repeater rpt = e.Item.FindControl("rptRoomTypeHeader") as Repeater)
                //{
                //    if (rpt != null)
                //    {
                //        rpt.DataSource = Module.RoomTypexGetAll();
                //        rpt.DataBind();
                //    }
                //}

                #endregion

                #region -- Item --

                #region RoomClass Id

                using (Label labelRoomClassId = e.Item.FindControl("labelRoomClassId") as Label)
                {
                    if (labelRoomClassId != null)
                    {
                        labelRoomClassId.Text = roomClass.Id.ToString();
                    }
                }

                #endregion

                ValueBinder.BindLabel(e.Item, "lblTrip", Trip.TripCode);
                if (Trip.NumberOfOptions > 1)
                {
                    ValueBinder.BindLiteral(e.Item, "litOption", Option);
                }
                ValueBinder.BindLiteral(e.Item, "litName", roomClass.Name);

                //Đối với từng dòng
                using (Repeater rpt = e.Item.FindControl("rptRoomTypeCell") as Repeater)
                {
                    if (rpt != null)
                    {
                        // Gán sự kiện ItemDataBound (vì control trong Repeater không tự nhận hàm này)
                        rpt.ItemDataBound += RptRoomTypeItemDataBound;

                        IList roomTypeList = AllRoomTypes;

                        _hasRoom = false;

                        rpt.DataSource = roomTypeList;
                        rpt.DataBind();

                        e.Item.Visible = _hasRoom;
                    }
                }

                #endregion
            }
        }
        protected void rptVouchers_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var value = (int)e.Item.DataItem;

            ValueBinder.BindLiteral(e.Item, "litCode", VoucherCodeEncryption.Encrypt(Convert.ToUInt32(value)));
        }
        protected void rptFeedback_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is AnswerGroup)
            {
                AnswerGroup group = (AnswerGroup)e.Item.DataItem;
                ValueBinder.BindLiteral(e.Item, "litDate", group.AnswerSheet.Date);
                //ValueBinder.BindLiteral(e.Item, "litCruise", group.AnswerSheet.Cruise.Name);
                ValueBinder.BindLiteral(e.Item, "litName", group.AnswerSheet.Name);
                ValueBinder.BindLiteral(e.Item, "litAddress", group.AnswerSheet.Address);
                ValueBinder.BindLiteral(e.Item, "litEmail", group.AnswerSheet.Email);
                ValueBinder.BindLiteral(e.Item, "litNote", group.Comment);
                ValueBinder.BindLiteral(e.Item, "litRoom", group.AnswerSheet.RoomNumber);
                int current = pagerFeedback.CurrentPageIndex;
                if (current < 0)
                {
                    current = 0;
                }
                ValueBinder.BindLiteral(e.Item, "litIndex", e.Item.ItemIndex + current * pagerFeedback.PageSize + 1);
                _currentGroup = group;

                Repeater rptOptions = (Repeater)e.Item.FindControl("rptOptions");
                rptOptions.DataSource = group.Group.Questions;
                rptOptions.DataBind();

                HtmlAnchor anchorFeedback = e.Item.FindControl("anchorFeedback") as HtmlAnchor;
                if (anchorFeedback != null)
                {
                    string url = string.Format("SurveyInput.aspx?NodeId={0}&SectionId={1}&sheetid={2}", Node.Id,
                                               Section.Id, group.AnswerSheet.Id);
                    anchorFeedback.Attributes.Add("onclick",
                                                  CMS.ServerControls.Popup.OpenPopupScript(url, "Survey input", 600, 800));
                }

                HtmlAnchor anchorEmail = e.Item.FindControl("anchorEmail") as HtmlAnchor;
                if (anchorEmail != null)
                {
                    string url = string.Format("FeedbackMail.aspx?NodeId={0}&SectionId={1}&sheetid={2}", Node.Id,
                                               Section.Id, group.AnswerSheet.Id);
                    anchorEmail.Attributes.Add("onclick",
                                               CMS.ServerControls.Popup.OpenPopupScript(url, "Survey input", 600, 800));
                }

                Literal trItem = (Literal)e.Item.FindControl("trItem");
                if (trItem != null)
                {
                    if (group.AnswerSheet.IsSent)
                    {
                        trItem.Text = @"<tr class='sent'>";
                    }
                }

                HyperLink hplBooking = e.Item.FindControl("hplBooking") as HyperLink;
                if (hplBooking != null)
                {
                    if (group.AnswerSheet.Booking != null)
                    {
                        hplBooking.Text        = string.Format(BookingFormat, group.AnswerSheet.Booking.Id);
                        hplBooking.NavigateUrl = string.Format("BookingView.aspx?NodeId={0}&SectionId={1}&bi={2}",
                                                               Node.Id, Section.Id, group.AnswerSheet.Booking.Id);
                        ValueBinder.BindLiteral(e.Item, "litTrip", group.AnswerSheet.Booking.Trip.TripCode);
                    }
                }

                HyperLink hplCruise = e.Item.FindControl("hplCruise") as HyperLink;
                if (hplCruise != null)
                {
                    hplCruise.Text        = group.AnswerSheet.Cruise.Name;
                    hplCruise.NavigateUrl = AddQuery("cruise", group.AnswerSheet.Cruise.Id.ToString());
                }

                HyperLink hplGuide = e.Item.FindControl("hplGuide") as HyperLink;
                if (hplGuide != null)
                {
                    hplGuide.Text        = group.AnswerSheet.Guide;
                    hplGuide.NavigateUrl = AddQuery("guide", HttpUtility.UrlEncode(group.AnswerSheet.Guide));
                }

                HyperLink hplDriver = e.Item.FindControl("hplDriver") as HyperLink;
                if (hplDriver != null)
                {
                    hplDriver.Text        = group.AnswerSheet.Driver;
                    hplDriver.NavigateUrl = AddQuery("driver", HttpUtility.UrlEncode(group.AnswerSheet.Guide));
                }
            }
        }
Exemplo n.º 28
0
        protected void rptBookingList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is Booking)
            {
                var booking = (Booking)e.Item.DataItem;

                Literal litTACode = e.Item.FindControl("litTACode") as Literal;
                if (litTACode != null)
                {
                    var            sailDate = Module.ExpenseGetByDate(booking.Trip, booking.StartDate);
                    ExpenseService driver   = null;
                    foreach (ExpenseService service in sailDate.Services)
                    {
                        if (service.Type.Name.ToUpper() == "TRANSPORT" && service.Group == booking.Group)
                        {
                            driver = service;
                        }
                    }

                    if (driver != null && driver.Supplier != null)
                    {
                        litTACode.Text = driver.Supplier.Name;
                    }
                }


                var hplCode = e.Item.FindControl("hplCode") as HyperLink;
                if (hplCode != null)
                {
                    hplCode.Text        = string.Format(BookingFormat, booking.Id);
                    hplCode.NavigateUrl = string.Format("BookingView.aspx?NodeId={0}&SectionId={1}&BookingId={2}",
                                                        Node.Id, Section.Id, booking.Id);
                }

                var hplCruise = e.Item.FindControl("hplCruise") as HyperLink;
                if (hplCruise != null)
                {
                    if (booking.Cruise != null)
                    {
                        hplCruise.Text        = booking.Cruise.Name;
                        hplCruise.NavigateUrl = string.Format("DriverCollects.aspx?NodeId={0}&SectionId={1}&cruiseid={2}", Node.Id,
                                                              Section.Id,
                                                              booking.Cruise.Id);
                    }
                }

                #region -- Others --

                Literal litDate = e.Item.FindControl("litDate") as Literal;
                if (litDate != null)
                {
                    litDate.Text = booking.StartDate.ToString("dd/MM/yyyy");
                }

                var hyperLink_Partner = e.Item.FindControl("hyperLink_Partner") as HyperLink;
                if (hyperLink_Partner != null)
                {
                    if (booking.Agency != null)
                    {
                        hyperLink_Partner.Text = booking.Agency.Name;
                        DateTime from;
                        DateTime to;
                        try
                        {
                            from = DateTime.ParseExact(txtFrom.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                            to   = DateTime.ParseExact(txtTo.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                            hyperLink_Partner.NavigateUrl =
                                string.Format(
                                    "DriverCollects.aspx?NodeId={0}&SectionId={1}&agencyid={2}&from={3}&to={4}", Node.Id,
                                    Section.Id, booking.Agency.Id, from.ToOADate(), to.ToOADate());
                        }
                        catch
                        {
                            hyperLink_Partner.NavigateUrl =
                                string.Format("DriverCollects.aspx?NodeId={0}&SectionId={1}&AgencyId={2}", Node.Id,
                                              Section.Id,
                                              booking.Agency.Id);
                        }
                    }
                    else
                    {
                        hyperLink_Partner.Text = SailsModule.NOAGENCY;
                    }
                }

                Literal litService = e.Item.FindControl("litService") as Literal;
                if (litService != null)
                {
                    litService.Text = booking.Trip.TripCode;
                }

                #endregion

                #region -- Number of pax --

                Label label_NoOfAdult = e.Item.FindControl("label_NoOfAdult") as Label;
                if (label_NoOfAdult != null)
                {
                    label_NoOfAdult.Text = booking.Adult.ToString();
                }

                Label label_NoOfChild = e.Item.FindControl("label_NoOfChild") as Label;
                if (label_NoOfChild != null)
                {
                    label_NoOfChild.Text = booking.Child.ToString();
                }

                Label label_NoOfBaby = e.Item.FindControl("label_NoOfBaby") as Label;
                if (label_NoOfBaby != null)
                {
                    label_NoOfBaby.Text = booking.Baby.ToString();
                }

                _adult += booking.Adult;
                _child += booking.Child;
                _baby  += booking.Baby;

                #endregion

                ValueBinder.BindLiteral(e.Item, "litDriverCollect", booking.DriverCollect);
                ValueBinder.BindLiteral(e.Item, "litDriverCollectVND", booking.DriverCollectVND.ToString("#,0.#"));

                #region -- Paid/Total --

                Label label_TotalPrice = e.Item.FindControl("label_TotalPrice") as Label;
                if (label_TotalPrice != null)
                {
                    if (booking.Value > 0)
                    {
                        label_TotalPrice.Text = booking.Value.ToString("#,###");
                    }
                    else
                    {
                        label_TotalPrice.Text = "0";
                    }
                }

                #endregion

                #region -- Editable --

                HtmlAnchor aPayment = e.Item.FindControl("aPayment") as HtmlAnchor;
                if (aPayment != null)
                {
                    string url = string.Format("BookingPayment.aspx?NodeId={0}&SectionId={1}&BookingId={2}&mode=driver", Node.Id,
                                               Section.Id, booking.Id);
                    aPayment.Attributes.Add("onclick",
                                            CMS.ServerControls.Popup.OpenPopupScript(url, "Payment", 300, 400));
                }

                Literal litPaid = e.Item.FindControl("litPaid") as Literal;
                if (litPaid != null)
                {
                    litPaid.Text = booking.DriverCollectedUSD.ToString("#,0.#");
                }

                Literal litPaidBase = e.Item.FindControl("litPaidBase") as Literal;
                if (litPaidBase != null)
                {
                    litPaidBase.Text = booking.DriverCollectedVND.ToString("#,0.#");
                }

                Literal litCurrentRate = e.Item.FindControl("litCurrentRate") as Literal;
                if (litCurrentRate != null)
                {
                    if (booking.CurrencyRate > 0)
                    {
                        litCurrentRate.Text = booking.CurrencyRate.ToString("#,0.#");
                    }
                    else
                    {
                        booking.CurrencyRate = GetCurrentRate();
                        litCurrentRate.Text  = booking.CurrencyRate.ToString("#,0.#");
                    }
                }

                Literal litReceivable = e.Item.FindControl("litReceivable") as Literal;
                if (litReceivable != null)
                {
                    litReceivable.Text = booking.DriverCollectReceivable.ToString("#,0.#");
                }
                _total      += booking.DriverCollect;
                _totalVND   += booking.DriverCollectVND;
                _paid       += booking.DriverCollectedUSD;
                _paidBase   += booking.DriverCollectedVND;
                _receivable += booking.DriverCollectReceivable;

                #endregion

                #region -- Tô màu --

                HtmlTableRow trItem = e.Item.FindControl("trItem") as HtmlTableRow;
                if (trItem != null)
                {
                    string color = string.Empty;
                    if (booking.DriverCollected)
                    {
                        color = SailsModule.GOOD;
                    }
                    else
                    {
                        color = SailsModule.WARNING;
                    }
                    if (!string.IsNullOrEmpty(color))
                    {
                        trItem.Attributes.Add("style", "background-color:" + color);
                    }
                }

                #endregion

                Literal litSaleInCharge = e.Item.FindControl("litSaleInCharge") as Literal;
                if (litSaleInCharge != null)
                {
                    if (booking.Agency != null && booking.Agency.Sale != null)
                    {
                        litSaleInCharge.Text = booking.Agency.Sale.UserName;
                    }
                }

                if (booking.PaidDate.HasValue)
                {
                    ValueBinder.BindLiteral(e.Item, "litPaidOn", booking.PaidDate.Value);
                }
            }
            else
            {
                if (e.Item.ItemType == ListItemType.Footer)
                {
                    #region -- get control --

                    Label   label_NoOfAdult     = (Label)e.Item.FindControl("label_NoOfAdult");
                    Label   label_NoOfChild     = (Label)e.Item.FindControl("label_NoOfChild");
                    Label   label_NoOfBaby      = (Label)e.Item.FindControl("label_NoOfBaby");
                    Label   label_TotalPrice    = (Label)e.Item.FindControl("label_TotalPrice");
                    Label   label_TotalPriceVND = (Label)e.Item.FindControl("label_TotalPriceVND");
                    Literal litPaid             = (Literal)e.Item.FindControl("litPaid");
                    Literal litPaidBase         = (Literal)e.Item.FindControl("litPaidBase");
                    Literal litReceivable       = (Literal)e.Item.FindControl("litReceivable");

                    #endregion

                    #region -- set value --

                    label_NoOfAdult.Text     = _adult.ToString();
                    label_NoOfChild.Text     = _child.ToString();
                    label_NoOfBaby.Text      = _baby.ToString();
                    label_TotalPrice.Text    = _total.ToString("#,###");
                    label_TotalPriceVND.Text = _totalVND.ToString("#,###");
                    if (_paid > 0)
                    {
                        litPaid.Text = _paid.ToString("#,###");
                    }
                    else
                    {
                        litPaid.Text = "0";
                    }

                    litPaidBase.Text = _paidBase.ToString("#,0.#");

                    if (_receivable > 0)
                    {
                        litReceivable.Text = _receivable.ToString("#,###");
                    }
                    else
                    {
                        litReceivable.Text = "0";
                    }

                    #endregion

                    HtmlAnchor aPayment = e.Item.FindControl("aPayment") as HtmlAnchor;
                    if (aPayment != null)
                    {
                        string url;
                        if (Request.QueryString["agencyid"] != null)
                        {
                            url =
                                string.Format(
                                    "BookingPayment.aspx?NodeId={0}&SectionId={1}&agencyid={4}&from={2}&to={3}",
                                    Node.Id, Section.Id, Request.QueryString["from"],
                                    Request.QueryString["to"], Request.QueryString["agencyid"]);
                        }
                        else if (Request.QueryString["agencyname"] != null)
                        {
                            url =
                                string.Format(
                                    "BookingPayment.aspx?NodeId={0}&SectionId={1}&agencyname={4}&from={2}&to={3}",
                                    Node.Id, Section.Id, Request.QueryString["from"],
                                    Request.QueryString["to"], Request.QueryString["agencyname"]);
                        }
                        else
                        {
                            url = string.Format("BookingPayment.aspx?NodeId={0}&SectionId={1}&from={2}&to={3}", Node.Id,
                                                Section.Id, Request.QueryString["from"],
                                                Request.QueryString["to"]);
                        }
                        aPayment.Attributes.Add("onclick",
                                                CMS.ServerControls.Popup.OpenPopupScript(url, "Payment", 300, 400));
                    }
                }
            }
        }
Exemplo n.º 29
0
        protected void rptBookings_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is Booking)
            {
                var booking = (Booking)e.Item.DataItem;
                if (booking.GuideCollectedRemain + booking.AgencyRemain == 0)
                {
                    e.Item.Visible = false;
                    return;
                }

                ValueBinder.BindLiteral(e.Item, "litGuideRemain", booking.GuideCollectedRemain);
                ValueBinder.BindLiteral(e.Item, "litPartnerRemain", booking.AgencyRemain);
                ValueBinder.BindLiteral(e.Item, "litService", booking.Trip.Name);

                var hplBookingCode = (HyperLink)e.Item.FindControl("hplBookingCode");
                if (hplBookingCode != null)
                {
                    hplBookingCode.Text        = Module.BookingCode(booking);
                    hplBookingCode.NavigateUrl = string.Format(
                        "BookingView.aspx?NodeId={0}&SectionId={1}&bookingid={2}", Node.Id, Section.Id, booking.Id);
                }

                var hplDate = (HyperLink)e.Item.FindControl("hplDate");
                hplDate.Text = booking.StartDate.ToString("dd/MM/yyyy");

                if (booking.Agency != null && booking.Agency.Sale != null)
                {
                    var hplSale = (HyperLink)e.Item.FindControl("hplSale");
                    hplSale.Text = booking.Agency.Sale.AllName;
                }

                if (booking.Agency != null)
                {
                    var hplPartner = (HyperLink)e.Item.FindControl("hplPartner");
                    hplPartner.Text = booking.Agency.Name;
                }

                var aPayment = e.Item.FindControl("aPayment") as HtmlAnchor;
                if (aPayment != null)
                {
                    string url = string.Format("BookingPayment.aspx?NodeId={0}&SectionId={1}&BookingId={2}", Node.Id,
                                               Section.Id, booking.Id);
                    aPayment.Attributes.Add("onclick",
                                            CMS.ServerControls.Popup.OpenPopupScript(url, "Payment", 600, 500));
                }

                if (UserIdentity.HasPermission(AccessLevel.Administrator))
                {
                    if (booking.GuideCollectedRemain != 0 && booking.GuideCollected && !booking.GuideConfirmed)
                    {
                        ValueBinder.ShowControl(e.Item, "lbtGuideConfirm");
                    }

                    if (booking.AgencyRemain != 0 && booking.IsPaid && !booking.AgencyConfirmed)
                    {
                        ValueBinder.ShowControl(e.Item, "lbtAgencyConfirm");
                    }

                    if (Math.Abs(booking.AgencyRemain) > 10 || Math.Abs(booking.GuideCollectedRemain) > 10)
                    {
                        var trRow = (HtmlTableRow)e.Item.FindControl("trRow");
                        trRow.Style.Add("background-color", "#FBFB00");
                    }

                    if (Math.Abs(booking.AgencyRemain) > 200 || Math.Abs(booking.GuideCollectedRemain) > 200)
                    {
                        var trRow = (HtmlTableRow)e.Item.FindControl("trRow");
                        trRow.Style.Add("background-color", "#FF7F7F");
                    }
                }
            }
        }
Exemplo n.º 30
0
        protected void rptBookingList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Header)
            {
                RepeaterOrder.FILE_NAME = "OrderReport.aspx";
                RepeaterOrder.SetOrderLink(e, "Agency", Request.QueryString);
                RepeaterOrder.SetOrderLink(e, "Trip", Request.QueryString);
                RepeaterOrder.SetOrderLink(e, "StartDate", Request.QueryString);
            }

            if (e.Item.DataItem is Booking)
            {
                Booking booking = (Booking)e.Item.DataItem;

                bool isDisabled = false;

                var hplCode = e.Item.FindControl("hplCode") as HyperLink;
                if (hplCode != null)
                {
                    hplCode.Text        = string.Format(BookingFormat, booking.Id);
                    hplCode.NavigateUrl = string.Format("BookingView.aspx?NodeId={0}&SectionId={1}&bi={2}",
                                                        Node.Id, Section.Id, booking.Id);
                }

                #region -- Date --

                Label labelDate = e.Item.FindControl("labelDate") as Label;
                if (labelDate != null)
                {
                    labelDate.Text = booking.StartDate.ToString("dd/MM/yyyy");
                }

                #endregion

                #region -- Trip --

                Label labelTrip = e.Item.FindControl("labelTrip") as Label;
                if (labelTrip != null)
                {
                    labelTrip.Text = booking.Trip.Name;
                    if (booking.Trip.NumberOfOptions > 1)
                    {
                        labelTrip.Text += string.Format("({0})", booking.TripOption);
                    }
                }

                #endregion

                #region -- Partner --

                Label labelPartner = e.Item.FindControl("labelPartner") as Label;
                if (labelPartner != null)
                {
                    if (booking.Agency != null)
                    {
                        labelPartner.Text = booking.Agency.Name;
                    }
                    else
                    {
                        labelPartner.Text = SailsModule.NOAGENCY;
                    }
                }

                if (booking.Agency != null && booking.Agency.Sale != null)
                {
                    ValueBinder.BindLiteral(e.Item, "litSale", booking.Agency.Sale.AllName);
                }

                #endregion

                #region -- Rooms --

                Label labelRoom = e.Item.FindControl("labelRoom") as Label;
                if (labelRoom != null)
                {
                    try
                    {
                        Dictionary <string, int> rooms        = new Dictionary <string, int>();
                        Dictionary <string, int> roomAvaiable = new Dictionary <string, int>();
                        // Đối với mỗi booking đã đặt
                        foreach (BookingRoom room in booking.BookingRooms)
                        {
                            // Lấy về loại phòng
                            string key = room.RoomClass.Name + " " + room.RoomType.Name;
                            if (room.RoomType.IsShared)
                            {
                                key += " spaces";
                            }

                            if (rooms.ContainsKey(key))
                            {
                                // Nếu đã có trong từ điển thì cộng thêm
                                if (room.RoomType.IsShared)
                                {
                                    rooms[key] += 1;
                                }
                                else
                                {
                                    rooms[key] += room.VirtualAdult;
                                }
                            }
                            else
                            {
                                // Nếu chưa có trong từ điển thì thêm vào
                                if (room.RoomType.IsShared)
                                {
                                    rooms.Add(key, 1);
                                }
                                else
                                {
                                    rooms.Add(key, room.VirtualAdult);
                                }
                            }

                            // Nếu thông tin về loại phòng này chưa có trong từ điển
                            if (!roomAvaiable.ContainsKey(key))
                            {
                                // Hoàn toàn phụ thuộc vào số chỗ trống
                                roomAvaiable.Add(key, Module.RoomCount(room.RoomClass, room.RoomType, booking.Cruise, booking.StartDate, booking.Trip.NumberOfDay, booking));
                            }
                        }

                        //TODO: Recheck
                        // Kiểm tra với từng loại phòng, nếu có 1 loại ko đủ chỗ trống thì loại
                        foreach (KeyValuePair <string, int> entry in rooms)
                        {
                            labelRoom.Text += entry.Value + @" " + entry.Key + @"<br/>";

                            //if (Convert.ToInt32(entry.Value) > Convert.ToInt32(roomAvaiable[entry.Key]))
                            //{
                            //    isDisabled = true;
                            //}
                        }
                    }
                    catch (Exception ex)
                    {
                        ShowError(ex.Message);
                    }
                }

                #endregion

                var labelNumberOfPax = e.Item.FindControl("labelNumberOfPax") as Label;
                if (labelNumberOfPax != null)
                {
                    labelNumberOfPax.Text = string.Format(Resources.formatCustomerCount, booking.Adult, booking.Child,
                                                          booking.Baby);
                }

                var lbtApprove = e.Item.FindControl("lbtApprove") as LinkButton;
                if (lbtApprove != null)
                {
                    // Lấy lại giá trị đánh dấu số phòng có đủ hay không
                    if (!isDisabled)
                    {
                        Control chkNofity = e.Item.FindControl("chkNofity");
                        string  popupurl  = string.Format("SendEmail.aspx?NodeId={0}&SectionId={1}&BookId={2}&status=1",
                                                          Node.Id, Section.Id, booking.Id);
                        lbtApprove.OnClientClick = "if (document.getElementById('" + chkNofity.ClientID + "').checked == 1) PopupCenter('" + popupurl + "','Send email',800,600)";
                    }
                    else
                    {
                        lbtApprove.Enabled = false;
                        lbtApprove.Text    = Resources.textStatusNotAvaiable;
                        lbtApprove.Attributes.Add("style", "color:" + SailsModule.IMPORTANT);
                    }
                }

                LinkButton lbtCancel = e.Item.FindControl("lbtCancel") as LinkButton;
                if (lbtCancel != null)
                {
                    Control chkNofity = e.Item.FindControl("chkNofity");
                    string  popupurl  = string.Format("SendEmail.aspx?NodeId={0}&SectionId={1}&BookId={2}&status=2", Node.Id, Section.Id, booking.Id);
                    lbtCancel.OnClientClick = "if (document.getElementById('" + chkNofity.ClientID + "').checked == 1) PopupCenter('" + popupurl + "','Send email',800,600)";
                }

                if (!string.IsNullOrEmpty(booking.Agency.Phone))
                {
                    ValueBinder.BindLiteral(e.Item, "litPhone", "(" + booking.Agency.Phone + ")");
                }
                if (booking.Deadline.HasValue)
                {
                    ValueBinder.BindLiteral(e.Item, "litPendingUntil", booking.Deadline.Value.ToString("HH:mm dd/MM/yyyy"));
                }
            }
        }