private void GetVrnLicenseAndInsurace(string vrn)
        {
            vrn = "AAZ1001";
            VehicleDetails vehicleDetails = GetVehicelDetials(vrn);

            if (vehicleDetails != null)
            {
                IcServiceobj = new ICEcashService();
                ObjToken     = IcServiceobj.getToken();
                parternToken = ObjToken.Response.PartnerToken;
            }

            if (vehicleDetails != null && vehicleDetails.LicenseId != null)
            {
                ObjToken = IcServiceobj.getToken();
                if (ObjToken != null)
                {
                    parternToken = ObjToken.Response.PartnerToken;
                }

                ResultLicenceIDRootObject quoteresponseResult = IcServiceobj.LICResult(vehicleDetails.LicenseId, parternToken);
                if (quoteresponseResult.Response != null)
                {
                    lblRegNum.Text = quoteresponseResult.Response.VRN;
                }
            }
        }
示例#2
0
        private void btnPdf_Click(object sender, EventArgs e)
        {
            if (txtLicPdfCode.Text == "" || txtLicPdfCode.Text == "Registration/Pdf Verification Code")
            {
                txtLicPdfCode.Focus();
                errorProvider1.SetError(txtLicPdfCode, "Registration/Pdf Verification Code");
                return;
            }
            else
            {
                errorProvider1.Clear();
            }

            if (IsSearchByVrn == true && (txtOtp.Text == "" || txtOtp.Text == "OTP"))
            {
                txtOtp.Focus();
                errorProvider1.SetError(txtOtp, "Please enter otp");
                return;
            }



            var vehicelDetails = new VehicleDetails();

            if (txtLicPdfCode.Text != "" && (txtOtp.Text != "" && txtOtp.Text != "OTP"))
            {
                var reprintDetial = GetAlmPrintDetialByCode(txtOtp.Text);
                if (reprintDetial != null && reprintDetial.Id != 0)
                {
                    ALMRePrint reprint = new ALMRePrint();
                    reprint.VRN       = txtLicPdfCode.Text;
                    reprint.IsActive  = true;
                    reprint.Id        = reprintDetial.Id;
                    reprint.CreatedOn = DateTime.Now;
                    SaveAlmPrintDetial(reprint);
                    PrintOutByVRN(txtLicPdfCode.Text);
                }
                else
                {
                    MyMessageBox.ShowBox("Certificate is not found for this code", "Message");
                }
            }
            else
            {
                vehicelDetails = GetVehicelDetialsByLicPdfCode(txtLicPdfCode.Text);
                if (vehicelDetails != null && vehicelDetails.VehicelId != 0)
                {
                    RequestToke token = Service_db.GetLatestToken();
                    if (ObjToken != null)
                    {
                        parternToken = token.Token;
                    }

                    pictureBox2.Visible    = true;
                    pictureBox2.WaitOnLoad = true;

                    String WebUrlPath       = WebConfigurationManager.AppSettings["WebUrlPath"];
                    string filePath         = WebUrlPath + "/" + "Documents/License/" + vehicelDetails.VehicelId + ".pdf";
                    string optionalFilePath = WebUrlPath + "/" + "Documents/License/" + vehicelDetails.RegistrationNo + ".pdf";
                    //urlPath
                    //var pdfPath = SavePdfFromUrl(filePath, optionalFilePath);
                    //// var pdfPath = @"F:\sample.pdf";
                    //PdfDocument doc = new PdfDocument();
                    //doc.LoadFromFile(pdfPath);
                    //doc.Pages.Insert(0);
                    //doc.Pages.Add();
                    //doc.Pages.RemoveAt(0);//Since First page have always Red Text if use Free Version.
                    //doc.SaveToFile(pdfPath);


                    string installedPath = @"C:\Users\Public\";
                    string fileName      = "Certificate" + ".pdf";

                    var destinationFileName = System.IO.Path.Combine(installedPath, System.IO.Path.GetFileName(fileName));


                    PdfReader  reader  = new PdfReader(filePath);
                    PdfStamper stamper = new PdfStamper(reader, new FileStream(destinationFileName, FileMode.Create));
                    int        total   = reader.NumberOfPages;
                    for (int pageNumber = total; pageNumber > 0; pageNumber--)
                    {
                        stamper.InsertPage(pageNumber, PageSize.A4);
                    }
                    stamper.Close();
                    reader.Close();


                    MyMessageBox.ShowBox("Please Print Licence Disk. ", "Print License Disk");

                    printPDFWithAcrobat(destinationFileName);
                    pictureBox2.Visible = false;

                    riskDetail = new RiskDetailModel {
                        CombinedID = vehicelDetails.CombinedID, LicenseId = vehicelDetails.LicenseId, RegistrationNo = vehicelDetails.RegistrationNo
                    };


                    this.Close();
                    WebCertificateSerial obj = new WebCertificateSerial(riskDetail, parternToken);
                    obj.Show();
                }
                else
                {
                    pictureBox2.Visible = false;
                    MyMessageBox.ShowBox("Certificate is not found for this code", "Message");
                }
            }

            pictureBox2.Visible = false;
        }
        private void GetInsuranceDetials(VehicleDetails vehicelDetails)
        {
            //RiskDetailModel model = new RiskDetailModel {InsuranceId= vehicelDetails.in }

            //var res = ICEcashService.TPIPolicy(vehicleDetails, parternToken);
        }