Exemplo n.º 1
0
        protected void btnAddRoomType_OnClick(object sender, EventArgs e)
        {
            IList data = new List <QGroupRomPrice>();

            foreach (RepeaterItem item in rptRoomPrice.Items)
            {
                var         roomPrice      = new QGroupRomPrice();
                HiddenField hidRoomPriceId = item.FindControl("hidRoomPriceId") as HiddenField;

                TextBox  txtRoomType       = item.FindControl("txtRoomType") as TextBox;
                TextBox  txtPriceDoubleUsd = item.FindControl("txtPriceDoubleUsd") as TextBox;
                TextBox  txtPriceDoubleVnd = item.FindControl("txtPriceDoubleVnd") as TextBox;
                TextBox  txtPriceTwinUsd   = item.FindControl("txtPriceTwinUsd") as TextBox;
                TextBox  txtPriceTwinVnd   = item.FindControl("txtPriceTwinVnd") as TextBox;
                TextBox  txtPriceExtraUsd  = item.FindControl("txtPriceExtraUsd") as TextBox;
                TextBox  txtPriceExtraVnd  = item.FindControl("txtPriceExtraVnd") as TextBox;
                TextBox  txtPriceChildUsd  = item.FindControl("txtPriceChildUsd") as TextBox;
                TextBox  txtPriceChildVnd  = item.FindControl("txtPriceChildVnd") as TextBox;
                CheckBox checkIsDelete     = item.FindControl("checkIsDelete") as CheckBox;


                if (!string.IsNullOrEmpty(hidRoomPriceId.Value) && hidRoomPriceId.Value != "0")
                {
                    roomPrice.Id = Convert.ToInt32(hidRoomPriceId.Value);
                }
                if (!string.IsNullOrEmpty(txtRoomType.Text))
                {
                    roomPrice.RoomType = txtRoomType.Text;
                }
                if (!string.IsNullOrEmpty(txtPriceDoubleUsd.Text))
                {
                    roomPrice.PriceDoubleUsd = Convert.ToDecimal(txtPriceDoubleUsd.Text);
                }
                if (!string.IsNullOrEmpty(txtPriceDoubleVnd.Text))
                {
                    roomPrice.PriceDoubleVnd = Convert.ToDecimal(txtPriceDoubleVnd.Text);
                }

                if (!string.IsNullOrEmpty(txtPriceTwinUsd.Text))
                {
                    roomPrice.PriceTwinUsd = Convert.ToDecimal(txtPriceTwinUsd.Text);
                }
                if (!string.IsNullOrEmpty(txtPriceTwinVnd.Text))
                {
                    roomPrice.PriceTwinVnd = Convert.ToDecimal(txtPriceTwinVnd.Text);
                }

                if (!string.IsNullOrEmpty(txtPriceExtraUsd.Text))
                {
                    roomPrice.PriceExtraUsd = Convert.ToDecimal(txtPriceExtraUsd.Text);
                }
                if (!string.IsNullOrEmpty(txtPriceExtraVnd.Text))
                {
                    roomPrice.PriceExtraVnd = Convert.ToDecimal(txtPriceExtraVnd.Text);
                }

                if (!string.IsNullOrEmpty(txtPriceChildUsd.Text))
                {
                    roomPrice.PriceChildUsd = Convert.ToDecimal(txtPriceChildUsd.Text);
                }
                if (!string.IsNullOrEmpty(txtPriceChildVnd.Text))
                {
                    roomPrice.PriceChildVnd = Convert.ToDecimal(txtPriceChildVnd.Text);
                }

                roomPrice.IsDeleted = checkIsDelete.Checked;
                data.Add(roomPrice);
            }

            data.Add(new QGroupRomPrice());
            rptRoomPrice.DataSource = data;
            rptRoomPrice.DataBind();
        }
Exemplo n.º 2
0
        public void SaveQuotationPriceConfig(SailsModule module, string agentLvCode, int trip, int groupId, QQuotation quotation)
        {
            QCruiseGroup group = module.GetById <QCruiseGroup>(groupId);

            // save room price
            foreach (RepeaterItem item in rptRoomPrice.Items)
            {
                var         roomPrice         = new QGroupRomPrice();
                HiddenField hidRoomPriceId    = item.FindControl("hidRoomPriceId") as HiddenField;
                TextBox     txtRoomType       = item.FindControl("txtRoomType") as TextBox;
                TextBox     txtPriceDoubleUsd = item.FindControl("txtPriceDoubleUsd") as TextBox;
                TextBox     txtPriceDoubleVnd = item.FindControl("txtPriceDoubleVnd") as TextBox;
                TextBox     txtPriceTwinUsd   = item.FindControl("txtPriceTwinUsd") as TextBox;
                TextBox     txtPriceTwinVnd   = item.FindControl("txtPriceTwinVnd") as TextBox;
                TextBox     txtPriceExtraUsd  = item.FindControl("txtPriceExtraUsd") as TextBox;
                TextBox     txtPriceExtraVnd  = item.FindControl("txtPriceExtraVnd") as TextBox;
                TextBox     txtPriceChildUsd  = item.FindControl("txtPriceChildUsd") as TextBox;
                TextBox     txtPriceChildVnd  = item.FindControl("txtPriceChildVnd") as TextBox;
                CheckBox    checkIsDelete     = item.FindControl("checkIsDelete") as CheckBox;


                if (!string.IsNullOrEmpty(hidRoomPriceId.Value) && hidRoomPriceId.Value != "0")
                {
                    roomPrice = module.GetById <QGroupRomPrice>(Convert.ToInt32(hidRoomPriceId.Value));
                }
                if (!string.IsNullOrEmpty(txtRoomType.Text))
                {
                    roomPrice.RoomType = txtRoomType.Text;
                }
                if (!string.IsNullOrEmpty(txtPriceDoubleUsd.Text))
                {
                    roomPrice.PriceDoubleUsd = Convert.ToDecimal(txtPriceDoubleUsd.Text);
                }
                if (!string.IsNullOrEmpty(txtPriceDoubleVnd.Text))
                {
                    roomPrice.PriceDoubleVnd = Convert.ToDecimal(txtPriceDoubleVnd.Text);
                }
                if (!string.IsNullOrEmpty(txtPriceTwinUsd.Text))
                {
                    roomPrice.PriceTwinUsd = Convert.ToDecimal(txtPriceTwinUsd.Text);
                }
                if (!string.IsNullOrEmpty(txtPriceTwinVnd.Text))
                {
                    roomPrice.PriceTwinVnd = Convert.ToDecimal(txtPriceTwinVnd.Text);
                }

                if (!string.IsNullOrEmpty(txtPriceExtraUsd.Text))
                {
                    roomPrice.PriceExtraUsd = Convert.ToDecimal(txtPriceExtraUsd.Text);
                }
                if (!string.IsNullOrEmpty(txtPriceExtraVnd.Text))
                {
                    roomPrice.PriceExtraVnd = Convert.ToDecimal(txtPriceExtraVnd.Text);
                }
                if (!string.IsNullOrEmpty(txtPriceChildUsd.Text))
                {
                    roomPrice.PriceChildUsd = Convert.ToDecimal(txtPriceChildUsd.Text);
                }
                if (!string.IsNullOrEmpty(txtPriceChildVnd.Text))
                {
                    roomPrice.PriceChildVnd = Convert.ToDecimal(txtPriceChildVnd.Text);
                }
                roomPrice.GroupCruise    = group;
                roomPrice.AgentLevelCode = agentLvCode;
                roomPrice.QQuotation     = quotation;
                roomPrice.Trip           = trip;
                if (checkIsDelete.Checked)
                {
                    module.Delete(roomPrice);
                }
                else
                {
                    module.SaveOrUpdate(roomPrice);
                }
            }
            //save charter range

            foreach (RepeaterItem cruiseItem in rptCruise.Items)
            {
                var hidCruise   = cruiseItem.FindControl("hidCruise") as HiddenField;
                var cruiseprice = cruiseItem.FindControl("cruiseprice") as CruiseCharterConfigPrice;
                if (cruiseprice != null)
                {
                    if (hidCruise != null && !string.IsNullOrWhiteSpace(hidCruise.Value))
                    {
                        var cruise = module.GetById <Cruise>(Convert.ToInt32(hidCruise.Value));
                        cruiseprice.SaveDataConfig(module, cruise, group, agentLvCode, trip, quotation);
                    }
                }
            }
        }