private void btnDLGifts_Click(object sender, EventArgs e) { //download profile, gifts, pledges, pledge pmts, and donor express records wsXferEventInfo.XferEventInfo wsDLGift; string strSQL; string[,] strAppendResXML = new string[5, 2]; long lngCTUserID = clsAppSettings.GetAppSettings().lngCTUserID; int intGiftCount = 0; int intDXCount = 0; try { intGiftCount = clsDonorCRUD.fcnGiftWebCount(); intDXCount = clsDonorCRUD.fcnDXCount(); lstStatus.Items.Insert(0, "Downloading Gifts..."); Application.DoEvents(); wsDLGift = new wsXferEventInfo.XferEventInfo(); //clear errors from previous download wsDLGift.fcnClearErrs(lngCTUserID, clsWebTalk.strWebConn, "tblGift"); //get contacts (tblProfiles) lstStatus.Items.Insert(0, "Getting new donors"); Application.DoEvents(); strSQL = "SELECT tblRecords.blnFlag1, tblRecords.blnFlag2, tblRecords.blnFlag3, tblRecords.blnFlag4, tblRecords.blnFlag5, tblRecords.blnFlag6, tblRecords.blnFlag7, tblRecords.blnFlag8, tblRecords.blnFlag9, tblRecords.blnFlag10, " + "tblRecords.dteCreationDate, " + "tblRecords.lngRecordWebID, tblRecords.lngRecordID, tblRecords.lngStateID, " + "tblRecords.strFirstName, tblRecords.strLastCoName, tblRecords.strAddress, tblRecords.strCity, tblRecords.strZip, tblRecords.strHomePhone, tblRecords.strWorkPhone, tblRecords.strWorkExt, tblRecords.strCellPhone, tblRecords.strEmail, tblRecords.strSpouseFName, tblRecords.strSpouseLName, tblRecords.strSpousePhone, tblRecords.strReferredBy, tblRecords.strCustom1, tblRecords.strCustom2, tblRecords.strCustom3, tblRecords.strCustom4, tblRecords.strCustom5, tblRecords.strCustom6, tblRecords.strCustom7, tblRecords.strCustom8, tblRecords.strCustom9, tblRecords.strCustom10, tblRecords.strMI, tblRecords.strTitle, tblRecords.strInformalSal " + "FROM tblGift " + "INNER JOIN tblRecords ON tblGift.lngRecordWebID = tblRecords.lngRecordWebID AND " + "tblGift.lngCTUserID = tblRecords.lngCTUserID " + "WHERE ISNULL(tblGift.lngGiftID, 0) = 0 AND " + "tblGift.blnRetrieved = 0 AND " + "tblRecords.lngCTUserID = " + lngCTUserID; strAppendResXML[0, 0] = wsDLGift.fcnGetRecords(strSQL, "tblWebRecords", clsWebTalk.strWebConn); //get gifts (tblGifts) lstStatus.Items.Insert(0, "Getting new gifts"); Application.DoEvents(); strSQL = "SELECT blnMemorial, blnInHonorOf, blnPledgeReminders, blnPledgeAutopay, " + "intPledgeFreq, intPledgeTerm, lngGiftWebID, lngRecordWebID, lngRecordID, lngGiftCategoryID, lngPledgeID, lngCampaignID, lngPaymentTypeID, lngBillStateID, " + "dteGiftDate, " + "curAmount, " + "strMemorialName, strInHonorOf, strAcctNum, strBankName, strBillAddress, strBillCity, strBillName, strBillPhone, strBillZip, strCCExpDate, strCCNumber, strCCValCode, strRoutingNum, strAuthNum, strPNRef, strXCAlias, strXCTransID, strXCEFTAuthCode, strXCEFTRefID, strEPSTransID, strEPSApprovalNumber, strEPSValidationCode, strEPSPmtAcctID " + "FROM tblGift " + "WHERE ISNULL(tblGift.lngGiftID, 0) = 0 AND " + "(blnRetrieved = 0) AND " + "(lngCTUserID = " + lngCTUserID + " )"; strAppendResXML[1, 0] = wsDLGift.fcnGetRecords(strSQL, "tblWebGift", clsWebTalk.strWebConn); //get donor express gifts lstStatus.Items.Insert(0, "Getting new donor express gifts"); Application.DoEvents(); strSQL = "SELECT lngDonorExpressID, lngPaymentTypeID, " + "dteCreated, dteSubmitted, " + "curGiftAmt, " + "strEmail, strFName, strLName, strAddress, strCity, strState, strZip, strHomePhone, strReferredBy, strIMO, strIHO, strCheckNumber, strAcctNum, strBankName, strCCExpDate, strCCNumber, strCCValCode, strRoutingNum, strAuthNum, strPNRef, strXCAlias, strXCTransID, strXCEFTAuthCode, strXCEFTRefID, strEPSTransID, strEPSApprovalNumber, strEPSValidationCode, strEPSPmtAcctID " + "FROM tblDonorExpress " + "WHERE blnRetrieved = 0 AND " + "lngCTUserID = " + clsAppSettings.GetAppSettings().lngCTUserID.ToString() + " AND " + "(NOT (dteSubmitted IS NULL))"; strAppendResXML[2, 0] = wsDLGift.fcnGetRecords(strSQL, "tblDonorExpress", clsWebTalk.strWebConn); lstStatus.Items.Insert(0, "Getting new donor express custom values"); Application.DoEvents(); strSQL = "SELECT tblDonorExpressCustomVals.lngDonorExpressID, " + "tblDonorExpressCustomVals.strFieldName, tblDonorExpressCustomVals.strValue " + "FROM tblDonorExpressCustomVals " + "INNER JOIN tblDonorExpress ON tblDonorExpressCustomVals.lngDonorExpressID = tblDonorExpress.lngDonorExpressID " + "WHERE tblDonorExpressCustomVals.lngCTUserID = " + clsAppSettings.GetAppSettings().lngCTUserID.ToString() + " AND " + "tblDonorExpress.blnRetrieved = 0 AND " + "(NOT (tblDonorExpress.dteSubmitted IS NULL))"; strAppendResXML[3, 0] = wsDLGift.fcnGetRecords(strSQL, "tblDonorExpressCustomVals", clsWebTalk.strWebConn); strSQL = "SELECT tblDXDonorCustomVals.lngDonorExpressID, " + "tblDXDonorCustomVals.strFieldName, tblDXDonorCustomVals.strValue " + "FROM tblDXDonorCustomVals " + "INNER JOIN tblDonorExpress ON tblDXDonorCustomVals.lngDonorExpressID = tblDonorExpress.lngDonorExpressID " + "WHERE tblDonorExpress.blnRetrieved = 0 AND " + "(NOT (tblDonorExpress.dteSubmitted IS NULL)) AND " + "tblDXDonorCustomVals.lngCTUserID = " + clsAppSettings.GetAppSettings().lngCTUserID.ToString(); strAppendResXML[4, 0] = wsDLGift.fcnGetRecords(strSQL, "tblDXDonorCustomVals", clsWebTalk.strWebConn); //add contacts, get result xml strAppendResXML[0, 1] = clsWebTalk.fcnWriteXMLToDB("tblWebRecords", strAppendResXML[0, 0], "lngRecordWebID", false, "lngGiftWebID"); lstStatus.Items.Insert(0, "Adding new donors"); Application.DoEvents(); strAppendResXML[1, 1] = clsWebTalk.fcnWriteXMLToDB("tblWebGift", strAppendResXML[1, 0], "lngGiftWebID", false, "lngGiftWebID"); lstStatus.Items.Insert(0, "Adding new gifts"); Application.DoEvents(); //append downloaded donor express records to db strAppendResXML[2, 1] = clsWebTalk.fcnWriteXMLToDB("tblDonorExpress", strAppendResXML[2, 0], "lngDonorExpressID", false, "lngDonorExpressID"); //append downloaded donor express custom vals to db strAppendResXML[3, 1] = clsWebTalk.fcnWriteXMLToDB("tblDonorExpressCustomVals", strAppendResXML[3, 0], "", false, "lngDonorExpressID"); strAppendResXML[4, 1] = clsWebTalk.fcnWriteXMLToDB("tblDXDonorCustomVals", strAppendResXML[4, 0], "", false, "lngDonorExpressID"); lstStatus.Items.Insert(0, "Posting download results to server"); Application.DoEvents(); //send xml back to server if (wsDLGift.fcnDLRes(strAppendResXML[0, 1], clsWebTalk.strWebConn) != "") lstStatus.Items.Insert(0, "Error posting donor results"); Application.DoEvents(); string strRes = wsDLGift.fcnDLRes(strAppendResXML[1, 1], clsWebTalk.strWebConn); if (strRes != "") lstStatus.Items.Insert(0, "Error posting gift results"); Application.DoEvents(); if (wsDLGift.fcnDLRes(strAppendResXML[2, 1], clsWebTalk.strWebConn) != "") lstStatus.Items.Insert(0, "Error posting donor express results"); Application.DoEvents(); wsDLGift.Dispose(); intGiftCount = clsDonorCRUD.fcnGiftWebCount() - intGiftCount; intDXCount = clsDonorCRUD.fcnDXCount() - intDXCount; lstStatus.Items.Insert(0, "Successfully downloaded and added " + intGiftCount.ToString() + " new gifts and " + intDXCount.ToString() + " donor express gifts"); Application.DoEvents(); } catch (Exception ex) { clsErr.subLogErr("btnDL_Click", ex); } wsDLGift = null; DialogResult resNav; resNav = MessageBox.Show("Process gifts now?", "Process Gifts?", MessageBoxButtons.YesNo); if (resNav == DialogResult.Yes) { clsNav.subShowProcessGifts(clsNav.objSwitchboard); clsNav.subCloseDLGifts(); } }
private void btnDL_Click(object sender, EventArgs e) { //download records, registrations, attendees, and activities that are not marked as 'retrieved'. wsXferEventInfo.XferEventInfo wsDLReg; string strSQL; string[,] strAppendResXML = new string[5, 2]; long lngCTUserID = clsAppSettings.GetAppSettings().lngCTUserID; int intRegCount = 0; try { intRegCount = clsGGCCCRUD.fcnGGCCRegWebCount(); lstStatus.Items.Add("Downloading Event Registrations..."); wsDLReg = new wsXferEventInfo.XferEventInfo(); //clear errors from previous download wsDLReg.fcnClearErrs(lngCTUserID, clsWebTalk.strWebConn, "tblGGCCRegistrations"); //get contacts (tblRecords) lstStatus.Items.Add("Getting new contacts"); Application.DoEvents(); strSQL = "SELECT tblRecords.blnGender, " + "tblRecords.lngRecordWebID, tblRecords.lngRecordID, tblRecords.lngStateID, tblRecords.lngCountryID, " + "tblRecords.strLastCoName, tblRecords.strFirstName, tblRecords.strCompanyName, tblRecords.strEmail, tblRecords.strAddress, tblRecords.strZip, tblRecords.strWorkExt, tblRecords.strWorkPhone, tblRecords.strCellPhone, tblRecords.strCity, tblRecords.strHomePhone " + "FROM tblGGCCRegistrations " + "INNER JOIN tblRecords ON tblGGCCRegistrations.lngRecordWebID = tblRecords.lngRecordWebID " + "WHERE tblGGCCRegistrations.blnRetrieved = 0 AND " + "tblGGCCRegistrations.lngCTUserID = " + lngCTUserID + " AND " + "tblGGCCRegistrations.dteDateRegistered IS NOT NULL " + "GROUP BY tblRecords.blnGender, " + "tblRecords.lngRecordWebID, tblRecords.lngRecordID, tblRecords.lngStateID, tblRecords.lngCountryID, tblGGCCRegistrations.lngGGCCRegistrationWebID, " + "tblRecords.strLastCoName, tblRecords.strFirstName, tblRecords.strCompanyName, tblRecords.strEmail, tblRecords.strAddress, tblRecords.strZip, tblRecords.strWorkExt, tblRecords.strWorkPhone, tblRecords.strCellPhone, tblRecords.strCity, tblRecords.strHomePhone;"; strAppendResXML[0, 0] = wsDLReg.fcnGetRecords(strSQL, "tblRecords", clsWebTalk.strWebConn); //get registrations (tblGGCCRegistrations) lstStatus.Items.Add("Getting new registrations"); Application.DoEvents(); strSQL = "SELECT blnCustomGGCCRegFlag1, blnCustomGGCCRegFlag2, blnCustomGGCCRegFlag3, blnCustomGGCCRegFlag4, blnCustomGGCCRegFlag5, blnCustomGGCCRegFlag6, blnCustomGGCCRegFlag7, blnCustomGGCCRegFlag8, blnCustomGGCCRegFlag9, blnCustomGGCCRegFlag10, blnCustomGGCCRegFlag11, blnCustomGGCCRegFlag12, blnCustomGGCCRegFlag13, blnCustomGGCCRegFlag14, blnCustomGGCCRegFlag15, " + "lngGGCCRegistrationWebID, lngGGCCRegistrationID, lngRegPrompt, lngGGCCID, lngRecordWebID, " + "curDeposit, " + "dblDiscount, " + "dteDateRegistered, dteLastModified, " + "strPaymentType, strBankName, strAcctNum, strRoutingNum, strCardType, strCardNum, strCVV2, strCCExp, strPNRef, strVancoCustRef, strVancoPmtMethID, strXCAlias, strXCTransID, strEPSTransID, strEPSApprovalNumber, strEPSValidationCode, strEPSPmtAcctID " + "FROM tblGGCCRegistrations " + "WHERE blnRetrieved = 0 AND " + "lngCTUserID = " + lngCTUserID.ToString() + " AND " + "dteDateRegistered IS NOT NULL"; strAppendResXML[1, 0] = wsDLReg.fcnGetRecords(strSQL, "tblGGCCRegistrations", clsWebTalk.strWebConn); //get attendees lstStatus.Items.Add("Getting new attendees"); Application.DoEvents(); strSQL = "SELECT tblGGCCRegAttendees.intGender, " + "tblGGCCRegistrations.lngGGCCRegistrationWebID, tblGGCCRegAttendees.lngGGCCRegAttendeeWebID, tblGGCCRegAttendees.lngGGCCRegAttendeeID, tblGGCCRegAttendees.lngGGCCAttendeeStatsID, tblGGCCRegAttendees.lngGuestTypeID, " + "tblGGCCRegAttendees.dteDOB, "+ "tblGGCCRegAttendees.curRate, " + "tblGGCCRegAttendees.strFName, tblGGCCRegAttendees.strLName " + "FROM tblGGCCRegistrations " + "INNER JOIN tblGGCCRegAttendees ON tblGGCCRegistrations.lngGGCCRegistrationWebID = tblGGCCRegAttendees.lngGGCCRegistrationWebID " + "WHERE tblGGCCRegistrations.blnRetrieved = 0 AND " + "tblGGCCRegistrations.lngCTUserID = " + lngCTUserID + " AND " + "tblGGCCRegistrations.dteDateRegistered IS NOT NULL"; strAppendResXML[2, 0] = wsDLReg.fcnGetRecords(strSQL, "tblGGCCRegAttendees", clsWebTalk.strWebConn); //get activities lstStatus.Items.Add("Getting new activities"); Application.DoEvents(); strSQL = "SELECT tblGGCCRegistrations.lngGGCCRegistrationWebID, tblGGCCRegActivities.lngGGCCRegActivityWebID, tblGGCCRegActivities.lngGGCCRegActivityID, tblGGCCRegActivities.intParticipants, tblGGCCRegActivities.lngGGCCActivityID, tblGGCCRegActivities.lngGGCCPackageID " + "FROM tblGGCCRegistrations " + "INNER JOIN tblGGCCRegActivities ON tblGGCCRegistrations.lngGGCCRegistrationWebID = tblGGCCRegActivities.lngGGCCRegistrationWebID " + "WHERE tblGGCCRegistrations.blnRetrieved = 0 AND " + "tblGGCCRegistrations.lngCTUserID = " + lngCTUserID + " AND " + "tblGGCCRegistrations.dteDateRegistered IS NOT NULL"; strAppendResXML[3, 0] = wsDLReg.fcnGetRecords(strSQL, "tblGGCCRegActivities", clsWebTalk.strWebConn); //get housing requests lstStatus.Items.Add("Getting new housing requests"); Application.DoEvents(); strSQL = "SELECT tblGGCCRegistrations.lngGGCCRegistrationWebID, tblGGCCRegHousingRequests.lngGGCCRegHousingRequestID, tblGGCCRegHousingRequests.lngHousingID, tblGGCCRegHousingRequests.lngCount, " + "tblGGCCRegHousingRequests.curCabinCharge AS curCharge " + "FROM tblGGCCRegHousingRequests " + "INNER JOIN tblGGCCRegistrations ON tblGGCCRegHousingRequests.lngGGCCRegistrationWebID = tblGGCCRegistrations.lngGGCCRegistrationWebID " + "WHERE tblGGCCRegistrations.lngCTUserID = " + lngCTUserID + " AND " + "tblGGCCRegistrations.blnRetrieved = 0 AND " + "tblGGCCRegistrations.dteDateRegistered IS NOT NULL"; strAppendResXML[4, 0] = wsDLReg.fcnGetRecords(strSQL, "tblGGCCRegHousingRequests", clsWebTalk.strWebConn); //add contacts, get result xml strAppendResXML[1, 1] = clsWebTalk.fcnWriteXMLToDB("tblWebGGCCRegistrations", strAppendResXML[1, 0], "lngGGCCRegistrationWebID", true, "lngGGCCRegistrationWebID"); lstStatus.Items.Add("Adding new registrations"); strAppendResXML[0, 1] = clsWebTalk.fcnWriteXMLToDB("tblWebRecordsGGCCReg", strAppendResXML[0, 0], "lngRecordWebID", false, "lngGGCCRegistrationWebID"); lstStatus.Items.Add("Adding new contacts"); strAppendResXML[2, 1] = clsWebTalk.fcnWriteXMLToDB("tblWebGGCCRegAttendees", strAppendResXML[2, 0], "lngGGCCRegAttendeeWebID", false, "lngGGCCRegistrationWebID"); lstStatus.Items.Add("Adding new attendees"); strAppendResXML[3, 1] = clsWebTalk.fcnWriteXMLToDB("tblWebGGCCRegActivities", strAppendResXML[3, 0], "lngGGCCRegActivityWebID", false, "lngGGCCRegistrationWebID"); lstStatus.Items.Add("Adding new activities"); strAppendResXML[4, 1] = clsWebTalk.fcnWriteXMLToDB("tblWebGGCCRegHousingRequests", strAppendResXML[4, 0], "lngGGCCRegHousingRequestID", false, "lngGGCCRegistrationWebID"); lstStatus.Items.Add("Adding new housing"); lstStatus.Items.Add("Posting download results to server"); //send xml back to server if (wsDLReg.fcnDLRes(strAppendResXML[0, 1], clsWebTalk.strWebConn) != "") lstStatus.Items.Add("Error posting contact results"); if (wsDLReg.fcnDLRes(strAppendResXML[1, 1], clsWebTalk.strWebConn) != "") lstStatus.Items.Add("Error posting registration results"); if (wsDLReg.fcnDLRes(strAppendResXML[2, 1], clsWebTalk.strWebConn) != "") lstStatus.Items.Add("Error posting attendee results"); if (wsDLReg.fcnDLRes(strAppendResXML[3, 1], clsWebTalk.strWebConn) != "") lstStatus.Items.Add("Error posting activity results"); if (wsDLReg.fcnDLRes(strAppendResXML[4, 1], clsWebTalk.strWebConn) != "") lstStatus.Items.Add("Error posting housing results"); //update dl status on server //wsDLReg.fcnUpdateDLStatus(lngCTUserID, clsWebTalk.strWebConn); wsDLReg.Dispose(); intRegCount = clsGGCCCRUD.fcnGGCCRegWebCount() - intRegCount; lstStatus.Items.Add("Successfully downloaded and added " + intRegCount + " new event registrations"); } catch (Exception ex) { clsErr.subLogErr("btnDL_Click", ex); } wsDLReg = null; }