Skip to content

Instantly share code, notes, and snippets.

View oguzhankircali's full-sized avatar

Oguzhan Kircali oguzhankircali

View GitHub Profile
@oguzhankircali
oguzhankircali / summernote.js
Last active February 9, 2018 10:46
Summernote Constructor
$('#ModelText').summernote({
height: 250,
lang: 'tr-TR',
fontSizes: ['10', '12', '14'],
toolbar: [
['style', ['bold', 'italic', 'underline', 'clear']],
['fontsize', ['fontsize']],
['para', ['ul', 'ol', 'paragraph']],
['note-view', ['codeview']]
],
@oguzhankircali
oguzhankircali / timeout.js
Last active November 14, 2018 06:13
timeout.js
CreateTimeout();
function CreateTimeout() {
console.log('Yooo!');
setTimeout(function () { alert('Yenileniyor…'); }, 2000);
console.log('Yooo!');
}
@oguzhankircali
oguzhankircali / FullStackTrace.cs
Last active March 27, 2019 19:09
Get full stack trace with error text, method and line number
public static string GetAllFootprints(Exception x)
{
var st = new StackTrace(x, true);
var frames = st.GetFrames();
var traceString = "";
foreach (var frame in frames)
{
if (frame.GetFileLineNumber() < 1)
continue;
@oguzhankircali
oguzhankircali / CallDatabaseFunctionWithEF.cs
Last active March 29, 2019 06:47
Calling user defined database functions in Entity Framework
List<MyClass> retval = db.Database.SqlQuery<MyClass>(String.Format(@”select * from dbo.fonksiyonum({0})”, id)).OrderBy(p => p.Sinif).ToList<MyClass>();
public class DtoGrafikItem
{
public decimal y { get; set; }
public string tooltip { get; set; }
public string label { get; set; }
}
@oguzhankircali
oguzhankircali / ExcelExportEPPlus.cs
Created February 11, 2018 00:09
Excel Export EP Plus Class C#
public static class ExcelExport
{
public static void EpplusExportToExcel(List<SObject> sobjectList, string fileName, bool isAddDateTimeExt = false)
{
fileName = GetFileName(fileName, isAddDateTimeExt);
List<string[]> arrayList = new List<string[]>();
if (sobjectList != null && sobjectList.Count > 0)
{
//PropertyName leri alınıyor.
<?xml version=”1.0″ encoding=”utf-8″ ?>
<configuration>
<log4net>
<appender name=”DbAppender” type=”log4net.Appender.ADONetAppender”>
<bufferSize value=”0″ />
<connectionType value=”System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089″ />
<connectionString value=”data source=IPAdres;Initial Catalog=VeritabaniAdi;user id=KullaniciAdi;password =Sifre;” />
<commandText value=”INSERT INTO Log4Net ([date],[thread],[level],[logger],[message],[exception], [CurrentUsername],[IPAddress], [CurrentUrl], [UserAgent]) VALUES
(@log_date, @thread , @log_level , @logger , @message , @exception , @CurrentUser , @IPAddress , @CurrentUrl , @UserAgent )” />
public class SagmerEnum
{
public enum PoliceTipiTypeEnum
{
[Description("Ferdi")]
Ferdi = 'F',
[Description("Grup")]
Grup = 'G'
}
@oguzhankircali
oguzhankircali / SoapBehavior.cs
Last active June 10, 2019 17:43
SOAP Logging (Log all incoming and outgoing xml)
using System;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.Linq;
using SoapLogging.Database;
namespace SoapLogging.Common
{
public class SoapBehavior : IEndpointBehavior, IClientMessageInspector
//TR: Bu metodu çağıran metotlarda rollback olduğundan, loglamayı etkilemesin diye RequiresNew attribute'u ekleniyor.
//Bu sayede metodun bitmesini beklemeden commit etmiş oluyor
//EN: Parent method of this have rollback features, but i want to log it,
//because of this i added TransactionScopeOption.RequiresNew to unit of work
var unitOfWorkManager = IocManager.Instance.Resolve<IUnitOfWorkManager>();
using (var unitOfWork = unitOfWorkManager.Begin(System.Transactions.TransactionScopeOption.RequiresNew))
{
_serviceLogManager.InsertOrUpdateAndGetId(this.ServiceLogEntity);