Esempio n. 1
0
        //[RestAuthenticationAttribute]
        public GetIrrigationMotorDataResponse GetIrrigationMotorData(GetIrrigationMotorDataRequest request)
        {
            request.DecodeAuthToken();
            BLUser userData = new BLUser();

            userData = CachingLayer.GetCacheObjectByType(request.SID, userData.GetType());
            GetIrrigationMotorDataResponse response = null;

            if (userData != null)
            {
                using (var dashboardUtils = new BLDashboards())
                {
                    response = new GetIrrigationMotorDataResponse()
                    {
                        IrrigationMotorData = dashboardUtils.Widget_IrrigationMotor4NAR(
                            userData.CompanyId,
                            request.DateFrom,
                            request.DateTo,
                            request.DateFrom,
                            request.DateTo,
                            request.VehicleID),
                        VolumeUnit = userData.Company.VolumeUnitText
                    };
                }
            }
            return(response);
        }
Esempio n. 2
0
        //[RestAuthenticationAttribute]
        public GetIdleTimeCurrentStatusResponse GetIdleTimeCurrentStatus(GetIdleTimeCurrentStatusRequest request)
        {
            request.DecodeAuthToken();
            BLUser userData = new BLUser();

            userData = CachingLayer.GetCacheObjectByType(request.SID, userData.GetType());
            GetIdleTimeCurrentStatusResponse response = null;

            if (userData != null)
            {
                using (var dashboardUtils = new BLDashboards())
                {
                    request.VehicleGroup = request.VehicleGroup > 0 ? request.VehicleGroup : userData.VehicleNodeId;
                    WIDGET_IdleTimeCurrentStatusResult result = dashboardUtils.Widget_IdleTimeCurrentStatus(userData.CompanyId, request.VehicleGroup, request.VehicleID, request.VehicleType);
                    response = new GetIdleTimeCurrentStatusResponse()
                    {
                        NowSecondsData   = result.IDLE_TIME_CURRENT_SECS.GetValueOrDefault(0),
                        TodaySecondsData = result.IDLE_TIME_TODAY_SECS.GetValueOrDefault(0),
                        WeekSecondsData  = result.IDLE_TIME_THIS_WEEK_SECS.GetValueOrDefault(0),
                        MonthSecondsData = result.IDLE_TIME_THIS_MONTH_SECS.GetValueOrDefault(0)
                    };
                }
            }
            return(response);
        }
Esempio n. 3
0
        //[RestAuthenticationAttribute]
        public IEnumerable <VehicleCommonInfo> GetUserVehiclesInfo(GetUserVehiclesInfoRequest request)
        {
            BLUser userData = new BLUser();

            request.DecodeAuthToken();
            IEnumerable <VehicleCommonInfo> vehicleInfoList = null;

            //userData = GlobalData.GetSessionProperty(request.SID, userData.GetType());
            userData = CachingLayer.GetCacheObjectByType(request.SID, userData.GetType());
            if (userData != null)
            {
                vehicleInfoList = userData.GetOnlineVehiclesInfo(false, string.Empty).Tables[0].DataTableToList <VehicleCommonInfo>();
            }
            return(vehicleInfoList);
        }
Esempio n. 4
0
        //[RestAuthenticationAttribute]
        public IEnumerable <VehicleType> GetVehicleTypes(GetVehicleTypesRequest request)
        {
            request.DecodeAuthToken();
            BLUser userData = new BLUser();

            userData = CachingLayer.GetCacheObjectByType(request.SID, userData.GetType());
            IEnumerable <VehicleType> vehicleTypeList = null;

            if (userData != null)
            {
                BLUtils utils = new BLUtils();
                vehicleTypeList = utils.GetVehicleTypes(userData.CompanyId).DataTableToList <VehicleType>();
            }
            return(vehicleTypeList);
        }
Esempio n. 5
0
        //[RestAuthenticationAttribute]
        public IEnumerable <GroupsDataInfo> GetGroupsData(GetUserGroupsDataRequest request)
        {
            BLUser userData = new BLUser();

            request.DecodeAuthToken();
            userData = CachingLayer.GetCacheObjectByType(request.SID, userData.GetType());
            VehicleTreeDS.VEHICLE_GROUPSRow temp           = userData.GetVehicleGroupsDS().VEHICLE_GROUPS.FindByVTR_NODE_ID(userData.VehicleNodeId);
            List <GroupsDataInfo>           groupsDataInfo = temp.Table.DataTableToList <GroupsDataInfo>().ToList();

            /*groupsDataInfo.Add(new GroupsDataInfo()
             * {
             *  VTR_COMPANY_ID=temp.VTR_COMPANY_ID,
             *  VTR_NODE_ID=temp.VTR_NODE_ID,
             *  VTR_NODE_NAME=temp.VTR_NODE_NAME
             * });*/

            return(groupsDataInfo);
        }
Esempio n. 6
0
        //[RestAuthenticationAttribute]/*only with DB connection*/
        public IEnumerable <VehicleMapInfo> GetMapData(GetMapDataRequest request)
        {
            request.DecodeAuthToken();
            BLUser userData = new BLUser();

            //userData = GlobalData.GetSessionProperty(request.SID, userData.GetType());
            userData = CachingLayer.GetCacheObjectByType(request.SID, userData.GetType());
            IEnumerable <VehicleMapInfo> vehicleMapInfo = null;

            if (userData != null)
            {
                vehicleMapInfo = MapsDAL.GetVehicleList(-180, -90, 180, 90, userData.CompanyId, request.VehicleIDs, -1).DataTableToList <VehicleMapInfo>();
                GoogleObject     GObj   = new GoogleObject();
                GetMapDataFacade facade = new GetMapDataFacade();
                facade.createMapDataObject(ref GObj, vehicleMapInfo.ToList());
            }
            return(vehicleMapInfo);
        }
Esempio n. 7
0
        //[RestAuthenticationAttribute]
        public List <WIDGET_OverspeedDistributionByAmountCEMEXResult> GetOverSpeedingDistributionByAmount(GetOverSpeedingDistributionByAmountRequest request)
        {
            request.DecodeAuthToken();
            BLUser userData = new BLUser();

            userData = CachingLayer.GetCacheObjectByType(request.SID, userData.GetType());
            List <WIDGET_OverspeedDistributionByAmountCEMEXResult> overspeedDistributionByAmountData = new List <WIDGET_OverspeedDistributionByAmountCEMEXResult>();

            if (userData != null)
            {
                using (var dashboardUtils = new BLDashboards())
                {
                    int _vehicleGroupID = request.VehicleGroupID > 0?request.VehicleGroupID:userData.VehicleNodeId;
                    overspeedDistributionByAmountData = dashboardUtils.Widget_OverspeedDistributionByAmountCEMEX(userData.CompanyId, request.DateFrom, request.DateTo, request.DateFrom, request.DateTo, _vehicleGroupID, request.VehicleTypeID);
                }
            }
            return(overspeedDistributionByAmountData);
        }