コード例 #1
0
        public int GetTotalsByCompanyId(int idCompany, CarFleet.Utils.Constants.CARFLEET_ENTITY CARFLEET_ENTITY)
        {
            FunctionsEntity entity = _FunctionsCrud.TotalsByCompany(idCompany, CARFLEET_ENTITY);

            if (entity != null)
            {
                object value;
                int    total = 0;
                if (Utils.Utilities._IsCasteable(entity.result.ToString(), out value, Utils.Constants.DATA_TYPES.INT))
                {
                    total = int.Parse(entity.result.ToString());
                }
                return(total);
            }
            else
            {
                return(0);
            }
        }
コード例 #2
0
        public FunctionsEntity TotalsByCompany(int companyId, CarFleet.Utils.Constants.CARFLEET_ENTITY CARFLEET_ENTITY)
        {
            using (var command = base.GetContextConnection.CreateCommand())
            {
                command.AddParameter("ID_COMPANY_OUT", SqlDbType.Int, companyId);
                switch (CARFLEET_ENTITY)
                {
                case Utils.Constants.CARFLEET_ENTITY.DRIVER:
                    command.CommandText = StoreProcedureConstants.stp_DriverTotalByCompanyId;
                    break;

                case Utils.Constants.CARFLEET_ENTITY.FLEET:
                    command.CommandText = StoreProcedureConstants.stp_FleetTotalByCompanyId;
                    break;

                case Utils.Constants.CARFLEET_ENTITY.VEHICLE:
                    command.CommandText = StoreProcedureConstants.stp_VehicleTotalByCompanyId;
                    break;
                }
                command.CommandType = CommandType.StoredProcedure;
                return(ToList(command).FirstOrDefault());
            }
        }