Skip to content

Instantly share code, notes, and snippets.

var umpd = "NON";
foreach (var rv in r.Vehicles)
{
if (rv.UmpdLimit.Equals("NONE"))
{
data["umpdlimit" + (rv.VehicleIndex + 1)] = "NON";
}
else
{
data["umpdlimit" + (rv.VehicleIndex + 1)] = rv.UmpdLimit;
@mps
mps / gist:884992
Created March 24, 2011 12:45
Delete everything for an Agency
private static void Delete(string customerCode)
{
MongoInitializer.Initialize();
var connectionString = ConfigurationManager.ConnectionStrings["AccuAutoMongo"];
MServer = MongoServer.Create(connectionString.ConnectionString);
MDatabase = MServer[ConfigurationManager.AppSettings["DbName"] ?? "AccuAuto"];
var clientCollection = MDatabase.GetCollection<Mongo.Data.Client>("Client");
var paymentCollection = MDatabase.GetCollection<Mongo.Data.Payment>("Payment");
var attachmentCollection = MDatabase.GetCollection<Mongo.Data.FileAttachment>("FileAttachment");
var commissionCollection = MDatabase.GetCollection<Mongo.Data.ManagementCommission>("ManagementCommission");
@mps
mps / gist:876691
Created March 18, 2011 19:33
Excluded
Func<PersDriver, bool> unverifiableMvr = d => d.Mvr == null || d.Mvr.MvrStatusCd != MvrStatus.Received || d.ViolationsChanged;
Func<PersDriver, bool> notExcluded = d => d.DriverStatusCd != DriverStatus.Excluded;
Func<PersVehicle, bool> requirePhoto = v => (((p.EffectiveDt.Year - v.ModelYear) + (p.EffectiveDt.Month >= 10 ? 1 : 0)) > 13) && !v.IsLiabilityOnly;
Func<bool> requireReceipt = () => p.Vehicles.Count / p.RatedDriverCount > 3;
if (p.Drivers.Any(unverifiableMvr) && p.Drivers.Any(notExcluded))
{
pd["suspenseheader1"] = "Unverifiable MVR. Please fax an enlarged copy of current driver's license for:";
pd["suspense1"] = p.Drivers.Where(unverifiableMvr).Where(notExcluded).Aggregate("", (current, d) => current + d.Name.FullName + "\r\n");
}
@mps
mps / import-vins.rb
Created March 7, 2011 17:00
Refactored using FasterCSV
#!/usr/bin/env ruby
require 'optparse'
require 'rubygems'
#require 'excelsior'
require 'mongo'
require 'fastercsv'
load 'progressbar.rb'
options = { :server => "localhost", :port => "27017", :db => "AccuAuto" }
#region Usings
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.Serialization;
#endregion