Skip to content

Instantly share code, notes, and snippets.

View janosorcsik's full-sized avatar

János Orcsik janosorcsik

View GitHub Profile
cask 'moeditor' do
version '0.0.1'
sha256 'db2c282cdf9854c7189dcc7e1e608f2be02c5cfb88f0bebd638db8008ecb664b'
url 'https://github.com/Moeditor/Moeditor/releases/download/v0.0.1-alpha/Moeditor-0.0.1-darwin-x64.7z'
name 'Moeditor'
license :gpl
depends_on arch: :x86_64
@janosorcsik
janosorcsik / SaveGrid.cs
Last active November 13, 2017 11:27
Infragristics save grid
public ActionResult SaveGrid()
{
GridModel gridModel = new GridModel();
Dictionary<string, bool> response = new Dictionary<string, bool>();
var validationErrors = new Dictionary<string, string>();
List<Transaction<PortDomainModel>> transactions = gridModel.LoadTransactions<PortDomainModel>(HttpContext.Request.Form["ig_transactions"]);
foreach (Transaction<PortDomainModel> t in transactions)
{
switch (t.type)
@janosorcsik
janosorcsik / MethodLocationPatternConverter.cs
Last active December 11, 2017 20:19
log4net extensions
using log4net.Layout.Pattern;
using log4net.Core;
using System.IO;
namespace LoggerExtensions
{
public class MethodLocationPatternConverter : PatternLayoutConverter
{
protected override void Convert(TextWriter writer, LoggingEvent loggingEvent)
{
@janosorcsik
janosorcsik / Mapper.cs
Last active December 11, 2017 20:41
Object mapper
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
namespace ObjectExtensions
{
public static class Mapper
{
public static T SetProperty<T>(this T host, string propertyName, object value, bool hideErrors = false)
@janosorcsik
janosorcsik / XMLTools.cs
Last active December 11, 2017 20:49
Generic XML writer and reader with encoding
using System;
using System.IO;
using System.Text;
using System.Xml.Serialization;
namespace Tools
{
public class XMLTools
{
#region singleton
@janosorcsik
janosorcsik / FakeHQContext.cs
Last active December 11, 2017 21:02
Fake Context
using System;
using System.Data.Entity;
using System.Linq;
using System.Reflection;
using Entities.HQ;
using Repositories.Contexts;
namespace TestUtils
{
public class FakeHQContext : IHQContext
@janosorcsik
janosorcsik / CheckMessageContract.cs
Last active December 11, 2017 21:05
Check MessageContractAttribute
[TestMethod]
public void CheckMessageContract()
{
var m = Assembly.Load("DataContracts").GetTypes().
Where(t => t.GetCustomAttributes(typeof(MessageContractAttribute)).Any()).ToArray();
foreach (Type t in m)
{
MessageContractAttribute a = (MessageContractAttribute) t.GetCustomAttribute(typeof(MessageContractAttribute), false);
@janosorcsik
janosorcsik / TestExtensions.cs
Last active December 11, 2017 21:07
Unit test extensions
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Web.App_Start;
@janosorcsik
janosorcsik / FakeDbSet.cs
Last active December 11, 2017 21:07
Fake DbSet
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
@janosorcsik
janosorcsik / MDI_CTE.sql
Last active December 11, 2017 21:09
Annyi sor, amennyi az intervantionumber
CREATE FUNCTION [dbo].[MDI_CTE] (@ID BIGINT)
RETURNS @MID_CTE TABLE
(
ID BIGINT,
ToothCode NVARCHAR(64),
InterventionCode NVARCHAR(16),
BNOCode NVARCHAR(16),
ToBeReported BIT,
DentistryPatientDatacardID BIGINT,
InterventionNumber INT