Skip to content

Instantly share code, notes, and snippets.

View jinan-kordab's full-sized avatar

Jinan Kordab jinan-kordab

View GitHub Profile
@{
ViewBag.Title = "Multiselect Cross Device ASP.NET MVC Control";
}
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="jumbotron">
<div class="input-control select" style="width:100%;">
<select multiple style="width:100%;height:177px;display:inline-block; vertical-align:top; overflow:hidden; border:1px solid #ccc;">
<option style="background-image:url(../Icons/tomato.png);background-repeat:no-repeat;background-position:left;background-size:30px;background-position-x:5px;text-align:center;font-size:17px;height:35px;padding-top:8px;padding-left:30px">TOMATO</option>
@jinan-kordab
jinan-kordab / LRT3.sql
Created May 28, 2018 00:42
Primary Key Table for Fast Read and Insert Application
USE [VERYFASTREADINSERT]
GO
/****** Object: Table [dbo].[LRT3] Script Date: 4/19/18 11:42:24 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
@jinan-kordab
jinan-kordab / LRT3FK.sql
Created May 28, 2018 00:45
Foreign Key Table for Fast Read and Insert Application
USE [VERYFASTREADINSERT]
GO
/****** Object: Table [dbo].[LRT3FK] Script Date: 2018-04-19 20:41:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
@jinan-kordab
jinan-kordab / CompiledQuery.sql
Created May 28, 2018 00:47
Compiled Query example for very fast read and insert
static readonly Func<LRT3FKDataContext, short, IQueryable<LRT3FK>> s_compiledQuery =
System.Data.Linq.CompiledQuery.Compile<LRT3FKDataContext, short, IQueryable<LRT3FK>>(
(ctx, PKID) => from dr in ctx.LRT3FKs
where dr.PKID == PKID
select dr);
@jinan-kordab
jinan-kordab / sbr.cs
Created May 28, 2018 00:53
Second business rule for semi identical records
var line = data[i].ToString().Split('\t');
var nextLine = data[i + 1].ToString().Split('\t');
if (line[0].ToString().Trim() == nextLine[0].ToString().Trim())
{
//The fourth column in our data text file that we already read - text file
String PKcriteria = nextLine[3].ToString().Trim();
//ALL LRT3FK values, or , our Foreign Key Values Table
// We, in a way import all of it to our business layer, then use it
@jinan-kordab
jinan-kordab / randomdata.sql
Created May 28, 2018 01:07
Random data SQL table for Entity Framework and Link To SQL Speed Test
USE [AdventureWorks2012]
GO
/****** Object: Table [dbo].[RANDOMDATA] Script Date: 2018-03-31 01:38:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
@jinan-kordab
jinan-kordab / SpeedTestJS.js
Created May 28, 2018 01:09
JavaScript code for Entity Framework and Link To SQL Speed Test
function startStandardLINQ(t) {
var timer = new Timer();
timer.start();
timer.addEventListener('secondsUpdated', function (e) {
$('#standardLambdaOne').html(timer.getTimeValues().toString());
});
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
@jinan-kordab
jinan-kordab / FirstInstance.sql
Created May 28, 2018 23:43
First instance on how to test and avoid SQL deadlock
DELETE FROM [dbo].[TBL_test_temp]
DELETE FROM [dbo].[TBL_test_temp_two]
INSERT [dbo].[TBL_test_temp] ([TESTCOLUMNONE], [TESTCOLUMNTWO],[PK]) VALUES
(N'TTTTTTTT',N'TTTTTTTTTTTTTT',1)
INSERT [dbo].[TBL_test_temp_two] ([TWOcolumnone], [TWOcolumntwo],[PK]) VALUES
(N'AAAAAAAA',N'AAAAAAAAAAAAAA',1)
@jinan-kordab
jinan-kordab / SecondInstance.sql
Created May 28, 2018 23:46
Second Instance in an example how to test and avoid SQL deadlock
--2
BEGIN TRAN;
Update TBL_test_temp_two set
TWOcolumnone =N'AAAAAAAA',
TWOcolumntwo =N'AAAAAAAAAAAAAA'
Where PK =1
And TWOcolumnone =N'AAAAAAAA'
AND TWOcolumntwo = N'AAAAAAAAAAAAAA'
COMMIT;
@jinan-kordab
jinan-kordab / webapirestfromcsharp.cs
Created May 29, 2018 01:23
Call WEB API REST from C#
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Mvc;
using Newtonsoft.Json;