示例#1
0
        public FuelObjectCollection GetFilter(string supplier, int fuelType,
                                              string employee, string vehicle, DateTime dateFrom, DateTime dateTo,
                                              Boolean privateFuel)
        {
            FuelObjectCollection fuels;
            QueryBuilder         builder;

            try
            {
                builder = new QueryBuilder();
                builder.Append(this.BaseQuery(false, 0));
                builder.AppendWhereString("1", "1", QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.FIRST);
                if (supplier != "" & supplier != null)
                {
                    builder.AppendWhereString(FuelObject.SUPPLIER, supplier, QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.MIDDLE);
                }
                if (fuelType != -1)
                {
                    builder.AppendWhereInteger(FuelObject.FUELTYPE, Convert.ToInt16(fuelType), QueryBuilder.ParameterLocation.MIDDLE);
                }
                if (employee != "" & employee != null)
                {
                    builder.AppendWhereString(FuelObject.EMPLOYEE, employee, QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.MIDDLE);
                }
                if (vehicle != "" & vehicle != null)
                {
                    builder.AppendWhereString(FuelObject.VEHICLE_LICENSEPLATE, vehicle, QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.MIDDLE);
                }
                if (dateFrom != DateTime.MinValue)
                {
                    builder.AppendWhereString(FuelObject.DATE, dateFrom.Year + "-" + dateFrom.Month + "-" + dateFrom.Day, QueryBuilder.ComparisonOperators.GreaterAndEqual, QueryBuilder.ParameterLocation.MIDDLE);
                }
                if (dateTo != DateTime.MaxValue)
                {
                    builder.AppendWhereString(FuelObject.DATE, dateTo.Year + "-" + dateTo.Month + "-" + dateTo.Day, QueryBuilder.ComparisonOperators.SmallerAndEqual, QueryBuilder.ParameterLocation.MIDDLE);
                }

                builder.AppendWhereBoolean(FuelObject.PRIVATE_TANKING, privateFuel, QueryBuilder.ParameterLocation.LAST);
                builder.AppendOrderBy(FuelObject.DATE, QueryBuilder.OrderByType.DESC, QueryBuilder.ParameterLocation.FIRST_LAST);
                return(fuels = FuelConvertor.DataTableToCollection(this.ExecuteDataSet(builder.Query, false).Tables[0]));
            }
            catch (System.Exception exception1)
            {
                throw new Exception(MethodBase.GetCurrentMethod().Name, exception1);
            }
            return(fuels);
        }
示例#2
0
        public FuelObjectCollection GetAll()
        {
            FuelObjectCollection fuels = new FuelObjectCollection();
            QueryBuilder         builder;

            try
            {
                builder = new QueryBuilder();
                builder.Append(this.BaseQuery(false, 0));
                builder.AppendOrderBy(FuelObject.DATE, QueryBuilder.OrderByType.ASC, QueryBuilder.ParameterLocation.FIRST_LAST);
                fuels = FuelConvertor.DataTableToCollection(this.ExecuteDataSet(builder.Query, false).Tables[0]);
            }
            catch (System.Exception exception1)
            {
                throw new Exception(MethodBase.GetCurrentMethod().Name, exception1);
            }
            return(fuels);
        }
示例#3
0
        public FuelObjectCollection GetForbiddenFuelNotSendMail(string supplier, int transc_NawID, DateTime dateFrom, DateTime dateTo)
        {
            FuelObjectCollection fuels;
            QueryBuilder         builder;

            try
            {
                builder = new QueryBuilder();
                builder.Append(this.BaseQuery(false, 0));
                builder.AppendWhereString("1", "1", QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.FIRST);
                if (supplier != "" & supplier != null)
                {
                    builder.AppendWhereString(FuelObject.SUPPLIER, supplier, QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.MIDDLE);
                }
                if (transc_NawID != -1)
                {
                    builder.AppendWhereInteger(FuelObject.TRANSC_NAWID, transc_NawID, QueryBuilder.ParameterLocation.MIDDLE);
                }
                if (dateFrom != DateTime.MinValue)
                {
                    builder.AppendWhereString(FuelObject.DATE, dateFrom.Year + "-" + dateFrom.Month + "-" + dateFrom.Day, QueryBuilder.ComparisonOperators.GreaterAndEqual, QueryBuilder.ParameterLocation.MIDDLE);
                }
                if (dateTo != DateTime.MaxValue)
                {
                    builder.AppendWhereString(FuelObject.DATE, dateTo.Year + "-" + dateTo.Month + "-" + dateTo.Day, QueryBuilder.ComparisonOperators.SmallerAndEqual, QueryBuilder.ParameterLocation.MIDDLE);
                }

                builder.Append(" AND " + FuelObject.DATEMAIL_FORBIDDENFUELING + " IS NULL ");

                builder.AppendOrderBy(FuelObject.DATE, QueryBuilder.OrderByType.DESC, QueryBuilder.ParameterLocation.FIRST_LAST);
                return(fuels = FuelConvertor.DataTableToCollection(this.ExecuteDataSet(builder.Query, false).Tables[0]));
            }
            catch (System.Exception exception1)
            {
                throw new Exception(MethodBase.GetCurrentMethod().Name, exception1);
            }
            return(fuels);
        }