private void CreateDeployment(Collar collar, ArgosPlatform platform, DateTime startDateTime)
        {
            DateTime?endDateTime = null;

            if (platform.ArgosDeployments.Count > 0 || collar.ArgosDeployments.Count > 0)
            {
                if (!FixOtherDeployments(collar, platform, startDateTime, ref endDateTime))
                {
                    return;
                }
            }
            var deploy = new ArgosDeployment
            {
                ArgosPlatform = platform,
                Collar        = collar,
                StartDate     = startDateTime,
                EndDate       = endDateTime
            };

            Database.ArgosDeployments.InsertOnSubmit(deploy);
            //Creating a deployment is optional, so we submit now, so a failure will not stop other transactions.
            if (!SubmitChanges())
            {
                Database.ArgosDeployments.DeleteOnSubmit(deploy);
            }
        }
Example #2
0
        private void AddArgosDeployment(string argosId, Collar collar, DateTime start)
        {
            var platform = Database.ArgosPlatforms.FirstOrDefault(a => a.PlatformId == argosId);

            if (platform == null)
            {
                return;
            }
            DateTime?endDate = null;

            if (platform.ArgosDeployments.Count > 0 || collar.ArgosDeployments.Count > 0)
            {
                if (!FixOtherArgosDeployments(collar, platform, start, ref endDate))
                {
                    return;
                }
            }
            var deploy = new ArgosDeployment
            {
                ArgosPlatform = platform,
                Collar        = collar,
                StartDate     = start,
                EndDate       = endDate
            };

            Database.ArgosDeployments.InsertOnSubmit(deploy);
            if (SubmitChanges())
            {
                TpfDataChanged();
            }
        }
Example #3
0
        private bool AddDeployment()
        {
            var deployment = new ArgosDeployment
            {
                Collar        = (Collar)CollarComboBox.SelectedItem,
                ArgosPlatform = (ArgosPlatform)ArgosComboBox.SelectedItem,
                StartDate     = StartDateTimePicker.Checked ? StartDateTimePicker.Value.Date.ToUniversalTime() : (DateTime?)null,
                EndDate       = EndDateTimePicker.Checked ? EndDateTimePicker.Value.Date.ToUniversalTime() : (DateTime?)null
            };

            Database.ArgosDeployments.InsertOnSubmit(deployment);
            if (SubmitChanges())
            {
                return(true);
            }
            // The collar now thinks it has a deployment, deleteOnSubmit does not clear it
            LoadDataContext();
            return(false);
        }
Example #4
0
        private void ArgosAdded(string argosId, Collar collar, DateTime start)
        {
            var platform = Database.ArgosPlatforms.FirstOrDefault(a => a.PlatformId == argosId);

            if (platform == null)
            {
                return;
            }
            var deploy = new ArgosDeployment
            {
                ArgosPlatform = platform,
                Collar        = collar,
                StartDate     = start
            };

            Database.ArgosDeployments.InsertOnSubmit(deploy);
            if (SubmitChanges())
            {
                TpfDataChanged();
            }
        }
 private bool AddDeployment()
 {
     var deployment = new ArgosDeployment
         {
             Collar = (Collar)CollarComboBox.SelectedItem,
             ArgosPlatform = (ArgosPlatform)ArgosComboBox.SelectedItem,
             StartDate = StartDateTimePicker.Checked ? StartDateTimePicker.Value.Date.ToUniversalTime() : (DateTime?)null,
             EndDate = EndDateTimePicker.Checked ? EndDateTimePicker.Value.Date.ToUniversalTime() : (DateTime?)null
         };
     Database.ArgosDeployments.InsertOnSubmit(deployment);
     if (SubmitChanges())
         return true;
     // The collar now thinks it has a deployment, deleteOnSubmit does not clear it
     LoadDataContext();
     return false;
 }
 private void CreateDeployment(Collar collar, ArgosPlatform platform, DateTime startDateTime)
 {
     DateTime? endDateTime = null;
     if (platform.ArgosDeployments.Count > 0 || collar.ArgosDeployments.Count > 0)
         if (!FixOtherDeployments(collar, platform, startDateTime, ref endDateTime))
             return;
     var deploy = new ArgosDeployment
     {
         ArgosPlatform = platform,
         Collar = collar,
         StartDate = startDateTime,
         EndDate = endDateTime
     };
     Database.ArgosDeployments.InsertOnSubmit(deploy);
     //Creating a deployment is optional, so we submit now, so a failure will not stop other transactions.
     if (!SubmitChanges())
         Database.ArgosDeployments.DeleteOnSubmit(deploy);
 }
 private void ArgosAdded(string argosId, Collar collar, DateTime start)
 {
     var platform = Database.ArgosPlatforms.FirstOrDefault(a => a.PlatformId == argosId);
     if (platform == null)
         return;
     var deploy = new ArgosDeployment
         {
             ArgosPlatform = platform,
             Collar = collar,
             StartDate = start
         };
     Database.ArgosDeployments.InsertOnSubmit(deploy);
     if (SubmitChanges())
         TpfDataChanged();
 }
 private void AddArgosDeployment(string argosId, Collar collar, DateTime start)
 {
     var platform = Database.ArgosPlatforms.FirstOrDefault(a => a.PlatformId == argosId);
     if (platform == null)
         return;
     DateTime? endDate = null;
     if (platform.ArgosDeployments.Count > 0 || collar.ArgosDeployments.Count > 0)
         if (!FixOtherArgosDeployments(collar, platform, start, ref endDate))
             return;
     var deploy = new ArgosDeployment
     {
         ArgosPlatform = platform,
         Collar = collar,
         StartDate = start,
         EndDate = endDate
     };
     Database.ArgosDeployments.InsertOnSubmit(deploy);
     if (SubmitChanges())
         TpfDataChanged();
 }