Example #1
0
 public override TreeDefaultValueDO ShowAddTreeDefault(TreeDefaultValueDO newTDV)
 {
     try
     {
         FormAddTreeDefault dialog = new FormAddTreeDefault(ApplicationController.SetupService.GetProductCodes());
         if (dialog.ShowDialog(newTDV) == DialogResult.OK)
         {
             newTDV.Save();
             return(newTDV);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         if (!this.ApplicationController.ExceptionHandler.Handel(ex))
         {
             throw;
         }
         else
         {
             return(null);
         }
     }
 }
Example #2
0
 public TreeDefaultValueDO ShowEditTreeDefault(TreeDefaultValueDO tdv)
 {
     try
     {
         using (FormAddTreeDefault dialog = new FormAddTreeDefault(ViewPresenter.ApplicationController.SetupService.GetProductCodes()))
         {
             if (dialog.ShowDialog(tdv) == DialogResult.OK)
             {
                 return(tdv);
             }
             else
             {
                 return(null);
             }
         }
     }
     catch (Exception ex)
     {
         if (!ViewPresenter.ApplicationController.ExceptionHandler.Handel(ex))
         {
             throw;
         }
         else
         {
             return(null);
         }
     }
 }
Example #3
0
        public override void ShowEditTreeDefault(TreeDefaultValueDO tdv)
        {
            TreeDefaultValueDO temp = new TreeDefaultValueDO(tdv);

            try
            {
                using (FormAddTreeDefault dialog = new FormAddTreeDefault(this.ApplicationController.SetupService.GetProductCodes()))
                {
                    if (dialog.ShowDialog(temp) == DialogResult.OK)
                    {
                        try
                        {
                            tdv.SetValues(temp);
                            tdv.Save();

                            RealignTreeSpecies(tdv.DAL, tdv.TreeDefaultValue_CN.Value);
                        }
                        catch (FMSC.ORM.UniqueConstraintException ex)
                        {
                            throw new UserFacingException("Values Conflict With Existing Tree Default", ex);
                        }
                        catch (FMSC.ORM.ConstraintException ex)
                        {
                            throw new UserFacingException("Invalid Values", ex);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                if (!this.ApplicationController.ExceptionHandler.Handel(ex))
                {
                    throw;
                }
            }
        }