Exemplo n.º 1
0
        Vehicle IViolationHistory.GetViolationHistoryByPlateNumber(string country, string emirate, string plateCategory, string plateNumber, string plateCode)
        {
            try
            {
                violationService.ViolationInformationServiceClient service = new violationService.ViolationInformationServiceClient();
                //violationService.ViolationInformationService service = new violationService.ViolationInformationService();
                //   violationService.ViolationInformationService service = new violationService.ViolationBlockedService()


                violationService.Inspection[] inspection;
                violationService.AuthHeader header = new VSDApp.violationService.AuthHeader();
                header.userName = AppProperties.empUserName;
                header.password = AppProperties.empPassword;

                // violationService.
                //   service.authHeader = header;

                // service.Timeout = 180000;
                violationService.Response response = new VSDApp.violationService.Response();

               

                violationService.VehiclePlate vehPlate = new violationService.VehiclePlate();
                vehPlate.category = (plateCategory != "") ? plateCategory.Trim() : "NA";
                vehPlate.code = (plateCode != "") ? plateCode.Trim() : "NA";
                vehPlate.number = plateNumber.Trim();
                vehPlate.source = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetPlateSourceCode((emirate == "") ? country : emirate).Trim();
                //service.max

                //  inspection = service.inquireViolationById("S-VI-IV-1", vioID, out response);
                inspection = service.inquireViolationByPlate(header, "S-VI-IV-1", vehPlate, out response);
                //  service.inquireViolationByPlate(header,"",





                if (response.code.Equals("1000"))
                {
                    // Resources res = Resources.GetInstance();
                    // bool isEng = (res.GetLocale().Equals(Resources.locale_EN));
                    bool isEng = true;
                    AppProperties.vehicle = null;

                    AppProperties.vehicle = new Vehicle();
                    AppProperties.vehicle.PlateCategory = inspection[0].vehicle.plateDetails.category;
                    AppProperties.vehicle.PlateCode = inspection[0].vehicle.plateDetails.code;
                    AppProperties.vehicle.Emirate = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetPlateEmirateByCode(inspection[0].vehicle.plateDetails.source).Trim();
                    AppProperties.vehicle.PlateNumber = inspection[0].vehicle.plateDetails.number;
                    // AppProperties.vehicle.Country = inspection[0].vehicle.country;
                    if (inspection[0].vehicle.country == null)
                        AppProperties.vehicle.Country = country;
                    else
                        AppProperties.vehicle.Country = inspection[0].vehicle.country;
                    AppProperties.vehicle.ChassisNumber = inspection[0].vehicle.chassisNumber;
                    AppProperties.vehicle.Year = inspection[0].vehicle.manufacturedYear;
                    if (AppProperties.vehicle.Operator == null)
                    {
                        AppProperties.vehicle.Operator = new Operator();
                    }
                    if (AppProperties.Selected_Resource == "English")
                    {
                        if (inspection[0].vehicle.manufacturer.name == null || inspection[0].vehicle.manufacturer.name == "")
                            AppProperties.vehicle.Make = inspection[0].vehicle.manufacturer.nameArabic;
                        else
                            AppProperties.vehicle.Make = inspection[0].vehicle.manufacturer.name;
                        if (inspection[0].vehicle.manufacturer.model == null || inspection[0].vehicle.manufacturer.model == "")
                            AppProperties.vehicle.Model = inspection[0].vehicle.manufacturer.modelArabic;
                        else
                            AppProperties.vehicle.Model = inspection[0].vehicle.manufacturer.model;
                        if (inspection[0].vehicle.owner.ownerName == null || inspection[0].vehicle.owner.ownerName == "")
                            AppProperties.vehicle.Operator.OperatorName = inspection[0].vehicle.owner.ownerNameArabic;
                        else
                            AppProperties.vehicle.Operator.OperatorName = inspection[0].vehicle.owner.ownerName;
                    }
                    else
                    {
                        if (inspection[0].vehicle.manufacturer.name != null || inspection[0].vehicle.manufacturer.name != "")
                            AppProperties.vehicle.Make = inspection[0].vehicle.manufacturer.nameArabic;
                        else
                            AppProperties.vehicle.Make = inspection[0].vehicle.manufacturer.name;
                        if (inspection[0].vehicle.manufacturer.model != null || inspection[0].vehicle.manufacturer.model != "")
                            AppProperties.vehicle.Model = inspection[0].vehicle.manufacturer.model;
                        else
                            AppProperties.vehicle.Model = inspection[0].vehicle.manufacturer.modelArabic;
                        if (inspection[0].vehicle.owner.ownerName != null || inspection[0].vehicle.owner.ownerName != "")
                            AppProperties.vehicle.Operator.OperatorName = inspection[0].vehicle.owner.ownerNameArabic;
                        else
                            AppProperties.vehicle.Operator.OperatorName = inspection[0].vehicle.owner.ownerName;
                    }


                    //  AppProperties.vehicle.Operator = new Operator();
                    AppProperties.vehicle.Operator.OperatorName = inspection[0].vehicle.owner.ownerName;
                    AppProperties.vehicle.Operator.OperatorNameAr = inspection[0].vehicle.owner.ownerNameArabic;
                    AppProperties.vehicle.Operator.TrafficFileNumber = inspection[0].vehicle.owner.trafficFileNumber;


                    AppProperties.vehicle.VehicleOVRRScore = (null != inspection[0].vehicle.riskRating) ? inspection[0].vehicle.riskRating.riskRatingName : "";

                    //AppProperties.vehicle.Recomendation = ((null != respItem.plateConfiscationInstruction) ? ((respItem.plateConfiscationInstruction.Equals("false", StringComparison.CurrentCultureIgnoreCase)) ? "" : Resources.GetInstance().GetString("Confiscate")) : "");
                    // AppProperties.vehicle.Recomendation = ((null != inspection[0].plateConfiscationInstruction) ? ((inspection[0].plateConfiscationInstruction.Equals("false", StringComparison.CurrentCultureIgnoreCase)) ? "" : "Confiscate") : "");
                    // AppProperties.vehicle.Instruction = (null != inspection[0].inspectionInstruction) ? inspection[0].inspectionInstruction : "";

                    // Violation[] searchedViolation = new Violation[1];
                    if (null != inspection)
                    {

                        Violation[] searchedViolation = new Violation[inspection.Length];

                        for (int i = 0; i < inspection.Length; i++)
                        {
                            searchedViolation[i] = new Violation();



                            //  searchedViolation[0] = new Violation();

                            searchedViolation[i].ViolationComments = inspection[i].violation.comments;
                            searchedViolation[i].ViolationCommentsAr = inspection[i].violation.commentsArabic;
                            searchedViolation[i].Inspection_location = inspection[i].locationName;
                            searchedViolation[i].Inspection_locationAr = inspection[i].locationNameArabic;
                            searchedViolation[i].ViolationDueDays = inspection[i].violation.dueDate;
                            searchedViolation[i].ViolationIssueDate = inspection[i].time;
                            searchedViolation[i].ViolationID = inspection[i].violation.ticketNumber;
                            searchedViolation[i].ViolationTicketCode = inspection[i].violation.ticketNumber;
                            searchedViolation[i].ViolationStatus = (isEng) ? inspection[i].violation.statusName : inspection[i].violation.statusNameArabic;
                            searchedViolation[i].ViolationSeverity = inspection[i].violation.severityLevel.name;
                            searchedViolation[i].ViolationSeverityAr = inspection[i].violation.severityLevel.nameArabic;

                            searchedViolation[i].DriverLicNo = inspection[i].vehicle.driver.licenseNumber;
                            searchedViolation[i].RtaEmpID = inspection[i].inspectorEmployeeId;

                            Violation.Defects[] searchedDefects = new Violation.Defects[inspection[i].violation.defects.Length];
                            for (int j = 0; j < searchedDefects.Length; j++)
                            {
                                int id;
                                searchedDefects[j] = new Violation.Defects();
                                searchedDefects[j].DefectID = ((id = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectIDByCode(inspection[i].violation.defects[j].code)) != -1) ? id : 0;
                                //  searchedDefects[i].DefectName = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectNameByID(inspection[0].violation.defects[i].code);
                                searchedDefects[j].DefectName = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectNameByID(inspection[i].violation.defects[j].code);
                                searchedDefects[j].DefectNameAr = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectNameArByID(inspection[i].violation.defects[j].code);
                                searchedDefects[j].DefectCode = inspection[i].violation.defects[j].code;
                                searchedDefects[j].DefectType = inspection[i].violation.defects[j].type;
                                searchedDefects[j].DefectCategory = inspection[i].violation.defects[j].category;
                                searchedDefects[j].DefectValue = inspection[i].violation.defects[j].comment;
                                string[][] cat = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectMainCategoryByID(searchedDefects[j].DefectCode.ToString());

                                if (cat.Length > 0)
                                {
                                    searchedDefects[j].DefectCategory = cat[0][0].Trim();

                                }

                                if (null != inspection[i].violation.defects[j].vehicleCategories && inspection[i].violation.defects[j].vehicleCategories.Length > 0)
                                {
                                    searchedDefects[j].DefectSeverity = inspection[i].violation.defects[j].vehicleCategories[0].defectSeverityLevel.name;
                                    searchedDefects[j].DefectSeverityAr = inspection[i].violation.defects[j].vehicleCategories[0].defectSeverityLevel.nameArabic;
                                }
                            }
                            searchedViolation[i].Defect = searchedDefects;
                            AppProperties.vehicle.Violations = searchedViolation;

                        }
                    }
                }
                else if (response.code.Equals("2000"))
                {
                    AppProperties.businessError = true;
                    AppProperties.errorMessageFromBusiness = response.message;

                }
                else
                {
                    AppProperties.NotFoundError = true;
                    AppProperties.errorMessageFromBusiness = response.message;
                    //System.Windows.Forms.MessageBox.Show(response.message);
                }

            }
            catch (Exception connectionEx)
            {
               // CommonUtils.WriteLog(connectionEx.StackTrace)
                    AppProperties.IsException = true;
                    AppProperties.errorMessageFromBusiness = connectionEx.InnerException.Message;
               // System.Windows.Forms.MessageBox.Show(connectionEx.Message);
            }
            return null;
        }
Exemplo n.º 2
0
        Vehicle IVehicleProfile.GetVehicleProfileDetails(string country, string emirate, string plateCategory, string plateNumber, string plateCode)
        {
            try
            {
                AppProperties.isComprehensive = false;
                AppProperties.isSafety = true;

                handHeldService.HandHeldService service = new VSDApp.handHeldService.HandHeldService();
                handHeldService.AuthHeader header = new VSDApp.handHeldService.AuthHeader();
                header.password = AppProperties.empPassword;
                header.userName = AppProperties.empUserName;

                service.authHeader = header;


                handHeldService.VehiclePlate vehPlate = new VSDApp.handHeldService.VehiclePlate();
                vehPlate.category = (plateCategory != "") ? plateCategory.Trim() : "NA";
                vehPlate.code = (plateCode != "") ? plateCode.Trim() : "NA";
                vehPlate.number = plateNumber.Trim();
                vehPlate.source = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetPlateSourceCode((emirate == "") ? country : emirate).Trim();

                if (AppProperties.vehicle == null)
                {
                    AppProperties.vehicle = new Vehicle();
                }
                AppProperties.vehicle.Country = country.Trim();
                AppProperties.vehicle.Emirate = emirate.Trim();
                AppProperties.vehicle.PlateCategory = vehPlate.category.Trim();
                AppProperties.vehicle.PlateNumber = vehPlate.number.Trim();
                AppProperties.vehicle.PlateCode = vehPlate.code.Trim();



                handHeldService.InquireVehicleProfileResponseItem respItem = new VSDApp.handHeldService.InquireVehicleProfileResponseItem();
                service.Timeout = 180000;
                


                respItem = service.inquireVehicleProfile("H-PS-IVP-1", vehPlate);

                if (respItem.response.code.Equals("1000"))
                {
                    
                    AppProperties.vehicle.ChassisNumber = respItem.vehicle.chassisNumber;
                    AppProperties.vehicle.Year = respItem.vehicle.manufacturedYear;
                    if (AppProperties.vehicle.Operator == null)
                    {
                        AppProperties.vehicle.Operator = new Operator();
                    }
                    if (AppProperties.Selected_Resource == "English")
                    {
                        if (respItem.vehicle.manufacturer.name == null || respItem.vehicle.manufacturer.name == "")
                            AppProperties.vehicle.Make = respItem.vehicle.manufacturer.nameArabic;
                        else
                            AppProperties.vehicle.Make = respItem.vehicle.manufacturer.name;
                        if (respItem.vehicle.manufacturer.model == null || respItem.vehicle.manufacturer.model == "")
                            AppProperties.vehicle.Model = respItem.vehicle.manufacturer.modelArabic;
                        else
                            AppProperties.vehicle.Model = respItem.vehicle.manufacturer.model;
                        if (respItem.vehicle.owner.ownerName == null || respItem.vehicle.owner.ownerName == "")
                            AppProperties.vehicle.Operator.OperatorName = respItem.vehicle.owner.ownerNameArabic;
                        else
                            AppProperties.vehicle.Operator.OperatorName = respItem.vehicle.owner.ownerName;
                    }
                    else
                    {
                        if (respItem.vehicle.manufacturer.name != null || respItem.vehicle.manufacturer.name != "")
                            AppProperties.vehicle.Make = respItem.vehicle.manufacturer.nameArabic;
                        else
                            AppProperties.vehicle.Make = respItem.vehicle.manufacturer.name;
                        if (respItem.vehicle.manufacturer.model != null || respItem.vehicle.manufacturer.model != "")
                            AppProperties.vehicle.Model = respItem.vehicle.manufacturer.model;
                        else
                            AppProperties.vehicle.Model = respItem.vehicle.manufacturer.modelArabic;
                        if (respItem.vehicle.owner.ownerName != null || respItem.vehicle.owner.ownerName != "")
                            AppProperties.vehicle.Operator.OperatorName = respItem.vehicle.owner.ownerNameArabic;
                        else
                            AppProperties.vehicle.Operator.OperatorName = respItem.vehicle.owner.ownerName;
                    }




                    //AppProperties.vehicle.Operator.OperatorNameAr = respItem.vehicle.owner.ownerNameArabic;
                    AppProperties.vehicle.Operator.TrafficFileNumber = respItem.vehicle.owner.trafficFileNumber;
                    AppProperties.vehicle.PlateCategory = plateCategory;
                    AppProperties.vehicle.PlateCode = plateCode;
                    AppProperties.vehicle.PlateNumber = plateNumber;
                    if (respItem.vehicle.category.code == null)
                    {
                        respItem.vehicle.category.code = "NA";
                    }
                    AppProperties.vehicle.VehicleCategory = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetVehicleCategoryNameByCode(respItem.vehicle.category.code).Trim();
                    AppProperties.vehicle.VehicleCategoryAr = respItem.vehicle.category.nameArabic;
                    AppProperties.vehicle.VehicleOVRRScore = (null != respItem.vehicle.riskRating) ? respItem.vehicle.riskRating.riskRatingName : "";

                    //AppProperties.vehicle.Recomendation = ((null != respItem.plateConfiscationInstruction) ? ((respItem.plateConfiscationInstruction.Equals("false", StringComparison.CurrentCultureIgnoreCase)) ? "" : Resources.GetInstance().GetString("Confiscate")) : "");
                    AppProperties.vehicle.Recomendation = ((null != respItem.plateConfiscationInstruction) ? ((respItem.plateConfiscationInstruction.Equals("false", StringComparison.CurrentCultureIgnoreCase)) ? "" : "Confiscate") : "");
                    AppProperties.vehicle.Instruction = (null != respItem.inspectionInstruction) ? respItem.inspectionInstruction : "";

                    if (null != respItem.violations)
                    {

                        Violation[] violations = new Violation[respItem.violations.Length];

                        for (int i = 0; i < respItem.violations.Length; i++)
                        {
                            violations[i] = new Violation();
                            violations[i].ConfiscationReason = respItem.violations[i].plateConfiscatedReason;
                            violations[i].ConfiscationReasonAr = respItem.violations[i].plateConfiscatedReasonArabic;
                            violations[i].Inspector = respItem.violations[i].inspectorName;
                            violations[i].Inspection_location = respItem.violations[i].address;
                            violations[i].Inspection_locationAr = respItem.violations[i].addressArabic;
                            // violations[i].InspectionArea = respItem.violations[i].kloca;
                            violations[i].IsConfiscated = (respItem.violations[i].isPlateConfiscated != null) ? true : false;
                            violations[i].ViolationComments = respItem.violations[i].violation.comments;
                            violations[i].ViolationCommentsAr = respItem.violations[i].violation.commentsArabic;
                            violations[i].ViolationDueDays = respItem.violations[i].violation.dueDate;
                            violations[i].ViolationIssueDate = respItem.violations[i].time;
                            violations[i].ViolationID = (null == respItem.violations[i].violation.violationId) ? "0" : respItem.violations[i].violation.violationId.ToString();
                            violations[i].ViolationSeverity = respItem.violations[i].violation.severityLevel.name;
                            violations[i].ViolationSeverityAr = respItem.violations[i].violation.severityLevel.nameArabic;
                            //violations[i].ViolationSource = respItem.violations[i].violation.severityLevel.channel;
                            violations[i].ViolationStatus = respItem.violations[i].violation.statusName;
                            violations[i].ViolationTicketCode = respItem.violations[i].violation.ticketNumber;

                            //Driver Lic No

                            // violations[i]respItem.vehicle.driver.licenseNumber;
                            violations[i].RtaEmpID = respItem.violations[i].inspectorEmployeeId;
                            violations[i].DriverLicNo = respItem.violations[i].vehicle.driver.licenseNumber;




                            if (null != respItem.violations[i].violation.testTypeName)
                            {
                                if (!AppProperties.isComprehensive)
                                {

                                    AppProperties.isComprehensive = ((respItem.violations[i].violation.testTypeName.StartsWith("Comprehens", StringComparison.CurrentCultureIgnoreCase)) && !(violations[i].ViolationStatus.Equals("Closed", StringComparison.CurrentCultureIgnoreCase))) ? true : false;
                                }
                            }

                            // if (Resources.GetInstance().GetLocale().Equals(Resources.locale_EN))
                            if (AppProperties.Selected_Resource == "English")
                            {
                                //checking if a major or severe violation already exists
                                ((IDBManager)DBBusinessRuleManager.GetInstance()).GetRecommendation(violations[i].ViolationDueDays, violations[i].ViolationStatus, AppProperties.vehicle.Emirate, violations[i].ViolationSeverity);

                            }
                            else
                            {
                                //checking a major or severe violation already exists
                                ((IDBManager)DBBusinessRuleManager.GetInstance()).GetRecommendation(violations[i].ViolationDueDays, violations[i].ViolationStatus, AppProperties.vehicle.Emirate, violations[i].ViolationSeverityAr);
                            }

                            if (respItem.violations[i].violation.defects.Length > 0)
                            {
                                Violation.Defects[] defects = new Violation.Defects[respItem.violations[i].violation.defects.Length];
                                for (int j = 0; j < defects.Length; j++)
                                {
                                    int id;
                                    defects[j] = new Violation.Defects();
                                    defects[j].DefectID = ((id = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectIDByCode(respItem.violations[i].violation.defects[j].code)) != -1) ? id : 0;

                                    //  string[][] cat = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectMainCategory();


                                    if (violations[i].ViolationStatus.StartsWith("Open", StringComparison.CurrentCultureIgnoreCase))
                                    {
                                        AppProperties.previousDefectIDs.Add(defects[j].DefectID);
                                    }
                                    defects[j].DefectType = respItem.violations[i].violation.defects[j].type;
                                    defects[j].DefectName = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectNameByID(respItem.violations[i].violation.defects[j].code);

                                    defects[j].DefectNameAr = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectNameArByID(respItem.violations[i].violation.defects[j].code);
                                    defects[j].DefectCode = respItem.violations[i].violation.defects[j].code;
                                    defects[j].DefectValue = respItem.violations[i].violation.defects[j].comment;
                                    //  defects[j].DefectCategory = respItem.violations[i].violation.defects[j].category;
                                    string[][] cat = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectMainCategoryByID(defects[j].DefectCode.ToString());

                                    if (cat.Length > 0)
                                    {
                                        defects[j].DefectCategory = cat[0][0].Trim();

                                    }


                                    if (null != respItem.violations[i].violation.defects[j].vehicleCategories && respItem.violations[i].violation.defects[j].vehicleCategories.Length > 0)
                                    {
                                        defects[j].DefectSeverity = respItem.violations[i].violation.defects[j].vehicleCategories[0].defectSeverityLevel.name;
                                        defects[j].DefectSeverityAr = respItem.violations[i].violation.defects[j].vehicleCategories[0].defectSeverityLevel.nameArabic;
                                    }



                                }
                                violations[i].Defect = defects;
                            }
                            
                        }
                        AppProperties.vehicle.Violations = violations;
                    }
                   

                }
                else if (respItem.response.code.Equals("2000"))
                {
                    AppProperties.businessError = true;
                    AppProperties.errorMessageFromBusiness = respItem.response.message;

                }
                else
                {
                   // System.Windows.Forms.MessageBox.Show(respItem.response.message);
                    AppProperties.vehicle = null;
                    return null;
                }

            }
            ////catch (NullReferenceException exNull)
            ////{
            ////    System.Windows.Forms.MessageBox.Show("Vehicle Info not found");
            ////    AppProperties.isOnline = false;
            ////    return null;
            ////}
            catch (Exception e)
            {
               // CommonUtils.WriteLog(e.StackTrace);
              //  System.Windows.Forms.MessageBox.Show(e.Message);
              //  AppProperties.isOnline = false;
                AppProperties.IsException = true;
                return null;
            }
            return AppProperties.vehicle;
        }
Exemplo n.º 3
0
        Vehicle IViolationHistory.GetViolationHistoryByID(string vioID)
        {
            try
            {
                violationService.ViolationInformationServiceClient service = new violationService.ViolationInformationServiceClient();
                //violationService.ViolationInformationService service = new violationService.ViolationInformationService();
                //   violationService.ViolationInformationService service = new violationService.ViolationBlockedService()


                violationService.Inspection[] inspection;
                violationService.AuthHeader header = new VSDApp.violationService.AuthHeader();
                header.userName = AppProperties.empUserName;
                header.password = AppProperties.empPassword;

                //   service.authHeader = header;

                // service.Timeout = 180000;
                violationService.Response response = new VSDApp.violationService.Response();
                //  inspection = service.inquireViolationById("S-VI-IV-1", vioID, out response);
                inspection = service.inquireViolationById(header, "S-VI-IV-1", vioID, out response);
                // service.inquireViolationByPlate(





                if (response.code.Equals("1000"))
                {
                    // Resources res = Resources.GetInstance();
                    // bool isEng = (res.GetLocale().Equals(Resources.locale_EN));
                    bool isEng = true;
                    AppProperties.vehicle = null;

                    AppProperties.vehicle = new Vehicle();
                    AppProperties.vehicle.PlateCategory = inspection[0].vehicle.plateDetails.category;
                    AppProperties.vehicle.PlateCode = inspection[0].vehicle.plateDetails.code;
                    AppProperties.vehicle.Emirate = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetPlateEmirateByCode(inspection[0].vehicle.plateDetails.source).Trim();
                    AppProperties.vehicle.PlateNumber = inspection[0].vehicle.plateDetails.number;
                    AppProperties.vehicle.Country = inspection[0].vehicle.country;

                    AppProperties.vehicle.ChassisNumber = inspection[0].vehicle.chassisNumber;
                    AppProperties.vehicle.Make = (isEng) ? inspection[0].vehicle.manufacturer.name : inspection[0].vehicle.manufacturer.nameArabic;
                    AppProperties.vehicle.Model = (isEng) ? inspection[0].vehicle.manufacturer.model : inspection[0].vehicle.manufacturer.modelArabic;
                    AppProperties.vehicle.Year = inspection[0].vehicle.manufacturedYear;


                    AppProperties.vehicle.Operator = new Operator();
                    AppProperties.vehicle.Operator.OperatorName = inspection[0].vehicle.owner.ownerName;
                    AppProperties.vehicle.Operator.OperatorNameAr = inspection[0].vehicle.owner.ownerNameArabic;
                    AppProperties.vehicle.Operator.TrafficFileNumber = inspection[0].vehicle.owner.trafficFileNumber;

                    Violation[] searchedViolation = new Violation[1];
                    searchedViolation[0] = new Violation();

                    searchedViolation[0].ViolationComments = inspection[0].violation.comments;
                    searchedViolation[0].ViolationCommentsAr = inspection[0].violation.commentsArabic;
                    searchedViolation[0].Inspection_location = inspection[0].locationName;
                    searchedViolation[0].Inspection_locationAr = inspection[0].locationNameArabic;
                    searchedViolation[0].ViolationDueDays = inspection[0].violation.dueDate;
                    searchedViolation[0].ViolationIssueDate = inspection[0].time;
                    searchedViolation[0].ViolationID = vioID;
                    searchedViolation[0].ViolationTicketCode = vioID;
                    searchedViolation[0].ViolationStatus = (isEng) ? inspection[0].violation.statusName : inspection[0].violation.statusNameArabic;
                    searchedViolation[0].ViolationSeverity = inspection[0].violation.severityLevel.name;
                    searchedViolation[0].ViolationSeverityAr = inspection[0].violation.severityLevel.nameArabic;

                    searchedViolation[0].DriverLicNo = inspection[0].vehicle.driver.licenseNumber;
                    searchedViolation[0].RtaEmpID = inspection[0].inspectorEmployeeId;

                    Violation.Defects[] searchedDefects = new Violation.Defects[inspection[0].violation.defects.Length];
                    for (int i = 0; i < searchedDefects.Length; i++)
                    {
                        int id;
                        searchedDefects[i] = new Violation.Defects();
                        searchedDefects[i].DefectID = ((id = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectIDByCode(inspection[0].violation.defects[i].code)) != -1) ? id : 0;
                        //  searchedDefects[i].DefectName = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectNameByID(inspection[0].violation.defects[i].code);
                        searchedDefects[i].DefectName = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectNameByID(inspection[0].violation.defects[i].code);
                        searchedDefects[i].DefectNameAr = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectNameArByID(inspection[0].violation.defects[i].code);
                        searchedDefects[i].DefectCode = inspection[0].violation.defects[i].code;
                        searchedDefects[i].DefectType = inspection[0].violation.defects[i].type;
                        searchedDefects[i].DefectCategory = inspection[0].violation.defects[i].category;
                        searchedDefects[i].DefectValue = inspection[0].violation.defects[i].comment;
                        string[][] cat = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectMainCategoryByID(searchedDefects[i].DefectCode.ToString());

                        if (cat.Length > 0)
                        {
                            searchedDefects[i].DefectCategory = cat[0][0].Trim();

                        }
                        if (null != inspection[0].violation.defects[i].vehicleCategories && inspection[0].violation.defects[i].vehicleCategories.Length > 0)
                        {
                            searchedDefects[i].DefectSeverity = inspection[0].violation.defects[i].vehicleCategories[0].defectSeverityLevel.name;

                            searchedDefects[i].DefectSeverityAr = inspection[0].violation.defects[i].vehicleCategories[0].defectSeverityLevel.name;
                        }
                    }
                    searchedViolation[0].Defect = searchedDefects;
                    AppProperties.vehicle.Violations = searchedViolation;

                }
                else if (response.code.Equals("2000"))
                {
                    AppProperties.businessError = true;
                    AppProperties.errorMessageFromBusiness = response.message;

                }
                else
                {
                    AppProperties.NotFoundError = true;
                    AppProperties.errorMessageFromBusiness = response.message;
                   // System.Windows.Forms.MessageBox.Show(response.message);
                }

            }
            catch (Exception connectionEx)
            {
                CommonUtils.WriteLog(connectionEx.StackTrace);
               // System.Windows.Forms.MessageBox.Show(connectionEx.Message);
                AppProperties.IsException = true;
                AppProperties.errorMessageFromBusiness = connectionEx.InnerException.Message;
            }
            return null;
        }