Skip to content

Instantly share code, notes, and snippets.

View jinweijie's full-sized avatar
🎾

Weijie JIN jinweijie

🎾
View GitHub Profile
/**
* Constructor
*/
public ControllerStudentOCLevel(){
//1. validate input
this.CurrentStudentId = ApexPages.currentPage().getParameters().get('studentId');
if( this.CurrentStudentId == null || this.CurrentStudentId.trim() == '')
throw new InvalidParameterValueException('studentId','Missing parameter studentId.');
/**
* Constructor
*/
public ControllerStudentOCLevel(){
//1. validate input
this.CurrentStudentId = ApexPages.currentPage().getParameters().get('studentId');
if( this.CurrentStudentId == null || this.CurrentStudentId.trim() == '')
throw new InvalidParameterValueException('studentId','Missing parameter studentId.');
@jinweijie
jinweijie / gist:3050450
Created July 5, 2012 01:31 — forked from igal/gist:53855
.gitrc aliases for common git commands
# Aliases for common git commands. E.g., enter "git d" for "git diff"
# These settings live in the ~/.gitconfig file.
[alias]
b = branch
ba = branch -a
ci = commit
co = checkout
d = diff
dc = diff --cached
@jinweijie
jinweijie / XElementNamespace.cs
Created July 18, 2012 01:23
create XElement with namespace
public static string ParameterXml
{
get
{
XNamespace xsd = "http://www.w3.org/2001/XMLSchema";
XNamespace xsi = "http://www.w3.org/2001/XMLSchema-instance";
XNamespace rs = "http://schemas.microsoft.com/sqlserver/2006/03/15/reporting/reportingservices";
XElement root = new XElement("ScheduleDefinition",
@jinweijie
jinweijie / RS_Subscription.sql
Created July 18, 2012 01:55
Reporting Service Subscription Query
SELECT usr.UserName,
cat.name,
sub.*
FROM [Subscriptions] sub
INNER JOIN [Users] usr ON sub.OwnerID = usr.UserID
INNER JOIN [Catalog] cat ON sub.report_oid = cat.itemid
@jinweijie
jinweijie / Linq2XMLGroupBy.cs
Created July 18, 2012 07:00
Linq2XMLGroupBy
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Linq;
/// <summary>
/// Linq2XMLGroupBy
/// </summary>
public class Linq2XMLGroupBy
@jinweijie
jinweijie / MonthDayValidation.txt
Created July 18, 2012 08:59
Monthday Validation Regex
(([3][0-1])|([1-2][0-9])|([1-9]))([\,](([3][0-1])|([1-2][0-9])|([1-9])))?
@jinweijie
jinweijie / GetAnonymousObjectValue.cs
Created July 19, 2012 01:15
GetAnonymousObjectValue
public static string GetAnonymousObjectValue( object data, string propName )
{
Type t = data.GetType();
// Get a list of the properties
PropertyInfo[] piList = t.GetProperties();
// Loop through the properties in the list
foreach(PropertyInfo pi in piList)
{
// Get the value of the property
object o = pi.GetValue(data, null);
@jinweijie
jinweijie / ConvertIds2Table.sql
Created July 19, 2012 02:01
ConvertIds2Table
-- =============================================
-- Author: Weijie JIN
-- Create date: 20120719
-- Description: Get list by Ids string
-- =============================================
ALTER PROCEDURE [dbo].[ConvertIds2Table]
@Ids NVARCHAR(2000)
AS
BEGIN
SET ARITHIGNORE ON
@jinweijie
jinweijie / GetDomainUserName.cs
Created July 19, 2012 07:17
GetDomainUserName
using System;
using System.IO;
/// <summary>
/// GetDomainUserName
/// </summary>
public class GetDomainUserName
{
/// <summary>
/// The main entry point for the application