Ejemplo n.º 1
0
        public void AddData(ModelNotifiedForTag modelNotifiedForTag, out string error)
        {
            TagBsn  bsn    = new TagBsn(wpfConfig);
            TagInfo dbItem = new TagInfo();

            Cloner.CopyAllTo(typeof(ModelNotifiedForTag), modelNotifiedForTag, typeof(TagInfo), dbItem);
            bsn.InsertOne(dbItem, out error);
            modelNotifiedForTag.NewItem = false;
            Cloner.CopyAllTo(typeof(TagInfo), dbItem, typeof(ModelNotifiedForTag), modelNotifiedForTag);
        }
Ejemplo n.º 2
0
        public void TryInclude(CreateTagView viewToInclude, out RestExceptionError error)
        {
            error = null;
            TagInfo dbViewToInclude = new TagInfo();

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

            try
            {
                TagBsn bsn     = new TagBsn(restConfig);
                string dbError = null;
                bsn.InsertOne(dbViewToInclude, out dbError);
                if (dbError != null)
                {
                    error = new RestExceptionError();
                    error.InternalMessage  = "Internal Error Save data for [Tag.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 [Tag.TryInclude/Save]";
                error.ExceptionMessage = ex.Message;
                error.SourceError      = RestExceptionError._SourceError.ServerSide;
                error.StackTrace       = ex.StackTrace;
            }
        }