示例#1
0
        internal static AirCraft GetAirCraft(Guid id, AirCraftView airCraftView)
        {
            var airCraft = GetAirCraft(airCraftView);

            airCraft.Id = id;
            return(airCraft);
        }
示例#2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Request.QueryString["action"] != null)
     {
         AirCraftView airCraftView = new AirCraftView()
         {
             Code         = this.txtPlaneTypeCode.Text.Trim(),
             Name         = this.txtPlaneTypeName.Text.Trim(),
             AirportFee   = Convert.ToDecimal(this.txtAirportPrice.Text.Trim()),
             Manufacturer = this.txtMake.Text.Trim(),
             Description  = this.ttDescription.InnerText.Trim(),
             Valid        = this.ddlStatus.SelectedValue == "T" ? true : false
         };
         if (Request.QueryString["action"].ToString() == "add")
         {
             try
             {
                 FoundationService.AddAirCraft(airCraftView, CurrentUser.UserName);
                 RegisterScript("alert('添加成功!'); window.location.href='PlaneType.aspx'");
             } catch (Exception ex) {
                 ShowExceptionMessage(ex, "添加");
             }
         }
         else
         {
             try
             {
                 FoundationService.UpdateAirCraft(new Guid(Request.QueryString["Id"].ToString()), airCraftView, CurrentUser.UserName);
                 RegisterScript("alert('修改成功!'); window.location.href='PlaneType.aspx?Search=Back'");
             } catch (Exception ex) {
                 ShowExceptionMessage(ex, "修改");
             }
         }
     }
 }
示例#3
0
        public static void AddAirCraft(AirCraftView airCraftView, string account)
        {
            var airCraft = AirCraft.GetAirCraft(airCraftView);

            if (QueryAirCraft(airCraft.Code) != null)
            {
                throw new ChinaPay.Core.Exception.KeyRepeatedException("机型[" + airCraft.Code.Value + "]已存在");
            }
            AirCraftCollection.Instance.Add(airCraft.Id, airCraft);
            saveAddLog("机型", airCraft.ToString(), airCraft.Id.ToString(), account);
        }
示例#4
0
 internal static AirCraft GetAirCraft(AirCraftView airCraftView)
 {
     if (null == airCraftView)
     {
         throw new ArgumentNullException("airCraftView");
     }
     airCraftView.Validate();
     return(new AirCraft()
     {
         Code = ChinaPay.Utility.StringUtility.Trim(airCraftView.Code),
         Name = ChinaPay.Utility.StringUtility.Trim(airCraftView.Name),
         AirportFee = airCraftView.AirportFee,
         Manufacturer = ChinaPay.Utility.StringUtility.Trim(airCraftView.Manufacturer),
         Description = ChinaPay.Utility.StringUtility.Trim(airCraftView.Description),
         Valid = airCraftView.Valid
     });
 }
示例#5
0
        public static void UpdateAirCraft(Guid id, AirCraftView airCraftView, string account)
        {
            var airCraft         = AirCraft.GetAirCraft(id, airCraftView);
            var originalAirCraft = QueryAirCraft(id);

            if (null == originalAirCraft)
            {
                throw new ChinaPay.Core.CustomException("原机型不存在");
            }
            var sameCodeAirCraft = QueryAirCraft(airCraft.Code);

            if (sameCodeAirCraft != null && sameCodeAirCraft.Id != id)
            {
                throw new ChinaPay.Core.Exception.KeyRepeatedException("机型[" + airCraft.Code.Value + "]已存在");
            }
            var originalContent = originalAirCraft.ToString();

            AirCraftCollection.Instance.Update(airCraft.Id, airCraft);
            saveUpdateLog("机型", originalContent, airCraft.ToString(), airCraft.Id.ToString(), account);
        }
示例#6
0
 protected void gvPlaneType_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "opdate")
     {
         string code = e.CommandArgument.ToString();
         ChinaPay.B3B.Service.Foundation.Domain.AirCraft air = FoundationService.QueryAirCraft(new Guid(code));
         if (air == null)
         {
             return;
         }
         AirCraftView airCraftView = new AirCraftView()
         {
             Code         = air.Code.Value,
             AirportFee   = air.AirportFee,
             Description  = air.Description,
             Manufacturer = air.Manufacturer,
             Name         = air.Name,
             Valid        = air.Valid == true ? false : true
         };
         try
         {
             FoundationService.UpdateAirCraft(new Guid(code), airCraftView, CurrentUser.UserName);
             if (air.Valid)
             {
                 RegisterScript("alert('禁用成功!'); window.location.href='PlaneType.aspx?Search=Back';");
             }
             else
             {
                 RegisterScript("alert('启用成功!'); window.location.href='PlaneType.aspx?Search=Back';");
             }
         } catch (Exception ex) {
             ShowExceptionMessage(ex, air.Valid ? "禁用" : "启用");
             return;
         }
         refresh();
     }
 }