コード例 #1
0
        public void SaveCertSerialNum(CertSerialNoDetailModel model)
        {
            if (model.VehicleId != 0)
            {
                var client  = new RestClient(IceCashRequestUrl + "SaveCertSerialNum");
                var request = new RestRequest(Method.POST);
                request.AddHeader("cache-control", "no-cache");
                request.AddHeader("content-type", "application/json");
                request.AddHeader("password", "Geninsure@123");
                request.AddHeader("username", "*****@*****.**");
                request.RequestFormat = DataFormat.Json;
                request.AddJsonBody(model);

                //request.Timeout = 5000;
                //request.ReadWriteTimeout = 5000;
                IRestResponse response = client.Execute(request);


                try
                {
                    Service_db service  = new Service_db();
                    string     branchId = service.ReadBranchFromLogFile();


                    var           apiStock     = new RestClient("http://api.gene.co.zw/inventory/api/paper/usage/" + branchId + "/" + model.CertSerialNo + "");
                    var           stockRequest = new RestRequest(Method.GET);
                    IRestResponse responseAPI  = apiStock.Execute(stockRequest);
                }
                catch (Exception e)
                {
                }
            }
        }
コード例 #2
0
        private void txtCertificateSerialNumber_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    if (valatedSerialNumber(txtCertificateSerialNumber.Text))
                    {
                        //else
                        //{
                        //    MessageBox.Show("Please Eneter the correct Serial Number", "Error");
                        //}

                        frmLicence quotObj = new frmLicence();
                        quotObj.CertificateNumber = txtCertificateSerialNumber.Text;
                        var response = ICEcashService.LICCertConf(RiskDetailModel, ParternToken, txtCertificateSerialNumber.Text);

                        if (response != null && response.Response.Message.Contains("Partner Token has expired"))
                        {
                            ObjToken     = IcServiceobj.getToken();
                            ParternToken = ObjToken.Response.PartnerToken;
                            Service_db.UpdateToken(ObjToken);
                            response = ICEcashService.LICCertConf(RiskDetailModel, ParternToken, txtCertificateSerialNumber.Text);
                        }

                        CertSerialNoDetailModel model = new CertSerialNoDetailModel();
                        model.VehicleId    = RiskDetailModel.Id;
                        model.CertSerialNo = txtCertificateSerialNumber.Text;

                        SaveCertSerialNum(model);

                        MessageBox.Show(response.Response.Message);
                        this.Close();
                        Form1 obj = new Form1();
                        obj.Show();
                    }
                    else
                    {
                        MessageBox.Show("Please Eneter the correct Serial Number", "Error");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #3
0
        public void SaveCertSerialNum(CertSerialNoDetailModel model)
        {
            if (model.VehicleId != 0)
            {
                var client  = new RestClient(IceCashRequestUrl + "SaveCertSerialNum");
                var request = new RestRequest(Method.POST);
                request.AddHeader("cache-control", "no-cache");
                request.AddHeader("content-type", "application/json");
                request.AddHeader("password", "Geninsure@123");
                request.AddHeader("username", "*****@*****.**");
                request.RequestFormat = DataFormat.Json;
                request.AddJsonBody(model);

                //request.Timeout = 5000;
                //request.ReadWriteTimeout = 5000;
                IRestResponse response = client.Execute(request);
            }
        }
コード例 #4
0
        private void btnScan_Click(object sender, EventArgs e)
        {
            try
            {
                pictureBox2.Visible    = true;
                pictureBox2.WaitOnLoad = true;
                var pdfPath = SavePdf(_base64Data);

                //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";
                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(pdfPath);
                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();


                //MessageBox.Show("Please Print Licence Disk.                                                                       ", "Print License Disk");

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

                printPDFWithAcrobat(destinationFileName);

                CreateLicenseFile(_base64Data);

                CertSerialNoDetailModel model = new CertSerialNoDetailModel();
                model.VehicleId    = RiskDetailModel.Id;
                model.CertSerialNo = txtCertificateSerialNumber.Text;

                SaveCertSerialNum(model);

                //  pictureBox2.WaitOnLoad = false;
                pictureBox2.Visible = false;
                txtCertificateSerialNumber.ForeColor = Color.Gray;

                txtCertificateSerialNumber.Focus();
            }
            catch (Exception ex)
            {
                pictureBox2.WaitOnLoad = false;
                pictureBox2.Visible    = false;
                // MessageBox.Show(ex.Message);
                MyMessageBox.ShowBox(ex.Message, "Modal error message");
            }
        }