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

            Cloner.CopyAllTo(typeof(ModelNotifiedForTerritories), modelNotifiedForTerritories, typeof(TerritoriesInfo), dbItem);

            bsn.UpdateOne(dbItem, out error);
        }
Beispiel #2
0
        public void TryUpdate(UpdateTerritoriesView viewToUpdate, out RestExceptionError error)
        {
            error = null;
            TerritoriesInfo dbViewToInclude = new TerritoriesInfo();

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

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