private void btnSendRequest_Click(object sender, EventArgs e) { FishConVars.sLog += "\n\r<<<<<<<<<<<<<Requst>>>>>>>>>>>>>\n\r"; FishConVars.sLog += queryParts() + "\n\r"; String customerNameList = FishConVars.fbCon.sendCommand(queryParts()); FishConVars.sLog += "*************Response**************\n\r"; FishConVars.sLog += customerNameList; //Get Response code FishConVars.sLog += FBConErrors.GetError(_form1.pullStatus(customerNameList)) + "\n\r"; if (Application.OpenForms.OfType <LogForm>().Any()) { Application.OpenForms.OfType <LogForm>().First().UpdateLog(); } }
private void btnSalesOrder_Click(object sender, EventArgs e) { //LogintoFishBowl(); Cursor.Current = Cursors.WaitCursor; dataGridView1.Rows.Clear(); String returnString = ""; returnString = FishConVars.FBTicketHeader; returnString += FishConVars.Key; //add key to string returnString += FishConVars.FBRequestHeader; returnString += FishConVars.SOQuery; returnString += tbSalesOrder.Text; returnString += "'" + FishConVars.FBTicketTail; String soResult = FishConVars.fbCon.sendCommand(returnString); FishConVars.sLog += "\n\r<<<<<<<<<<<<<Requst>>>>>>>>>>>>>\n\r"; FishConVars.sLog += returnString + "\n\r"; FishConVars.sLog += "*************Response**************\n\r"; FishConVars.sLog += soResult; FishConVars.sLog += FBConErrors.GetError(pullStatus(soResult)) + "\n\r"; if (Int32.Parse(pullStatus(soResult)) <= 1000) { loadDatagrid(soResult); } if (Application.OpenForms.OfType <LogForm>().Any()) { Application.OpenForms.OfType <LogForm>().First().UpdateLog(); } //LogoutFishbowl(); Cursor.Current = Cursors.Default; //Get Response code }
public string pullStatus(string sResponse) { Match m = Regex.Match(sResponse, "\"statusCode\":*\\s*(\\d*)"); String responseCode = m.Groups[1].ToString(); try { if (Int32.Parse(responseCode) != 1000) { sslResultCode.BackColor = Color.Yellow; } else { sslResultCode.BackColor = Color.LimeGreen; } } catch (Exception e) { MessageBox.Show(e.Message + "\n\rPlease close application and try again.", "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } sslResultCode.Text = responseCode; sslResultCode.ToolTipText = FBConErrors.GetError(responseCode); return(responseCode); }