Skip to content

Instantly share code, notes, and snippets.

@f1code
f1code / ProductsGridHelper-MoveUpDown.js
Last active October 26, 2015 23:14
Move Up / Move Down buttons for InforCRM (code for https://nicocrm.wordpress.com/?p=562)
// Helper for the products grid used at the SalesOrder and Opportunity levels
define(['dojo/_base/declare', 'dojo/_base/lang', 'dojo/aspect', 'dojo/on', 'Sage/UI/Dialogs'],
function (declare, lang, aspect, on, slxDialogs) {
var Helper = declare([], {
grid: null,
constructor: function (grid) {
this.grid = grid;
this.setupMoveUpDownHandlers();
},
@f1code
f1code / ProductsGridHelper.js
Created October 26, 2015 13:13
Used to customize the grid without having to modify the code in Application Architect (I use it to apply same customizations to Opportunity and Sales Order product grids)
// Helper for the products grid used at the SalesOrder and Opportunity levels
define(['dojo/_base/declare', 'dojo/aspect'], function (declare, aspect) {
var Helper = declare([], {
grid: null,
constructor: function(grid) {
this.grid = grid;
this.setupDefaultProgram();
this.setupProductFilter();
},
@f1code
f1code / AddReturnProduct.ascx.cs
Last active October 23, 2015 14:21
InforCRM - Custom search form
// In AA: I created a "Panel" placeholder and set the column span to 2
// I can't use the placeholder directly because it is itself a dijit
// form load method:
String appPath = Request.ApplicationPath;
ScriptManager.RegisterStartupScript(this, GetType(), "AddReturnProduct",
@"require({ packages: [{ name: 'Martin', location: '" + appPath +
@"/MartinEng/js'}] }, ['Martin/Return/AddReturnProduct'], function(AddReturnProduct) {
var s = new AddReturnProduct({});
dojo.place(s.domNode, dojo.byId('" + placeholder.ClientID + @"').parentElement, 'only');
// 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>();
@f1code
f1code / 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
@f1code
f1code / IsDateAfterAttribute.cs
Last active October 11, 2016 10:36
ASP.NET MVC ValidationAttribute ensuring one date is greater than another
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
namespace WebUI.Infrastructure
{
/// <summary>
/// Validation attribute ensuring a date property is greater than another one specified.
/// </summary>
@f1code
f1code / CustomDashboardPageSetting.js
Last active May 8, 2017 21:25
Javascript Snippets for Infor CRM
define(['Sage/UI/Dashboard/DashboardPage', 'dojo/aspect', 'dojo/query', 'dojo/dom-construct', './MultiSelectDropdown', './PicklistDataStore'],
function (DashboardPage, aspect, query, domConstruct, MultiSelect, PicklistDataStore) {
var _portalAccess = undefined;
aspect.after(DashboardPage.prototype, '_editOptionsMenu', function () {
var trButtons = query('.dijitDialog .edit-options-table > table > tbody > tr');
if (trButtons.length == 0) {
console.warn('Unable to find options dialog');
return;
}
@f1code
f1code / 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:

@f1code
f1code / 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"},
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using log4net;
using Sage.Integration.Web;
using Sage.Platform.Application;
using Sage.Integration.Messaging.Model;
namespace SSSWorld.RFI.BusinessRules.CustomerPortalSecurity