Ejemplo n.º 1
0
    protected void btnSubmit_Click1(object sender, EventArgs e)
    {
        Utility utility = new Utility();

        try
        {
            if (Page.IsValid)
            {
                try
                {
                    txtSertifikat.Text      = string.Empty;
                    txtstatus.Text          = string.Empty;
                    txtPostExpressBroj.Text = string.Empty;
                    //-----------------GetUserAgent string---------------------------

                    /*
                     * string SettingValue = utility.getSettingsValueGlobalSettings(Constants.GLOBAL_GEOLOCATIONS);
                     * if (SettingValue == Constants.SETTING_VALUE_TRUE)
                     * {
                     *  GetUserAgentInformation(out userAgentBrowser, out userAgentStringApplicant, out userAgentOS, out userAgentIP);
                     *  log.Info("GetUserAgentInformation function. userAgentBrowser is " + userAgentBrowser + ". userAgentStringApplicant is " + userAgentStringApplicant + ". userAgentOS is " + userAgentOS + ". userAgentIP is " + userAgentIP);
                     *  PisMessServiceReference.IpGeolocationData ipGeolocationData = new PisMessServiceReference.IpGeolocationData();
                     *  try
                     *  {
                     *      ipGeolocationData = new PisMessServiceReference.PisMessServiceClient().SendIpGeolocationRequest(userAgentIP);
                     *  }
                     *  catch (Exception)
                     *  {
                     *      log.Error("IP address is not in correct format or it is empty. IP is: " + userAgentIP);
                     *  }
                     *  Utils.CheckIPGeolocationData(ipGeolocationData.Status, userAgentIP, ipGeolocationData.Country, ipGeolocationData.CountryCode, ipGeolocationData.City, ipGeolocationData.Isp, ipGeolocationData.Continent, out userAgentCountry, out userAgentCountryCode, out userAgentCity, out userAgentISP, out userAgentContinent);
                     * }
                     * else
                     * {
                     *  log.Info("Geolocation is not active!");
                     * }
                     */
                    Session["provera-statusa-zahteva-userAgentBrowser"]         = userAgentBrowser;
                    Session["provera-statusa-zahteva-userAgentStringApplicant"] = userAgentStringApplicant;
                    Session["provera-statusa-zahteva-userAgentOS"]          = userAgentOS;
                    Session["provera-statusa-zahteva-userAgentIP"]          = userAgentIP;
                    Session["provera-statusa-zahteva-userAgentContinent"]   = userAgentContinent;
                    Session["provera-statusa-zahteva-userAgentCountry"]     = userAgentCountry;
                    Session["provera-statusa-zahteva-userAgentCountryCode"] = userAgentCountryCode;
                    Session["provera-statusa-zahteva-userAgentCity"]        = userAgentCity;
                    Session["provera-statusa-zahteva-userAgentISP"]         = userAgentISP;

                    log.Info("Start sending first SOAP message with requestNumber.");

                    BxSoapEnvelope envelope = new BxSoapEnvelopeRequestStatus();

                    envelope.BxData.setValue(@"requestNumber", txtbrojzahteva.Text);
                    //todo samo zameni
                    //envelope.BxData.setValue(@"requestNumber", "2"); //fiksirano za test

                    string SOAPresponse = string.Empty;
                    try
                    {
                        SOAPresponse = BxSoap.SOAPManual(envelope.createBxSoapEnvelope());
                        log.Info("Response is: " + SOAPresponse);
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("Error. Response from BlueX is: " + SOAPresponse + ex.Message);
                    }

                    Certificates = Utils.ParseSoapEnvelopeRequestStatusPostExpressID(SOAPresponse);

                    if (Certificates == null)
                    {
                        throw new Exception("Error. Certificates List is null. " + SOAPresponse);
                    }
                    //todo za test
                    //Certificates.Add(new CertificateRequestStatus(8, "Production/Qualified Electronic Certificate Legal Enitity.xml-dev", "tokenContractConcluded"));
                    //Certificates.Add(new CertificateRequestStatus(9, "Production/Qualified Electronic Certificate Foreigner Legal Enitity.xml-dev", "tokenOrderPayed"));
                    Session["provera-statusa-zahteva-Certificates"] = Certificates;

                    log.Info("Successfully send first SOAP message with requestNumber.");

                    ddlListaSertifikata.Items.Clear();

                    if (Certificates.Count > 1)
                    {
                        Container0.Visible   = false;
                        Container00.Visible  = true;
                        Container000.Visible = true;

                        List <String> certificates = new List <String>();
                        foreach (var certificate in Certificates)
                        {
                            string CertificateTypeSrb = string.Empty;
                            SetUpCertificateTypeSrb(certificate.Type, out CertificateTypeSrb);
                            certificates.Add(CertificateTypeSrb);
                            txtPostExpressBroj.Text = certificate.PostExpressID;
                        }

                        ddlListaSertifikata.Items.Insert(0, utility.getItemText(Constants.DefaultIdItemLegal));
                        ddlListaSertifikata.DataSource = certificates;
                        ddlListaSertifikata.DataBind();
                    }
                    else if (Certificates.Count == 1)
                    {
                        Container0.Visible   = true;
                        Container00.Visible  = false;
                        Container000.Visible = true;
                        Container1.Visible   = true;

                        foreach (var certificate in Certificates)
                        {
                            string CertificateTypeSrb = string.Empty;
                            SetUpCertificateTypeSrb(certificate.Type, out CertificateTypeSrb);
                            txtSertifikat.Text      = CertificateTypeSrb;
                            txtPostExpressBroj.Text = certificate.PostExpressID;

                            SetUpCertificateStatusVariables(Constants.ITEM_CHALLENGE_RESPONSE, Constants.ITEM_STATUS_CHECK, certificate.Status, out Item, out ItemTextEnglish, out Notification, out ItemValue);

                            switch (ItemValue)
                            {
                            case 0:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 1:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 2:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 3:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 4:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 5:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 6:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 7:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 8:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 9:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 10:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 11:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 12:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 13:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 14:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 15:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 16:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 17:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 18:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 19:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 20:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 21:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 22:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 23:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 24:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 25:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 26:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            case 27:
                                SetUpCertificateStatus(Item, Notification, ItemValue);
                                break;

                            default:
                                //
                                break;
                            }
                        }
                        if (txtSertifikat.Text == string.Empty && txtPostExpressBroj.Text == string.Empty && txtstatus.Text == string.Empty)
                        {
                            NoStatusDisplay();
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), "successalert", "successalert();", true);
                        }
                    }
                    else
                    {
                        NoStatusDisplay();
                    }
                }
                catch (Exception ex)
                {
                    log.Info("Za navedeni broj zahteva " + txtbrojzahteva.Text + "nema statusa. " + ex.Message);
                    txtstatus.Text       = utility.pronadjiNaziveGresaka(Constants.ITEM_ERROR, Constants.ERROR_3373);
                    txtstatus.ForeColor  = System.Drawing.Color.Red;
                    Container000.Visible = false;
                    Container00.Visible  = false;
                    Container0.Visible   = false;
                    ScriptManager.RegisterStartupScript(this, GetType(), "Notification", "Notification();", true);
                    //log.Error("Error while sending request. " + ex.Message);
                    //ScriptManager.RegisterStartupScript(this, GetType(), "erroralertSendSOAP", "erroralertSendSOAP();", true);
                    ScriptManager.RegisterStartupScript(this, GetType(), "Disable", "DisableCalendar();", true);
                }
            }
            else if (!Page.IsValid)
            {
                Container000.Visible = false;
                Container00.Visible  = false;
                Container0.Visible   = false;
                txtstatus.Text       = string.Empty;
                ScriptManager.RegisterStartupScript(this, GetType(), "erroralert", "erroralert();", true);
            }
        }
        catch (Exception ex)
        {
            log.Error("Error while sending SOAP message. " + ex.Message);
            ScriptManager.RegisterStartupScript(this, GetType(), "errorSOAPalert", "errorSOAPalert();", true);
        }
    }
Ejemplo n.º 2
0
    protected void btnSubmit_Click1(object sender, EventArgs e)
    {
        Utility utility = new Utility();

        try
        {
            if (Page.IsValid)
            {
                txtime.Text            = string.Empty;
                txtprezime.Text        = string.Empty;
                txtdatumizdavanja.Text = string.Empty;
                txtdatumsiteka.Text    = string.Empty;
                try
                {
                    /*
                     * //-----------------GetUserAgent string---------------------------
                     * Utility utility = new Utility();
                     * string SettingValue = utility.getSettingsValueGlobalSettings(Constants.GLOBAL_GEOLOCATIONS);
                     * if (SettingValue == Constants.SETTING_VALUE_TRUE)
                     * {
                     *  GetUserAgentInformation(out userAgentBrowser, out userAgentStringApplicant, out userAgentOS, out userAgentIP);
                     *  log.Info("GetUserAgentInformation function. userAgentBrowser is " + userAgentBrowser + ". userAgentStringApplicant is " + userAgentStringApplicant + ". userAgentOS is " + userAgentOS + ". userAgentIP is " + userAgentIP);
                     *  PisMessServiceReference.IpGeolocationData ipGeolocationData = new PisMessServiceReference.IpGeolocationData();
                     *  try
                     *  {
                     *      ipGeolocationData = new PisMessServiceReference.PisMessServiceClient().SendIpGeolocationRequest(userAgentIP);
                     *  }
                     *  catch (Exception)
                     *  {
                     *      log.Error("IP address is not in correct format or it is empty. IP is: " + userAgentIP);
                     *  }
                     *  Utils.CheckIPGeolocationData(ipGeolocationData.Status, userAgentIP, ipGeolocationData.Country, ipGeolocationData.CountryCode, ipGeolocationData.City, ipGeolocationData.Isp, ipGeolocationData.Continent, out userAgentCountry, out userAgentCountryCode, out userAgentCity, out userAgentISP, out userAgentContinent);
                     * }
                     * else
                     * {
                     *  log.Info("Geolocation is not active!");
                     * }
                     * Session["zahtev-provera-datuma-isticanja-sertifikata-userAgentBrowser"] = userAgentBrowser;
                     * Session["zahtev-provera-datuma-isticanja-sertifikata-userAgentStringApplicant"] = userAgentStringApplicant;
                     * Session["zahtev-provera-datuma-isticanja-sertifikata-userAgentOS"] = userAgentOS;
                     * Session["zahtev-provera-datuma-isticanja-sertifikata-userAgentIP"] = userAgentIP;
                     * Session["zahtev-provera-datuma-isticanja-sertifikata-userAgentContinent"] = userAgentContinent;
                     * Session["zahtev-provera-datuma-isticanja-sertifikata-userAgentCountry"] = userAgentCountry;
                     * Session["zahtev-provera-datuma-isticanja-sertifikata-userAgentCountryCode"] = userAgentCountryCode;
                     * Session["zahtev-provera-datuma-isticanja-sertifikata-userAgentCity"] = userAgentCity;
                     * Session["zahtev-provera-datuma-isticanja-sertifikata-userAgentISP"] = userAgentISP;
                     * //todo Poslati SOAP poruku sa JIK-om i dobiti ime, prezime, datum izdavanja korisnika i datum isteka vaznosti sertifikata
                     */
                    log.Info("Start sending SOAP message with USI.");

                    BxSoapEnvelope envelope = new BxSoapEnvelopeCertificateStatusCheck();
                    //todo samo zameni
                    if (Session["zahtev-provera-datuma-isticanja-sertifikata-CertificateJIK"] != null)
                    {
                        string jik = Session["zahtev-provera-datuma-isticanja-sertifikata-CertificateJIK"].ToString();
                        if (jik != string.Empty)
                        {
                            envelope.BxData.setValue(@"USI", jik);
                        }
                        else
                        {
                            envelope.BxData.setValue(@"USI", txtjik.Text);
                        }
                    }
                    else
                    {
                        envelope.BxData.setValue(@"USI", txtjik.Text);
                    }
                    //envelope.BxData.setValue(@"USI", "PNORS-2603978934645");

                    string SOAPresponse = string.Empty;
                    try
                    {
                        SOAPresponse = BxSoap.SOAPManual(envelope.createBxSoapEnvelope());
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("Error. Response from BlueX is: " + SOAPresponse + ex.Message);
                    }

                    CertificateStatuses = Utils.ParseSoapEnvelopeCertificateStatusCheck(SOAPresponse);

                    if (CertificateStatuses == null)
                    {
                        throw new Exception("Error. CertificateStatuses List is null. " + SOAPresponse);
                    }

                    Session["zahtev-provera-datuma-isticanja-sertifikata-CertificateStatuses"] = CertificateStatuses;

                    log.Info("Successfully send SOAP message with USI.");

                    if (CertificateStatuses.Count > 0)
                    {
                        foreach (var certificatestatus in CertificateStatuses)
                        {
                            if (Session["zahtev-provera-datuma-isticanja-sertifikata-CertificateJIK"] != null)
                            {
                                string jik = Session["zahtev-provera-datuma-isticanja-sertifikata-CertificateJIK"].ToString();
                                if (jik != string.Empty)
                                {
                                    txtjik.Text = jik;
                                }
                            }
                            else
                            {
                                txtjik.Text = txtjik.Text;
                            }
                            errLabel.Text          = string.Empty;
                            txtime.Text            = certificatestatus.GivenName;
                            txtprezime.Text        = certificatestatus.LastName;
                            txtdatumizdavanja.Text = certificatestatus.ValidFrom;
                            txtdatumsiteka.Text    = certificatestatus.ValidTo;
                            ScriptManager.RegisterStartupScript(this, GetType(), "successalert", "successalert();", true);
                        }
                    }
                    else
                    {
                        log.Info("Za navedeni USI(JIK) " + txtjik.Text + "nema statusa.");
                        ScriptManager.RegisterStartupScript(this, GetType(), "Notification", "Notification();", true);
                    }
                }
                catch (Exception ex)
                {
                    log.Info("Za navedeni USI(JIK) " + txtjik.Text + "nema statusa. " + ex.Message);
                    ScriptManager.RegisterStartupScript(this, GetType(), "Notification", "Notification();", true);
                    errLabel.Text = utility.pronadjiNaziveGresaka(Constants.ITEM_ERROR, Constants.ERROR_3371);
                    //log.Error("Error while sending request. " + ex.Message);
                    //ScriptManager.RegisterStartupScript(this, GetType(), "erroralertSendSOAP", "erroralertSendSOAP();", true);
                }
            }
            else if (!Page.IsValid)
            {
                txtime.Text            = string.Empty;
                txtprezime.Text        = string.Empty;
                txtdatumizdavanja.Text = string.Empty;
                txtdatumsiteka.Text    = string.Empty;
                errLabel.Text          = string.Empty;
                ScriptManager.RegisterStartupScript(this, GetType(), "erroralert", "erroralert();", true);
            }

            if (rbAutomatikJik.Checked)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "EnableButton", "EnableButton();", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "DisableButton", "DisableButton();", true);
            }
            ScriptManager.RegisterStartupScript(this, GetType(), "EnableSubmitButton", "EnableSubmitButton();", true);
        }
        catch (Exception ex)
        {
            log.Error("Error while sending SOAP message. " + ex.Message);
            ScriptManager.RegisterStartupScript(this, GetType(), "errorSOAPalert", "errorSOAPalert();", true);
        }
    }
Ejemplo n.º 3
0
    protected void btnSubmit_Click1(object sender, EventArgs e)
    {
        Utility utility = new Utility();

        try
        {
            if (txtchallenge.Text == string.Empty)
            {
                cvchallenge.IsValid = true;
            }
            if (Page.IsValid)
            {
                try
                {
                    ContainerFirstState();
                    //-----------------GetUserAgent string---------------------------

                    /*
                     * string SettingValue = utility.getSettingsValueGlobalSettings(Constants.GLOBAL_GEOLOCATIONS);
                     * if (SettingValue == Constants.SETTING_VALUE_TRUE)
                     * {
                     *  GetUserAgentInformation(out userAgentBrowser, out userAgentStringApplicant, out userAgentOS, out userAgentIP);
                     *  log.Info("GetUserAgentInformation function. userAgentBrowser is " + userAgentBrowser + ". userAgentStringApplicant is " + userAgentStringApplicant + ". userAgentOS is " + userAgentOS + ". userAgentIP is " + userAgentIP);
                     *  PisMessServiceReference.IpGeolocationData ipGeolocationData = new PisMessServiceReference.IpGeolocationData();
                     *  try
                     *  {
                     *      ipGeolocationData = new PisMessServiceReference.PisMessServiceClient().SendIpGeolocationRequest(userAgentIP);
                     *  }
                     *  catch (Exception)
                     *  {
                     *      log.Error("IP address is not in correct format or it is empty. IP is: " + userAgentIP);
                     *  }
                     *  Utils.CheckIPGeolocationData(ipGeolocationData.Status, userAgentIP, ipGeolocationData.Country, ipGeolocationData.CountryCode, ipGeolocationData.City, ipGeolocationData.Isp, ipGeolocationData.Continent, out userAgentCountry, out userAgentCountryCode, out userAgentCity, out userAgentISP, out userAgentContinent);
                     * }
                     * else
                     * {
                     *  log.Info("Geolocation is not active!");
                     * }
                     * Session["zahtev-dobijanje-koda-deblokada-kartice-userAgentBrowser"] = userAgentBrowser;
                     * Session["zahtev-dobijanje-koda-deblokada-kartice-userAgentStringApplicant"] = userAgentStringApplicant;
                     * Session["zahtev-dobijanje-koda-deblokada-kartice-userAgentOS"] = userAgentOS;
                     * Session["zahtev-dobijanje-koda-deblokada-kartice-userAgentIP"] = userAgentIP;
                     * Session["zahtev-dobijanje-koda-deblokada-kartice-userAgentContinent"] = userAgentContinent;
                     * Session["zahtev-dobijanje-koda-deblokada-kartice-userAgentCountry"] = userAgentCountry;
                     * Session["zahtev-dobijanje-koda-deblokada-kartice-userAgentCountryCode"] = userAgentCountryCode;
                     * Session["zahtev-dobijanje-koda-deblokada-kartice-userAgentCity"] = userAgentCity;
                     * Session["zahtev-dobijanje-koda-deblokada-kartice-userAgentISP"] = userAgentISP;
                     */
                    log.Info("Start sending first SOAP message with requestNumber.");

                    BxSoapEnvelope envelope = new BxSoapEnvelopeRequestStatus();
                    //todo samo zameni
                    envelope.BxData.setValue(@"requestNumber", txtbrojzahteva.Text);
                    //envelope.BxData.setValue(@"requestNumber", "2"); //fiksirano za test

                    string SOAPresponse = string.Empty;
                    try
                    {
                        SOAPresponse = BxSoap.SOAPManual(envelope.createBxSoapEnvelope());
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("Error. Response from BlueX is: " + SOAPresponse + ex.Message);
                    }

                    Certificates = Utils.ParseSoapEnvelopeRequestStatus(SOAPresponse);

                    if (Certificates == null)
                    {
                        throw new Exception("Error. Certificates List is null. " + SOAPresponse);
                    }

                    //todo za test
                    //Certificates.Add(new CertificateRequestStatus(3, "Production/Authentication and Encryption Certificate.xml-dev", "requestUnblockDenied"));
                    //Certificates.Add(new CertificateRequestStatus(4, "Production/Qualified Electronic Certificate Foreigner Legal Enitity.xml-dev", "requestUnblockWaiting"));
                    Session["zahtev-dobijanje-koda-deblokada-kartice-Certificates"] = Certificates;

                    log.Info("Successfully send first SOAP message with requestNumber.");

                    ddlListaSertifikata.Items.Clear();

                    string RequestUnblockStatus = string.Empty;
                    SetUpRequestUnblockStatus(Constants.IDITEM_REQUEST_UNBLOCK_STATUS, out RequestUnblockStatus);
                    List <String> certificatesUblockToken = new List <String>();

                    foreach (var certificatesunblocktoken in Certificates)
                    {
                        if (RequestUnblockStatus.Equals(certificatesunblocktoken.Type))
                        {
                            if (Certificates.Count > 1)
                            {
                                List <String> certificates = new List <String>();
                                foreach (var certificate in Certificates)
                                {
                                    string CertificateTypeSrb = string.Empty;
                                    SetUpCertificateTypeSrb(certificate.Type, out CertificateTypeSrb);
                                    certificates.Add(CertificateTypeSrb);
                                }
                                Container0.Visible  = false;
                                Container00.Visible = true;

                                ddlListaSertifikata.Items.Insert(0, utility.getItemText(Constants.DefaultIdItemLegal));
                                ddlListaSertifikata.DataSource = certificates;
                                ddlListaSertifikata.DataBind();
                            }
                            else if (Certificates.Count == 1)
                            {
                                Container0.Visible  = true;
                                Container00.Visible = false;
                                Container1.Visible  = true;
                                Container4.Visible  = true;
                                txtobavestenje.Text = string.Empty;

                                foreach (var certificate in Certificates)
                                {
                                    string CertificateTypeSrb = string.Empty;
                                    SetUpCertificateTypeSrb(certificate.Type, out CertificateTypeSrb);
                                    txtSertifikat.Text = CertificateTypeSrb;

                                    SetUpCertificateStatusVariables(Constants.ITEM_CHALLENGE_RESPONSE, Constants.ITEM_STATUS_CHECK, certificate.Status, out Item, out ItemTextEnglish, out Notification, out ItemValue);

                                    if (ItemValue == Constants.ITEM_VALUE_APPROVED)
                                    {
                                        SetUpCertificateStatus(Item, Notification, ItemValue);
                                    }
                                    else if (ItemValue == Constants.ITEM_VALUE_WAITING)
                                    {
                                        SetUpCertificateStatus(Item, Notification, ItemValue);
                                    }
                                    else if (ItemValue == Constants.ITEM_VALUE_REFUSED)
                                    {
                                        SetUpCertificateStatus(Item, Notification, ItemValue);
                                    }
                                    else if (ItemValue == Constants.ITEM_VALUE_REQUESTED)
                                    {
                                        SetUpCertificateStatus(Item, Notification, ItemValue);
                                    }
                                    else if (ItemValue == Constants.ITEM_VALUE_COMPLETED)
                                    {
                                        SetUpCertificateStatus(Item, Notification, ItemValue);
                                    }
                                    else if (ItemValue == Constants.ITEM_VALUE_REFUSED_19)
                                    {
                                        SetUpCertificateStatus(Item, Notification, ItemValue);
                                    }
                                }
                            }
                            else
                            {
                                log.Info("Za navedeni broj zahteva " + txtbrojzahteva.Text + "nema statusa.");
                                ScriptManager.RegisterStartupScript(this, GetType(), "Notification", "Notification();", true);
                            }
                        }
                        else
                        {
                            errLabel.Text = utility.pronadjiNaziveGresaka(Constants.ITEM_ERROR, Constants.ERROR_3376);
                            log.Error("Za navedeni broj zahteva " + txtbrojzahteva.Text + "ne postoje podaci za udaljenu (Challenge-Reposnse) deblokadu.");
                            ScriptManager.RegisterStartupScript(this, GetType(), "erroralert", "erroralert();", true);
                        }
                    }
                }
                catch (Exception ex)
                {
                    log.Info("Za navedeni broj zahteva " + txtbrojzahteva.Text + "nema statusa. " + ex.Message);
                    ScriptManager.RegisterStartupScript(this, GetType(), "Notification", "Notification();", true);
                    //ScriptManager.RegisterStartupScript(this, GetType(), "erroralertSendSOAP", "erroralertSendSOAP();", true);
                    //log.Error("Error while sending request. " + ex.Message);
                    ScriptManager.RegisterStartupScript(this, GetType(), "Disable", "DisableCalendar();", true);
                }
            }
            else if (!Page.IsValid)
            {
                Container00.Visible = false;
                Container0.Visible  = false;
                Container1.Visible  = false;
                Container2.Visible  = false;
                Container4.Visible  = false;
                Container3.Visible  = false;
                ScriptManager.RegisterStartupScript(this, GetType(), "erroralert", "erroralert();", true);
            }
        }
        catch (Exception ex)
        {
            log.Error("Error while sending SOAP message. " + ex.Message);
            ScriptManager.RegisterStartupScript(this, GetType(), "errorSOAPalert", "errorSOAPalert();", true);
        }
    }
Ejemplo n.º 4
0
    protected void btnGenerateResponse_Click1(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            Container3.Visible = true;

            try
            {
                log.Info("Start sending second SOAP message with requestNumber and challenge.");

                BxSoapEnvelope envelope = new BxSoapEnvelopeChallengeResponse();
                //todo samo zameni
                envelope.BxData.setValue(@"requestNumber", txtbrojzahteva.Text);
                //envelope.BxData.setValue(@"requestNumber", "2"); //fiksirano za test
                envelope.BxData.setValue(@"challenge", txtchallenge.Text);

                string SOAPresponse = string.Empty;
                try
                {
                    SOAPresponse = BxSoap.SOAPManual(envelope.createBxSoapEnvelope());
                }
                catch (Exception ex)
                {
                    throw new Exception("Error. Response from BlueX is: " + SOAPresponse + ex.Message);
                }

                ChallengeResponses = Utils.ParseSoapEnvelopeChallengeResponse(SOAPresponse);

                if (ChallengeResponses == null)
                {
                    throw new Exception("Error. ChallengeResponses List is null. " + SOAPresponse);
                }

                log.Info("Successfully send second SOAP message with requestNumber and challenge.");

                if (ChallengeResponses.Count > 0)
                {
                    List <String> responses = new List <String>();
                    foreach (var response in ChallengeResponses)
                    {
                        responses.Add(response.Response);
                        txtresponse.Text = response.Response;
                        ScriptManager.RegisterStartupScript(this, GetType(), "successalertResponse", "successalertResponse();", true);
                    }
                }
                else
                {
                    log.Info("Za navedeni Challenge " + txtchallenge.Text + "ne postoji Response.");
                    ScriptManager.RegisterStartupScript(this, GetType(), "NotificationResponse", "NotificationResponse();", true);
                }
            }
            catch (Exception ex)
            {
                log.Info("Za navedeni Challenge " + txtchallenge.Text + "ne postoji Response. " + ex.Message);
                ScriptManager.RegisterStartupScript(this, GetType(), "NotificationResponse", "NotificationResponse();", true);
                //ScriptManager.RegisterStartupScript(this, GetType(), "erroralertSendSOAP", "erroralertSendSOAP();", true);
                //log.Error("Error while sending request. " + ex.Message);
                ScriptManager.RegisterStartupScript(this, GetType(), "Disable", "DisableCalendar();", true);
            }
        }
        else if (!Page.IsValid)
        {
            Container3.Visible = false;
            ScriptManager.RegisterStartupScript(this, GetType(), "erroralert", "erroralert();", true);
        }
    }
    protected void btnSubmit_Click1(object sender, EventArgs e)
    {
        Session["Preuzimanje-softverskog-sertifikata-parseErrorPKCS12"] = string.Empty;
        Utility utility = new Utility();

        if (Page.IsValid)
        {
            try
            {
                log.Info("Start sending SOAP message.");

                BxSoapEnvelope envelope = createSoapEnvelope(utility);

                //envelope.createBxSoapEnvelope();   //create SOAP.xml
                string SOAPresponse = BxSoap.SOAPManual(envelope.createBxSoapEnvelope());
                //string SOAPresponse = "<?xml version='1.0' encoding='UTF-8'?><env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/' xmlns:bx='http://namespaces.bluex.com/bluex/bluexml'><env:Header/><env:Body><bx:BlueXMLRequestMessage xmlns:bx='http://namespaces.bluex.com/bluex/bluexml'><bx:data><error>[10DB032A] Error getting REQID/UID [Component_ElementaryAction_Workflow_SetUID::DoAction()]</error><error>Authorization Code does not match</error></bx:data></bx:BlueXMLRequestMessage></env:Body></env:Envelope>";

                /*
                 * if (Convert.ToBoolean(Session["Preuzimanje-softverskog-sertifikata-expiredtime"]))
                 * {
                 *  throw new Exception("Time is expired! ");
                 * }
                 */
                log.Info("Response SOAP message from BlueX for pkcs12 is: " + SOAPresponse);
                Utils.ParseSoapEnvelopePKCS12(SOAPresponse, out USI, out pkcs12, out errorPKCS12);

                if (errorPKCS12 != string.Empty)
                {
                    string parseErrorPKCS12 = Utils.Between(errorPKCS12, Constants.rightBrackets, Constants.leftBrackets);
                    Session["Preuzimanje-softverskog-sertifikata-parseErrorPKCS12"] = parseErrorPKCS12;
                    log.Info("parseErrorPKCS12: " + parseErrorPKCS12);
                }

                if (pkcs12 == string.Empty)
                {
                    throw new Exception("pkcs12 is empty! ");
                }

                Session["Preuzimanje-softverskog-sertifikata-pkcs12"] = pkcs12;

                string pkcs12filename = Path.GetFileName(pkcs12);

                ScriptManager.RegisterStartupScript(this, GetType(), "EnableButton", "EnableButton();", true);
                txtdatotekasert.Text = pkcs12filename;

                ScriptManager.RegisterStartupScript(this, GetType(), "successalert", "successalert();", true);

                log.Info("Successfully send SOAP message! pkcs12 is: " + pkcs12);
            }
            catch (Exception ex)
            {
                log.Error("Error while sending request. " + ex.Message);
                //errLabel.Text = utility.pronadjiNaziveGresaka(Constants.ITEM_ERROR, Constants.ERROR_3374);
                if (Session["Preuzimanje-softverskog-sertifikata-parseErrorPKCS12"].ToString().Equals(Constants.AuthorizationCodeDoesNotMatch))
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "errorGettingAuthorizationCodePKCS12", "errorGettingAuthorizationCodePKCS12();", true);
                }
                else if (Session["Preuzimanje-softverskog-sertifikata-parseErrorPKCS12"].ToString().Equals(Constants.ErrorGettingRequestNumber))
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "errorGettingRequestNumberPKCS12", "errorGettingRequestNumberPKCS12();", true);
                }
                else if (Session["Preuzimanje-softverskog-sertifikata-parseErrorPKCS12"].ToString().Equals(Constants.TransferServiceFailed))
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "errorTransferServiceFailedPKCS12", "errorTransferServiceFailedPKCS12();", true);
                }
                else if (Session["Preuzimanje-softverskog-sertifikata-parseErrorPKCS12"].ToString().Equals(Constants.RrequestIsNotInRequiredState))
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "errorRrequestIsNotInRequiredStatePKCS12", "errorRrequestIsNotInRequiredStatePKCS12();", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "erroralert", "erroralert();", true);
                }
                ScriptManager.RegisterStartupScript(this, GetType(), "DisableButton", "DisableButton();", true);
            }
        }
        else if (!Page.IsValid)
        {
            errLabel.Text = string.Empty;
            ScriptManager.RegisterStartupScript(this, GetType(), "erroralert", "erroralert();", true);
            ScriptManager.RegisterStartupScript(this, GetType(), "DisableButton", "DisableButton();", true);
        }
    }