public static void subShowProcessIndReg(Form _mdiParent) { try { if (objProcessIndReg == null || objProcessIndReg.IsDisposed) objProcessIndReg = new global::CTWebMgmt.Ind.frmProcessIndReg(); objProcessIndReg.MdiParent = _mdiParent; objProcessIndReg.Show(); } catch (Exception ex) { clsErr.subLogErr("subShowProcessIndReg", ex); } }
private void btnDLIndReg_Click(object sender, EventArgs e) { //download records, registrations, and reg choices that are not marked as 'retrieved'. wsXferEventInfo.XferEventInfo wsDLReg; string strSQL; string[,] strAppendResXML = new string[7, 2]; long lngCTUserID = clsAppSettings.GetAppSettings().lngCTUserID; long lngRegCount = 0; try { //get starting count of registrations lngRegCount = clsIndCRUD.fcnGetIRRegCount(); wsDLReg = new wsXferEventInfo.XferEventInfo(); //get parent records lstDLStatus.Items.Add("Getting new parent records"); Application.DoEvents(); strSQL = "SELECT tblRecords_Parents.blnGender, " + "tblRecords_Parents.lngRecordWebID, tblRecords_Parents.lngRecordID, tblRecords_Parents.lngStateID, tblRecords_Parents.lngCountryID, " + "tblRecords_Parents.strLastCoName, tblRecords_Parents.strFirstName, tblRecords_Parents.strCompanyName, tblRecords_Parents.strEmail, tblRecords_Parents.strPassword, tblRecords_Parents.strAddress, tblRecords_Parents.strZip, tblRecords_Parents.strWorkExt, tblRecords_Parents.strWorkPhone, tblRecords_Parents.strCellPhone, tblRecords_Parents.strCity, tblRecords_Parents.strMI, tblRecords_Parents.strCounty, tblRecords_Parents.strHomePhone, tblRecords_Parents.strSpouseFName, tblRecords_Parents.strSpouseLName, tblRecords_Parents.strReferredBy, " + "tblRecords_Parents.mmoSpecialNeeds, tblRecords_Parents.mmoNotes " + "FROM tblRecords tblRecords_Campers " + "INNER JOIN tblRegistrations ON tblRecords_Campers.lngRecordWebID = tblRegistrations.lngRecordWebID AND " + "tblRecords_Campers.lngCTUserID = tblRegistrations.lngCTUserID " + "INNER JOIN tblRecords tblRecords_Parents ON tblRecords_Campers.lngCTUserID = tblRecords_Parents.lngCTUserID AND " + "tblRecords_Campers.lngProfileWebID = tblRecords_Parents.lngRecordWebID " + "WHERE tblRegistrations.lngCTUserID = " + lngCTUserID.ToString() + " AND " + "tblRegistrations.blnRetrieved = 0 AND " + "tblRegistrations.blnSubmitted = 1"; strAppendResXML[0, 0] = wsDLReg.fcnGetRecords(strSQL, "tblRecords", clsWebTalk.strWebConn); //get camper records lstDLStatus.Items.Add("Getting new camper records"); Application.DoEvents(); strSQL = "SELECT tblRecords_Campers.blnGender, " + "tblRecords_Campers.intGradeCompleted, tblRecords_Campers.intYearofGraduation, " + "tblRecords_Campers.lngRecordWebID, tblRecords_Campers.lngRecordID, tblRecords_Campers.lngStateID, tblRecords_Campers.lngCountryID, tblRecords_Campers.lngProfileWebID, " + "tblRecords_Campers.dteBirthDate, " + "tblRecords_Campers.strLastCoName, tblRecords_Campers.strFirstName, tblRecords_Campers.strCompanyName, tblRecords_Campers.strEmail, tblRecords_Campers.strAddress, tblRecords_Campers.strZip, tblRecords_Campers.strWorkExt, tblRecords_Campers.strWorkPhone, tblRecords_Campers.strCellPhone, tblRecords_Campers.strCity, tblRecords_Campers.strMI, tblRecords_Campers.strCounty, tblRecords_Campers.strHomePhone, tblRecords_Campers.strSpouseFName, tblRecords_Campers.strSpouseLName, tblRecords_Campers.strSpousePhone, tblRecords_Campers.strMotherName, tblRecords_Campers.strFatherName, " + "tblRecords_Campers.mmoSpecialNeeds, tblRecords_Campers.mmoNotes " + "FROM tblRecords tblRecords_Campers " + "INNER JOIN tblRegistrations ON tblRecords_Campers.lngRecordWebID = tblRegistrations.lngRecordWebID AND " + "tblRecords_Campers.lngCTUserID = tblRegistrations.lngCTUserID " + "WHERE tblRegistrations.lngCTUserID = " + lngCTUserID.ToString() + " AND " + "tblRegistrations.blnRetrieved = 0 AND " + "tblRegistrations.blnSubmitted = 1"; strAppendResXML[1, 0] = wsDLReg.fcnGetRecords(strSQL, "tblRecords", clsWebTalk.strWebConn); //get registration records lstDLStatus.Items.Add("Getting new registrations"); Application.DoEvents(); string strDiscount = ""; for (int intI = 1; intI <= 10; intI++) strDiscount += "blnDiscount" + intI.ToString() + ", "; strSQL = "SELECT " + strDiscount + "lngRegistrationWebID, lngRecordWebID, lngRegSourceID, lngConfMethodID, lngRegHoldID, " + "curDeposit, curDonation, curSpendingMoney, " + "dteRegistrationDate, dteCreated, " + "strBuddy1, strBuddy2, strReleaseTo, strXCTransID, strXCAlias, strRoutingNumber, strAcctNumber, strPmtType, strCardNumber, strPNRef, strXCAuthCode, strEPSTransID, strEPSApprovalNumber, strEPSValidationCode, strEPSPmtAcctID, strOrgCode, " + "mmoRegNotes " + "FROM tblRegistrations " + "WHERE lngCTUserID = " + lngCTUserID.ToString() + " AND " + "blnRetrieved = 0 AND " + "blnSubmitted = 1"; strAppendResXML[2, 0] = wsDLReg.fcnGetRecords(strSQL, "tblRegistrations", clsWebTalk.strWebConn); //get block choices lstDLStatus.Items.Add("Getting additional registration choices"); Application.DoEvents(); strSQL = "SELECT tblRegistrationBlockChoices.lngRegistrationBlockChoiceID, tblRegistrationBlockChoices.lngRegistrationWebID, tblRegistrationBlockChoices.lngBlockID, tblRegistrationBlockChoices.lngChoice " + "FROM tblRegistrations " + "INNER JOIN tblRegistrationBlockChoices ON tblRegistrations.lngRegistrationWebID = tblRegistrationBlockChoices.lngRegistrationWebID " + "WHERE tblRegistrations.blnRetrieved = 0 AND " + "tblRegistrations.lngCTUserID = " + lngCTUserID; strAppendResXML[3, 0] = wsDLReg.fcnGetRecords(strSQL, "tblRegistrationBlockChoices", clsWebTalk.strWebConn); //add records, get result xml to send to web server and update record ids strAppendResXML[0, 1] = clsWebTalk.fcnWriteXMLToDB("tblWebRecords", strAppendResXML[0, 0], "lngRecordWebID", true, "lngRecordWebID"); lstDLStatus.Items.Add("Adding new parent records"); Application.DoEvents(); strAppendResXML[1, 1] = clsWebTalk.fcnWriteXMLToDB("tblWebRecords", strAppendResXML[1, 0], "lngRecordWebID", true, "lngRecordWebID"); lstDLStatus.Items.Add("Adding new camper records"); Application.DoEvents(); //write web record custom field vals to new tbl //custom data for profile records strSQL = "SELECT tblCustomFieldValIR.lngRecordWebID, " + "tblCustomFieldValIR.strLocalCaption, tblCustomFieldValIR.strValue " + "FROM tblRecords tblRecords_Campers " + "INNER JOIN tblRegistrations ON tblRecords_Campers.lngRecordWebID = tblRegistrations.lngRecordWebID AND " + "tblRecords_Campers.lngCTUserID = tblRegistrations.lngCTUserID " + "INNER JOIN tblRecords tblRecords_Parents ON tblRecords_Campers.lngCTUserID = tblRecords_Parents.lngCTUserID AND " + "tblRecords_Campers.lngProfileWebID = tblRecords_Parents.lngRecordWebID " + "INNER JOIN tblCustomFieldValIR ON tblCustomFieldValIR.lngRecordWebID = tblRecords_Parents.lngRecordWebID " + "WHERE tblRegistrations.lngCTUserID = " + lngCTUserID.ToString() + " AND " + "tblRegistrations.blnRetrieved = 0 AND " + "tblRegistrations.blnSubmitted = 1"; strAppendResXML[4, 0] = wsDLReg.fcnGetRecords(strSQL, "tblCustomFieldValIR", clsWebTalk.strWebConn); strAppendResXML[4, 1] = clsWebTalk.fcnWriteXMLToDB("tblCustomFieldValWebIR", strAppendResXML[4, 0], "", false, ""); //custom data for camper records strSQL = "SELECT tblCustomFieldValIR.lngRecordWebID, " + "tblCustomFieldValIR.strLocalCaption, tblCustomFieldValIR.strValue " + "FROM tblCustomFieldValIR " + "INNER JOIN tblRecords ON tblCustomFieldValIR.lngRecordWebID = tblRecords.lngRecordWebID " + "INNER JOIN tblRegistrations ON tblRecords.lngRecordWebID = tblRegistrations.lngRecordWebID " + "WHERE tblRegistrations.lngCTUserID = " + clsAppSettings.GetAppSettings().lngCTUserID.ToString() + " AND " + "tblRegistrations.blnRetrieved = 0 AND " + "tblRegistrations.blnSubmitted = 1"; strAppendResXML[5, 0] = wsDLReg.fcnGetRecords(strSQL, "tblCustomFieldValIR", clsWebTalk.strWebConn); strAppendResXML[5, 1] = clsWebTalk.fcnWriteXMLToDB("tblCustomFieldValWebIR", strAppendResXML[5, 0], "", false, ""); strSQL = "SELECT tblCustomFieldValReg.lngRegistrationWebID, " + "tblCustomFieldValReg.strLocalCaption, tblCustomFieldValReg.strValue " + "FROM tblRegistrations " + "INNER JOIN tblCustomFieldValReg ON tblRegistrations.lngRegistrationWebID = tblCustomFieldValReg.lngRegistrationWebID " + "WHERE tblRegistrations.lngCTUserID = " + clsAppSettings.GetAppSettings().lngCTUserID.ToString() + " AND " + "tblRegistrations.blnRetrieved = 0 AND " + "tblRegistrations.blnSubmitted = 1"; strAppendResXML[6, 0] = wsDLReg.fcnGetRecords(strSQL, "tblCustomFieldValReg", clsWebTalk.strWebConn); strAppendResXML[6, 1] = clsWebTalk.fcnWriteXMLToDB("tblCustomFieldValWebReg", strAppendResXML[6, 0], "", false, ""); strAppendResXML[2, 1] = clsWebTalk.fcnWriteXMLToDB("tblWebIndRegistrations", strAppendResXML[2, 0], "lngRegistrationWebID", true, "lngRegistrationWebID"); lstDLStatus.Items.Add("Adding new registrations"); strAppendResXML[3, 1] = clsWebTalk.fcnWriteXMLToDB("tblWebIndRegBlockChoices", strAppendResXML[3, 0], "lngRegistrationBlockChoiceID", false, "lngRegistrationWebID"); lstDLStatus.Items.Add("Adding new block choices"); Application.DoEvents(); subValidateProfiles(lngCTUserID); lstDLStatus.Items.Add("Validating custom profile data"); Application.DoEvents(); //subValidateCustomProfileData(); //subCleanCustomData(); lstDLStatus.Items.Add("Posting download results to server"); Application.DoEvents(); string strErr = ""; //update dl status on server strErr = wsDLReg.fcnDLRes(strAppendResXML[2, 1], clsWebTalk.strWebConn); wsDLReg.Dispose(); lngRegCount = clsIndCRUD.fcnGetIRRegCount() - lngRegCount; lstDLStatus.Items.Add("Successfully downloaded and added " + lngRegCount + " new registrations"); Application.DoEvents(); frmProcessIndReg objProcessIndReg = new frmProcessIndReg(); objProcessIndReg.MdiParent = this.MdiParent; this.Close(); objProcessIndReg.Show(); } catch (Exception ex) { clsErr.subLogErr("btnDL_Click", ex); } wsDLReg = null; }
public static void subCloseProcessIndReg() { try { objProcessIndReg.Close(); objProcessIndReg.Dispose(); objProcessIndReg = null; } catch (Exception ex) { clsErr.subLogErr("subCloseProcessIndReg", ex); } }