Exemplo n.º 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 <GetTagEmployeeView> 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;
                TagEmployeeBsn bsn = new TagEmployeeBsn(restConfig);
                List <DataFilterExpressionDB> dbFilter = HelperRESTFilterToDB.FilterRestFilterToDBExpression(generalBodyGet.Filters);
                List <TagEmployeeInfo>        dbItems  = bsn.GetAll(dbFilter);
                List <GetTagEmployeeView>     result   = new List <GetTagEmployeeView>();
                foreach (TagEmployeeInfo item in dbItems)
                {
                    GetTagEmployeeView view = new GetTagEmployeeView();
                    Cloner.CopyAllTo(typeof(TagEmployeeInfo), item, typeof(GetTagEmployeeView), view);
                    result.Add(view);
                }

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



        public List <ModelNotifiedForTagEmployee> GetAllTagEmployee(out string error)
        {
            error = null;
            try
            {
                TagEmployeeBsn                     bsn           = new TagEmployeeBsn(wpfConfig);
                List <TagEmployeeInfo>             dbItems       = bsn.GetAll();
                List <ModelNotifiedForTagEmployee> notifiedItems = new List <ModelNotifiedForTagEmployee>();

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

                return(notifiedItems);
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }
            return(null);
        }
Exemplo n.º 3
0
        public List <GetTagEmployeeView> GetAll(out RestExceptionError error)
        {
            try
            {
                error = null;
                TagEmployeeBsn            bsn     = new TagEmployeeBsn(restConfig);
                List <TagEmployeeInfo>    dbItems = bsn.GetAll();
                List <GetTagEmployeeView> result  = new List <GetTagEmployeeView>();
                foreach (TagEmployeeInfo item in dbItems)
                {
                    GetTagEmployeeView view = new GetTagEmployeeView();
                    Cloner.CopyAllTo(typeof(TagEmployeeInfo), item, typeof(GetTagEmployeeView), view);
                    result.Add(view);
                }

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