private void AddInmateFromIDCode(List <string> inmateIDs, List <string> codes) { UpdateStatus(statusSeperator); UpdateStatus("Adding Inmate From ID Code Began"); for (int i = 0; i < inmateIDs.Count; i++) { UpdateStatus("Adding Inmate ID from IDCode => inmateID: " + inmateIDs[i] + ", IDCode: " + codes[i]); String url = "http://ddtext.com/corrlinks/add-inmate-from-IDcode.php?inmateID=" + inmateIDs[i] + "&IDCode=" + codes[i]; MyUtil.GetRequest(url); } UpdateStatus("Adding Inmate From ID Code Ended"); UpdateStatus(statusSeperator); }
private void ValidateSentMessages() { UpdateStatus("Validating Sent Messages"); UpdateStatus(statusSeperator); mChrome.GoToUrl("https://www.corrlinks.com/SentMessages.aspx"); Thread.Sleep(1000); List <string> messageIDs = new List <string>(); try { for (int i = 2; i < 12; i++) { IWebElement ele = mChrome.FindByXPath("//table[@class='MessageDataGrid PhotoMessageDataGrid']//tr[" + i.ToString() + "]//td//a[@class='tooltip'][1]"); if (ele == null) { continue; } string subject = ele.GetAttribute("innerHTML"); bool messageIDAvailable = subject.IndexOf('[') == -1 ? false : true; if (!messageIDAvailable) { continue; } string messageID = subject.Substring(subject.IndexOf('[') + 1, subject.IndexOf(']') - subject.IndexOf('[') - 1); messageIDs.Add(messageID); } string validationURL = "http://ddtext.com/corrlinks/sentmessage-update.php?"; for (int i = 0; i < messageIDs.Count; i++) { validationURL += "msgID[]=" + messageIDs[i] + "&"; } string validationResult = MyUtil.GetRequest(validationURL); UpdateStatus(validationResult); } catch (Exception ex) { } }
private bool SendMessage(MessageOut msg) { mChrome.GoToUrl("https://www.corrlinks.com/NewMessage.aspx"); Thread.Sleep(1000); mChrome.SetTextByID("ctl00_mainContentPlaceHolder_subjectTextBox", msg.SUBJECT); UpdateStatus("Fill the message body"); if (!mChrome.SetTextByID("ctl00_mainContentPlaceHolder_messageTextBox", msg.MESSAGE)) { mChrome.FindById("ctl00_mainContentPlaceHolder_messageTextBox").SendKeys(msg.MESSAGE); } Thread.Sleep(500); mChrome.TryCloseAlert(); try { mChrome.FindById("ctl00_mainContentPlaceHolder_addressBox_addressTextBox").Click(); } catch { UpdateStatus("Error when clicking addressbox field"); return(false); } String addressHtmlBody = mChrome.FindByXPath("//table[@class='AddressBoxDataGrid']/tbody").GetAttribute("innerHTML"); int addressCount = Regex.Matches(addressHtmlBody, "<tr").Count - 1; bool addressFound = false; for (int j = 0; j < addressCount; j++) { String tr = "//table[@class='AddressBoxDataGrid']/tbody/tr[" + (j + 2).ToString() + "]"; String address = mChrome.FindByXPath(tr + "/th").GetAttribute("innerHTML"); int inmate_id = MyUtil.GetMateID(address); if (inmate_id == msg.INMATE_ID) { addressFound = true; mChrome.FindByXPath(tr + "/td[1]//input").Click(); mChrome.FindById("ctl00_mainContentPlaceHolder_addressBox_okButton").Click(); Thread.Sleep(3000); mChrome.FindById("ctl00_mainContentPlaceHolder_sendMessageButton").Click(); Thread.Sleep(3000); UpdateStatus("Sent message to " + msg.INMATE_ID); break; } } if (!addressFound) // Send request if address not found { UpdateStatus("Address not found" + msg.INMATE_ID.ToString()); string validationURL = "http://ddtext.com/corrlinks/sentmessage-update.php?"; validationURL += "msgID[]=" + msg.INBOX_ID + "&" + "addressnotfound=" + msg.INMATE_ID; string validationResult = MyUtil.GetRequest(validationURL); UpdateStatus(validationResult); } return(addressFound); }