示例#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 <GetEmployeesView> 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;
                EmployeesBsn bsn = new EmployeesBsn(restConfig);
                List <DataFilterExpressionDB> dbFilter = HelperRESTFilterToDB.FilterRestFilterToDBExpression(generalBodyGet.Filters);
                List <EmployeesInfo>          dbItems  = bsn.GetAll(dbFilter);
                List <GetEmployeesView>       result   = new List <GetEmployeesView>();
                foreach (EmployeesInfo item in dbItems)
                {
                    GetEmployeesView view = new GetEmployeesView();
                    Cloner.CopyAllTo(typeof(EmployeesInfo), item, typeof(GetEmployeesView), view);
                    result.Add(view);
                }

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



        public List <ModelNotifiedForEmployees> GetAllEmployees(out string error)
        {
            error = null;
            try
            {
                EmployeesBsn                     bsn           = new EmployeesBsn(wpfConfig);
                List <EmployeesInfo>             dbItems       = bsn.GetAll();
                List <ModelNotifiedForEmployees> notifiedItems = new List <ModelNotifiedForEmployees>();

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

                return(notifiedItems);
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }
            return(null);
        }
示例#3
0
        /// <summary>
        /// Retrieve all data from Employees table. Used to fill combo box.
        /// </summary>
        /// <returns>List of Employees</returns>
        public List <ModelNotifiedForEmployees> GetAll_Employees(out string error)
        {
            error = null;
            EmployeesBsn                     bsn           = new EmployeesBsn(wpfConfig);
            List <EmployeesInfo>             dbItems       = bsn.GetAll();
            List <ModelNotifiedForEmployees> notifiedItems = new List <ModelNotifiedForEmployees>();

            foreach (EmployeesInfo dbItem in dbItems)
            {
                ModelNotifiedForEmployees itemToAdd = new ModelNotifiedForEmployees();
                Cloner.CopyAllTo(typeof(EmployeesInfo), dbItem, typeof(ModelNotifiedForEmployees), itemToAdd);
                notifiedItems.Add(itemToAdd);
            }
            return(notifiedItems);
        }
示例#4
0
        public List <GetEmployeesView> GetAll(out RestExceptionError error)
        {
            try
            {
                error = null;
                EmployeesBsn            bsn     = new EmployeesBsn(restConfig);
                List <EmployeesInfo>    dbItems = bsn.GetAll();
                List <GetEmployeesView> result  = new List <GetEmployeesView>();
                foreach (EmployeesInfo item in dbItems)
                {
                    GetEmployeesView view = new GetEmployeesView();
                    Cloner.CopyAllTo(typeof(EmployeesInfo), item, typeof(GetEmployeesView), view);
                    result.Add(view);
                }

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