Ejemplo n.º 1
0
        /// <summary>Get eFleetVehicle Details
        /// <CreatedBy>Bhushan Dod</CreatedBY>
        /// <CreatedFor>GeteFleetVehicleDetailsByID</CreatedFor>
        /// <CreatedOn>Sept-06-2017</CreatedOn>
        /// </summary>
        /// <param name="ObjServiceQRCElevatorModel"></param>
        /// <returns></returns>
        public ServiceResponseModel <VehicleScanModel> GeteFleetVehicleDetailsByID(VehicleScanModel ObjServiceVehicleModel)
        {
            var             ObjeFleetVehicleRepository        = new eFleetVehicleRepository();
            var             objeFleetVehicleScanLogRepository = new eFleetVehicleScanLogRepository();
            var             ObjUserRepository = new UserRepository();
            var             objDARRepository  = new DARRepository();
            ServiceDARModel obj = new ServiceDARModel();
            ServiceResponseModel <VehicleScanModel> ObjServiceResponseModel = new ServiceResponseModel <VehicleScanModel>();

            try
            {
                var authuser = ObjUserRepository.GetSingleOrDefault(x => x.ServiceAuthKey == ObjServiceVehicleModel.ServiceAuthKey && x.IsDeleted == false);
                if (authuser != null && authuser.UserId > 0)
                {
                    var result = GeteFleetVehicleById(ObjServiceVehicleModel.QRCodeID, ObjServiceVehicleModel.LocationID);

                    ObjServiceResponseModel.Message  = (result != null && result.VehicleID > 0) ? CommonMessage.Successful() : CommonMessage.DoesNotExistsRecordMessage();
                    ObjServiceResponseModel.Response = (result != null && result.VehicleID > 0) ? Convert.ToInt32(ServiceResponse.SuccessResponse, CultureInfo.CurrentCulture) : Convert.ToInt32(ServiceResponse.FailedResponse, CultureInfo.CurrentCulture);
                    ObjServiceResponseModel.Data     = result;
                    if (result.VehicleID > 0)
                    {
                        //For Scan log maintian
                        long VehScanLogId = objeFleetVehicleScanLogRepository.SaveeFleetVehicleScanLog(result.VehicleID, Convert.ToInt64(eFleetEnum.VehicleScan), authuser.UserId, Convert.ToInt64(result.LocationID));
                        ObjServiceResponseModel.Data.VehicleScanLogId = VehScanLogId;

                        //For DAR log maintian
                        obj.CreatedBy       = authuser.UserId;
                        obj.ActivityDetails = DarMessage.VehicleScanMessage((authuser.FirstName + " " + authuser.LastName), result.VehicleNumber, result.QRCodeID);
                        obj.LocationId      = Convert.ToInt64(result.LocationID);
                        obj.UserId          = authuser.UserId;
                        obj.TaskType        = (long)eFleetEnum.VehicleScan;
                        long DarId = objDARRepository.SaveDARDetails(obj);
                        ObjServiceResponseModel.Data.DarID = DarId;
                    }
                }
                else
                {
                    ObjServiceResponseModel.Response = Convert.ToInt32(ServiceResponse.InvalidSessionResponse, CultureInfo.CurrentCulture);
                    ObjServiceResponseModel.Message  = CommonMessage.InvalidUser();
                }
            }
            catch (Exception ex)
            {
                WorkOrderEMS.BusinessLogic.Exception_B.Exception_B.exceptionHandel_Runtime(ex, "ServiceResponseModel<VehicleScanModel> GeteFleetVehicleDetailsByID(VehicleScanModel ObjServiceVehicleModel)", "while fetching GeteFleetVehicleDetailsByID", ObjServiceVehicleModel);
                ObjServiceResponseModel.Message  = ex.Message;
                ObjServiceResponseModel.Response = Convert.ToInt32(ServiceResponse.ExeptionResponse, CultureInfo.CurrentCulture);
                ObjServiceResponseModel.Data     = null;
            }
            return(ObjServiceResponseModel);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// CreatedBy   :   Bhushan Dod
        /// CreatedOn   :   Sep-08-2017
        /// CreatedFor  :   Get eFleet Vehicle by ID
        /// </summary>
        /// <param name="vehicleId"></param>
        /// <returns></returns>
        public VehicleScanModel GeteFleetVehicleById(string QRCodeID, long locationId)
        {
            try
            {
                var ObjReturn = new VehicleScanModel();

                //ServiceQrcShuttleBusModel objReturnShuttle = new ServiceQrcShuttleBusModel();
                var ObjeFleetVehicleRepository = new eFleetVehicleRepository();
                var ObjUserRepository          = new UserRepository();
                var ObjVehicleDetail           = ObjeFleetVehicleRepository.GetSingleOrDefault(q => q.QRCodeID == QRCodeID && q.LocationID == locationId && q.IsDeleted == false);
                if (ObjVehicleDetail == null)
                {
                    throw new Exception("Record not found.");
                }
                AutoMapper.Mapper.CreateMap <eFleetVehicle, VehicleScanModel>();
                ObjReturn = AutoMapper.Mapper.Map(ObjVehicleDetail, ObjReturn);

                string HostingPrefix = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["hostingPrefix"], CultureInfo.InvariantCulture);

                string AssetImgURLPrefix = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["VehicleImage"], CultureInfo.InvariantCulture);
                ObjReturn.VehicleImage = HostingPrefix + AssetImgURLPrefix.Replace("~", "") + ObjVehicleDetail.VehicleImage;

                //Added By Bhushan Dod on 06/09/2017 for Damage in mobile app
                if (ObjVehicleDetail.DamageTireDetails != null)
                {
                    var ObjReturnDamageTire = new eFleetDamageTireModel();
                    ObjReturnDamageTire = GenericDataContractSerializer <eFleetDamageTireModel> .DeserializeXml(ObjVehicleDetail.DamageTireDetails);

                    //ObjReturn.DamageTire = ObjReturnDamageTire;
                    //ObjReturn.IsDamage = ObjReturnDamageTire.Damage.IsDamage;
                    //ObjReturn.DarID = ObjReturnDamageTire.Damage.DamageDarId;
                }
                //Added By Bhushan Dod on 06/09/2017 for Damage in mobile app
                if (ObjVehicleDetail.InteriorMileageDriverDetails != null)
                {
                    var objInteriorMileageDriverDetails = new eFleetInteriorMileageDriverModel();
                    objInteriorMileageDriverDetails = GenericDataContractSerializer <eFleetInteriorMileageDriverModel> .DeserializeXml(ObjVehicleDetail.InteriorMileageDriverDetails);

                    ObjReturn.ChShDescription    = objInteriorMileageDriverDetails.Mileage.ChShDescription;
                    ObjReturn.OldChShDescription = objInteriorMileageDriverDetails.Mileage.OldChShDescription;

                    //ObjReturn.InteriorMileageDriver = objInteriorMileageDriverDetails;
                }
                //Added By Bhushan Dod on 06/09/2017 for Damage in mobile app
                if (ObjVehicleDetail.EngineExteriorDetails != null)
                {
                    var objEngineExteriorDetails = new eFleetEngineExteriorModel();
                    objEngineExteriorDetails = GenericDataContractSerializer <eFleetEngineExteriorModel> .DeserializeXml(ObjVehicleDetail.EngineExteriorDetails);

                    //ObjReturn.EngineExterior = objEngineExteriorDetails;
                }
                //Added By Bhushan Dod on 06/09/2017 for Damage in mobile app
                if (ObjVehicleDetail.EmergencyAccessoriesDetails != null)
                {
                    var objEmergencyAccessoriesDetails = new eFleetEmergencyAccessoriesModel();
                    objEmergencyAccessoriesDetails = GenericDataContractSerializer <eFleetEmergencyAccessoriesModel> .DeserializeXml(ObjVehicleDetail.EmergencyAccessoriesDetails);

                    //ObjReturn.EmergencyAccessories = objEmergencyAccessoriesDetails;
                }
                return(ObjReturn);
            }
            catch (Exception ex)
            {
                WorkOrderEMS.BusinessLogic.Exception_B.Exception_B.exceptionHandel_Runtime(ex, "VehicleScanModel GeteFleetVehicleById(long vehicleId, long locationId)", "while fetching GeteFleetVehicleById", QRCodeID);
                return(null);
            }
        }