Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="objAttr"></param>
        /// <returns></returns>
        public ServiceResponse <string> SaveGSTR1(WEP.GSP.Document.Attrbute objAttr)
        {
            try
            {
                var token = new GSTR1Business(this._clientid,
                                              this._statecd,
                                              this._username,
                                              this._txn,
                                              this._clientSecret,
                                              this._ipUsr,
                                              this._authToken,
                                              this._ret_period,
                                              this._gstin)
                            .SaveGSTR1(objAttr);

                var respone = new ServiceResponse <string> {
                    ResponseObject = token, IsError = false
                };
                return(respone);
            }
            catch (Exception ex)
            {
                new RequestData().InsertExceptionLog("error while API call - Client:" + this._clientid + " Username: " + this._username, ex.Message, ex.Source, (int)WEP.GSP.Document.Stage.WriteAsync_Error);

                var exe = new ExceptionModel {
                    ErrorMessage = ex.Message
                };

                return(new ServiceResponse <string>
                {
                    IsError = true,
                    ExceptionObject = exe
                });
            }
        }
Пример #2
0
        public JsonResult GetAll(WEP.GSP.Document.Attrbute objAttr)
        {
            string jsonRequest = "{\"PartitionKey\":\"PK_SaveGSTR1\",\"RequestType\":1,\"Clientid\":\"l7xxdf2b47b7d728426699a05c8d1ec33a60\",\"Statecd\":\"11\",\"Username\":\"WeP\",\"Txn\":\"returns\",\"ClientSecret\":\"30a28162eb024f6e859a12bbb9c31725\",\"IpUsr\":\"12.8.9l.80\",\"Blob\":2,\"BlobFile\":\"l7xxdf2b47b7d728426699a05c8d1ec33a60_WeP_11_12.8.9l.80_636292360674179616\",\"RequestToken\":\"l7xxdf2b47b7d728426699a05c8d1ec33a60_WeP_11_12.8.9l.80_636292360674179616\",\"AuthToken\":\"8a227e0ba56042a0acdf98b3477d2c03\",\"CreatedOn\":\"5/1/2017 11:47:52 AM\",\"Response\":null,\"ModifiedOn\":null}";
            var    request     = JsonConvert.DeserializeObject <Request>(jsonRequest);

            var token = new GSTR1Business(this._clientid,
                                          this._statecd,
                                          this._username,
                                          this._txn,
                                          this._clientSecret,
                                          this._ipUsr,
                                          this._authToken)
                        .SaveGSTR1(objAttr);

            var respone = new ServiceResponse <string> {
                ResponseObject = token, IsError = false
            };


            var result = new JsonResult
            {
                Data = JsonConvert.DeserializeObject(token)
            };


            return(result);
        }
Пример #3
0
        public ServiceResponse <string> SaveGSTRI(WEP.GSP.Document.Attrbute objAttr)
        {
            var token = new GSTR1Business(this._clientid,
                                          this._statecd,
                                          this._username,
                                          this._txn,
                                          this._clientSecret,
                                          this._ipUsr,
                                          this._authToken)
                        .SaveGSTR1(objAttr);

            var respone = new ServiceResponse <string> {
                ResponseObject = token, IsError = false
            };

            //Serialize to string
            string jsonReqst = new JavaScriptSerializer().Serialize(respone);

            return(respone);
        }
        public ServiceResponse <string> SaveGSTRI(WEP.GSP.Document.Attrbute objAttr)
        {
            try
            {
                #region Header



                var re = Request;

                //IEnumerable<string> headerValues = request.Headers.GetValues("MyCustomID");
                //var id = headerValues.FirstOrDefault();


                System.Net.Http.Headers.HttpRequestHeaders headers = this.Request.Headers;

                if (headers.Contains(WEP.GSP.Document.Constants.Clientid))
                {
                    _clientid = headers.GetValues(WEP.GSP.Document.Constants.Clientid).First();
                }

                if (headers.Contains(WEP.GSP.Document.Constants.State_cd))
                {
                    _statecd = headers.GetValues(WEP.GSP.Document.Constants.State_cd).First();
                }

                if (headers.Contains(WEP.GSP.Document.Constants.Txn))
                {
                    _txn = headers.GetValues(WEP.GSP.Document.Constants.Txn).First();
                }

                if (headers.Contains(WEP.GSP.Document.Constants.Client_secret))
                {
                    _clientSecret = headers.GetValues(WEP.GSP.Document.Constants.Client_secret).First();
                }

                if (headers.Contains(WEP.GSP.Document.Constants.UserName))
                {
                    _username = headers.GetValues(WEP.GSP.Document.Constants.UserName).First();
                }


                if (headers.Contains(WEP.GSP.Document.Constants.Auth_Token))
                {
                    _authToken = headers.GetValues(WEP.GSP.Document.Constants.Auth_Token).First();
                }


                if (headers.Contains(WEP.GSP.Document.Constants.IpUsr))
                {
                    _ipUsr = headers.GetValues(WEP.GSP.Document.Constants.IpUsr).First();
                }

                #endregion



                #region Authentication
                //string SignURL = "http://localhost:2277/Home/SignIn";
                //var request = WebRequest.Create(SignURL);
                //HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                //Stream dataStream = response.GetResponseStream();
                //StreamReader reader = new StreamReader(dataStream);

                //string responseFromServer = reader.ReadToEnd();

                #endregion


                var token = new GSTR1Business(this._clientid,
                                              this._statecd,
                                              this._username,
                                              this._txn,
                                              this._clientSecret,
                                              this._ipUsr,
                                              this._authToken)
                            .SaveGSTR1(objAttr);

                var respone = new ServiceResponse <string> {
                    ResponseObject = token, IsError = false
                };
                return(respone);
            }
            catch (Exception e)
            {
                var exe = new ExceptionModel {
                    ErrorMessage = e.Message
                };

                return(new ServiceResponse <string>
                {
                    IsError = true,
                    ExceptionObject = exe
                });
            }
        }