/*-------------------------------------------------------------------------------------------------------------------------------------------------- Program Listing for: massfileDlg.cpp Project: massfile Namespace: c++ ---------------------------------------------------------------------------------------------------------------------------------------------------- */ // massfileDlg.cpp : implementation file // #include "stdafx.h" #include "massfile.h" #include "massfileDlg.h" #include "dlgOptions.h" #include <wininet.h> #include <stdio.h> #include <stdlib.h> #include <time.h> // for now this is a test server running on my home computer #define MARICOPA_URL "www.sboe.state.az.us" #define MARICOPA_USER "REDACTED" #define MARICOPA_PASS "REDACTED" // when doing things requiring low level things with sockets its nice to hit the message // loop, otherwise the whole app appears to hang and the progress bar doesnt move, which is what // peekme does, it just calls peekmessage a few times, which gets rid of screen locking type behavior // while the socket send is going on (if you don't believe me, take it out and try dragging the window // during file send, or see if the progress bar moves very uniformly - it doesn't. ) this is standard // windows esoterica "well behaved apps hit the message queue every now and then" void peekme(void); #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif // agency structure used for keeping data on agents // note attempt to use consts more struct Agency { long AgencyNo; const char *Descrip; }; // this list of agents is static but could make it interactive from web site // for now this fine... // note I'm not including this stuff in list box this is sort // of like a lame security method so they have to know // they're agent no (or type in 300 possibilities). // probably will get this stuff via XML in next version #define BASKIND_ID 110 Agency agencylist[] = { {165,"INDEPENDENT,EUGENE JONES"}, {27, "BASKIND & ASSOCIATES"}, {185,"INDEPENDENT,DOUGLAS CHEESMAN"}, {245,"INDEPENDENT,RICHARD FELDMANN"}, {125,"INDEPENDENT,JOHN CAMPO III"}, {225,"INDEPENDENT,PATRICIA DUNCAN"}, {385,"INDEPENDENT,RICHARD MADRIL"}, {387,"INDEPENDENT,LOUIS MAEGDLIN"}, {382,"INDEPENDENT,MARTIN LORCH"}, {204,"INDEPENDENT,LAWRENCE CUTLER"}, {178,"INDEPENDENT,LARRY FINK"}, {222,"INDEPENDENT,MACK DICKERSON"}, {362,"INDEPENDENT,DAVID KRAUS"}, {13,"INDEPENDENT,ARTHUR ROMLEY"}, {12,"INDEPENDENT,MICHAEL PETRUS"}, {4,"ADVANTAGE 2000,LOUIS SANCHEZ"}, {15,"AMERICAN PROPERTY ADVISORS INC,JAMES VICENDESE, JR"}, {17,"ANDERSON & ASSOCIATES,DON ANDERSON"}, {18,"APPRAISAL SERVICES,MEAHL CLAUDIA"}, {20,"ARIZONA LAND ADVISORS,MIKE SCHWAB"}, {30,"ARIZONA PROPERTY TAX PROFESSIONALS INC,JACK GARRETT"}, {40,"ARTHUR ANDERSEN LLP,NEIL WOLFE"}, {6,"ASHLAND SERVICE CO,STEPHEN LENIHAN"}, {5,"ASHLAND SERVICE COMPANY,DUFF HEARON"}, {9,"ASHLAND SERVICE COMPANY,JOHN LLOYD"}, {7,"ASSET TAX CONSULTING GROUP,PETER HOLMES"}, {60,"ASSOCIATED SERVICES,RALPH KLEIN"}, {70,"ATI TAX SERVICE,MARK WIRTH"}, {187,"ATTORNEY AT LAW,LOREN CHRISTENFELD"}, {80,"AVS/VALUATION SERVICES INC,TODD SAKOWICZ"}, {85,"AVTAX,PAUL HAWN"}, {90,"B & G PROPERTY TAX ASSOCIATES,JOY GOMEZ"}, {100,"BANK ONE,NEIL CHRISTENSEN"}, {110,"ROBIN COHEN"}, {130,"BROADWAY REALTY & TRUST,JOSEPH CESARE"}, {10,"BROENING, OBERG, WOODS, WILSON & CASS,KEVIN AHERN"}, {135,"BURCH & CRACCHIOLO,CLARE ABLE"}, {701,"BURKE & NICKEL,STANLEY JOHNSON"}, {137,"BURR WOLFF PROPERTY TAX CONSULTANTS,MARK VANDAGRIFF"}, {155,"CAREFREE PROPERTY TAX REDUCTION SPECIALI,JERRY O'HANLON"}, {180,"CB RICHARD ELLIS INC,KENT GREENWALD"}, {170,"CB COMMERCIAL PROP TAX SERVICES - TUCSON,DONALD AHEE"}, {202,"COLE REAL ESTATE SERVICES INC,SCOTT COLE"}, {295,"COMPREHENSIVE PROPERTY TAX SERVICE,DOUGLAS GOODRICH"}, {205,"COOPERS & LYBRAND LLP,BRAD GORSKI"}, {201,"CULBRETH GROUP LLC,JAMES CULBRETH"}, {615,"CUSHMAN & WAKEFIELD,ROBERT RYAN"}, {140,"DAIN CALVIN, ATTY AT LAW,DAIN CALVIN"}, {210,"DELIOTTE & TOUCHE LLP,PAUL RIORDAN"}, {540,"DELOITTE & TOUCHE LLP,MARY LAMBERT"}, {550,"DELOITTE & TOUCHE LLP,MAUREEN TATUM"}, {215,"DEPASQUALE KELLEY & CO,SEAN KELLEY"}, {216,"DEVON TAX GROUP,RONALD RITCHIE"}, {600,"DON ROELKE LAW OFFICES,DON ROELKE"}, {655,"ED & LINDA VAN SCOY,ED VAN SCOY"}, {240,"EQUITY PLUS,STEVE PRITCHARD"}, {235,"ERNST & YOUNG LLP,BOB KUISLE"}, {670,"FENNEMORE CRAIG LAW OFFICES,JIM WRIGHT"}, {450,"FENNEMORE GRAIG LAW OFFICES,PAUL MOONEY"}, {255,"FIRST APPRAISAL SERVICES INC,RICHARD FOGARTY"}, {250,"FLYNN & ASSOCIATED,RICHARD FLYNN"}, {260,"G H GARCIA CONSULTING INC,GEORGE GARCIA"}, {270,"GARLAND REALTY,BOB GARLAND"}, {310,"GARY HEIMBACH P C,GARY HEIMBACH"}, {280,"GEISLER & ASSOCIATES,STEVE GEISLER"}, {290,"GENESIS REAL ESTATE & DEVELOPMENT,VALERIE PRUITT"}, {410,"GEORGE MCELROY & ASSOCIATES,ROLAND WELCH"}, {345,"GOLDMAN & KAPLAN,MORRIS KAPLAN"}, {666,"GRUBB & ELLIS,RUSSELL WARNER"}, {305,"HAYLAND GROUP,JOHN HAY"}, {315,"HELLON & ASSOCIATES,MICHAEL HELLON"}, {347,"HILL & HILL ACCOUNTING,JEFFREY HILL"}, {316,"HOFFERT & ASSOCIATES,KENNETH VOSS"}, {2,"HOSKINS COMPANY,CHARLES HOSKINS"}, {320,"HOSPITALITY ASSESSMENT SERVICES INC,DAN MITCHELL"}, {325,"HOWARD & ASSOCITES,HUGH HOWARD"}, {327,"INTERNATIONAL APPRAISAL CO,BRUCE STAVITSKY"}, {330,"IRA H FRIEDMAN & ASSOCIATES,IRA FRIEDMAN"}, {340,"IRONSTONE GROUP INC,JUDY HILL"}, {342,"J.C. ENTERPRISES,JOHN CLARK"}, {200,"JAMES CLARK CO,JOHN CLARK"}, {660,"JAMES D WEZELMAN PC,JAMES WEZELMAN"}, {653,"JAY VANCE & ASSO.,JAY VANCE"}, {150,"JD CAMPBELL REALTY,JD CAMPBELL"}, {152,"JOSEPH C SANSONE CO,DAVE SMITH"}, {151,"JOSEPH C SANSONE CO,MICHAEL McDONALD"}, {360,"KPMG PEAT MARWICK,KEVIN RICHARDSON"}, {665,"LAW OFFICES,JOHN TULLY"}, {365,"LEADORN ENTERPRISES,TIM SANDROCK"}, {220,"LEWIS & ROCA,PATRICK DERDENGER"}, {380,"LIBERATORE & ASSOCIATES,TONY LIBERATORE"}, {349,"LOUIS L. KISSLING & ASSO.,LOUIS KISSLING"}, {390,"MARATHON RESOURCES INC,KEVIN MARINAN"}, {160,"MARK CAVNESS LAW OFFICES,MARK CAVNESS"}, {650,"MARK TYNAN LAW OFFICES,MARK TYNAN"}, {425,"MARSHALL & ASSOCIATES,MARIE MARSHALL"}, {400,"MARVIN POER & CO,PATRICK SULLIVAN"}, {405,"MAXEY & ASSOCIATES,ROBERT MAXEY"}, {420,"METCALF & ASSOCIATES,RAY METCALF"}, {490,"MILT NOVKOV & ASSOCIATES,MILT NOVKOV"}, {440,"MJN ENTERPRISES INC,THOMAS NAIFEH"}, {300,"MOHR, HACKETT, PEDERSON & BLANKLEY,AZIM HAMEED"}, {430,"MORRISON & HECKER,JIM BARRONS"}, {462,"MOUNTS REAL ESTATE GROUP,SUSAN MOUNTS"}, {480,"NEARHOOD & PARKER, LLC,TODD PARKER"}, {120,"PAMELA BEATON & ASSOCIATES INC,PAMELA BEATON"}, {659,"PAUL A WETZEL, ATTORNEY AT LAW,PAUL WETZEL"}, {485,"PERRY & NEIDORF,MURRY NEIDORF"}, {500,"PROPERTY ASSESSMENT SERVICES,PETER MCCLAUGHLIN"}, {11,"PROPERTY TAX BUSTERS "}, {510,"PROPERTY TAX EVALUATIONS,BARBARA PERSHING"}, {505,"PROPERTY TAX EVALUATIONS INC,TIMOTHY ABRAMS"}, {520,"PROPERTY TAX PROFESSIONALS,MIKE STAKEMILLER"}, {530,"PROPERTY TAX RELIEF SPECIALISTS INC,GEORGE BASCH"}, {408,"R E MCELROY INC,MICHAEL McELROY"}, {560,"REAL ESTATE EVALUATION GROUP,LES ABRAMS"}, {565,"REAL ESTATE VALUATION CONSULTANTS,BILL CHRISMAN"}, {570,"REALTY EXECUTIVES OF TUCSON,JAMES TSIGHIS"}, {580,"REICHER CORP,SHEILA REICHER"}, {370,"RICHARD LANE LAW OFFICES,RICHARD LANE"}, {495,"RICHARD POTTS LAW OFFICES,RICHARD POTTS"}, {605,"RUSSO, COX & RUSSO, P.C.,STEVEN RUSSO"}, {585,"RYLEY CARLOCK & APPLEWHITE,WILLIAM WILDER"}, {700,"RYLEY, CARLOCK, & APPLEWHITE,WERNER MEYER"}, {610,"SAGE TAX GROUP INC,HEDY PIVARAL"}, {21,"SCHAEFER & ASSOCIATES,DONALD SCHAEFER"}, {625,"SIERRA PACIFIC TAX SERVICES,SHAUN RUDGEAR"}, {620,"SNELL & WILMER,JANET BARTON"}, {656,"SOUTHWEST,JUSTIN WEISS"}, {627,"SOUTHWEST FINANCIAL SERVICES,JEFF SEAHORN"}, {630,"SPIESS & SHORT P C,PETER SPIESS"}, {355,"STEVEN M KOSSACK & ASSOCIATES,STEVEN KOSSACK"}, {730,"STRASSBURG & COMPANY,NEAL SANDERS"}, {640,"STREICH LANG,JOHN SWAIN"}, {632,"STUBBS & SCHUBART PC,THOMAS PARSONS, ESQ."}, {633,"SUNVEST COMMERCIAL,JOSEPH NEHLS"}, {635,"SURE ASSESSMENT SERVICES,SHIRLEY STEPHENSON"}, {3,"TAX DETECTIVE LLC,PAUL EULER"}, {641,"TAX PROFILE SERVICE INC,JEFFREY MONROE"}, {8,"THE ASSOCIATES REAL ESTATE APPRAISING,MARY CAROL O'MALLEY"}, {302,"THE HAVINS CO INC,HERBERT HAVINS"}, {317,"THE HOSKINS COMPANY INC,CHARLES HOSKINS"}, {465,"THOMAS J MURPHY ATTORNEY AT LAW,THOMAS MURPHY"}, {190,"TOSCO MARKETING CO,GAYLE PLATT"}, {642,"TUCSON REAL ESTATE APPRAISAL,JEFF PATCH"}, {645,"TUCSON REALTY & TRUST "}, {14,"WEBB COOLEY COMPANY,LEE ADAMS"}, {657,"WENTWORTH, WEBB & POSTAL LLC,DERON WEBB"}, {658,"WF INTERWEST INC REAL ESTATE APPRAISAERS,JACK FIENE"}, {0, (char *)0 } }; // these are the agent numbers for maricopa probably should dynamically "grab" this /// via the web at some point. note maricopa trashes their file every year and starts anew but I am not sure // whether this means agents do or do not reuse their old numbers... further research here. Agency CountyList[] = { {0,"RALPH V BENSON"}, {2,"ASSET TAX CONSULTING GROUP"}, {5,"LOU KISSLING"}, {6,"ROBERT KIRSHENBAUM GENERAL PARTNER"}, {19,"MARK L MANOIL"}, {20,"PROPERTIES & MANAGEMENT"}, {25,"MILLER LORI R"}, {27,"ATTORNEY AND ATTORNEY IN FACT"}, {28,"ARIZONA LAND ADVISORS INC"}, {29,"PAMELA BEATON & ASSOCIATES INC"}, {32,"INDUSTRY CONSULTING GROUP INC"}, {33,"DON R ANDERSON"}, {34,"ARTHUR ANDERSEN & COMPANY"}, {39,"AVS VALUATION SERVICES INC"}, {40,"CBTZ PROPERTY TAX SOLUTIONS"}, {41,"AD VALOREM TAX INC"}, {42,"THOMAS J MCNULTY, NEAL, GERBER & EISENBERG"}, {44,"GH GARCIA CONSULTING INC"}, {45,"KNIGHT & ASSOCIATES INC"}, {46,"PLANTE JOHN PAUL"}, {48,"ARIZONA LAND ADVISORS"}, {49,"BASKIND COHEN & ASSOCIATES"}, {50,"R WOOD"}, {54,"REALTY INVESTMENT COMPANY"}, {55,"CLEMMENS WILLIAM L"}, {57,"JIM SCHWALLS & ASSOC"}, {58,"NATIONWIDE CONSULTING CO INC"}, {59,"R E MCELROY INC"}, {62,"LEWIS AND ROCA"}, {64,"DAVID WM WEST"}, {65,"NCK RAYES ATT"}, {68,"STREICH LANG PA"}, {69,"BURTON T COHEN"}, {70,"ZANE L BRANNAN"}, {71,"GERALD D SHERRIL ESQ"}, {72,"NEARHOOD & PARKER"}, {73,"ROBERT MASON CFP, EA"}, {74,"JAMES L CORBET"}, {75,"DEPASQUALE KELLEY & COMPANY"}, {76,"NATIONAL BUREAU OF PROPERTY ADMIN INC"}, {77,"DAVE BROWNC/O ERNST & YOUNG LLP PROP TAX"}, {80,"BURKE & NICKEL"}, {81,"DENNIS SEVER"}, {86,"KRIEBS DIANA L"}, {88,"MARK LORUSSO DUCHARME MCMILLEN & ASSOC"}, {89,"CHARLES R STEEN"}, {91,"COMMERCIAL TAX NETWORK"}, {92,"CHARLES ALBERT"}, {94,"GAMMAGE & BURNHAM P L C"}, {95,"THE SAGE TAX GROUP INC"}, {96,"RONALD N ROVEY"}, {97,"DAIN K CALVIN ESQ"}, {98,"MICHAEL T HELLON"}, {100,"MEYERS TABER & MEYERS P C"}, {101,"DUSHOFF & MCCALL"}, {101,"MANDY E CONSLTING"}, {105,"DOUGLAS KOCK"}, {108,"CLARK JAMES CO & ASSOCIATES"}, {109,"SMIT HEMMESCH BURKE & BRANNIGAN"}, {110,"JOHN OPFERMAN OR ROBERT SLAVIN"}, {111,"T MICHAEL DAGGETT ESQ"}, {112,"TAXDECTECTIVE LLC"}, {113,"LEWIS & ROCA"}, {114,"SHARON SNOW & ASSOCIATES INC"}, {115,"LEVENBAUM & COHEN ATTYS"}, {119,"STEVENS &ASSOCIATES INC"}, {120,"LAS SALAS INC"}, {128,"GATES WILLIAMS"}, {142,"DUCHARME MCMILLEN & ASSOCIATES INC"}, {150,"BURR WOLFF LP"}, {154,"EQUITY PLUS"}, {190,"COMPRENSIVE TAX SERVICE"}, {237,"GERALD L COOLEY ATT"}, {242,"WILDER WILLIAM F ESQ"}, {243,"ANN M DUMENIL ATTORNEY"}, {247,"LEE JOSEPH W ATTY"}, {251,"ROELKE DONALD ATTY"}, {252,"ROMLEY & ROMLEY ATTY"}, {262,"GARY HEIMBACH P C"}, {263,"WARNER ANGLE ROPER & HALLAM PC"}, {264,"JIM L WRIGHT C/O FERNEMORE CRAIG"}, {265,"ATI TAX SERVICE"}, {269,"SPIESS, SPIESS & SHORT P C"}, {276,"PAUL J MOONEY"}, {286,"FIRST AMERICAN TAX VALUATION"}, {295,"KPMG PEAT MARWICK"}, {306,"FINK LARRY A"}, {317,"ANTHONY LIBERATORE AND ASSOCIATES"}, {396,"NATIONWIDE TAX APPEALS INC"}, {398,"NEARHOOD & PARKER"}, {408,"OCONNOR, CAVANAGH"}, {409,"HUTCHISON"}, {428,"MARVIN POER F & CO"}, {449,"PROPERTY ASSESSMENT SERVICES"}, {451,"PROPERTY ASSESSMENT SERVICES INC"}, {455,"MORRIS A KAPLAN ATTORHNEY AT LAW"}, {466,"STEVEN J BROWN"}, {467,"PROPERTY TAX RELIEF SPECIALISTS INC"}, {475,"WAYNE A SMITH"}, {476,"THE HOSKINS COMPANY INC"}, {477,"BOB JASTRZAB"}, {486,"REAL ESTATE EVALUATION GROUP INC"}, {488,"PROPERTY TAX PROFESSIONALS"}, {489,"REAL ESTATE VALUATION CONSULTANTS"}, {495,"REICHER CORPORATION"}, {497,"FLYNN RICHARD"}, {500,"ASSOCIATE PROPERTY TAX"}, {542,"SNELL & WILMER"}, {564,"STRASSBURG & COMPANY"}, {566,"STRAUS & CO"}, {572,"STREICH LANG"}, {599,"REO TAX CONSULTING INC"}, {607,"DELOITTE & TOUCHE PROPERTY TAX SERVICES"}, {666,"STERNBERG & EAGLE"}, {667,"MICHEAL PETRUS"}, {685,"J C ENTERPRISE"}, {692,"PROPERTY TAX EVALUATION INC"}, {725,"HAYLAND PROPERTY TAX CONSULTING INC"}, {738,"B & G PROPERTY TAX ASSOCIATES"}, {808,"PROPERTY TAX PROFESSIONALS"}, {828,"MARSHALL & ASSOC."}, {838,"BRIDGE & ASSOCIATES"}, {840,"IRA H FRIEDMAN & ASSOCIATES"}, {847,"AMERICAN PROPERTY ADVISORS INC"}, {871,"REAL ESTATE SERVICES"}, {875,"RICHARD H LANE ATTORNEY"}, {879,"HOSPITALITY ASSESSMENT SERVICE"}, {889,"RICHARD M FELDMAN"}, {891,"METCALF AND ASSOCIATES"}, {895,"GEO WILLIAMS"}, {899,"DELOITE &TOUCHE LLP"}, {900,"JD CAMPBELL"}, {901,"KLEIM & BARENBLAT"}, {902,"GEORGE MCELROY & ASSOCIATES IN"}, {903,"DUCHARME,MILLEN & ASSOCIATES INC"}, {904,"GAYLE PLATT"}, {906,"COLE REAL ESTATES SERVICES"}, {907,"ROVERT R BAUER ESQ"}, {910,"DEVRY, INC"}, {911,"NEIL FRYE"}, {913,"W W P"}, {914,"ROBERT D RASH & ASSOCIATES INC"}, {916,"ELLIS BAKER & PORTER"}, {917,"JAMES R PERRY ESQ"}, {918,"THE STRATOS GROUP C/O STAN WAGNER"}, {921,"DEVON TAX GROUP"}, {922,"KENNETH W VOSS"}, {924,"MARC C CAVNESS ATTORNEY"}, {925,"STEWART & BOURQUE P C"}, {926,"DOUGLAS K COOK"}, {930,"BURR WOLFF"}, {931,"PAUL S HARTER P C"}, {932,"MARTIN & PATTERSON LTD"}, {933,"RYLERY CARLOCK & APPLEWHITE"}, {936,"EKMARK & EKMARK L L C"}, {938,"FIRSTAR REAL ESTATE"}, {945,"MARRIOTT INTERNATIONAL INC"}, {950,"COOPERS & LYBRAND LLP"}, {951,"ANDREW M COHN LTD"}, {975,"COMMERCIAL TAX NETWORK"}, {990,"ROBERT D MCCOY ATTORNEY AT LAW"}, {999,"DON R ANDERSON"}, {999,"CURRY & ASSOCIATES"}, {1000,"JOSEPH C SANSONE CO"}, {1110,"CUSHMENT & WAKEFIELD"}, {1507,"SD KLEMM & ASSOCIATES"}, {5000,"EKMARK & EKMARK LLC"}, {5555,"PROTAX/NAT PRO TAX MGNT"}, {6669,"SIMON PROPERTY TAX"}, {900009,"BASKIND & ASSOCIATES"}, {900007,"R. L. Cohen & Associates"}, {-1, (char *)0 } }; ///////////////////////////////////////////////////////////////////////////// // CAboutDlg dialog used for App About class CAboutDlg : public CDialog { public: CAboutDlg(); // Dialog Data //{{AFX_DATA(CAboutDlg) enum { IDD = IDD_ABOUTBOX }; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAboutDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: //{{AFX_MSG(CAboutDlg) //}}AFX_MSG DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { //{{AFX_DATA_INIT(CAboutDlg) //}}AFX_DATA_INIT } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CAboutDlg) //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) //{{AFX_MSG_MAP(CAboutDlg) // No message handlers //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CMassfileDlg dialog CMassfileDlg::CMassfileDlg(CWnd* pParent /*=NULL*/) : CDialog(CMassfileDlg::IDD, pParent) { //{{AFX_DATA_INIT(CMassfileDlg) m_Comments = _T(""); m_UploadFile = _T(""); m_Response = _T(""); m_Status = _T(""); m_EMail = _T(""); m_FT_Access = -1; m_FT_Text = -1; m_MainFileText = _T(""); m_MultFileText = _T(""); m_UploadFileDos = _T(""); m_FT_Dbase = -1; m_CountyResponse = _T(""); m_AgencyID = 0; m_StateAgencyNo = 0; //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); bUsingProxy = 0; cSendType = 'D'; } void CMassfileDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CMassfileDlg) DDX_Text(pDX, IDC_COMMENTS, m_Comments); DDX_Text(pDX, IDC_UPLOADFILE, m_UploadFile); DDX_Text(pDX, IDC_RESPONSE, m_Response); DDX_Text(pDX, IDC_STATUSINFO, m_Status); DDX_Text(pDX, IDC_EMAIL, m_EMail); DDX_Radio(pDX, IDC_ACCESSFILES, m_FT_Access); DDX_Radio(pDX, IDC_TEXTFILES, m_FT_Text); DDX_Text(pDX, IDC_MAINFILETEXT, m_MainFileText); DDX_Text(pDX, IDC_MULTFILETEXT, m_MultFileText); DDX_Text(pDX, IDC_UPLOADFILE2, m_UploadFileDos); DDX_Radio(pDX, IDC_DBASEFILE, m_FT_Dbase); DDX_Text(pDX, IDC_RESPONSE2, m_CountyResponse); DDX_Text(pDX, IDC_AGENCYNO, m_AgencyID); DDX_Text(pDX, IDC_STATEAGENCYNO, m_StateAgencyNo); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CMassfileDlg, CDialog) //{{AFX_MSG_MAP(CMassfileDlg) ON_WM_SYSCOMMAND() ON_WM_DESTROY() ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(IDC_LOCATE, OnLocate) ON_EN_CHANGE(IDC_AGENCYNO, OnChangeAgencyno) ON_EN_UPDATE(IDC_AGENCYNO, OnUpdateAgencyno) ON_EN_KILLFOCUS(IDC_AGENCYNO, OnKillfocusAgencyno) ON_BN_CLICKED(IDOK, OnSend) ON_BN_CLICKED(IDOPTIONS, OnOptions) ON_BN_CLICKED(IDGETSAMPLE, OnGetsample) ON_BN_CLICKED(IDC_ACCESSFILES, OnAccessfiles) ON_BN_CLICKED(IDC_TEXTFILES, OnTextfiles) ON_BN_CLICKED(IDC_LOCATE2, OnLocate2) ON_BN_CLICKED(IDGETSAMPLE2, OnGetsampleDBF) ON_BN_CLICKED(IDC_DBASEFILE, OnDbasefile) ON_BN_CLICKED(IDC_SENDMARICOPA, OnSendMaricopa) ON_EN_KILLFOCUS(IDC_STATEAGENCYNO, OnKillfocusStateagencyno) ON_WM_CTLCOLOR() ON_BN_CLICKED(IDC_FORMATINFO, OnFormatinfo) ON_BN_CLICKED(IDC_MARICO_BULK_INFO, OnMaricoBulkInfo) ON_BN_CLICKED(IDC_SENDTOSBOE, OnSend) ON_BN_CLICKED(IDC_ModProfile, OnModProfile) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CMassfileDlg message handlers BOOL CMassfileDlg::OnInitDialog() { CDialog::OnInitDialog(); // Add "About..." menu item to system menu. // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon CStatic* maricopa_text = (CStatic *)GetDlgItem(IDC_MARICOPA_TEXT); CStatic* sboe_text = (CStatic *)GetDlgItem(IDC_SBOE_TEXT); CStatic* text1 = (CStatic *)GetDlgItem(IDC_MAINFILETEXT); CStatic* text2 = (CStatic *)GetDlgItem(IDC_MULTFILETEXT); CStatic* text3 = (CStatic *)GetDlgItem(IDC_MULTFILETEXT2); CStatic* text4 = (CStatic *)GetDlgItem(IDC_RESPONSE); CStatic* text5 = (CStatic *)GetDlgItem(IDC_RESPONSE2); CStatic* text6 = (CStatic *)GetDlgItem(IDC_EMAIL1); CStatic* text7 = (CStatic *)GetDlgItem(IDC_EMAIL2); CStatic* text8 = (CStatic *)GetDlgItem(IDC_COMMENTS2); CStatic* text9 = (CStatic *)GetDlgItem(IDC_STATUSINFO); CStatic* text10 = (CStatic *)GetDlgItem(IDC_SBOE_TEXT_TYPE); CButton* button1 = (CButton *)GetDlgItem(IDC_DBASEFILE); CButton* button2 = (CButton *)GetDlgItem(IDC_TEXTFILES); CButton* button3 = (CButton *)GetDlgItem(IDC_ACCESSFILES); ASSERT_VALID(maricopa_text); CDC* pDC = GetDC(); newfont.CreateFont(MulDiv(8, -pDC->GetDeviceCaps(LOGPIXELSY), 72), 0, 0, 0, FW_BOLD, 0, 0, 0, ANSI_CHARSET, OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, DRAFT_QUALITY, VARIABLE_PITCH | FF_SWISS, _T("Arial")); maricopa_text->SetFont(&newfont); sboe_text->SetFont(&newfont); text1->SetFont(&newfont); text2->SetFont(&newfont); text3->SetFont(&newfont); text4->SetFont(&newfont); text5->SetFont(&newfont); text6->SetFont(&newfont); text7->SetFont(&newfont); text8->SetFont(&newfont); text9->SetFont(&newfont); text10->SetFont(&newfont); button1->SetFont(&newfont); button2->SetFont(&newfont); button3->SetFont(&newfont); CComboBox* pLB = (CComboBox *)GetDlgItem(IDC_COMBO_TYPE_SEND); //pLB->SetHorizontalExtent( 1000 ); //pLB->SetDroppedWidth( 1000); pLB->InsertString(-1,"Main Season Appeals"); pLB->InsertString(-1,"Notice of Change Appeals"); pLB->InsertString(-1,"Error or Correction Appeals"); //HRGN *region = new HRGN; //SetWindowRgn( ®ion, 1 ); //pLB->SetItemHeight( 0, 16 ); // TODO: Add extra initialization here return TRUE; // return TRUE unless you set the focus to a control } void CMassfileDlg::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID & 0xFFF0) == IDM_ABOUTBOX) { CAboutDlg dlgAbout; dlgAbout.DoModal(); } else { CDialog::OnSysCommand(nID, lParam); } } void CMassfileDlg::OnDestroy() { WinHelp(0L, HELP_QUIT); CDialog::OnDestroy(); } // If you add a minimize button to your dialog, you will need the code below // to draw the icon. For MFC applications using the document/view model, // this is automatically done for you by the framework. void CMassfileDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); // Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon dc.DrawIcon(x, y, m_hIcon); } else { CDialog::OnPaint(); } } // The system calls this to obtain the cursor to display while the user drags // the minimized window. HCURSOR CMassfileDlg::OnQueryDragIcon() { return (HCURSOR) m_hIcon; } void CMassfileDlg::OnLocate() { UpdateData(TRUE); // make sure they've selected a file type, nonselected is -1 if ( (m_FT_Access == -1) && (m_FT_Text == -1) && (m_FT_Dbase == -1) ) { AfxMessageBox("Select Transfer Type First"); return; } CFileDialog * dlg; CString temp; if (m_FT_Access == 0) { temp = "Access Database\0*.MDB\0\0"; dlg = new CFileDialog(TRUE, "mdb", "*.mdb"); } else if (m_FT_Text == 0) { temp = "Main Text File\0*.TXT;*.\0\0"; dlg = new CFileDialog(TRUE, "txt", "*.txt"); } else { temp = "Dbase III+ File\0*.DBF;*.\0\0"; dlg = new CFileDialog(TRUE, "dbf", "*.dbf"); } dlg->m_ofn.lpstrFilter = temp; UpdateData(TRUE); if (dlg->DoModal() == IDOK) { m_UploadFile = dlg->GetPathName(); m_UploadFile.MakeUpper(); // redraw upload file on screen UpdateData(FALSE); } } void CMassfileDlg::OnChangeAgencyno() { //MessageBox("Changing Text"); } void CMassfileDlg::OnUpdateAgencyno() { // MessageBox("UPdate agency no"); } // this function checks the SBOE agent id for validity void CMassfileDlg::OnKillfocusAgencyno() { UpdateData(TRUE); int n; long itemp; CString temp; if (m_AgencyID == 0) { m_Response = "SBOE Agency Not Found"; UpdateData(FALSE); return; } // loop thru and try to find the agency no in the list array for (n=0; 1; n++ ) { itemp = agencylist[n].AgencyNo; if (m_AgencyID == itemp ) { m_Response = agencylist[n].Descrip; UpdateData(FALSE); break; } // the last item in the structure has a value of zero, this means we've exhausted the // possibilities and didn't find it. not this isn't indexed but the array isn't super huge so // this somewhat brute force method should be okies for now. if (itemp == 0) { MessageBox("Sorry, SBOE Agency Not Found!"); m_Response = "Not Found"; UpdateData(FALSE); break; } } } int CMassfileDlg::SendFile(CString sLocal, CString sRemote, int send_type) { BOOL error = 0; BOOL bret = TRUE; CFile uploadFile; HINTERNET hIS, hIC, hIF; DWORD dwBytes; DWORD fsize; CString writefile, write2; UpdateData(TRUE); if ( strchr( m_EMail, '@') == NULL || strchr( m_EMail, '.') == NULL ) { MessageBox("Invalid email, valid format user@site.ext"); return FALSE; } if (! uploadFile.Open(sLocal, CFile::modeRead) ) { MessageBox("Couldn't open local file!"); return FALSE; } fsize = uploadFile.GetLength(); //if (! bUsingProxy) // new logic, test for direct, if not try proxy, then if problem quit hIS = InternetOpen("MFUPLOAD", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); // direct failure, try proxy if (! hIS ) { hIS = InternetOpen("MFUPLOAD", INTERNET_OPEN_TYPE_PROXY, NULL, NULL, 0); } // proxy failed too, show error msg if (! hIS) { MessageBox("Trouble opening Internet connection... Make sure you are on the net!"); uploadFile.Close(); return FALSE; } // if SBOE type sending if (send_type == 0) { hIC = InternetConnect(hIS, "www.sboe.state.az.us", INTERNET_DEFAULT_FTP_PORT, "Uploader", "Emilie", INTERNET_SERVICE_FTP, 0, 0); if (! hIC) { MessageBox("Trouble creating Internet connection to SBOE, Please retry later"); InternetCloseHandle(hIS); uploadFile.Close(); return FALSE; } } // otherwise assume MARICOPA (for now these are the two options as of now) else { hIC = InternetConnect(hIS, MARICOPA_URL, INTERNET_DEFAULT_FTP_PORT, MARICOPA_USER, MARICOPA_PASS, INTERNET_SERVICE_FTP, 0, 0); if (! hIC) { MessageBox("Trouble creating Internet connection to County, Please retry later"); InternetCloseHandle(hIS); uploadFile.Close(); return FALSE; } } hIF = FtpOpenFile(hIC, sRemote, GENERIC_WRITE, FTP_TRANSFER_TYPE_BINARY, 0); if (! hIF) { MessageBox("Trouble creating server write file"); InternetCloseHandle(hIC); InternetCloseHandle(hIS); uploadFile.Close(); return FALSE; } char *pbuf; // new array of chars is always fun, as long as it gets deleted later using the weird delete [] construct // in general i prefer c++ ways to malloc, and also, in general, i prefer raw c++ constructs (canonical) // to the sometimes useful but often not entirely MFC collection classes, etc. pbuf = new char[201]; // i use the fields like m_Status and m_Response as a way to quickly write label values m_Status = "Please wait.. uploading File"; UpdateData(FALSE); // put below in block to save memory... (I was being creative, but it doesn't hurt anything =) { // note i send the file sort of in small pieces, this allows me to update the progress bar smoothly // and also i'm not sure if internetwritefile might act weird if i sent like 5megs of data all at once. // so i break it unto little pieces, it doesn't appear to hurt performance much, the sends are fairly // fast. int n; unsigned long curpos; unsigned long readnum; // why UINT? because microsoft dislikes using canonical c++ when they can redefine the language // in such a way as it is less portable. why is UINT better than unsigned int? because monopolies make // more money for billy bob. can you sense I am not a huge redmond fan? UINT nBytesRead; // setup progress bar stuff CProgressCtrl *pb = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS1); pb->SetRange(0, 100); pb->SetPos(0); int iquit = 0; // loop through local file reading 200 bytes at a time // and writing it to server file, with error checking for (n=0;1;n++) { curpos = n*200; readnum = 200; pb->SetPos( 100*curpos/fsize ); // call to peekmessage via peekme helps the screen to not lock during low level operations // like this, this is a general windows trick to provide fluid screens even when working with // modems and sockets. (take this out and watch the progress bar not work and the whole app // appear to "freeze up" on you until the send finishes). peekme(); // 200 more would exceed file len, set readnum // to a lesser amt if (curpos + 200 > fsize ) { readnum = fsize - curpos; if (readnum == 0) { pb->SetPos(100); // progress bar won't update visually unless peekmsg // is called to process a few windows msgs // peekme function does this. basic // multithreading at its simplest. peekme(); break; } // this is last chunk of file to read, set ending flag iquit = 1; } // shd never happen, i'm paranoid if (readnum > 200) { MessageBox("Logic error, file not written, notify programmer"); bret = FALSE; break; } // read in from local file readnum bytes nBytesRead = uploadFile.Read( pbuf, readnum ); if (nBytesRead != readnum ) { MessageBox("Trouble reading local data file, bytes missing!"); bret = FALSE; break; } // write those bytes to target on server if (! InternetWriteFile(hIF, pbuf, readnum, &dwBytes) ) { MessageBox("Trouble writing data file, write file fx"); bret = FALSE; break; } if (readnum != dwBytes ) { MessageBox("Trouble writing data file, bytes not written fully!"); bret = FALSE; break; } // one way out of loop, we've finished file if (iquit) { pb->SetPos(100); peekme(); break; } } } // close files InternetCloseHandle(hIF); uploadFile.Close(); delete [] pbuf; InternetCloseHandle(hIC); InternetCloseHandle(hIS); // reset progress bar to zero. CProgressCtrl *pb = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS1); pb->SetPos(0); return bret; } // SendStringToFile sends the tracking information on this send to the tracking file // which is often an INF file I write on the server (simply a text file in a special format // with info in it I use to get more background on the file sending). This function sends // this "string" of info to a file on the FTP server. // send_type is a new addition to track whether this is a county or SBOE send. int CMassfileDlg::SendStringToFile(CString sData, CString sRemote, int send_type) { BOOL error = 0; HINTERNET hIS, hIC, hIF; DWORD dwBytes; //DWORD fsize; CString writefile, write2; UpdateData(TRUE); //if (! bUsingProxy) // new logic, test for direct, if not try proxy, then if problem quit hIS = InternetOpen("MFUPLOAD", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); // direct failure, try proxy if (! hIS ) { hIS = InternetOpen("MFUPLOAD", INTERNET_OPEN_TYPE_PROXY, NULL, NULL, 0); } if (! hIS) { MessageBox("Trouble opening Internet connection... Make sure you are on the net!"); return FALSE; } if (send_type==0) { hIC = InternetConnect(hIS, "www.sboe.state.az.us", INTERNET_DEFAULT_FTP_PORT, "Uploader", "Emilie", INTERNET_SERVICE_FTP, 0, 0); if (! hIC) { MessageBox("Trouble creating Internet connection to the SBOE, please retry later"); InternetCloseHandle(hIS); return FALSE; } } else { hIC = InternetConnect(hIS, MARICOPA_URL, INTERNET_DEFAULT_FTP_PORT, MARICOPA_USER, MARICOPA_PASS, INTERNET_SERVICE_FTP, 0, 0); if (! hIC) { MessageBox("Trouble creating Internet connection to Maricopa, please retry later"); InternetCloseHandle(hIS); return FALSE; } } hIF = FtpOpenFile(hIC, sRemote, GENERIC_WRITE, FTP_TRANSFER_TYPE_BINARY, 0); if (! hIF) { MessageBox("Trouble creating server write file"); InternetCloseHandle(hIC); InternetCloseHandle(hIS); return FALSE; } m_Status = "Please wait.. uploading File"; UpdateData(FALSE); char *pbuf2 = new char[sData.GetLength() + 1]; strcpy(pbuf2, sData); //MessageBox(pbuf2); InternetWriteFile(hIF, pbuf2, sData.GetLength(), &dwBytes); if (dwBytes != (unsigned)(sData.GetLength()) ) { MessageBox("Trouble uploading file summary information!"); InternetCloseHandle(hIF); InternetCloseHandle(hIC); InternetCloseHandle(hIS); return FALSE; } delete [] pbuf2; InternetCloseHandle(hIF); InternetCloseHandle(hIC); InternetCloseHandle(hIS); // reset progress bar to zero. CProgressCtrl *pb = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS1); pb->SetPos(0); return TRUE; } void CMassfileDlg::OnSend() { UpdateData(TRUE); if ( (m_FT_Access == -1) && (m_FT_Text == -1) && (m_FT_Dbase == -1) ) { AfxMessageBox("Select Transfer Type First"); return; } // get reference to type of send list box CComboBox* pLB = (CComboBox *)GetDlgItem(IDC_COMBO_TYPE_SEND); int cursel = pLB->GetCurSel(); if (cursel == -1) { MessageBox("Please Select Type of Sending (e.g. Main Season, Notice of Change, or Correction"); return; } BOOL error = 0; CFile uploadFile; //HINTERNET hIS, hIC, hIF; //DWORD dwBytes; //DWORD fsize; CString writefile, write2; //write2 is inf file CString writeshort; // writefile without path info added CString writefile2; //writefile2 defined for multiple parcel for text sendings CString short2; UpdateData(TRUE); srand( (unsigned)time( NULL ) ); CString tmp1; tmp1 = m_EMail; tmp1.TrimLeft(); if (tmp1.IsEmpty() ) { MessageBox("Must fill in EMail Address!"); return; } CString info; char bufferx[20]; bufferx[0] = (char) 0; // set default to empty string // transfer long to this character buffer _ltoa(m_AgencyID, bufferx, 10); // create a temp string from this buffer CString tmp(bufferx); //tmp = m_AgencyID; /* if ( tmp.IsEmpty() || m_AgencyID == 0) { MessageBox("Must fill in Valid SBOE Agency No!"); return; } if (m_Response == "Not Found") { MessageBox("Must fill in Valid SBOE Agency No!"); return; } */ time_t osBinaryTime; // C run-time time (defined in <time.h>) time( &osBinaryTime ) ; // Get the current time from the // operating system. CTime t3( osBinaryTime ); // CTime from CString s = t3.Format( "%A, %B %d, %Y, %H:%M:%S" ); long rnd; rnd = rand(); if (m_FT_Dbase == 0) { writefile.Format("/process/%i_%d.DBF", m_AgencyID, rnd ); writeshort.Format("%i_%d.DBF", m_AgencyID, rnd ); write2.Format("/process/%i_%d.INF", m_AgencyID, rnd ); //AfxMessageBox(writefile); if ( ! SendFile(m_UploadFile, writefile, 0) ) { AfxMessageBox("Process Aborted"); return; } // put info going into INF file into a string, "info" info.Format("XBASE:%d",m_AgencyID); info += (char)13; info += s; info += (char)13; info += m_UploadFile; info += (char)13; info += writeshort; info += (char)13; info += (char)13; info += (char)13; info += m_EMail; info += (char)13; info += m_Comments; } else if ( m_FT_Access == 0) { writefile.Format("/process/%i_%d.MDB", m_AgencyID, rnd ); write2.Format("/process/%i_%d.INF", m_AgencyID, rnd ); writeshort.Format("%i_%d.MDB", m_AgencyID, rnd ); //AfxMessageBox(writefile); if ( ! SendFile(m_UploadFile, writefile, 0) ) { AfxMessageBox("Process Aborted"); return; } // put info going into INF file into a string, "info" info.Format("ACCESS:%d",m_AgencyID); info += (char)13; info += s; info += (char)13; info += m_UploadFile; info += (char)13; info += writeshort; info += (char)13; info += (char)13; info += (char)13; info += m_EMail; info += (char)13; info += m_Comments; } else { writefile.Format("/process/%i_%d.MAI", m_AgencyID, rnd ); writefile2.Format("/process/%i_%d.MUL", m_AgencyID, rnd ); writeshort.Format("%i_%d.MAI", m_AgencyID, rnd ); short2.Format("%i_%d.MUL", m_AgencyID, rnd ); //AfxMessageBox(writefile); //AfxMessageBox(writefile2); write2.Format("/process/%i_%d.INF", m_AgencyID, rnd ); if ( ! SendFile(m_UploadFile, writefile, 0) ) { AfxMessageBox("Process Aborted"); return; } // upload file dos, as in uno dos tres... if ( ! SendFile(m_UploadFileDos, writefile2, 0) ) { AfxMessageBox("Process Aborted"); return; } // put info going into INF file into a string, "info" info.Format("TEXT:%d",m_AgencyID); info += (char)13; info += s; info += (char)13; info += m_UploadFile; info += (char)13; info += writeshort; info += (char)13; info += m_UploadFileDos; info += (char)13; info += short2; info += (char)13; info += m_EMail; info += (char)13; info += m_Comments; } //AfxMessageBox(info); info += "__TYPE_SBOE__\n"; CString sTypeSend; ((CWnd *)pLB)->GetWindowText( sTypeSend ); info += "SEND_TYPE::"; info += sTypeSend; info += "\n"; //MessageBox( test); if (!SendStringToFile( info, write2, 0) ) { AfxMessageBox("Process Aborted"); return; } m_Status = "Data Uploaded Successfully"; MessageBox("You should receive confirmation to your default email within\n1-2 hours if questions contact SBOE at 602-253-7800 x28\n"); UpdateData(FALSE); } void CMassfileDlg::OnSendTxt() { } // at various points the visual interface needs to be updated // say progress bar changing size while uploading. // this won't happen during, say file read, windows has to // be able to process a few messages first. this proc allows that. // or restated this makes the app not "freeze" during socket stuff by // calling peekmessage which allows windows to keep the screens looking // somewhat happy and not "freezing". for why this is so read a book on windows // I've played with the value of the number of peeks to peek, right now its 10 which // appears to work well. void peekme(void) { MSG message; int n2; // 10 is an arbitrary number for (n2=0;n2<10;n2++) { if (::PeekMessage(&message, NULL, 0, 0, PM_REMOVE)) { ::TranslateMessage(&message); ::DispatchMessage(&message); } } } void CMassfileDlg::OnOptions() { dlgOptions dlg; dlg.m_Proxy = bUsingProxy; int ret = dlg.DoModal(); bUsingProxy = dlg.m_Proxy; if (ret) { CString out; out.Format("proxy flag:%i", bUsingProxy); //MessageBox(out); } // TODO: Add your control notification handler code here } // allow them to download samples off our ftp site on the web void CMassfileDlg::OnGetsample() { HINTERNET hIS, hIC, hIF; DWORD dwBytes; char c[201] ; CFile savefile; CString savefilename; CFileDialog dlg(FALSE, "mdb", "access_samp.mdb"); char *temp = "Access Files, *.MDB\0*.MDB\0\0"; dlg.m_ofn.lpstrFilter = temp; dlg.m_ofn.lpstrTitle = "Enter Local Filename to Save Sample MDB File As"; if (dlg.DoModal() == IDOK) { savefilename = dlg.GetPathName(); UpdateData(FALSE); } else { return; } peekme(); hIS = InternetOpen("MASSGET", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); // direct failure, try proxy if (! hIS ) { hIS = InternetOpen("MFUPLOAD", INTERNET_OPEN_TYPE_PROXY, NULL, NULL, 0); } if (! hIS) { MessageBox("Trouble opening Internet connection... Make sure you are on the net!"); return; } hIC = InternetConnect(hIS, "www.sboe.state.az.us", INTERNET_DEFAULT_FTP_PORT, "Uploader", "Emilie", INTERNET_SERVICE_FTP, 0, 0); if (! hIC) { MessageBox("Trouble creating Internet connection"); InternetCloseHandle(hIS); return; } hIF = FtpOpenFile(hIC, "ef_db.mdb", GENERIC_READ, FTP_TRANSFER_TYPE_BINARY, 0); if (! hIF) { MessageBox("Trouble accessing sample file on server, retry in a few minutes"); InternetCloseHandle(hIC); InternetCloseHandle(hIS); return; } if (! savefile.Open(savefilename, CFile::modeCreate | CFile::modeWrite) ) { MessageBox("Trouble creating local save file!"); InternetCloseHandle(hIC); InternetCloseHandle(hIS); InternetCloseHandle(hIF); return; } CProgressCtrl *pb = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS1); pb->SetRange(0, 100); pb->SetPos(0); DWORD curpos = 0; while (1) { if ( ! InternetReadFile(hIF, c, 200, &dwBytes)) { MessageBox("Some trouble during transfer.. full info not sent.. aborting."); InternetCloseHandle(hIC); InternetCloseHandle(hIS); InternetCloseHandle(hIF); savefile.Close(); return; } // if this happens have reached eof if (dwBytes == 0) break; savefile.Write(c, dwBytes); curpos += dwBytes; // 165888 is size of sample file in bytes pb->SetPos( 100*curpos/165888 ); peekme(); } savefile.Close(); InternetCloseHandle(hIF); InternetCloseHandle(hIC); InternetCloseHandle(hIS); m_Status = "Sample File Received OK"; UpdateData(FALSE); pb->SetPos(0); } void CMassfileDlg::OnAccessfiles() { UpdateData(TRUE); if (m_FT_Access != 0) m_UploadFile = ""; m_FT_Text = 1; m_FT_Access = 0; m_FT_Dbase = 1; m_MainFileText = "ACCESS MDB FILE"; m_UploadFile = ""; UpdateData(FALSE); CWnd * tp = GetDlgItem(IDC_MULTFILETEXT); tp->ShowWindow(SW_HIDE); CWnd * tp2 = GetDlgItem(IDC_UPLOADFILE2); tp2->ShowWindow(SW_HIDE); CWnd * tp3 = GetDlgItem(IDC_LOCATE2); tp3->ShowWindow(SW_HIDE); } void CMassfileDlg::OnTextfiles() { UpdateData(TRUE); if (m_FT_Text != 0) m_UploadFile = ""; m_FT_Access = 1; m_FT_Text = 0; m_FT_Dbase = 1; //m_UploadFileDos = ""; UpdateData(FALSE); if (m_AgencyID != BASKIND_ID) { AfxMessageBox("The Text format is currently only in use " "with a few agencies.\n\nThis format is rather " "difficult to get right and is typically not \nrecommended for agents if the other formats are possible.\nIf you are a new e-filing agent wishing " "to use it please \nnotify SBOE beforehand by " "calling 602-253-7800 x28 \nso we can test your " "format.\n\nThanks."); if (AfxMessageBox("I have already tested my Text sending format and wish to continue.", MB_YESNO ) != IDYES) { OnAccessfiles(); return; } } m_MainFileText = "MAIN TEXT FILE"; m_MultFileText = "MULT PARCEL TEXT FILE"; UpdateData(FALSE); CWnd * tp = GetDlgItem(IDC_MULTFILETEXT); tp->ShowWindow(SW_SHOW); CWnd * tp2 = GetDlgItem(IDC_UPLOADFILE2); tp2->ShowWindow(SW_SHOW); CWnd * tp3 = GetDlgItem(IDC_LOCATE2); tp3->ShowWindow(SW_SHOW); } void CMassfileDlg::OnLocate2() { CFileDialog * dlg; CString temp; temp = "Multiple Parcel Info Text File\0*.TXT;*.\0\0"; dlg = new CFileDialog(TRUE, "txt", "*.txt"); dlg->m_ofn.lpstrFilter = temp; UpdateData(TRUE); if (dlg->DoModal() == IDOK) { m_UploadFileDos = dlg->GetPathName(); m_UploadFileDos.MakeUpper(); // redraw upload file on screen UpdateData(FALSE); } // TODO: Add your control notification handler code here } void CMassfileDlg::OnGetsampleDBF() { // TODO: Add your control notification handler code here HINTERNET hIS, hIC, hIF; DWORD dwBytes; char c[201] ; CFile savefile; CString savefilename; CFileDialog dlg(FALSE, "dbf", "fox_samp.dbf"); char *temp = "Dbase Files, *.DBF\0*.DBF\0\0"; dlg.m_ofn.lpstrFilter = temp; dlg.m_ofn.lpstrTitle = "Enter Local Filename to Save Sample DBF File As"; if (dlg.DoModal() == IDOK) { savefilename = dlg.GetPathName(); UpdateData(FALSE); } else { return; } peekme(); hIS = InternetOpen("MASSGET", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_ASYNC); // direct failure, try proxy if (! hIS ) { hIS = InternetOpen("MFUPLOAD", INTERNET_OPEN_TYPE_PROXY, NULL, NULL, 0); } if (! hIS) { MessageBox("Trouble opening Internet connection... Make sure you are on the net!"); return; } hIC = InternetConnect(hIS, "www.sboe.state.az.us", INTERNET_DEFAULT_FTP_PORT, "Uploader", "Emilie", INTERNET_SERVICE_FTP, 0, 0); if (! hIC) { MessageBox("Trouble creating Internet connection"); InternetCloseHandle(hIS); return; } hIF = FtpOpenFile(hIC, "fox_samp.dbf", GENERIC_READ, FTP_TRANSFER_TYPE_BINARY, 0); if (! hIF) { MessageBox("Trouble accessing sample file on server, retry in a few minutes"); InternetCloseHandle(hIC); InternetCloseHandle(hIS); return; } if (! savefile.Open(savefilename, CFile::modeCreate | CFile::modeWrite) ) { MessageBox("Trouble creating local save file!"); InternetCloseHandle(hIC); InternetCloseHandle(hIS); InternetCloseHandle(hIF); return; } CProgressCtrl *pb = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS1); pb->SetRange(0, 100); pb->SetPos(0); DWORD curpos = 0; while (1) { if ( ! InternetReadFile(hIF, c, 200, &dwBytes)) { MessageBox("Some trouble during transfer.. full info not sent.. aborting."); InternetCloseHandle(hIC); InternetCloseHandle(hIS); InternetCloseHandle(hIF); savefile.Close(); return; } // if this happens have reached eof if (dwBytes == 0) break; savefile.Write(c, dwBytes); curpos += dwBytes; // 165888 is size of sample file in bytes pb->SetPos( 100*curpos/165888 ); peekme(); } savefile.Close(); InternetCloseHandle(hIF); InternetCloseHandle(hIC); InternetCloseHandle(hIS); m_Status = "Sample File Received OK"; UpdateData(FALSE); pb->SetPos(0); } void CMassfileDlg::OnDbasefile() { // TODO: Add your control notification handler code here UpdateData(TRUE); if (m_FT_Dbase != 0) m_UploadFile = ""; m_FT_Dbase = 0; m_FT_Text = 1; m_FT_Access = 1; m_MainFileText = "Dbase III+/Foxplus DBF FILE"; m_UploadFile = ""; UpdateData(FALSE); CWnd * tp = GetDlgItem(IDC_MULTFILETEXT); tp->ShowWindow(SW_HIDE); CWnd * tp2 = GetDlgItem(IDC_UPLOADFILE2); tp2->ShowWindow(SW_HIDE); CWnd * tp3 = GetDlgItem(IDC_LOCATE2); tp3->ShowWindow(SW_HIDE); } void CMassfileDlg::OnSendMaricopa() { time_t osBinaryTime2; // C run-time time (defined in <time.h>) time( &osBinaryTime2 ) ; // Get the current time from the // operating system. CTime t4( osBinaryTime2 ); // CTime from CString s2 = t4.Format( "%Y" ); //MessageBox( s2 ); // if not 2002 show this error and exit if ( s2 == "2001") { MessageBox("The Maricopa Sending System is in Beta and will begin Main Season 2002. " "Contact SBOE and Maricopa County for more info on how you may participate, SBOE will be sending more updates later this year " "on how to file to Maricopa electronically using this same uploader utility. The process will be very similar to filing an SBOE " "claim, the database layout will allow the same types (xbase, text, access) and is almost identical to the SBOE format with a few other fields added. To get more info click on the Maricopa Bulk Info button. " "To send a filing to SBOE please use Send To SBOE button above and continue as normal."); return; } UpdateData(TRUE); if ( (m_FT_Access == -1) && (m_FT_Text == -1) && (m_FT_Dbase == -1) ) { AfxMessageBox("Select Transfer Type First"); return; } BOOL error = 0; CFile uploadFile; //HINTERNET hIS, hIC, hIF; //DWORD dwBytes; //DWORD fsize; CString writefile, write2; //write2 is inf file CString writeshort; // writefile without path info added CString writefile2; //writefile2 defined for multiple parcel for text sendings CString short2; UpdateData(TRUE); srand( (unsigned)time( NULL ) ); CString tmp1; tmp1 = m_EMail; tmp1.TrimLeft(); if (tmp1.IsEmpty() ) { MessageBox("Must fill in EMail Address!"); return; } CString info; char bufferx[20]; bufferx[0] = (char) 0; // set default to empty string // transfer long to this character buffer _ltoa(m_StateAgencyNo, bufferx, 10); // create a temp string from this buffer CString tmp(bufferx); //tmp = m_StateAgencyNo; if ( tmp.IsEmpty() || m_StateAgencyNo == 0) { MessageBox("Must fill in Valid Maricopa Agency ID!"); return; } if (m_CountyResponse == "Not Found") { MessageBox("Must fill in Valid Maricopa Agency ID!"); return; } time_t osBinaryTime; // C run-time time (defined in <time.h>) time( &osBinaryTime ) ; // Get the current time from the // operating system. CTime t3( osBinaryTime ); // CTime from CString s = t3.Format( "%A, %B %d, %Y, %H:%M:%S" ); long rnd; rnd = rand(); if (m_FT_Dbase == 0) { writefile.Format("/process/%i_%d.DBF", m_StateAgencyNo, rnd ); writeshort.Format("%i_%d.DBF", m_StateAgencyNo, rnd ); write2.Format("/process/%i_%d.INF", m_StateAgencyNo, rnd ); //AfxMessageBox(writefile); if ( ! SendFile(m_UploadFile, writefile, 1) ) { AfxMessageBox("Process Aborted"); return; } // put info going into INF file into a string, "info" info.Format("XBASE:%d",m_StateAgencyNo); info += (char)13; info += s; info += (char)13; info += m_UploadFile; info += (char)13; info += writeshort; info += (char)13; info += (char)13; info += (char)13; info += m_EMail; info += (char)13; info += m_Comments; } else if ( m_FT_Access == 0) { writefile.Format("/process/%i_%d.MDB", m_StateAgencyNo, rnd ); write2.Format("/process/%i_%d.INF", m_StateAgencyNo, rnd ); writeshort.Format("%i_%d.MDB", m_StateAgencyNo, rnd ); //AfxMessageBox(writefile); if ( ! SendFile(m_UploadFile, writefile,1) ) { AfxMessageBox("Process Aborted"); return; } // put info going into INF file into a string, "info" info.Format("ACCESS:%d",m_StateAgencyNo); info += (char)13; info += s; info += (char)13; info += m_UploadFile; info += (char)13; info += writeshort; info += (char)13; info += (char)13; info += (char)13; info += m_EMail; info += (char)13; info += m_Comments; } else { writefile.Format("/process/%i_%d.MAI", m_StateAgencyNo, rnd ); writefile2.Format("/process/%i_%d.MUL", m_StateAgencyNo, rnd ); writeshort.Format("%i_%d.MAI", m_StateAgencyNo, rnd ); short2.Format("%i_%d.MUL", m_StateAgencyNo, rnd ); //AfxMessageBox(writefile); //AfxMessageBox(writefile2); write2.Format("/process/%i_%d.INF", m_StateAgencyNo, rnd ); if ( ! SendFile(m_UploadFile, writefile,1) ) { AfxMessageBox("Process Aborted"); return; } // upload file dos, as in uno dos tres... if ( ! SendFile(m_UploadFileDos, writefile2, 1) ) { AfxMessageBox("Process Aborted"); return; } // put info going into INF file into a string, "info" info.Format("TEXT:%d",m_StateAgencyNo); info += (char)13; info += s; info += (char)13; info += m_UploadFile; info += (char)13; info += writeshort; info += (char)13; info += m_UploadFileDos; info += (char)13; info += short2; info += (char)13; info += m_EMail; info += (char)13; info += m_Comments; } //AfxMessageBox(info); info += (char)13; info += "__TYPE_MARICOPA__\n"; if (!SendStringToFile( info, write2,1) ) { AfxMessageBox("Process Aborted"); return; } m_Status = "Data Uploaded Successfully"; MessageBox("You should receive confirmation to your default email within\n1-2 hours if questions contact Scott at 602-628-5221\n"); MessageBox("Be sure to send in any related evidence to this e-filing ahead of time to the Assessor either in person or Fax to them @ 602-506-1075. When faxing each faxed page " "should include the main parcel ID stamped on it for safety. Items should be faxed or hand delivered at least 10 days prior to the meeting or sooner " " if at all possible, to ensure the Assessor time to prepare for the meeting. Questions contact the assessor at 602-506-3406."); UpdateData(FALSE); } // attempt to find a match for this maricopa agency (i misnamed this it should be // OnKillfocusMaricopaAgencyNo, so ignore the state part in the method's name). void CMassfileDlg::OnKillfocusStateagencyno() { //AfxMessageBox("testing"); UpdateData(TRUE); int n; long itemp; CString temp; if (m_StateAgencyNo == 0) { m_CountyResponse = "County Agency Not Found"; UpdateData(FALSE); return; } for (n=0; 1; n++ ) { itemp = CountyList[n].AgencyNo; if (m_StateAgencyNo == itemp ) { m_CountyResponse = CountyList[n].Descrip; UpdateData(FALSE); break; } // the last one has a -1, note this is different from last one in SBOE list which // has a AgencyNo value of 0 as it's last one. one of maricopa's agents actually // used zero so i changed the end marker to -1 for this list. if (itemp == -1) { MessageBox("Sorry, County Agency Not Found!"); m_CountyResponse = "County Agency Not Found"; UpdateData(FALSE); break; } } } HBRUSH CMassfileDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if (nCtlColor == CTLCOLOR_STATIC) pDC->SetTextColor( RGB( 0,0,192) ); // TODO: Return a different brush if the default is not desired return hbr; } void CMassfileDlg::OnFormatinfo() { // this should execute internet explorer or whatever browser is the default and open // up a browser window to point to our site's definition of stuff. ::ShellExecute(NULL, NULL, "http://www.sboe.state.az.us/ag_info.php", NULL, "", SW_SHOW); return; } void CMassfileDlg::OnMaricoBulkInfo() { // this should execute internet explorer or whatever browser is the default and open // up a browser window to point to our site's definition of stuff. ::ShellExecute(NULL, NULL, "http://www.sboe.state.az.us/marico_bulk_info.php", NULL, "", SW_SHOW); return; } void CMassfileDlg::OnModProfile() { // this should execute internet explorer or whatever browser is the default and open // up a browser window to point to our site's definition of stuff. ::ShellExecute(NULL, NULL, "http://www.sboe.state.az.us/cgi-bin/agent_signon.pl", NULL, "", SW_SHOW); return; }