Latest Added Tutorials
10-04-2019
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Sheets.v4;
using Google.Apis.Sheets.v4.Data;
using Google.Apis.Services;
using Google.Apis.Util.Store;
using System.IO;
using System.Threading;
namespace DgEeUI.Utils
{
public class GoogleSheetUtil
{
private string _webRootPath;
private string _spreadSheetId;
public GoogleSheetUtil(string webRootPath, string spreadSheetId)
{
_webRootPath = webRootPath;
_...Continue Reading
using System;
using System.Data.Entity;
using System.Data.Entity.Core.Objects;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Web;
using log4net;
using TelifBandrolTutanak.Models;
namespace TelifBandrolTutanak.DAL
{
public class BandrolContext : DbContext
{
private readonly ILog _logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public BandrolContext() : base("Ban...Continue Reading
19-08-2017
When using onesignal as notification system in Android application, we should insert following codes in ApplicationManifest.xml file:
<meta-data
android:name="com.onesignal.NotificationOpened.DEFAULT"
android:value="DISABLE" />
After adding this meta-data, Android will disable launcher activity to be opened.
Handle notification opened event as follows:
public class App extends Application {
protected boolean active = true;
protected int splashTime = 3000;
@Override
public void onCreate() {
s...Continue Reading
14-07-2017
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization;
using VirtualPos.Models;
namespace VirtualPos.Controllers
{
[Route("api/[controller]")]
public class BankController : Controller
{
private readonly BankContext _context;
private readonly IStringLocalizer<BankController> _localizer;
public BankController(BankContext context, IStringLocalizer<BankController> localizer)
{
_context = context;
_localizer = loca...Continue Reading
13-07-2017
[Route("api/[controller]")]
public class HomeController : Controller
{
private readonly IStringLocalizer<HomeController> _localizer;
public HomeController(IStringLocalizer<HomeController> localizer)
{
_localizer = localizer;
}
[HttpGet("index/{id}")]
public IActionResult Index()
{
return new ObjectResult(_localizer["Hello"]);
}
}
Add Resources folder then, add Controllers.HomeController.tr-TR.resx and Controllers.HomeController.en-EN....Continue Reading
16-06-2016
C# Codes
private void ExportGridToExcel()
{
Response.Clear();
Response.Buffer = true;
Response.ClearContent();
Response.ClearHeaders();
string fileName = "Devlet_Personel_Baskanligi_"
+ DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
StringWriter strwritter = new StringWriter();
HtmlTextWriter htmltextwrtter = new HtmlTextWriter(strwritter);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/ms-excel";
Response.ContentEncoding = System.Text.Encoding.Unicode;...Continue Reading
Getting images from Scanner in C#, we will use ShowTransfer() method of WIA.ICommonDialog class in Windows Image Acqusition(WIA) library
Full Code
WIA.ICommonDialog dialog = new WIA.CommonDialog();
WIA.Device device = dialog.ShowSelectDevice(WIA.WiaDeviceType.UnspecifiedDeviceType, true, false);
var d = device.DeviceID;
WIA.DeviceManager manager = new WIA.DeviceManager();
foreach (WIA.DeviceInfo info in manager.DeviceInfos)
{
if (info.DeviceID == d)
{
// connect to scanner
device = WiaDeviceId.Connect();
break;
}...Continue Reading
In order to use CheckBox ListBox in a WPF application, we should use custom ListBox list.
There are three steps to accomplish this:
1. Create a class which will represent items of the ListBox.
2. Create a List object consisting of the custom item class defined in step 1.
3. Add ListBox.ItemTemplate into <ListBox> element to create CheckBox ListBox.
4. Create a custom MultiValueConverter if you want to initialize the CheckBox items to be selected or not.
Step 1: Create Country class for ListBox items
internal class Country
{
public strin...Continue Reading