예제 #1
0
        FreeBunk loadFreeBunk(Bunk bunk, DbDataReader reader)
        {
            FreeBunk result = null;
            var      id     = reader.GetGuid(1);

            if (null == bunk || id != bunk.Id)
            {
                result = new FreeBunk(reader.GetGuid(1))
                {
                    AirlineCode     = reader.IsDBNull(2) ? string.Empty : reader.GetString(2),
                    FlightBeginDate = reader.GetDateTime(3),
                    ETDZDate        = reader.GetDateTime(5),
                    Code            = reader.GetString(6),
                    Valid           = reader.GetBoolean(9),
                    Description     = reader.IsDBNull(12) ? string.Empty : reader.GetString(12),
                    ModifyTime      = reader.GetDateTime(13)
                };
                if (!reader.IsDBNull(4))
                {
                    result.FlightEndDate = reader.GetDateTime(4);
                }
            }
            else
            {
                result = bunk as FreeBunk;
            }
            return(result);
        }
예제 #2
0
 private void Refresh()
 {
     ChinaPay.B3B.Service.Foundation.Domain.Bunk bunk = FoundationService.QueryBunkNew(new Guid(Request.QueryString["Id"].ToString()));
     ddlAirline.SelectedValue = bunk.AirlineCode.Value;
     txtHBStartDate.Text      = bunk.FlightBeginDate.ToString("yyyy-MM-dd");
     if (bunk.FlightEndDate != null)
     {
         txtHBStopDate.Text = Convert.ToDateTime(bunk.FlightEndDate).ToString("yyyy-MM-dd");
     }
     txtCpStartDate.Text       = bunk.ETDZDate.ToString("yyyy-MM-dd");
     txtRefundRegulation.Text  = bunk.RefundRegulation;
     txtChangeRegulation.Text  = bunk.ChangeRegulation;
     txtEndorseRegulation.Text = bunk.EndorseRegulation;
     txtRemarks.Text           = bunk.Remarks;
     radseatlist.SelectedIndex = bunk.Valid == true ? 0 : 1;
     txtCwCode.Text            = bunk.Code.Value;
     //舱位类型
     if (bunk is EconomicBunk)//经济舱位
     {
         radiolist.SelectedValue = ((int)BunkType.Economic).ToString();
         EconomicBunk economicBunk = bunk as EconomicBunk;
         this.ddlDepartCity.SelectedValue = economicBunk.DepartureCode.Value;
         this.ddlArriveCity.SelectedValue = economicBunk.ArrivalCode.Value;
         this.txtDiscount.Text            = (economicBunk.Discount * 100).ToString();
         this.txtCwCode.Text = economicBunk.Code.Value;
         if (economicBunk.Extended.Count() > 0)
         {
             UpdateData(economicBunk.Extended);
         }
     }
     else if (bunk is FirstBusinessBunk)
     {
         radiolist.SelectedValue = ((int)BunkType.FirstOrBusiness).ToString();
         FirstBusinessBunk firstBusinessBunk = bunk as FirstBusinessBunk;
         this.ddlDepartCity.SelectedValue = firstBusinessBunk.DepartureCode.Value;
         this.ddlArriveCity.SelectedValue = firstBusinessBunk.ArrivalCode.Value;
         setDropDownListSelectItemByText(this.ddltdType, firstBusinessBunk.Description);
         this.txtCwCode.Text   = firstBusinessBunk.Code.Value;
         this.txtDiscount.Text = (firstBusinessBunk.Discount * 100).ToString();
         if (firstBusinessBunk.Extended.Count() > 0)
         {
             UpdateData(firstBusinessBunk.Extended);
         }
     }
     else if (bunk is PromotionBunk)
     {
         radiolist.SelectedValue = ((int)BunkType.Promotion).ToString();
         PromotionBunk promotionBunk = bunk as PromotionBunk;
         setDropDownListSelectItemByText(this.ddlTJType, promotionBunk.Description);
         this.txtCwCode.Text = promotionBunk.Code.Value;
         if (promotionBunk.Extended.Count() > 0)
         {
             int           index = 0;
             StringBuilder str   = new StringBuilder();
             foreach (string cal in promotionBunk.Extended)
             {
                 str.Append("(tr class='tr')(th height='23')扩展:(/th)(td colspan='3')(input type='text' class='input2' id='txtCodeExtend" + index + "'  value='" + cal + "' /)(/tr)");
                 index++;
             }
             hiddindex.Value = index.ToString();
             hiddtr.Value    = str.ToString();
         }
     }
     else if (bunk is ProductionBunk)
     {
         radiolist.SelectedValue = ((int)BunkType.Production).ToString();
     }
     else if (bunk is TransferBunk)
     {
         radiolist.SelectedValue = ((int)BunkType.Transfer).ToString();
     }
     else if (bunk is FreeBunk)
     {
         radiolist.SelectedValue = ((int)BunkType.Free).ToString();
         FreeBunk promotionBunk = bunk as FreeBunk;
         setDropDownListSelectItemByText(this.dropMpType, promotionBunk.Description);
     }
     else if (bunk is TeamBunk)
     {
         radiolist.SelectedValue = ((int)BunkType.Team).ToString();
     }
     ddlAirline.Enabled    = false;
     ddlDepartCity.Enabled = false;
     ddlArriveCity.Enabled = false;
     txtCwCode.Enabled     = false;
     radiolist.Enabled     = false;
 }
예제 #3
0
파일: Bunk.aspx.cs 프로젝트: 842549829/Pool
        protected void gvDiscount_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "opdate")
            {
                string code = e.CommandArgument.ToString();
                ChinaPay.B3B.Service.Foundation.Domain.Bunk bunk = FoundationService.QueryBunkNew(new Guid(code));
                if (bunk == null)
                {
                    return;
                }
                BunkView bunkView = null;
                switch (bunk.Type)
                {
                case BunkType.Economic:
                    EconomicBunk economicBunk     = bunk as EconomicBunk;
                    var          economicBunkView = new EconomicBunkView()
                    {
                        Arrival   = economicBunk.ArrivalCode.Value,
                        Departure = economicBunk.DepartureCode.Value,
                        Discount  = economicBunk.Discount
                    };
                    foreach (var item in economicBunk.Extended)
                    {
                        economicBunkView.AddExtended(new ExtendedWithDiscountBunkView {
                            Code = item.Code.Value, Discount = item.Discount
                        });
                    }
                    bunkView = economicBunkView;
                    break;

                case BunkType.FirstOrBusiness:
                    FirstBusinessBunk firstBusinessBunk = bunk as FirstBusinessBunk;
                    var firstBusinessBunkView           = new FirstBusinessBunkView()
                    {
                        Arrival     = firstBusinessBunk.ArrivalCode.Value,
                        Departure   = firstBusinessBunk.DepartureCode.Value,
                        Description = firstBusinessBunk.Description,
                        Discount    = firstBusinessBunk.Discount
                    };
                    foreach (var item in firstBusinessBunk.Extended)
                    {
                        firstBusinessBunkView.AddExtended(new ExtendedWithDiscountBunkView {
                            Code = item.Code.Value, Discount = item.Discount
                        });
                    }
                    bunkView = firstBusinessBunkView;
                    break;

                case BunkType.Promotion:
                    PromotionBunk promotionBunk     = bunk as PromotionBunk;
                    var           promotionBunkView = new PromotionBunkView()
                    {
                        Description = promotionBunk.Description
                    };
                    foreach (var item in promotionBunk.Extended)
                    {
                        promotionBunkView.AddExtended(item);
                    }
                    bunkView = promotionBunkView;
                    break;

                case BunkType.Production:
                    bunkView = new ProductionBunkView();
                    break;

                case BunkType.Transfer:
                    bunkView = new TransferBunkView();
                    break;

                case BunkType.Free:
                    FreeBunk freeBunk = bunk as FreeBunk;
                    bunkView = new FreeBunkView()
                    {
                        Description = freeBunk.Description
                    };
                    break;

                case BunkType.Team:
                    bunkView = new TeamBunkView();
                    break;

                default:
                    throw new Exception("舱位不存在");
                }
                bunkView.Code              = bunk.Code.Value;
                bunkView.RefundRegulation  = bunk.RefundRegulation;
                bunkView.ChangeRegulation  = bunk.ChangeRegulation;
                bunkView.EndorseRegulation = bunk.EndorseRegulation;
                bunkView.VoyageType        = bunk.VoyageType;
                bunkView.PassengerType     = bunk.PassengerType;
                bunkView.TravelType        = bunk.TravelType;
                bunkView.Remarks           = bunk.Remarks;
                bunkView.FlightBeginDate   = bunk.FlightBeginDate;
                bunkView.FlightEndDate     = bunk.FlightEndDate;
                bunkView.ETDZDate          = bunk.ETDZDate;
                bunkView.Airline           = bunk.AirlineCode.Value;
                bunkView.Valid             = !bunk.Valid;
                try
                {
                    FoundationService.UpdateBunk(new Guid(code), bunkView, CurrentUser.UserName);
                    if (bunk.Valid)
                    {
                        RegisterScript("alert('禁用成功!'); window.location.href='Bunk.aspx?Search=Back';");
                    }
                    else
                    {
                        RegisterScript("alert('启用成功!'); window.location.href='Bunk.aspx?Search=Back';");
                    }
                }
                catch (Exception ex)
                {
                    ShowExceptionMessage(ex, bunk.Valid ? "禁用" : "启用");
                    return;
                }
                refresh();
            }
        }