Skip to content

Instantly share code, notes, and snippets.

View oguzhankircali's full-sized avatar
:octocat:
Creating a product

Oğuzhan Kırçalı oguzhankircali

:octocat:
Creating a product
View GitHub Profile
protected void Application_Error(object sender, EventArgs e)
{
var ex = Server.GetLastError();
string allFootprints = GetAllFootprints(ex);
}
$('.register-container').pgNotification({
style: 'circle',
title: 'Çabucak.Net',
message: 'Copied',
position: 'top',
timeout: 3000,
type: 'success',
thumbnail: '<img width="40" height="40" style="display: inline-block;" src="assets/img/profiles/avatar2x.jpg" data-src="assets/img/profiles/avatar.jpg" data-src-retina="assets/img/profiles/avatar2x.jpg" alt="">'
}).show();
Close Visual Studio
Open visual studio developer command prompt
run this command;
tf workspaces /updateComputerName:OGUZHANKIRCALI1 /s:"http://legedema:8080/tfs/DefaultCollection"
--Creating Temp Table (Optional)
create table YourTempTable as
SELECT * from YourTable --select statement
--update with loop
BEGIN
FOR r IN (SELECT * FROM YourTempTable)
LOOP
UPDATE YourAnotherTable SET ColumnName=r.ColumnName WHERE Id=r.Id;
@oguzhankircali
oguzhankircali / TheoryWithClassData.cs
Created January 15, 2019 08:36
xUnit Tests With Data
public class TestDataGenerator : IEnumerable<object[]>
{
private readonly List<object[]> _data = new List<object[]>
{
new object[] {5, 1, 3, 9},
new object[] {7, 1, 5, 3}
};
public IEnumerator<object[]> GetEnumerator() => _data.GetEnumerator();
@oguzhankircali
oguzhankircali / linq-join-with-multiple-nullable-columns.cs
Last active December 27, 2018 11:04
Linq join query with nullable relations.
from t in _policyPrintingNoteRepository.GetAll()
join p in _planRepository.GetAll() on new { t.PlanCode, t.ProductId }
equals new { PlanCode = p.Code, p.ProductId } into planView from p in planView.DefaultIfEmpty()
join pr in _productRepository.GetAll() on t.ProductId
equals pr.Id into productView from pr in productView.DefaultIfEmpty()
orderby t.Id descending
select
new
{
t.Id,
@oguzhankircali
oguzhankircali / cross-origin.md
Last active December 19, 2018 13:03
Uncaught SecurityError: Blocked a frame with origin "https://domain.com/area" from accessing a cross-origin frame.

When use window.opener to refresh your page, if you came to this page from another domain, you'll get cross-origin error. To resolve this issue;

//change from 
window.opener.location.reload();

//to
window.location.reload();
@oguzhankircali
oguzhankircali / DataFormatString.cs
Created November 26, 2018 18:39
Date Format on MVC Model
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}")]
[Display(Name = "End Date", Prompt = "")]
[UIHint("DateBox")]
public DateTime? EndDate { get; set; }
<html>
<head>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.0.226/pdf.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.0.226/pdf_viewer.js"></script>
</head>
<body>
<a class="btn btn-default" href="/pdf/viewer?file=/common/file/" target="_blank"><i class="fa fa-file-pdf-o"></i> PDF Görüntüle</a>
</body>
</html>
public static string GetDescription(this Enum value)
{
string description = string.Empty;
if (value != null)
{
description = value.ToString();
FieldInfo fieldInfo = value.GetType().GetField(description);
DescriptionAttribute[] attributes = (DescriptionAttribute[])fieldInfo.GetCustomAttributes(typeof(DescriptionAttribute), false);
if (attributes.Length > 0)