Пример #1
0
 public void UpdateWithNumber(Snowtam snowtam)
 {
     if (string.IsNullOrEmpty(snowtam.Number))
     {
         List<Snowtam> list = new List<Snowtam>();
         list.AddRange(this._Snowtams);
         list.AddRange(this._ArchiveSnowtams);
         List<Snowtam> source = (
             from x in list
             where !string.IsNullOrEmpty(x.Sendtime) && x.Sendtime.Substring(0, 2).Equals(DateTime.Now.Year.ToString().Substring(2, 2))
             select x).ToList<Snowtam>();
         string text = (
             from n in source
             orderby n.Number descending
             select n.Number).FirstOrDefault<string>();
         if (string.IsNullOrEmpty(text))
         {
             text = "0";
         }
         int num = int.Parse(text) + 1;
         snowtam.Number = string.Format("{0:0000}", num);
         snowtam.Status = "D";
     }
     this.Insert(snowtam);
 }
Пример #2
0
 public bool ContainsSnowtam(Snowtam snowtam)
 {
     if (snowtam == null)
     {
         throw new ArgumentNullException("snowtam");
     }
     return this._Snowtams.Contains(snowtam);
 }
Пример #3
0
 public void Delete(Snowtam snowtam)
 {
     if (this._AllSnowtams.Contains(snowtam))
     {
         this._AllSnowtams.Remove(snowtam);
         this._dataContext.Snowtams.DeleteOnSubmit(snowtam);
         this._dataContext.SubmitChanges();
     }
 }
Пример #4
0
 public void Insert(Snowtam snowtam)
 {
     if (snowtam == null)
     {
         throw new ArgumentNullException("snowtam");
     }
     if (!this._dataContext.Snowtams.Contains(snowtam))
     {
         this._Snowtams.Add(snowtam);
         this._dataContext.Snowtams.InsertOnSubmit(snowtam);
         this._dataContext.SubmitChanges();
         if (this.SnowtamAdded != null)
         {
             this.SnowtamAdded(this, new EntityAddedEventArgs<Snowtam>(snowtam));
         }
     }
 }
Пример #5
0
 public SnowtamViewModel(Snowtam snowtam, SnowtamService snowtamService)
 {
     if (snowtam == null)
     {
         throw new ArgumentNullException("snowtam");
     }
     if (snowtamService == null)
     {
         throw new ArgumentNullException("snowtamService");
     }
     this._snowtam = snowtam;
     this._snowtamService = snowtamService;
 }
Пример #6
0
 public SnowtamViewModel(Snowtam snowtam, SnowtamService snowtamService, ObservableCollection<WorkspaceViewModel> parent)
     : this(snowtam, snowtamService)
 {
     this.parentWorkSpaces = parent;
 }
Пример #7
0
        public static string GeneratePreviewSnowtamText(Snowtam snowtam,string strAFTNeader = null)
        {

            var ntmBuilder = new StringBuilder();

            #region First Line
            if (!string.IsNullOrEmpty(strAFTNeader))
                for (int i = 0; i < 120; i++)
                    ntmBuilder.Append("\0");
            ntmBuilder.Append("GG");
            if (!string.IsNullOrEmpty(strAFTNeader))
                ntmBuilder.Append(strAFTNeader);
            else
                ntmBuilder.Append(Environment.NewLine);
            #endregion

            #region Second Line

            if (snowtam.Origin != null)
                ntmBuilder.Append(snowtam.Sendtime.Substring(snowtam.Sendtime.Length - 6, 6) + " " +
                                snowtam.Origin.Code + Environment.NewLine);
            #endregion

            #region 3rd and 4th line
            ntmBuilder.Append("SW" + snowtam.Location.Substring(0,2) + snowtam.Number + " " + snowtam.Location + " " +
                              snowtam.Obsrvdate + Environment.NewLine);
            ntmBuilder.Append("(SNOWTAM" + " " + snowtam.Number + Environment.NewLine);
            #endregion
            #region 5th line
           // ntmBuilder.Append("A)" + snowtam.aerodome + " B)" + snowtam.Obsrvdate + Environment.NewLine);

            #endregion

            ntmBuilder.Append("A)" + snowtam.aerodome + " B)" + snowtam.Obsrvfulldate + " C)" + snowtam.Runway + " D)" + snowtam.ClearedRunwayLen + " E)" +
                snowtam.ClearedRunwayWidth + " F)" + snowtam.Depositon + " G)" + snowtam.MeanDepth
                + " H)" + snowtam.Friction + " " + Environment.NewLine);

            ntmBuilder.Append("J)" + snowtam.CriticalSnowbank + " K)" + snowtam.RunwayLight + " L)" +
                snowtam.FurtherClearance + " M)" + snowtam.FurtherClearanceExp + " N)" + snowtam.Taxiway +
                " P)" + snowtam.TaxiwaySnowbank + " " + Environment.NewLine);

            ntmBuilder.Append("B)" + snowtam.ObsrvDate2 + " C)" + snowtam.Runway2 + " D)" + snowtam.ClearedRunwayLen2 + " E)" +
                snowtam.ClearedRunwayWidth2 + " F)" + snowtam.Depositon2 + " G)" + snowtam.MeanDepth2 +
                " H)" + snowtam.Friction2 + " " + Environment.NewLine);

            ntmBuilder.Append("J)" + snowtam.CriticalSnowbank2 + " K)" + snowtam.RunwayLight2 + " L)" +
                snowtam.FurtherClearance2 + " M)" + snowtam.FurtherClearanceexp2 + " N)" + snowtam.Taxiway2 +
                " P)" + snowtam.TaxiwaySnowbank2 + " " + Environment.NewLine);

            ntmBuilder.Append("B)" + snowtam.ObsrvDate3 + " C)" + snowtam.Runway3 + " D)" + snowtam.ClearedRunwayLen3 + " E)" +
                snowtam.ClearedRunwayWidth3 + " F)" + snowtam.Depositon3 + " G)" + snowtam.MeanDepth3 +
                " H)" + snowtam.Friction3 + " " + Environment.NewLine);

            ntmBuilder.Append("J)" + snowtam.CriticalSnowbank3 + " K)" + snowtam.RunwayLight3 + " L)" +
                snowtam.FurtherClearance3 + " M)" + snowtam.FurtherClearanceexp3 + " N)" + snowtam.Taxiway3 +
                " P)" + snowtam.TaxiwaySnowbank3 +" "+ Environment.NewLine);


            ntmBuilder.Append("R)" + snowtam.Apron + " S)" + snowtam.NextObsrv + Environment.NewLine);

            ntmBuilder.Append("T)" + snowtam.FreeTextt + " )" + Environment.NewLine);

            string strRet = ntmBuilder.ToString();
            for (char ch = 'A'; ch <= 'T'; ch++)
            {
                strRet = strRet.Replace(ch + ") ", string.Empty);
                strRet = strRet.Replace(ch + ")\r\n", string.Empty);
            }
            string[] strAll = strRet.Split('\n');
            strRet = "";
            foreach (string s in strAll)
            {
                if (s != "\r")
                    strRet += (s + "\n");
            }
            return strRet;
        }
Пример #8
0
 public void Update(Snowtam snowtam)
 {
     this._dataContext.SubmitChanges();
 }
Пример #9
0
        public SnowtamDetail(Snowtam snowtam)
            : this()
        {
            Snowtam = snowtam;

        }
Пример #10
0
 public static SnowtamDetail CreateNewNotamDetail(Snowtam snowtam)
 {
     return new SnowtamDetail(snowtam);
 }