예제 #1
0
        public void SaveDataConfig(SailsModule module, Cruise cruise, QCruiseGroup group, string agentLvCode, int trip, QQuotation qQuotation)
        {
            litCruiseName.Text = cruise.Name;
            _module            = module;
            _qQuotation        = qQuotation;
            _trip        = trip;
            _agentLvCode = agentLvCode;
            foreach (RepeaterItem item in rptCharterRanger.Items)
            {
                var         charterPrice      = new QCharterPrice();
                HiddenField hidCharterPriceId = item.FindControl("hidCharterPriceId") as HiddenField;

                TextBox  txtValidFrom  = item.FindControl("txtValidFrom") as TextBox;
                TextBox  txtValidTo    = item.FindControl("txtValidTo") as TextBox;
                TextBox  txtPriceUSD   = item.FindControl("txtPriceUSD") as TextBox;
                TextBox  txtPriceVND   = item.FindControl("txtPriceVND") as TextBox;
                CheckBox checkIsDelete = item.FindControl("checkIsDelete") as CheckBox;


                if (hidCharterPriceId != null && (!string.IsNullOrEmpty(hidCharterPriceId.Value) && hidCharterPriceId.Value != "0"))
                {
                    charterPrice = _module.GetById <QCharterPrice>(Convert.ToInt32(hidCharterPriceId.Value));
                }
                if (txtValidFrom != null && !string.IsNullOrEmpty(txtValidFrom.Text))
                {
                    charterPrice.Validfrom = Convert.ToInt32(txtValidFrom.Text);
                }
                if (txtValidTo != null && !string.IsNullOrEmpty(txtValidTo.Text))
                {
                    charterPrice.Validto = Convert.ToInt32(txtValidTo.Text);
                }

                if (txtPriceUSD != null && !string.IsNullOrEmpty(txtPriceUSD.Text))
                {
                    charterPrice.Priceusd = Convert.ToDecimal(txtPriceUSD.Text);
                }
                if (txtPriceVND != null && !string.IsNullOrEmpty(txtPriceVND.Text))
                {
                    charterPrice.Pricevnd = Convert.ToDecimal(txtPriceVND.Text);
                }
                charterPrice.QQuotation     = qQuotation;
                charterPrice.Trip           = trip;
                charterPrice.AgentLevelCode = agentLvCode;
                charterPrice.Cruise         = cruise;
                charterPrice.GroupCruise    = group;
                if (checkIsDelete.Checked)
                {
                    module.Delete(charterPrice);
                }
                else
                {
                    module.SaveOrUpdate(charterPrice);
                }
            }
        }
예제 #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);
                    }
                }
            }
        }