Example #1
0
        public void Hold()
        {
            
            if (string.IsNullOrEmpty(_notam.Number))
            if (ToDate != null && ToDate.Length > 0)
            {
                CultureInfo MyCultureInfo = new CultureInfo("en-US");
                DateTime dtfrom = DateTime.ParseExact(FromDate, "yyMMddHHmm", CultureInfo.InvariantCulture);
                DateTime dtto = DateTime.ParseExact(ToDate, "yyMMddHHmm", CultureInfo.InvariantCulture);
                TimeSpan s = dtto.Subtract(dtfrom);
                if (s.Days > 90)
                {
                    MessageBoxResult dresult = MessageBox.Show("Different between FromDate And ToDate is more than 90 days\nAre you sure want to hold?", "Caution", MessageBoxButton.YesNo);
                    if (dresult == MessageBoxResult.No)
                        return ;

                }
            }
            if (!_notam.IsValid)
                throw new InvalidOperationException(Entity.OriginViewModel_Exception_CannotSave);

            if (string.IsNullOrEmpty(_notam.HigherLimit))
                _notam.HigherLimit = "999";
            if (string.IsNullOrEmpty(_notam.LowerLimit))
                _notam.LowerLimit = "000";
            if (_FreeStyle)
            {
                if (!_notamService.CheckUnique(NotamNum, Type, Year))
                {
                    MessageBox.Show("Invalid NOTAM Number", "ERROR");
                    return;

                }
                _notamService.UpdateWithNumber(_notam);
            }
            else
            {
                if (this.IsNewNotam)
                {
                    _notamService.Insert(_notam);
                }
                else
                {
                    if (string.IsNullOrEmpty(_notam.Number))
                        _notamService.Update(_notam);
                    else
                        _notam = _notamService.GetByNumber(_notam.Number, _notam.Type, _notam.Year);
                }

            }
            var notamDetail = NOTAM.SERVICE.Model.NotamDetail.CreateNewNotamDetail(_notam);
            var detailService = new NotamDetailService(_notamService._dataContext);
            var result = detailService.GetByNotamId(_notam.Id);
            if (result != null)
                notamDetail = result;
            var workspace = new NotamDetailViewModel(notamDetail, detailService,_notamService, parentWorkSpaces,this);
            parentWorkSpaces.Add(workspace);
            workspace.FreeStyle = FreeStyle;


            this.SetActiveWorkspace(workspace);
            
            OnPropertyChanged("NotamNum");
        }
Example #2
0
 public void Send()
 {
     _notamService.UpdateWithNumber(_notam);
     base.OnPropertyChanged("NotamNum");
     base.OnPropertyChanged("DisplayName");
    var notamDetail = NOTAM.SERVICE.Model.NotamDetail.CreateNewNotamDetail(_notam) ;
    var detailService = new NotamDetailService(_notamService._dataContext);
     var result = detailService.GetByNotamId(_notam.Id);
     if (result != null)
         notamDetail = result;
     var workspace = new NotamDetailViewModel(notamDetail, detailService,_notamService,parentWorkSpaces,this);
    parentWorkSpaces.Add(workspace);
    this.SetActiveWorkspace(workspace);
 }