This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myObjectAsJsonStringInCSharp = Newtonsoft.Json.JsonConvert.SerializeObject(myObj); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function downloadBase64BlobFile(response) { | |
var blob = b64toBlob(response.data, 'application/vnd.ms-excel'); | |
if (blob != null && navigator.msSaveBlob) { | |
return navigator.msSaveBlob(blob, response.fileName); | |
} | |
var a = $('<a style=\'display: none;\'/>'); | |
var url = window.URL.createObjectURL(new Blob([blob], { | |
type: 'application/vnd.ms-excel', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function b64toBlob(b64Data, contentType, sliceSize) { | |
contentType = contentType || ''; | |
sliceSize = sliceSize || 512; | |
var byteCharacters = atob(b64Data); | |
var byteArrays = []; | |
for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) { | |
var slice = byteCharacters.slice(offset, offset + sliceSize); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Use : http://angular-ui.github.io/bootstrap/ | |
HTML PART | |
--- | |
.... | |
</table> | |
<pagination | |
ng-click="ctrl.showPageUkOnly()" | |
ng-model="ctrl.currentPageUkOnly" | |
total-items="ctrl.ukOnlyResults.length" | |
max-size="ctrl.maxSize" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SwaggerConfig | |
{ | |
public static void Register() | |
{ | |
if (System.Configuration.ConfigurationManager.AppSettings["DisableSwagger"].Equals("True")) | |
{ | |
return; | |
} | |
...... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jsonFormatter = config.Formatters.OfType<JsonMediaTypeFormatter>().First(); | |
jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class PrintAllProperties | |
{ | |
public static string PropertyList(this object obj) | |
{ | |
var props = obj.GetType().GetProperties(); | |
var sb = new System.Text.StringBuilder(); | |
foreach (var p in props) | |
{ | |
sb.AppendLine(p.Name + ": " + p.GetValue(obj, null)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Data.Entity; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Threading.Tasks; | |
namespace BUSINESS | |
{ | |
//http://www.itworld.com/article/2700950/development/a-generic-repository-for--net-entity-framework-6-with-async-operations.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExcelOperations | |
{ | |
public List<List<string>> Read(string filePath) | |
{ | |
OleDbConnection conn = new OleDbConnection("Provider = Microsoft.ACE.OLEDB.12.0; Data Source = " + filePath + "; Extended Properties = 'Excel 8.0; HDR=NO'"); | |
OleDbCommand cmd = new OleDbCommand("select * from [Sheet1$]", conn); | |
conn.Open(); | |
OleDbDataReader dr = cmd.ExecuteReader(); |