Exemplo n.º 1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            int intRes = 0;
            int intA = 0;
            int intB = 0;

            wsXferEventInfo.XferEventInfo wsTest;

            try
            {
                intA = int.Parse(txtIntA.Text);
                intB = int.Parse(txtIntB.Text);

                wsTest = new wsXferEventInfo.XferEventInfo();

                intRes = wsTest.fcnAddInt(intA, intB);

                wsTest.Dispose();

                MessageBox.Show("Returned from web service: " + intRes.ToString());
            }
            catch (Exception ex)
            {
                clsErr.subLogErr("frmTestWebService.btnSubmit_Click", ex);
            }

            wsTest = null;
        }
Exemplo n.º 2
0
        private void subValidateProfiles(long _lngCTUserID)
        {
            //download any missing parents of campers that were submitted through the online registration system.
            string strSQL = "";
            string strWHERE = "";
            long lngMissingProfileCount = 0;

            using (OleDbConnection conDB = new OleDbConnection(clsAppSettings.GetAppSettings().strCTConn))
            {
                conDB.Open();

                strSQL = "SELECT tblWebRecords_Camper.lngProfileWebID " +
                        "FROM (tblWebIndRegistrations " +
                            "INNER JOIN tblWebRecords AS tblWebRecords_Camper ON tblWebIndRegistrations.lngRecordWebID = tblWebRecords_Camper.lngRecordWebID) LEFT JOIN tblWebRecords AS tblWebRecords_Parent ON tblWebRecords_Camper.lngProfileWebID = tblWebRecords_Parent.lngRecordWebID " +
                        "GROUP BY tblWebRecords_Camper.lngProfileWebID, tblWebRecords_Parent.lngRecordWebID " +
                        "HAVING tblWebRecords_Camper.lngProfileWebID Is Not Null AND " +
                            "tblWebRecords_Parent.lngRecordWebID Is Null";

                using (OleDbCommand cmdDB = new OleDbCommand(strSQL, conDB))
                {
                    using (OleDbDataReader drProfile = cmdDB.ExecuteReader())
                    {
                        while (drProfile.Read())
                        {
                            lngMissingProfileCount++;

                            long lngProfileWebID = 0;

                            try { lngProfileWebID = Convert.ToInt32(drProfile["lngProfileWebID"]); }
                            catch { lngProfileWebID = 0; }

                            if (strWHERE == "")
                                strWHERE = "WHERE tblRecords.lngRecordWebID=" + lngProfileWebID.ToString();
                            else
                                strWHERE += " OR tblRecords.lngRecordWebID=" + lngProfileWebID.ToString();
                        }
                    }
                }

                conDB.Close();
            }

            if (lngMissingProfileCount > 0)
            {
                //get parent records
                lstDLStatus.Items.Add("Getting missing parent records");
                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.strMI, tblRecords.strCounty, tblRecords.strHomePhone, tblRecords.strSpouseFName, tblRecords.strSpouseLName, tblRecords.strReferredBy, " +
                            "tblRecords.mmoSpecialNeeds, tblRecords.mmoNotes " +
                        "FROM tblRecords " +
                        strWHERE;

                using (wsXferEventInfo.XferEventInfo wsDLProfile = new wsXferEventInfo.XferEventInfo())
                {
                    string strAppendResXML = "";

                    strAppendResXML = wsDLProfile.fcnGetRecords(strSQL, "tblRecords", clsWebTalk.strWebConn);

                    string strRes = clsWebTalk.fcnWriteXMLToDB("tblWebRecords", strAppendResXML, "lngRecordWebID", true, "lngRecordWebID");
                    lstDLStatus.Items.Add("Adding new parent records");
                    Application.DoEvents();
                }
            }
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        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();
            }
        }
Exemplo n.º 5
0
        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;
        }