public void DownloadLiveData() { bool flag; //clsPubPro _clsPubPro; try { MC.Open(); string reply = ""; System.Xml.XmlDocument xmldoc; DataSet dsresult; // string strQuery = ""; //string companyGSTN = CommonHelper.CompanyGSTN; //string TdstcsYear= CommonHelper.ReturnYear; //string month = CommonHelper.GetMonth(CommonHelper.SelectedMonth); //string reqParam = ""; //if (Convert.ToInt32(month) > 3 && Convert.ToInt32(month) <= 12) reqParam = string.Concat(CommonHelper.GetMonth(CommonHelper.SelectedMonth), CommonHelper.ReturnYear.Split('-')[0].Trim()); //else reqParam = string.Concat(CommonHelper.GetMonth(CommonHelper.SelectedMonth), CommonHelper.ReturnYear.Split('-')[1].Trim()); //string _Param = "092019"; var obj = clsPro.Cooki != null?clsPro.Cooki.FirstOrDefault(x => x.ckname == (string.Concat("loginCookies_", "1"))) : null; if (obj != null && obj.CC1 != null) { this.Cc = obj.CC1; //Request URL: https://services.gst.gov.in/services/auth/api/get/certs //Referer: https://services.gst.gov.in/services/auth/certs HttpWebRequest httpWebRequest = this.PrepareGetRequestTdsTcs(new Uri(string.Format("https://services.gst.gov.in/services/auth/api/get/certs")), "https://services.gst.gov.in/services/auth/certs"); this.response = (HttpWebResponse)httpWebRequest.GetResponse(); Stream responseStream = this.response.GetResponseStream(); reply = (new StreamReader(responseStream, Encoding.UTF8)).ReadToEnd(); bool flagstatus = false; JArray arr = JArray.Parse(reply); string sql = ""; sql = "Delete from SPQViewCertificate"; MC.sqlcmd = new SQLiteCommand(sql, MC.con); MC.sqlcmd.ExecuteNonQuery(); for (int i = 0; i < arr.Count; i++) { string frmno = Convert.ToString(arr[i]["frmno"]); string frmdc = Convert.ToString(arr[i]["frmdc"]); string isdt = Convert.ToString(arr[i]["isdt"]); string docid = Convert.ToString(arr[i]["docid"]); string applnId = Convert.ToString(arr[i]["applnId"]); // DataSet ds = new DataSet(); //string sql = ""; //sql = "Delete from SPQViewCertificate"; sql = " insert into SPQViewCertificate ( frmno, frmdc, isdt, docid, appInId,url ) " + " VALUES('" + frmno + "','" + frmdc + "','" + isdt + "', '" + docid + "','" + applnId + "','https://services.gst.gov.in/document/" + docid + "/" + applnId + "')"; // sql = sql + " Values ('" + frmno + "','" + frmdc + "','" + isdt + "', '" + doc id + "','" + applnId + "')"; MC.sqlcmd = new SQLiteCommand(sql, MC.con); MC.sqlcmd.ExecuteNonQuery(); //MC.InitializeColumn(dgv_view, 3, "Downloads", 100, true, DataGridViewContentAlignment.MiddleCenter); } DataTable dt = new DataTable(); dt = MC.GetValueindatatable("Select frmno,frmdc,isdt,url From SPQViewCertificate"); dgv_view.DataSource = dt; MC.InitializeColumn(dgv_view, 0, "From No", 100, true, DataGridViewContentAlignment.MiddleCenter); MC.InitializeColumn(dgv_view, 1, "Form Description", 300, true, DataGridViewContentAlignment.MiddleCenter); MC.InitializeColumn(dgv_view, 2, "Date Of Issue", 200, true, DataGridViewContentAlignment.MiddleCenter); MC.InitializeColumn(dgv_view, 3, "Downloads", 200, false, DataGridViewContentAlignment.MiddleCenter); DataGridViewLinkColumn link = new DataGridViewLinkColumn(); link.HeaderText = "Action"; link.Name = "pdf"; link.UseColumnTextForLinkValue = true; link.Text = "View PDF"; link.Width = 60; dgv_view.Columns.Add(link); //+ System.Diagnostics.Process.Start(Convert.ToString(dgv_view.Rows[0].Cells[3].Value)); } else { SPQGstLogin frm = new SPQGstLogin(); frm.strBulk = "BULK"; frm.Visible = false; var result = frm.ShowDialog(); if (result != DialogResult.OK) { DownloadLiveData(); } else { DownloadLiveData(); } } } catch (Exception exception1) { Exception exception = exception1; if (!exception.Message.Contains("403")) { MessageBox.Show(string.Concat("Error : ", exception.Message), "Technical Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); object[] message = new object[] { exception.Message, Environment.NewLine, exception.StackTrace, Environment.NewLine, DateTime.Now, Environment.NewLine }; string str = string.Format("Error: {0}{1}Source: {2}{3}Error Time: {4}{5}", message); StreamWriter streamWriter = new StreamWriter("SPEQTA_Error_File.txt", true); streamWriter.Write(str); streamWriter.Close(); flag = false; } else { SPQGstLogin frm = new SPQGstLogin(); frm.Visible = false; var result = frm.ShowDialog(); if (result != DialogResult.OK) { //GstLogin objLogin = new GstLogin(); //objLogin.Show(); } else { DownloadLiveData(); } //frmGstLogin _frmGstLogin = new frmGstLogin() //{ // Visible = false //}; //if (_frmGstLogin.ShowDialog() == DialogResult.OK) //{ // this.DownloadLiveGSTR9(); //} flag = true; } } finally { MC.Close(); } // return true; }
private void DownloadLiveData() { bool flag; //clsPubPro _clsPubPro; try { string reply = ""; System.Xml.XmlDocument xmldoc; DataSet dsresult; // string strQuery = ""; string companyGSTN = CommonHelper.CompanyGSTN; //string TdstcsYear= CommonHelper.ReturnYear; //string month = CommonHelper.GetMonth(CommonHelper.SelectedMonth); //string reqParam = ""; //if (Convert.ToInt32(month) > 3 && Convert.ToInt32(month) <= 12) reqParam = string.Concat(CommonHelper.GetMonth(CommonHelper.SelectedMonth), CommonHelper.ReturnYear.Split('-')[0].Trim()); //else reqParam = string.Concat(CommonHelper.GetMonth(CommonHelper.SelectedMonth), CommonHelper.ReturnYear.Split('-')[1].Trim()); string _Param = "092019"; var obj = clsPro.Cooki != null?clsPro.Cooki.FirstOrDefault(x => x.ckname == (string.Concat("loginCookies_", "1"))) : null; if (obj != null && obj.CC1 != null) { this.Cc = obj.CC1; //Request URL: https://return.gst.gov.in/returns2/auth/api/gstr7a/getcertificate?req_typ=SRCH&rtn_prd=092019 //Referer: https://return.gst.gov.in/returns2/auth/gstr7a/search HttpWebRequest httpWebRequest = this.PrepareGetRequestTdsTcs(new Uri(string.Format("https://return.gst.gov.in/returns2/auth/api/gstr7a/getcertificate?req_typ=SRCH&rtn_prd={0}", _Param)), "https://return.gst.gov.in/returns2/auth/gstr7a/search"); this.response = (HttpWebResponse)httpWebRequest.GetResponse(); Stream responseStream = this.response.GetResponseStream(); reply = (new StreamReader(responseStream, Encoding.UTF8)).ReadToEnd(); bool flagstatus = false; string jsonString = "{ \"TdsCertificate\": {" + reply.Trim().TrimStart('{').TrimEnd('}') + @"} }"; //// Now it is secure that we have always a Json with one node as root xmldoc = JsonConvert.DeserializeXmlNode(jsonString); //// DataSet is able to read from XML and return a proper DataSet dsresult = new DataSet(); dsresult.ReadXml(new StringReader(xmldoc.InnerXml)); } else { SPQGstLogin frm = new SPQGstLogin(); frm.Visible = false; var result = frm.ShowDialog(); if (result != DialogResult.OK) { } else { DownloadLiveData(); } } } catch (Exception exception1) { Exception exception = exception1; if (!exception.Message.Contains("403")) { MessageBox.Show(string.Concat("Error : ", exception.Message), "Technical Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); object[] message = new object[] { exception.Message, Environment.NewLine, exception.StackTrace, Environment.NewLine, DateTime.Now, Environment.NewLine }; string str = string.Format("Error: {0}{1}Source: {2}{3}Error Time: {4}{5}", message); StreamWriter streamWriter = new StreamWriter("SPEQTA_Error_File.txt", true); streamWriter.Write(str); streamWriter.Close(); flag = false; } else { SPQGstLogin frm = new SPQGstLogin(); frm.Visible = false; var result = frm.ShowDialog(); if (result != DialogResult.OK) { //GstLogin objLogin = new GstLogin(); //objLogin.Show(); } else { DownloadLiveData(); } //frmGstLogin _frmGstLogin = new frmGstLogin() //{ // Visible = false //}; //if (_frmGstLogin.ShowDialog() == DialogResult.OK) //{ // this.DownloadLiveGSTR9(); //} flag = true; } } finally { } // return true; }
private void btnVerify_Click(object sender, EventArgs e) { if (TxtGSTIN_NO.Text.Trim() == "" || TxtGSTIN_NO.Text.Trim() == "Enter GSTIN No") { MessageBox.Show("Please Enter GSTIN NO.", "REMINDER", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } SPQGstLogin frmGstLogin = new SPQGstLogin(); frmGstLogin.lblGSTINNO.Visible = true; frmGstLogin.lblGSTHEADING.Visible = true; frmGstLogin.lblUserName.Visible = false; frmGstLogin.lblPassword.Visible = false; frmGstLogin.TxtUserName.Visible = false; frmGstLogin.TxtPassword.Visible = false; frmGstLogin.lblMendetory1.Visible = false; frmGstLogin.lblMendetory2.Visible = false; frmGstLogin.img.Location = new Point(100, 71); frmGstLogin.pbRefresh.Location = new Point(294, 79); frmGstLogin.lblCaptcha.Location = new Point(20, 142); frmGstLogin.lblmendetory3.Location = new Point(118, 142); frmGstLogin.txtCaptcha.Location = new Point(134, 141); frmGstLogin.btnContinue.Location = new Point(88, 191); frmGstLogin.btnCancel.Location = new Point(203, 191); frmGstLogin.lblGSTINNO.Text = TxtGSTIN_NO.Text; frmGstLogin.strSingle = btnVerify.AccessibleDescription; frmGstLogin.ShowDialog(); //DataTable dt = frmGstLogin.dtGstinInfoss; DataSet dsjstinsingle = new DataSet(); DataSet dsReturnFile = new DataSet(); DataTable dtReturnFile = new DataTable(); dsjstinsingle = frmGstLogin.dsPartyInfo; dsReturnFile = frmGstLogin.dsReturnInfo; dtReturnFile = frmGstLogin.dsReturnInfo.Tables["filingStatus"]; GrdReturnfilingStatus.AutoGenerateColumns = false; if (dsjstinsingle.Tables.Count > 0 && dsjstinsingle.Tables[0].Rows.Count > 0) { if (dsjstinsingle.Tables["TDPARTY"].Rows[0][2].ToString() == "SWEB_9035") { MessageBox.Show("INVALID JSTIN INSERTED...!!!", "REMINDER", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtGSTIN_NO.Focus(); dsjstinsingle.Tables.Clear(); return; } GrdInfo.Rows[0].Cells[1].Value = dsjstinsingle.Tables["TDPARTY"].Rows[0]["gstin"]; GrdInfo[1, 1].Value = dsjstinsingle.Tables["TDPARTY]"].Rows[0]["tradeNam"]; GrdInfo[1, 2].Value = dsjstinsingle.Tables["TDPARTY"].Rows[0]["lgnm"]; GrdInfo[1, 3].Value = dsjstinsingle.Tables["TDPARTY"].Rows[0]["ctb"]; GrdInfo[1, 4].Value = dsjstinsingle.Tables["TDPARTY"].Rows[0]["dty"]; GrdInfo[1, 4].Value = dsjstinsingle.Tables["TDPARTY"].Rows[0]["dty"]; if (dsjstinsingle.Tables["TDPARTY"].Rows[0]["dty"].ToString() == "Regular") { GrdInfo[1, 5].Value = "YES"; GrdInfo.Rows[5].Cells[1].Style.BackColor = Color.Green; } else { GrdInfo[1, 5].Value = "NO"; GrdInfo.Rows[5].Cells[1].Style.BackColor = Color.Red; } GrdInfo[1, 6].Value = dsjstinsingle.Tables["TDPARTY"].Rows[0]["rgdt"]; GrdInfo[1, 7].Value = dsjstinsingle.Tables["TDPARTY"].Rows[0]["sts"]; if (GrdInfo[1, 7].Value.ToString() == "Active") { GrdInfo.Rows[7].Cells[1].Style.BackColor = Color.Green; } else { GrdInfo.Rows[7].Cells[1].Style.BackColor = Color.Red; } GrdInfo[1, 8].Value = dsjstinsingle.Tables["TDPARTY"].Rows[0]["cxdt"]; GrdInfo[1, 9].Value = dsjstinsingle.Tables["TDPARTY"].Rows[0]["ctj"]; GrdInfo[1, 10].Value = dsjstinsingle.Tables["TDPARTY"].Rows[0]["stj"]; } if (dsReturnFile.Tables.Count > 0 && dsReturnFile.Tables["filingStatus"].Rows.Count > 0) { //dsReturnFile.Tables["filingStatus"].Rows.RemoveAt(0); //dsReturnFile.Tables["filingStatus"].AcceptChanges(); //GrdReturnfilingStatus.Columns[1].DataPropertyName = "rtntype"; //GrdReturnfilingStatus.Columns[2].DataPropertyName = "fy"; //GrdReturnfilingStatus.Columns[3].DataPropertyName = "taxp"; //GrdReturnfilingStatus.Columns[4].DataPropertyName = "dof"; //GrdReturnfilingStatus.Columns[5].DataPropertyName = "status"; //GrdReturnfilingStatus.DataSource = dsReturnFile.Tables["filingStatus"]; if (GrdReturnfilingStatus.Rows.Count > 0) { GrdReturnfilingStatus.Rows.Clear(); } GrdReturnfilingStatus.RowCount = dsReturnFile.Tables["filingStatus"].Rows.Count - 1; for (int i = 1; i < dsReturnFile.Tables["filingStatus"].Rows.Count; i++) { GrdReturnfilingStatus[0, i - 1].Value = i; GrdReturnfilingStatus[1, i - 1].Value = dsReturnFile.Tables["filingStatus"].Rows[i]["rtntype"]; GrdReturnfilingStatus[2, i - 1].Value = dsReturnFile.Tables["filingStatus"].Rows[i]["fy"]; GrdReturnfilingStatus[3, i - 1].Value = dsReturnFile.Tables["filingStatus"].Rows[i]["taxp"]; GrdReturnfilingStatus[4, i - 1].Value = dsReturnFile.Tables["filingStatus"].Rows[i]["dof"]; GrdReturnfilingStatus[5, i - 1].Value = dsReturnFile.Tables["filingStatus"].Rows[i]["status"]; } } //06AADCS1804N1ZC }
private void BtnBulkGSTINverification_Click(object sender, EventArgs e) { if (CheckForInternetConnection() == false) { MessageBox.Show("Internet is not available..!\n please check Internet connection then Veryfy ...! ", "Warning"); return; } if (Grd_Bulk.Rows.Count <= 1) { MessageBox.Show("Please Enter GSTIN NO. Then Veryfy...!!!!", "REMINDER", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (dtGStinInfo.Rows.Count > 0) { dtGStinInfo.Rows.Clear(); } for (int i = 0; i < Grd_Bulk.Rows.Count - 1; i++) { DataRow dr = dtGStinInfo.NewRow(); dr[0] = Grd_Bulk.Rows[i].Cells[1].Value.ToString(); dtGStinInfo.Rows.Add(dr); } SPQGstLogin Gstvery = new SPQGstLogin(); //Gstvery.lblGSTINNO.Text = TxtGSTIN_NO.Text; Gstvery.lblGSTINNO.Visible = false; Gstvery.lblGSTHEADING.Visible = false; Gstvery.lblUserName.Visible = true; Gstvery.lblPassword.Visible = true; Gstvery.TxtUserName.Visible = true; Gstvery.TxtPassword.Visible = true; Gstvery.lblMendetory1.Visible = true; Gstvery.lblMendetory2.Visible = true; Gstvery.dtgstIn = dtGStinInfo; Gstvery.strBulk = BtnBulkGSTINverification.AccessibleDescription; Gstvery.ShowDialog(); //DataTable dt = Gstvery.dtGstinInfoss; //DataSet ds = new DataSet(); ds = Gstvery.dsPartyInfo; if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { for (int j = 0; j < ds.Tables[0].Rows.Count; j++) { if (ds.Tables["TDPARTY"].Rows[j]["gstin"].ToString() == Grd_Bulk.Rows[j].Cells[1].Value.ToString()) { Grd_Bulk.Rows[j].Cells[2].Value = ds.Tables["TDPARTY"].Rows[j]["tradeNam"].ToString(); Grd_Bulk.Rows[j].Cells[3].Value = ds.Tables["TDPARTY"].Rows[j]["lgnm"].ToString(); Grd_Bulk.Rows[j].Cells[4].Value = ds.Tables["TDPARTY"].Rows[j]["rgdt"].ToString(); Grd_Bulk.Rows[j].Cells[5].Value = ds.Tables["TDPARTY"].Rows[j]["dty"].ToString(); if (Grd_Bulk.Rows[j].Cells[5].Value.ToString() == "Regular") { Grd_Bulk.Rows[j].Cells[5].Style.BackColor = Color.Green; } else { Grd_Bulk.Rows[j].Cells[5].Style.BackColor = Color.Red; } Grd_Bulk.Rows[j].Cells[6].Value = ds.Tables["TDPARTY"].Rows[j]["sts"].ToString(); if (Grd_Bulk.Rows[j].Cells[6].Value.ToString() == "Active") { Grd_Bulk.Rows[j].Cells[6].Style.BackColor = Color.Green; } else { Grd_Bulk.Rows[j].Cells[6].Style.BackColor = Color.Red; } Grd_Bulk.Rows[j].Cells[7].Value = ds.Tables["TDPARTY"].Rows[j]["ctb"].ToString(); } } } }
public void DownloadLiveData() { bool flag; //clsPubPro _clsPubPro; try { MC.Open(); string reply = ""; System.Xml.XmlDocument xmldoc; DataSet dsresult; // string strQuery = ""; //string companyGSTN = CommonHelper.CompanyGSTN; //string TdstcsYear= CommonHelper.ReturnYear; //string month = CommonHelper.GetMonth(CommonHelper.SelectedMonth); //string reqParam = ""; //if (Convert.ToInt32(month) > 3 && Convert.ToInt32(month) <= 12) reqParam = string.Concat(CommonHelper.GetMonth(CommonHelper.SelectedMonth), CommonHelper.ReturnYear.Split('-')[0].Trim()); //else reqParam = string.Concat(CommonHelper.GetMonth(CommonHelper.SelectedMonth), CommonHelper.ReturnYear.Split('-')[1].Trim()); //string _Param = "092019"; var obj = clsPro.Cooki != null?clsPro.Cooki.FirstOrDefault(x => x.ckname == (string.Concat("loginCookies_", "1"))) : null; if (obj != null && obj.CC1 != null) { this.Cc = obj.CC1; //Request URL: https://services.gst.gov.in/services/auth/api/get/certs //Referer: https://services.gst.gov.in/services/auth/certs //Request:https://return.gst.gov.in/returns/auth/api/offline/upload/summary?rtn_prd=032018&rtn_typ=GSTR9C //Referer:https://return.gst.gov.in/returns2/auth/gstr9c/offlineupload //https://return.gst.gov.in/returns/auth/api/offline/upload/error/report/url?token=66ebc40febc6467eac57d0ceb0e87600affb2&rtn_prd=032018&rtn_typ=GSTR9C HttpWebRequest httpWebRequest = this.PrepareGetRequestTdsTcs(new Uri(string.Format("https://return.gst.gov.in/returns/auth/api/offline/upload/error/generate?ref_id=a8cad1ed-1061-43ac-993a-51ce2017fc37&rtn_prd=032018&rtn_typ=GSTR9C")), " https://return.gst.gov.in/returns/auth/api/offline/upload/error/report/url?token=66ebc40febc6467eac57d0ceb0e876002&rtn_prd=032018&rtn_typ=GSTR9C"); this.response = (HttpWebResponse)httpWebRequest.GetResponse(); Stream responseStream = this.response.GetResponseStream(); reply = (new StreamReader(responseStream, Encoding.UTF8)).ReadToEnd(); bool flagstatus = false; //HttpWebRequest httpWebRequest = this.PrepareGetRequestTdsTcs(new Uri(string.Format("https://return.gst.gov.in/returns/auth/api/offline/upload/summary?rtn_prd=032018&rtn_typ=GSTR9C")), "https://return.gst.gov.in/returns2/auth/gstr9c/offlineupload"); //this.response = (HttpWebResponse)httpWebRequest.GetResponse(); //Stream responseStream = this.response.GetResponseStream(); //reply = (new StreamReader(responseStream, Encoding.UTF8)).ReadToEnd(); //bool flagstatus1 = false; JObject jobj = JObject.Parse(reply); JObject jdata = (JObject)jobj["data"]; //JObject jupload = (JObject)jdata["upload"]; JArray jupld = (JArray)jdata["upload"]; // JArray arr = JArray.Parse(reply); string sql = ""; //sql = "Delete from SPQ_UploadSummary"; //MC.sqlcmd = new SQLiteCommand(sql, MC.con); //MC.sqlcmd.ExecuteNonQuery(); for (int i = 0; i < jupld.Count; i++) { string num = Convert.ToString(jupld[i]["num"]); string date = Convert.ToString(jupld[i]["date"]); string time = Convert.ToString(jupld[i]["time"]); string ref_id = Convert.ToString(jupld[i]["ref_id"]); string status = Convert.ToString(jupld[i]["status"]); string er_token = Convert.ToString(jupld[i]["er_token"]); string er_status = Convert.ToString(jupld[i]["er_status"]); } DataTable dt = new DataTable(); //dt = MC.GetValueindatatable("Select Fld_Date, Fld_Time ,Fld_ref_id,Fld_status,Fld_Downloads" + //"CASE WHEN Fld_status = 'P' THEN 'Processed' " + //"WHEN Fld_status = 'PE' THEN 'Processed With error'" + //"END AS QuantityText FROM SPQ_UploadSummary"); dt = MC.GetValueindatatable("SELECT Fld_Date, Fld_Time,Fld_ref_id,CASE WHEN Fld_status = 'P' THEN 'Processed'WHEN Fld_status = 'PE' THEN 'Processed with error' END as 'Status' , Fld_Downloads FROM SPQ_UploadSummary"); Grid_certification.DataSource = dt; MC.InitializeColumn(Grid_certification, 0, "Date", 200, true, DataGridViewContentAlignment.MiddleCenter); MC.InitializeColumn(Grid_certification, 1, "Time", 200, true, DataGridViewContentAlignment.MiddleCenter); MC.InitializeColumn(Grid_certification, 2, "Reference Id", 300, true, DataGridViewContentAlignment.MiddleCenter); MC.InitializeColumn(Grid_certification, 3, "Status", 200, true, DataGridViewContentAlignment.MiddleCenter); MC.InitializeColumn(Grid_certification, 4, "Error Reports", 200, true, DataGridViewContentAlignment.MiddleCenter); //DataGridViewLinkColumn link = new DataGridViewLinkColumn(); //link.HeaderText = "Action"; //link.Name = "pdf"; //link.UseColumnTextForLinkValue = true; //link.Text = "View PDF"; //link.Width = 60; //dgv_view.Columns.Add(link); //+ System.Diagnostics.Process.Start(Convert.ToString(dgv_view.Rows[0].Cells[3].Value)); } else { SPQGstLogin frm = new SPQGstLogin(); frm.strBulk = "BULK"; frm.Visible = false; var result = frm.ShowDialog(); if (result != DialogResult.OK) { DownloadLiveData(); } else { DownloadLiveData(); } } } catch (Exception exception1) { Exception exception = exception1; if (!exception.Message.Contains("403")) { MessageBox.Show(string.Concat("Error : ", exception.Message), "Technical Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); object[] message = new object[] { exception.Message, Environment.NewLine, exception.StackTrace, Environment.NewLine, DateTime.Now, Environment.NewLine }; string str = string.Format("Error: {0}{1}Source: {2}{3}Error Time: {4}{5}", message); StreamWriter streamWriter = new StreamWriter("SPEQTA_Error_File.txt", true); streamWriter.Write(str); streamWriter.Close(); flag = false; } else { SPQGstLogin frm = new SPQGstLogin(); frm.Visible = false; var result = frm.ShowDialog(); if (result != DialogResult.OK) { //GstLogin objLogin = new GstLogin(); //objLogin.Show(); } else { DownloadLiveData(); } //frmGstLogin _frmGstLogin = new frmGstLogin() //{ // Visible = false //}; //if (_frmGstLogin.ShowDialog() == DialogResult.OK) //{ // this.DownloadLiveGSTR9(); //} flag = true; } } finally { MC.Close(); } // return true; }