Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="p_certapp"></param>
        /// <param name="p_certifier"></param>
        /// <param name="p_invoicerId"></param>
        /// <param name="p_issueIds"></param>
        /// <returns></returns>
        public int SignatureWithIDs(Guid p_certapp, string[] p_certifier, string p_invoicerId, string[] p_issueIds)
        {
            int _result = 0;

            try
            {
                if (ISigner.CheckValidApplication(p_certapp) == true)
                {
                    if (p_issueIds.Length > 100)
                    {
                        throw new SignerException(String.Format("Issue-ids can not exceed 100-records. invoiceId->'{0}', length->{1})", p_invoicerId, p_issueIds.Length));
                    }

                    X509CertMgr _invoicerCert = UCertHelper.GetCustomerCertMgr(p_invoicerId, p_certifier[0], p_certifier[1], p_certifier[2]);
                    _result = ESigner.DoSignInvoice(_invoicerCert, p_invoicerId, p_issueIds);
                }
            }
            catch (SignerException ex)
            {
                ELogger.SNG.WriteLog(ex);
            }
            catch (Exception ex)
            {
                ELogger.SNG.WriteLog(ex);
            }

            return(_result);
        }
Beispiel #2
0
        //-------------------------------------------------------------------------------------------------------------------------
        // logger
        //-------------------------------------------------------------------------------------------------------------------------

        /// <summary>
        ///
        /// </summary>
        /// <param name="p_certapp"></param>
        /// <param name="p_exception"></param>
        /// <param name="p_message"></param>
        public void WriteLog(Guid p_certapp, string p_exception, string p_message)
        {
            if (ISigner.CheckValidApplication(p_certapp) == true)
            {
                ELogger.SNG.WriteLog(p_exception, p_message);
            }
        }
Beispiel #3
0
        //-------------------------------------------------------------------------------------------------------------------------
        //
        //-------------------------------------------------------------------------------------------------------------------------

        /// <summary>
        ///
        /// </summary>
        /// <param name="p_certapp"></param>
        /// <param name="p_certifier"></param>
        /// <param name="p_invoicerId"></param>
        /// <param name="p_fromDay"></param>
        /// <param name="p_tillDay"></param>
        /// <returns></returns>
        public int SignatureWithDateRange(Guid p_certapp, string[] p_certifier, string p_invoicerId, DateTime p_fromDay, DateTime p_tillDay)
        {
            int _result = 0;

            try
            {
                if (ISigner.CheckValidApplication(p_certapp) == true)
                {
                    UTextHelper.SNG.GetSigningRange(ref p_fromDay, ref p_tillDay);

                    var _sqlstr
                        = "SELECT invoicerId, COUNT(invoicerId) as norec "
                          + "  FROM TB_eTAX_INVOICE "
                          + " WHERE isSuccess != @isSuccess "         // for resignning, do check 'isSuccess' here
                          + "   AND ( "
                          + "         (RIGHT(typeCode, 2) IN ('01', '02', '04') AND invoicerId=@invoicerId) "
                          + "         OR "
                          + "         (RIGHT(typeCode, 2) IN ('03', '05') AND brokerId=@invoicerId) "
                          + "       ) "
                          + "   AND issueDate>=@fromDate AND issueDate<=@tillDate "
                          + " GROUP BY invoicerId";

                    var _dbps = new PgDatParameters();
                    {
                        _dbps.Add("@isSuccess", NpgsqlDbType.Varchar, "T");
                        _dbps.Add("@invoicerId", NpgsqlDbType.Varchar, p_invoicerId);
                        _dbps.Add("@fromDate", NpgsqlDbType.TimestampTz, p_fromDay);
                        _dbps.Add("@tillDate", NpgsqlDbType.TimestampTz, p_tillDay);
                    }

                    var _ds = LSQLHelper.SelectDataSet(UAppHelper.ConnectionString, _sqlstr, _dbps);
                    if (LSQLHelper.IsNullOrEmpty(_ds) == false)
                    {
                        X509CertMgr _invoicerCert = UCertHelper.GetCustomerCertMgr(p_invoicerId, p_certifier[0], p_certifier[1], p_certifier[2]);

                        var _rows = _ds.Tables[0].Rows;
                        for (int i = 0; i < _rows.Count; i++)
                        {
                            string _invoicerId = Convert.ToString(_rows[i]["invoicerId"]);
                            int    _noInvoice  = Convert.ToInt32(_rows[i]["norec"]);

                            _result += ESigner.DoSignInvoice(_invoicerCert, _invoicerId, _noInvoice, p_fromDay, p_tillDay);
                        }
                    }
                }
            }
            catch (SignerException ex)
            {
                ELogger.SNG.WriteLog(ex);
            }
            catch (Exception ex)
            {
                ELogger.SNG.WriteLog(ex);
            }

            return(_result);
        }
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="p_certapp"></param>
        /// <param name="p_invoicerId"></param>
        /// <returns></returns>
        public int ClearXFlag(Guid p_certapp, string p_invoicerId)
        {
            int _result = 0;

            try
            {
                if (ISigner.CheckValidApplication(p_certapp) == true)
                {
                    _result = ESigner.ClearXFlag(p_invoicerId);
                }
            }
            catch (SignerException ex)
            {
                ELogger.SNG.WriteLog(ex);
            }
            catch (Exception ex)
            {
                ELogger.SNG.WriteLog(ex);
            }

            return(_result);
        }