Skip to content

Instantly share code, notes, and snippets.

@nicocrm
nicocrm / DateTimeParser.cs
Created September 8, 2015 21:49
DateTimeParser with Timezone string conversion
public static class DateTimeParser
{
private static readonly Dictionary<string, string> TimeZones = new Dictionary<string, string>()
{
{"CDT", "-0500"},
{"CST", "-0600"},
{"EDT", "-0400"},
{"EST", "-0500"},
{"PDT", "-0700"},
{"PST", "-0800"},
@nicocrm
nicocrm / README.markdown
Last active September 9, 2015 09:38 — forked from beccasaurus/README.markdown
Adds hooks to jQuery.validate's form/element validation methods (via trigger())

jQuery Validate Hooks

If you're using [ASP.NET MVC3][], it uses [jQuery Validate][] to do client-side validations. Instead of using [jQuery Validate][] directly, however, it wraps it with its own jQuery plugin called [jQuery.Validate.Unobtrusive][]. [jQuery.Validate.Unobtrusive][] sets up [jQuery Validate][] for you, behind the scenes, so you don't have an opportunity to customize your [jQuery Validate][] settings at all!

We've been running into trouble with this when we've been doing our own custom client-side validations. We need a way to integrate with the build-in [ASP.NET MVC3][] validation so we can:

@nicocrm
nicocrm / MultiSelectDropdown.css
Created September 24, 2015 16:50
A multi select dropdown for dojo.
div.multiselect
{
background-color: White;
border: 1px solid #A8A9BE;
text-align: left;
height: 180px;
z-index: 999;
padding: 2px;
}
div.multiselect div.checkboxList
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css" type="text/css"
media="screen" />
</head>
<body>
<h1 id="qunit-header">
QUnit example</h1>
/*
* Copyright Strategic Sales Systems 2011
* Customization to write an email to the selected records on the mainview.
*/
define({
/**
* Open an email using Outlook automation, if available, falling back to mailto url otherwise.
* @param {Array|String} recipient email address (or addresses)
*/
function () {
// Execute the "Copy" method on each selected record
var grid = this;
// check that we have a selection
var selectedItems = grid.selection.getSelected();
if (selectedItems.length < 1) {
alert(grid.noSelectionsText);
return;
}
ICAccWidget nw = Sage.Platform.EntityFactory.Create();
nw.Account = caccwidget.Account;
nw.WIdget_name = caccwidget.WIdget_name;
nw.Quantity = caccwidget.Quantity;
nw.Price = caccwidget.Price;
nw.Save();
// With Count
var count = sess.QueryOver<ITicket>()
.Where(x => (x.SentBundle == false || x.SentBundle == null)
&& x.ScheduledDate >= startDate && x.ScheduledDate <= endDate &&
(string)x.Contact.Id == (string)contact.Id)
.Select(Projections.Count("Id"))
.SingleOrDefault<int>();
@nicocrm
nicocrm / GetCampaignResponsesPaged.cs
Created April 5, 2012 16:41
GetCampaignResponsesPaged
public class CampaignResponse
{
public String Id { get; set; }
public String ContactId { get; set; }
}
public List<CampaignResponse> GetCampaignResponses(String campaignId)
{
List<CampaignResponse> result = new List<CampaignResponse>();
GetCampaignResponsesPaged(campaignId, result, 1);
<?xml version="1.0"?>
<ContextualListConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<TargetPages>
<TargetConfigInfo>
<TargetPage>CONTACT</TargetPage>
<ReferingPages>
<ContextConditionInfo>
<ReferringPage>ACCOUNT</ReferringPage>
<DataPath>CONTACT:ACCOUNTID</DataPath>
<ConditionValue>ReferringId</ConditionValue>