Exemple #1
0
 public ConnectionArgs(Property property, bool newState, ChangeReasons changeReason, string message)
 {
     this.property     = property;
     this.newState     = newState;
     this.changeReason = changeReason;
     this.message      = message;
 }
        public static void Set(Property property, bool value, ChangeReasons changeReason, string message = null)
        {
            switch (property)
            {
            case Property.alive:
                alive = value;
                aliveChanged.Invoke(null, new ConnectionArgs(Property.alive, value, changeReason, message));
                break;

            case Property.error:
                error = value;
                errorChanged.Invoke(null, new ConnectionArgs(Property.error, value, changeReason, message));
                break;

            case Property.ring:
                ring = value;
                ringChanged.Invoke(null, new ConnectionArgs(Property.ring, value, changeReason, message));
                if (!value)
                {
                    Set(Property.alive, true, ChangeReasons.ringOff);
                }
                break;

            default:
                break;
            }
        }
Exemple #3
0
        private RequestMode _currentMode = RequestMode.BounceOrder;//当前申请模式

        #endregion

        #region 构造函数

        /// <summary>
        /// Initializes a new instance of the <see cref="ReissueViewModel"/> class.
        /// </summary>
        public ReissueViewModel()
        {
            AnnulReasons.Add("我方已经作废行程单/未创建行程单,并且取消位置,申请卖家废票!");
            AnnulReasons.Add("一个编码贴有多个票号,申请卖家废票!");

            ChangeReasons.Add("乘客需要改签升舱。");
            ChangeReasons.Add("同等舱位更改时间");
            ChangeReasons.Add("航班延误,机场关闭,申请免费改签。");

            ModifyReasons.Add("修改乘机人证件号");
            ModifyReasons.Add("修改乘机人联系方式");
            ModifyReasons.Add("时限项修改为票号(仅用于B2B客票操作时提交)");
            ModifyReasons.Add("申请票号挂起");
            ModifyReasons.Add("申请票号解挂");

            _allInsextypes.Add(new KeyValuePair <EnumSexType?, string>(EnumSexType.Male, EnumHelper.GetDescription(EnumSexType.Male)));
            _allInsextypes.Add(new KeyValuePair <EnumSexType?, string>(EnumSexType.Female, EnumHelper.GetDescription(EnumSexType.Female)));
            _allInsextypes.Add(new KeyValuePair <EnumSexType?, string>(EnumSexType.UnKnown, EnumHelper.GetDescription(EnumSexType.UnKnown)));

            BabyInformationItemsItems = new ObservableCollection <BabyModel>();

            IsVoluntary       = true;
            IsSameSpaceChange = true;
        }
Exemple #4
0
        /// <summary>
        /// Method for tracking related stories stat. units
        /// </summary>
        /// <param name="unit">Stat. unit</param>
        /// <param name="hUnit">History stat. units</param>
        /// <param name="userId">Usser Id</param>
        /// <param name="changeReason">Reason for change</param>
        /// <param name="comment">Comment</param>
        /// <param name="changeDateTime">Change Date</param>
        /// <param name="unitsHistoryHolder">Keeper of the history stat. units</param>
        public void TrackRelatedUnitsHistory <TUnit>(
            TUnit unit,
            TUnit hUnit,
            string userId,
            ChangeReasons changeReason,
            string comment,
            DateTime changeDateTime,
            UnitsHistoryHolder unitsHistoryHolder)
            where TUnit : class, IStatisticalUnit, new()
        {
            switch (unit.GetType().Name)
            {
            case nameof(LocalUnit):
            {
                var localUnit = unit as LocalUnit;

                if (localUnit?.LegalUnitId != unitsHistoryHolder.HistoryUnits.legalUnitId)
                {
                    void PostAction(IStatisticalUnit historyUnit, IStatisticalUnit editedUnit)
                    {
                        var legalUnit = editedUnit as LegalUnit;

                        if (legalUnit != null && string.IsNullOrEmpty(legalUnit.HistoryLocalUnitIds))
                        {
                            return;
                        }
                        var historyLocalUnits = legalUnit?.HistoryLocalUnitIds?.Split(',')
                                                .Select(int.Parse)
                                                .ToList();

                        if (historyLocalUnits == null)
                        {
                            return;
                        }
                        if (localUnit != null && historyLocalUnits.Contains(localUnit.RegId) &&
                            legalUnit.RegId != localUnit.LegalUnitId)
                        {
                            historyLocalUnits.Remove(localUnit.RegId);
                        }
                        else if (localUnit != null && !historyLocalUnits.Contains(localUnit.RegId))
                        {
                            historyLocalUnits.Add(localUnit.RegId);
                        }
                        legalUnit.HistoryLocalUnitIds = historyLocalUnits.Count == 0
                                ? null
                                : string.Join(",", historyLocalUnits);
                    }

                    TrackUnithistoryFor <LegalUnit>(localUnit?.LegalUnitId, userId, changeReason, comment,
                                                    changeDateTime, PostAction);
                    TrackUnithistoryFor <LegalUnit>(unitsHistoryHolder.HistoryUnits.legalUnitId, userId,
                                                    changeReason, comment, changeDateTime, PostAction);
                }

                break;
            }

            case nameof(LegalUnit):
            {
                var legalUnit = unit as LegalUnit;

                TrackHistoryForListOfUnitsFor <LocalUnit>(
                    () => legalUnit?.LocalUnits.Select(x => x.RegId).ToList(),
                    () => unitsHistoryHolder.HistoryUnits.localUnitsIds,
                    userId,
                    changeReason,
                    comment,
                    changeDateTime,
                    (historyUnit, editedUnit) =>
                    {
                        if (!(historyUnit is LocalUnit hLocalUnit))
                        {
                            return;
                        }
                        if (unitsHistoryHolder.HistoryUnits.localUnitsIds.Count == 0)
                        {
                            hLocalUnit.LegalUnit   = null;
                            hLocalUnit.LegalUnitId = null;
                            return;
                        }

                        if (editedUnit is LocalUnit editedLocalUnit &&
                            !unitsHistoryHolder.HistoryUnits.localUnitsIds.Contains(editedLocalUnit.RegId) &&
                            editedLocalUnit.LegalUnitId != null)
                        {
                            hLocalUnit.LegalUnit   = null;
                            hLocalUnit.LegalUnitId = null;
                            return;
                        }

                        hLocalUnit.LegalUnit = legalUnit;
                        if (legalUnit != null)
                        {
                            hLocalUnit.LegalUnitId = legalUnit.RegId;
                        }
                    });

                if (legalUnit?.EnterpriseUnitRegId != unitsHistoryHolder.HistoryUnits.enterpriseUnitId)
                {
                    void PostAction(IStatisticalUnit historyUnit, IStatisticalUnit editedUnit)
                    {
                        var enterpriseUnit = editedUnit as EnterpriseUnit;

                        if (enterpriseUnit != null && string.IsNullOrEmpty(enterpriseUnit.HistoryLegalUnitIds))
                        {
                            return;
                        }
                        var historyLegalUnits = enterpriseUnit?.HistoryLegalUnitIds?.Split(',').Select(int.Parse)
                                                .ToList();

                        if (historyLegalUnits == null)
                        {
                            return;
                        }
                        if (legalUnit != null && (historyLegalUnits.Contains(legalUnit.RegId) &&
                                                  enterpriseUnit.RegId != legalUnit.EnterpriseUnitRegId))
                        {
                            historyLegalUnits.Remove(legalUnit.RegId);
                        }
                        else if (legalUnit != null && !historyLegalUnits.Contains(legalUnit.RegId))
                        {
                            historyLegalUnits.Add(legalUnit.RegId);
                        }
                        enterpriseUnit.HistoryLegalUnitIds = string.Join(",", historyLegalUnits);
                    }

                    TrackUnithistoryFor <EnterpriseUnit>(legalUnit?.EnterpriseUnitRegId, userId, changeReason,
                                                         comment, changeDateTime, PostAction);
                    TrackUnithistoryFor <EnterpriseUnit>(unitsHistoryHolder.HistoryUnits.enterpriseUnitId, userId,
                                                         changeReason, comment, changeDateTime, PostAction);
                }

                break;
            }