示例#1
0
        /// <summary>
        /// GSTR2B2B
        /// </summary>
        /// <param name="objAttr"></param>
        private void GSTR2B2B(Attrbute objAttr, string token)
        {
            //table storage connection object
            var tblConnection = CommonFunction.GetBlob();


            //log to table storage  => P1 started
            Task.Factory.StartNew(() =>
                                  new WEP.GSP.Service.Blob.TableStorage(Constants.PartitionKey, Constants.RowKey
                                                                        , (int)WEP.GSP.Document.Stage.Validation_BEGIN
                                                                        , token
                                                                        , Constants.GSTR2AStageTable
                                                                        , Constants.actualTime)
                                  .InsertStageToTableStorage(tblConnection.Keys));
            // prepare message for Event hub
            string jsonReqst = new JavaScriptSerializer()
                               .Serialize(new Request
            {
                RequestType  = RequestType.GSTR2A_GetB2B,
                RequestToken = token,
                Clientid     = _clientid,
                Statecd      = _statecd,
                Username     = _username,
                Txn          = _txn,
                ClientSecret = _clientSecret,
                IpUsr        = _ipUsr,
                AuthToken    = _authToken,
                CreatedOn    = System.DateTime.UtcNow,
                //PartitionKey = Constants.PK_SaveGSTR1,
                RetPeriod        = this._ret_period,
                Gstin            = this._gstin,
                param_ctin       = objAttr.param_ctin,
                param_action     = objAttr.param_action,
                param_gstin      = objAttr.param_gstin,
                param_ret_period = objAttr.param_ret_period,
                Action           = objAttr.action,
                Blob             = tblConnection.Id,
                BlobKey          = tblConnection.Keys,
                ApiAction        = objAttr.apiAction,
                BlobFile         = token
            });

            //Write to Service Bus
            IQueueProcessor masterqueue = new WEP.GSP.EventHub.Queue.ServiceBus();

            masterqueue.WriteAsync(jsonReqst, true);

            //log to table storage  => P1 completed
            Task.Factory.StartNew(() =>
                                  new WEP.GSP.Service.Blob.TableStorage(Constants.PartitionKey, Constants.RowKey
                                                                        , (int)WEP.GSP.Document.Stage.Request_WRT_SUCCESS
                                                                        , token
                                                                        , Constants.GSTR2AStageTable
                                                                        , Constants.actualTime)
                                  .InsertStageToTableStorage(tblConnection.Keys));
        }
        /// <summary>
        /// GSTR3B
        /// </summary>
        /// <param name="attrbute"></param>
        /// <param name="token"></param>
        private void GSTR3B(Attrbute attrbute, string token, Blob blob, TableStorage objTableStorage)
        {
            //upload  payload to blob storage
            var blobStorage = new BlobStorage(blob.Connection, Constants.CotainerPayload, token, new Dictionary <string, string>(), blob.Id);

            var blobPath = blobStorage.UploadBlob(attrbute);

            // prepare message for Event hub
            string jsonReqst = new JavaScriptSerializer()
                               .Serialize(new Request
            {
                RequestType  = RequestType.SaveGSTR3B,
                BlobFile     = token,
                RequestToken = token,
                Blob         = blob.Id,
                Clientid     = _clientid,
                Statecd      = _statecd,
                Username     = _username,
                Txn          = _txn,
                ClientSecret = _clientSecret,
                IpUsr        = _ipUsr,
                AuthToken    = _authToken,
                CreatedOn    = System.DateTime.UtcNow,
                //PartitionKey = Constants.PK_SaveGSTR1,
                RetPeriod = this._ret_period,
                Gstin     = this._gstin,
                ApiAction = attrbute.apiAction
            });

            //Write to Service Bus

            IQueueProcessor masterqueue = new WEP.GSP.EventHub.Queue.ServiceBus();

            masterqueue.WriteAsync(jsonReqst, true);

            //log to table storage  => P1 completed
            Task.Factory.StartNew(() =>
                                  objTableStorage.InsertStageToTableStorage(blob.Keys, (int)WEP.GSP.Document.Stage.Request_WRT_SUCCESS));
        }