invoices.Select(i => new
{
FormattedDate = ( EntityFunctions.Right(String.Concat(" ", SqlFunctions.StringConvert((double?) SqlFunctions.DatePart("dd", i.DocumentDate))), 2)
+ "/"
+ EntityFunctions.Right(String.Concat(" ",SqlFunctions.StringConvert((double?) SqlFunctions.DatePart("mm", i.DocumentDate))), 2)
+ "/"
+ EntityFunctions.Right(SqlFunctions.StringConvert((double?) SqlFunctions.DatePart("yyyy", i.DocumentDate)), 4)
).Replace(" ", "0")
}
Sunday, 28 December 2014
Formatting date in Linq-to-Entities query causes exception
Friday, 27 June 2014
Convert returned JSON Object Properties to (lower first) camelCase
I have JSON returned from an API like so:
Contacts: [{ GivenName: "Matt", FamilyName:"Berry" }]
To keep this consitent with my code style (camelCase - lower case first letter) I want to transform the array to produce the following:
contacts: [{ givenName: "Matt", familyName:"Berry" }]
Whats the easiest/best way to do this? create a new Contact object and iterate over all the conatacts in the returned array?
I needed a generic method that accepted an array or object. This is what I'm using (I borrowed KyorCode's
firstToLower() implementation):
function convertKeysToCamelCase(obj) {
if (!obj || typeof obj !== "object") return null;
if (obj instanceof Array) {
return $.map(obj, function(value) {
return convertKeysToCamelCase(value);
});
}
var newObj = {};
$.each(obj, function(key, value) {
key = key.charAt(0).toLowerCase() + key.slice(1);
newObj[key] = value;
});
return newObj;
};
Example calls:
var contact = { GivenName: "Matt", FamilyName:"Berry" };
console.log(convertKeysToCamelCase(contact));
// logs: Object { givenName="Matt", familyName="Berry"}
console.log(convertKeysToCamelCase([contact]));
// logs: [Object { givenName="Matt", familyName="Berry"}]
console.log(convertKeysToCamelCase("string"));
// logs: null
console.log(contact);
// logs: Object { GivenName="Matt", FamilyName="Berry"}
Thursday, 22 May 2014
Give custom validation message in HTML5
Custom Message in HTML5
Generally if you are just giving required in input it will give its own validation message in html5. But if you want to give your custom message then do this.
<input id="UserID" type="text" required="required" oninvalid="this.setCustomValidity('Witinnovation')">
Generally if you are just giving required in input it will give its own validation message in html5. But if you want to give your custom message then do this.
<input id="UserID" type="text" required="required" oninvalid="this.setCustomValidity('Witinnovation')">
Thursday, 17 April 2014
Get added and deleted items from array
This one is only for int array
Here i am going to show how to get value of add and deleted items from defined array.
var oldbrd = $scope.selectedDiagnosis.sort();
var newbrd = $scope.RefferalView.Diagnosis.sort();
var additem = [];
var deleteitem = [];
//var index;
angular.forEach(oldbrd, function (value) {
if (newbrd.indexOf(value) == -1) {
deleteitem.push(value);
}
});
angular.forEach(newbrd, function (value) {
if (oldbrd.indexOf(value) == -1) {
additem.push(value);
}
});
$scope.AddedDiagnosisCode = additem;
$scope.DeletedDiagnosisCode = deleteitem;
alert('added =>: ' + additem + "_________" + 'deleted =>: ' + deleteitem);
Tuesday, 19 November 2013
Custom Column Filter only with a single textbox on each column without any operators and buttons.
Here i find custom search functionality for KendoUI grid. Hope you really find helpfull.
HTML
<link href="http://cdn.kendostatic.com/2012.3.1114/styles/kendo.rtl.min.css" rel="stylesheet" type="text/css" />
<link href="http://cdn.kendostatic.com/2012.3.1114/styles/kendo.default.min.css" rel="stylesheet" type="text/css" />
<link href="http://cdn.kendostatic.com/2012.3.1114/styles/kendo.dataviz.min.css" rel="stylesheet" type="text/css" />
<link href="http://cdn.kendostatic.com/2012.3.1114/styles/kendo.dataviz.default.min.css" rel="stylesheet" type="text/css" />
<link href="http://cdn.kendostatic.com/2012.3.1114/styles/kendo.mobile.all.min.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://cdn.kendostatic.com/2012.3.1114/js/kendo.all.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<div id="grid"></div>
</body>
</html>
<link href="http://cdn.kendostatic.com/2012.3.1114/styles/kendo.default.min.css" rel="stylesheet" type="text/css" />
<link href="http://cdn.kendostatic.com/2012.3.1114/styles/kendo.dataviz.min.css" rel="stylesheet" type="text/css" />
<link href="http://cdn.kendostatic.com/2012.3.1114/styles/kendo.dataviz.default.min.css" rel="stylesheet" type="text/css" />
<link href="http://cdn.kendostatic.com/2012.3.1114/styles/kendo.mobile.all.min.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://cdn.kendostatic.com/2012.3.1114/js/kendo.all.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<div id="grid"></div>
</body>
</html>
JavaScript
dataSource:[ {
foo: "Foo 1",
bar: "Bar 1"
} , {
foo: "Foo 2",
bar: "Bar 2"
}
]
});
var grid = $("#grid").data("kendoGrid");
$("<tr><th class='k-header' data-field='foo'><input /></th><th data-field='bar' class='k-header' ><input /></th></tr>").appendTo($("#grid thead")).find("input").keyup(function() {
grid.dataSource.filter({
operator: "contains",
value: $(this).val(),
field: $(this).parent("th").data("field")
});
});
foo: "Foo 1",
bar: "Bar 1"
} , {
foo: "Foo 2",
bar: "Bar 2"
}
]
});
var grid = $("#grid").data("kendoGrid");
$("<tr><th class='k-header' data-field='foo'><input /></th><th data-field='bar' class='k-header' ><input /></th></tr>").appendTo($("#grid thead")).find("input").keyup(function() {
grid.dataSource.filter({
operator: "contains",
value: $(this).val(),
field: $(this).parent("th").data("field")
});
});
http://www.kendoui.com/forums/kendo-ui-complete-for-asp-net-mvc/grid/custom-column-filter-only-with-a-single-textbox-on-each-column-without-any-operators-and-buttons.aspx
Another link is
http://jsbin.com/ihanun/1/edit
Wednesday, 13 November 2013
Html5 Examples
I found one site which have such amazing html5 examples. Please look forward it once.
http://tympanus.net/Development/MultiLevelPushMenu/index3.html
http://tympanus.net/Development/MultiLevelPushMenu/index3.html
Wednesday, 30 October 2013
Make CSS3 Creatures
Something really amazing with css3 is one of here. You can see below.
Style for it
For reference link
http://bennettfeely.com/csscreatures/
So here you go for Html page code
CSS Creatures
by Col Talbot by Levente Molnar by Adrian Rossouw by kannan by kannan by kannan by Ade Gunawan W.I. by DAMYAN by SΤΞPΗANiΞ by Una Kravets by Geeky Pup by Kinjal Shah by Brian Rose (b_Ro) by Luis Luna by IshiiPrints. by Andrea Buran
Style for it
For reference link
http://bennettfeely.com/csscreatures/
Subscribe to:
Posts (Atom)