private async Task GetGSTINDataAsync()
        {
            EWBSession EwbSession = new EWBSession();

            EwbSession.EwbApiLoginDetails.EwbGstin    = GlobalVariables.EWBGSTIN;
            EwbSession.EwbApiLoginDetails.EwbUserID   = GlobalVariables.EWBUserID;
            EwbSession.EwbApiLoginDetails.EwbPassword = GlobalVariables.EWBPassword;
            EwbSession.EwbApiSetting.GSPName          = GlobalVariables.GSPName;
            EwbSession.EwbApiSetting.AspPassword      = GlobalVariables.ASPPassword;
            EwbSession.EwbApiSetting.AspUserId        = GlobalVariables.ASPNetUser;
            EwbSession.EwbApiSetting.BaseUrl          = GlobalVariables.BaseUrl;


            TxnRespWithObjAndInfo <EWBSession> TxnResp2 = await EWBAPI.GetAuthTokenAsync(EwbSession);

            if (TxnResp2.IsSuccess)
            {
                //TxnRespWithObjAndInfo<RespGetEWBDetail> TxnResp = await EWBAPI.GetEWBDetailAsync(EwbSession, EwbNo);

                TxnRespWithObjAndInfo <GSTINDetail> TxnResp = await EWBAPI.GetGSTNDetailAsync(EwbSession, txtGSTNo.Text);

                if (TxnResp.IsSuccess)



                {
                    TextEdit t = new TextEdit
                    {
                        Text = JsonConvert.SerializeObject(TxnResp.RespObj)
                    };
                    var details = JObject.Parse(t.Text);


                    if (details["status"].ToString().ToUpper() == "ACT")
                    {
                        lblGstInfo.Text = "Status - Active As on Date - " + DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss");
                    }
                    txtGSTType.Text = details["txpType"].ToString();

                    txtGSTStateCode.Text = details["stateCode"].ToString().PadLeft(2, '0');
                    txtGSTStateDesc.Text = ProjectFunctions.GetDataSet("select GSTStateDesc from GSTStateMst where GSTStateCode='" + details["stateCode"].ToString().PadLeft(2, '0') + "' ").Tables[0].Rows[0][0].ToString();



                    XtraMessageBox.Show(JsonConvert.SerializeObject(TxnResp.RespObj));
                }
                else
                {
                    XtraMessageBox.Show(JsonConvert.SerializeObject(TxnResp.TxnOutcome));
                }
            }
        }
Exemplo n.º 2
0
        private async void btnAuthToken_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Calling any API method will internally check for valid AuthToken and would try to obtain AuthToken if its is expired.  You don't need to explicitly call GetAuthTokenAsync method. Do you want to proceed?", "AuthToken is Automatic", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                TxnRespWithObj <EWBSession> TxnResp = await EWBAPI.GetAuthTokenAsync(EwbSession);

                if (TxnResp.IsSuccess)
                {
                    //Call Refresh Display Api Login Details to refresh auth token and Exp Time in display
                    DisplayApiLoginDetails();
                }
                rtbResponce.Text = TxnResp.TxnOutcome;
            }
        }
Exemplo n.º 3
0
        private async void PrintewayBill()
        {
            string strJSON = "";

            if (DateTime.Now < EwbSession.EwbApiLoginDetails.EwbTokenExp)
            {
                lblResponce.Text = EwbSession.EwbApiLoginDetails.EwbAuthToken + "valid Upto:" + EwbSession.EwbApiLoginDetails.EwbTokenExp.ToString();
            }
            else
            {
                TxnRespWithObj <EWBSession> TxnSesResp = await EWBAPI.GetAuthTokenAsync(EwbSession);

                if (TxnSesResp.IsSuccess == true)
                {
                    lblResponce.Text = TxnSesResp.RespObj.EwbApiLoginDetails.EwbAuthToken;
                    strJSON          = JsonConvert.SerializeObject(TxnSesResp.RespObj.EwbApiLoginDetails);
                    Database.CommandExecutor("Update Company set EwbLoginDetail='" + strJSON + "'");
                    UpdateEwayBalance(-1, "On Print Auth");
                    CheckEwayBalance(false);
                }
                else
                {
                    lblResponce.Text = TxnSesResp.TxnOutcome;
                    CheckEwayBalance(false);
                    return;
                }
            }


            string rtbResponce = "";
            TxnRespWithObj <RespGetEWBDetail> TxnResp = await EWBAPI.GetEWBDetailAsync(EwbSession, EwbNo);

            if (TxnResp.IsSuccess == true)
            {
                UpdateEwayBalance(-1, "On Print Detail");
                EWBAPI.PrintEWB(EwbSession, TxnResp.RespObj, "", true, true);
                UpdateEwayBalance(-1, "On Print");
            }
            else
            {
                rtbResponce = TxnResp.TxnOutcome;
                UpdateEwayBalance(-1, TxnResp.TxnOutcome);
            }

            CheckEwayBalance(false);
        }
Exemplo n.º 4
0
        private async void OnlineewayBill()
        {
            //GetAuthenticationToken();

            string strJSON = "";

            if (DateTime.Now < EwbSession.EwbApiLoginDetails.EwbTokenExp)
            {
                lblResponce.Text = EwbSession.EwbApiLoginDetails.EwbAuthToken + "valid Upto:" + EwbSession.EwbApiLoginDetails.EwbTokenExp.ToString();
            }
            else
            {
                TxnRespWithObj <EWBSession> TxnSesResp = await EWBAPI.GetAuthTokenAsync(EwbSession);

                if (TxnSesResp.IsSuccess == true)
                {
                    lblResponce.Text = TxnSesResp.RespObj.EwbApiLoginDetails.EwbAuthToken;
                    strJSON          = JsonConvert.SerializeObject(TxnSesResp.RespObj.EwbApiLoginDetails);
                    Database.CommandExecutor("Update Company set EwbLoginDetail='" + strJSON + "'");
                    UpdateEwayBalance(-1, "On Generate Eway Auth");
                    CheckEwayBalance(false);
                }
                else
                {
                    lblResponce.Text = TxnSesResp.TxnOutcome;
                    UpdateEwayBalance(-1, TxnSesResp.TxnOutcome);
                    CheckEwayBalance(false);
                    return;
                }
            }



            strJSON = JsonConvert.SerializeObject(ewbGen);
            //  System.IO.File.WriteAllText(Applidispcation.StartupPath + "\\EWAYJSON.txt", strJSON);

            //strJSON = System.IO.File.ReadAllText(Application.StartupPath + "\\EWAYJSON.txt");

            if (DateTime.Now > EwbSession.EwbApiLoginDetails.EwbTokenExp)
            {
                return;
            }


            TxnRespWithObj <RespGenEwbPl> TxnResp = await EWBAPI.GenEWBAsync(EwbSession, strJSON);

            if (TxnResp.IsSuccess)
            {
                lblResponce.Text = JsonConvert.SerializeObject(TxnResp.RespObj);
                Database.CommandExecutor("Update voucherinfo set EwayBillno='" + TxnResp.RespObj.ewayBillNo + "' where vi_id='" + gvid + "'");
                EwbNo = long.Parse(TxnResp.RespObj.ewayBillNo);

                UpdateEwayBalance(-1, TxnResp.RespObj.ewayBillNo);
            }
            else
            {
                lblResponce.Text = lblResponce.Text + Environment.NewLine + TxnResp.TxnOutcome;
                UpdateEwayBalance(-1, TxnResp.TxnOutcome);
            }

            CheckEwayBalance(false);
            SideFill();
        }