public MailMergeStaging(BankruptcyCase _case, string callSource) { _caseNumber = _case.CMECF_Internal.ToString(); _caseNumber4Digit = _case.CaseNumber4Digit; _filedDate = _case.FileDateString; _dischargedDate = _case.DischargeDateString; _firstName = _case.FirstName; _middleName = _case.MiddleName; _lastName = _case.LastName; _suffix = _case.Suffix; _address1 = _case.AddrLine1; _address2 = _case.AddrLine2; _city = _case.City; _state = _case.StateCode; _postalCode = _case.PostalCodeString; _callsource = callSource; }
public static bool GeocodeCase(BankruptcyCase _case) { float _lat = 0.0F; float _long = 0.0F; // minum required for geocoding with Yahoo is City and state or zip try { GeocodeAddress(_case.StateCode + "/" + HttpUtility.UrlEncode(_case.City).Replace("+", "%20") + "/" + _case.PostalCode + "/" + HttpUtility.UrlEncode(_case.AddrLine1).Replace("+", "%20"), ref _lat, ref _long); _case.Latitude = _lat; _case.Longitude = _long; return(true); } catch { return(false); } }
public BankruptcyCase Copy() { BankruptcyCase _bankruptcyCase = new BankruptcyCase(); _bankruptcyCase.ID = _iD; _bankruptcyCase.CourtID = _courtID; _bankruptcyCase.CMECF_Internal = _cMECF_Internal; _bankruptcyCase.CaseNumber4Digit = _caseNumber4Digit; _bankruptcyCase.PacerImportTransactionID = _pacerImportTransactionID; _bankruptcyCase.Chapter = _chapter; _bankruptcyCase.FiledOnly = _filedOnly; _bankruptcyCase.FiledDate = _filedDate; _bankruptcyCase.DischargeDate = _dischargeDate; _bankruptcyCase.Trustee = _trustee; _bankruptcyCase.Judge = _judge; _bankruptcyCase.County = _county; _bankruptcyCase.Office = _office; _bankruptcyCase.Fee = _fee; _bankruptcyCase.Asset = _asset; _bankruptcyCase.FirstName = _firstName; _bankruptcyCase.MiddleName = _middleName; _bankruptcyCase.LastName = _lastName; _bankruptcyCase.Suffix = _suffix; _bankruptcyCase.AddrLine1 = _addrLine1; _bankruptcyCase.AddrLine2 = _addrLine2; _bankruptcyCase.AddrLine3 = _addrLine3; _bankruptcyCase.City = _city; _bankruptcyCase.StateCode = _stateCode; _bankruptcyCase.PostalCode = _postalCode; _bankruptcyCase.PostalLast4 = _postalLast4; _bankruptcyCase.Latitude = _latitude; _bankruptcyCase.Longitude = _longitude; _bankruptcyCase.Country = _country; _bankruptcyCase.Phone = _phone; _bankruptcyCase.ssnLast4 = _ssnLast4; _bankruptcyCase.CareOf = _careOf; _bankruptcyCase.DontSend = _dontSend; _bankruptcyCase.Returned = _returned; _bankruptcyCase.SoldCount = _soldCount; _bankruptcyCase.LastSoldDate = _lastSoldDate; _bankruptcyCase.BKLeadsOnlineUploadedDate = _bKLeadsOnlineUploadedDate; _bankruptcyCase.CourtName = _courtName; return(_bankruptcyCase); }
static public int ProcessImportedLineItems(PacerImportTransaction objPacerImportTransaction, bool GeocodeLocations) { List <PacerImportData> _data = PacerImportDataService.GetForImportTransaction(objPacerImportTransaction.ID); PacerImportData _previousRow = null; int insertedRowCount = 0; int updatedRowCount = 0; int formatErrors = 0; string StateCode = null; foreach (PacerImportData _row in _data) { if (_previousRow == null) { //first row - is this row a debtor - if this row fails we just exit with failure because the //file format is most likely incorrect. if (((_row.PartyCaseRole.ToUpper() == "DEBTOR") || (_row.PartyCaseRole.ToUpper() == "CO-DEBTOR") || (_row.PartyCaseRole.ToUpper() == "JOINT DEBTOR")) && _row.CareOfOK) { _row.Imported = true; PacerImportDataService.Save(_row); try { BankruptcyCase _case = new BankruptcyCase(_row); Debug.WriteLine(_case.CaseNumber4Digit); if (GeocodeLocations) { YahooGeoCoder.GeocodeCase(_case); } _case.IsModified = true; int returnvalue = BankruptcyCaseService.Save(_case, true); if (returnvalue == 1) { insertedRowCount++; } else if (returnvalue == 2) { updatedRowCount++; } } catch (Exception ex) { formatErrors++; } } _previousRow = _row; } else //previousrow != null if this row fails we do not exit with failure because the // it's just a bad row. { if (_row.PartyAddressLine1 != _previousRow.PartyAddressLine1 && ((_row.PartyCaseRole.ToUpper() == "DEBTOR") || (_row.PartyCaseRole.ToUpper() == "CO-DEBTOR") || (_row.PartyCaseRole.ToUpper() == "JOINT DEBTOR")) && _row.CareOfOK) { try { //debtor at different address _row.Imported = true; PacerImportDataService.Save(_row); BankruptcyCase _case = new BankruptcyCase(_row); if (GeocodeLocations) { YahooGeoCoder.GeocodeCase(_case); } if (insertedRowCount == 318) { Debug.WriteLine(_case.CaseNumber4Digit); } if (_case.LastName == "Babakatis") { Debug.WriteLine(_case.CaseNumber4Digit); } _case.IsModified = true; int returnvalue = BankruptcyCaseService.Save(_case, true); if (returnvalue == 1) { insertedRowCount++; if (insertedRowCount == 1654) { Debug.WriteLine(insertedRowCount); } } else if (returnvalue == 2) { updatedRowCount++; } } catch (Exception e) { formatErrors++; } } _previousRow = _row; } } // update counts for objPacerImportTransaction.InsertedCases = insertedRowCount; objPacerImportTransaction.LineCount = _data.Count; objPacerImportTransaction.TotalCases = insertedRowCount + updatedRowCount; if (objPacerImportTransaction.ImportMessage.Length > 0) { //we already have an import string - parse the result to add the previous total try { if (objPacerImportTransaction.ImportMessage.IndexOf("Unique Cases Added") > 0) { int previoustotal = Int32.Parse(objPacerImportTransaction.ImportMessage.Substring(0, objPacerImportTransaction.ImportMessage.IndexOf("Unique Cases Added") - 1)); objPacerImportTransaction.ImportMessage = previoustotal + insertedRowCount + " Unique Cases Added! " + updatedRowCount + " Cases Updated! " + formatErrors + " format Errors."; } else { objPacerImportTransaction.ImportMessage = insertedRowCount + " Unique Cases Added! " + updatedRowCount + " Cases Updated! " + formatErrors + " format Errors."; } } catch { } } else { objPacerImportTransaction.ImportMessage = insertedRowCount + " Unique Cases Added! " + updatedRowCount + " Cases Updated! " + formatErrors + " format Errors."; } objPacerImportTransaction.ImportStatus = "SUCCESS"; Save(objPacerImportTransaction); Court _court = CourtService.GetByID(objPacerImportTransaction.CourtID); ZipGeoCodeService.UpdateStatsForState(_court.StateCode); return(insertedRowCount); }