Beispiel #1
0
        /// <summary>
        /// Get all itens filtering direct in DB. Up: More optimized because filters DB. Down: less flexible, don't support dynamic filters.
        /// </summary>
        /// <param name="generalBodyGet"></param>
        /// <param name="error"></param>
        /// <returns></returns>
        public List <GetTagView> GetAllWithDBFilter(GeneralBodyGet generalBodyGet, out RestExceptionError error)
        {
            try
            {
                if ((generalBodyGet == null) || (generalBodyGet.Filters == null) || (generalBodyGet.Filters.Count == 0))
                {
                    error = new RestExceptionError();
                    error.ExceptionMessage = "";
                    error.InternalMessage  = "Url does not contains filter section";
                }

                error = null;
                TagBsn bsn = new TagBsn(restConfig);
                List <DataFilterExpressionDB> dbFilter = HelperRESTFilterToDB.FilterRestFilterToDBExpression(generalBodyGet.Filters);
                List <TagInfo>    dbItems = bsn.GetAll(dbFilter);
                List <GetTagView> result  = new List <GetTagView>();
                foreach (TagInfo item in dbItems)
                {
                    GetTagView view = new GetTagView();
                    Cloner.CopyAllTo(typeof(TagInfo), item, typeof(GetTagView), view);
                    result.Add(view);
                }

                return(result);
            }
            catch (Exception ex)
            {
                error = new RestExceptionError();
                error.ExceptionMessage = ex.Message;
            }
            return(null);
        }
Beispiel #2
0
        //private void CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        //{
        //Notify("IncludeFolders");
        //}



        public List <ModelNotifiedForTag> GetAllTag(out string error)
        {
            error = null;
            try
            {
                TagBsn                     bsn           = new TagBsn(wpfConfig);
                List <TagInfo>             dbItems       = bsn.GetAll();
                List <ModelNotifiedForTag> notifiedItems = new List <ModelNotifiedForTag>();

                foreach (TagInfo dbItem in dbItems)
                {
                    ModelNotifiedForTag itemToAdd = new ModelNotifiedForTag();
                    Cloner.CopyAllTo(typeof(TagInfo), dbItem, typeof(ModelNotifiedForTag), itemToAdd);
                    itemToAdd.ItemChanged = false;
                    itemToAdd.NewItem     = false;
                    notifiedItems.Add(itemToAdd);
                }

                return(notifiedItems);
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }
            return(null);
        }
Beispiel #3
0
        /// <summary>
        /// Retrieve all data from Tag table. Used to fill combo box.
        /// </summary>
        /// <returns>List of Tag</returns>
        public List <ModelNotifiedForTag> GetAll_Tag(out string error)
        {
            error = null;
            TagBsn                     bsn           = new TagBsn(wpfConfig);
            List <TagInfo>             dbItems       = bsn.GetAll();
            List <ModelNotifiedForTag> notifiedItems = new List <ModelNotifiedForTag>();

            foreach (TagInfo dbItem in dbItems)
            {
                ModelNotifiedForTag itemToAdd = new ModelNotifiedForTag();
                Cloner.CopyAllTo(typeof(TagInfo), dbItem, typeof(ModelNotifiedForTag), itemToAdd);
                notifiedItems.Add(itemToAdd);
            }
            return(notifiedItems);
        }
Beispiel #4
0
        public List <GetTagView> GetAll(out RestExceptionError error)
        {
            try
            {
                error = null;
                TagBsn            bsn     = new TagBsn(restConfig);
                List <TagInfo>    dbItems = bsn.GetAll();
                List <GetTagView> result  = new List <GetTagView>();
                foreach (TagInfo item in dbItems)
                {
                    GetTagView view = new GetTagView();
                    Cloner.CopyAllTo(typeof(TagInfo), item, typeof(GetTagView), view);
                    result.Add(view);
                }

                return(result);
            }
            catch (Exception ex)
            {
                error = new RestExceptionError();
                error.ExceptionMessage = ex.Message;
            }
            return(null);
        }