Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }