Beispiel #1
0
        public void AddData(ModelNotifiedForTerritories modelNotifiedForTerritories, out string error)
        {
            TerritoriesBsn  bsn    = new TerritoriesBsn(wpfConfig);
            TerritoriesInfo dbItem = new TerritoriesInfo();

            Cloner.CopyAllTo(typeof(ModelNotifiedForTerritories), modelNotifiedForTerritories, typeof(TerritoriesInfo), dbItem);
            bsn.InsertOne(dbItem, out error);
            modelNotifiedForTerritories.NewItem = false;
            Cloner.CopyAllTo(typeof(TerritoriesInfo), dbItem, typeof(ModelNotifiedForTerritories), modelNotifiedForTerritories);
        }
Beispiel #2
0
        public void TryInclude(CreateTerritoriesView viewToInclude, out RestExceptionError error)
        {
            error = null;
            TerritoriesInfo dbViewToInclude = new TerritoriesInfo();

            try
            {
                Cloner.CopyAllTo(typeof(CreateTerritoriesView), viewToInclude, typeof(TerritoriesInfo), dbViewToInclude);
            }
            catch (Exception ex)
            {
                error = new RestExceptionError();
                error.InternalMessage  = "Internal Error parsing data for (Territories.TryInclude/Parsing)";
                error.ExceptionMessage = ex.Message;
                error.SourceError      = RestExceptionError._SourceError.ServerSide;
                error.StackTrace       = ex.StackTrace;
            }

            try
            {
                TerritoriesBsn bsn     = new TerritoriesBsn(restConfig);
                string         dbError = null;
                bsn.InsertOne(dbViewToInclude, out dbError);
                if (dbError != null)
                {
                    error = new RestExceptionError();
                    error.InternalMessage  = "Internal Error Save data for [Territories.TryInclude/Save]";
                    error.ExceptionMessage = dbError;
                    error.SourceError      = RestExceptionError._SourceError.ServerSide;
                    error.StackTrace       = "";
                }
            }
            catch (Exception ex)
            {
                error = new RestExceptionError();
                error.InternalMessage  = "Internal Error Save data for [Territories.TryInclude/Save]";
                error.ExceptionMessage = ex.Message;
                error.SourceError      = RestExceptionError._SourceError.ServerSide;
                error.StackTrace       = ex.StackTrace;
            }
        }