Ejemplo n.º 1
0
        public Task <List <vh_expense_transC> > GetExpensesByExpenseType(dto_fs_rangeC _dto)
        {
            List <vh_expense_transC> _list = null;

            if (_dto == null)
            {
                AddErrorMessage("Error", "Error", "Expense Object Can Not Be Null");
                return(Task.FromResult(_list));
            }
            if (_dto.filter_id == 0)
            {
                AddErrorMessage("Error", "Error", "Filter Id Can Not Be Null");
                return(Task.FromResult(_list));
            }

            string _sql = null;

            try
            {
                using (var _db = fnn.GetDbConnection())
                {
                    if (_dto.fs_time_stamp == 0)
                    {
                        _sql  = string.Format("select * from {0} where delete_id = 0", _table_name.ToDbSchemaTable());
                        _list = _db.Query <vh_expense_transC>(_sql).ToList();
                    }
                    else
                    {
                        _sql = string.Format("select * from {0} where exp_type_id = {1} and fs_timestamp > {2} and fs_timestamp < {3}  and delete_id = 0",
                                             _table_name.ToDbSchemaTable(), _dto.filter_id, _dto.start_fs_id, _dto.end_fs_id);
                        _list = _db.Query <vh_expense_transC>(_sql).ToList();
                    }
                }
            }
            catch (SqlException ex)
            {
                LoggerX.LogException(ex);
            }
            catch (DbException ex)
            {
                LoggerX.LogException(ex);
            }
            catch (Exception ex)
            {
                LoggerX.LogException(ex);
            }
            return(Task.FromResult(_list));
        }
Ejemplo n.º 2
0
        public Task <List <creditor_depositC> > GetAllCreditorDepositsByRange(dto_fs_rangeC _dto)
        {
            List <creditor_depositC> _list = null;

            if (_dto == null)
            {
                AddErrorMessage("Error", "Error", "DTO Can Not Be Null");
                return(Task.FromResult(_list));
            }

            string _sql = null;

            try
            {
                using (var _db = fnn.GetDbConnection())
                {
                    if (_dto.fs_time_stamp == 0)
                    {
                        _sql = string.Format("select * from {0} where  (deposit_fs_id>={1} and  deposit_fs_id <= {2}) and delete_id = 0",
                                             FleetManager.DbBase.tableNames.creditor_deposit_tb.ToDbSchemaTable(), _dto.start_fs_id, _dto.end_fs_id);
                        _list = _db.Query <creditor_depositC>(_sql).ToList();
                    }
                    else
                    {
                        _sql = string.Format("select * from {0} where (deposit_fs_id >={1} and  deposit_fs_id <= {2}) and fs_timestamp >{3}",
                                             FleetManager.DbBase.tableNames.creditor_deposit_tb.ToDbSchemaTable(), _dto.start_fs_id, _dto.end_fs_id, _dto.fs_time_stamp);
                        _list = _db.Query <creditor_depositC>(_sql).ToList();
                    }
                }
            }
            catch (SqlException ex)
            {
                LoggerX.LogException(ex);
            }
            catch (DbException ex)
            {
                LoggerX.LogException(ex);
            }
            catch (Exception ex)
            {
                LoggerX.LogException(ex);
            }
            return(Task.FromResult(_list));
        }