24 Nisan 2017 Pazartesi

Sql try catch - uzun sorgu için

BEGIN TRY
        BEGIN TRANSACTION
      
        --Buraya sorgular yazılır
              
        --Bi sıkıntı yoksa commit  
        COMMIT TRANSACTION  
          
          
        --sıkıtnı olursa rolback
        --ROLLBACK TRANSACTION
  
END TRY
BEGIN CATCH  
        --Catch düştüyse rollback yapılır
        ROLLBACK TRANSACTION
END CATCH

23 Nisan 2017 Pazar

Veritabanı adı değiştme

ALTER DATABASE [old_name]
 
 SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
ALTER DATABASE [old_name]
 
 MODIFY NAME = [new_name]
GO
ALTER DATABASE [new_name]
 SET MULTI_USER
GO

23 Mart 2017 Perşembe

IIS Uygulama timeout'u kapatma

Application Pool ve sitenin "Advenced Settings"den timeout süresini 65535 (45gün) yapmak gerekiyor

9 Mart 2017 Perşembe

bootstrap table tarihe göre sıralama

var dateSorter = function (a ,b) {
    var aParts = a.split('/');
    var bParts = b.split('/');
    if (aParts.length === 3 && bParts.length === 3) {
        var integerA = parseInt(aParts[2] + aParts[1] + aParts[0]);
        var integerB = parseInt(bParts[2] + bParts[1] + bParts[0]);
        return integerA < integerB ? -1 : 1;
    }
    return 0;
}

24 Şubat 2017 Cuma

WcfTestClient.exe lokasyon

For .NET 4.5+:
C:\Program Files (x86)\Microsoft Visual Studio {YourVersionHere}\Common7\IDE
VS 2015:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
VS 2013:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE
VS 2012:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE

23 Şubat 2017 Perşembe

File upload using MVC 4 with Ajax

ere is my small working sample, which uploads multiple files and uploads in a folder called as 'junk'
Client Side....
    <html>
    <head>
    <title>Upload Example</title>
    <script src="~/Scripts/jquery-2.1.0.intellisense.js"></script>
    <script src="~/Scripts/jquery-2.1.0.js"></script>
    <script src="~/Scripts/jquery-2.1.0.min.js"></script>
    <script>
    $(document).ready(function () {
        $("#Upload").click(function () {
            var formData = new FormData();
            var totalFiles = document.getElementById("FileUpload").files.length;
            for (var i = 0; i < totalFiles; i++)
            {
                var file = document.getElementById("FileUpload").files[i];

                formData.append("FileUpload", file);
            }
            $.ajax({
                type: "POST",
                url: '/Home/Upload',
                data: formData,
                dataType: 'json',
                contentType: false,
                processData: false,
                success: function (response) {
                    alert('succes!!');
                },
                error: function (error) {
                    alert("errror");
                }
            });
        });
    });

</script>
</head>
<body>
    <input type="file" id="FileUpload" multiple />
    <input type="button" id="Upload" value="Upload" />
</body>
</html>
Server Side....
public class HomeController : Controller
{
    [HttpPost]
    public void Upload( )
    {
        for( int i = 0 ; i < Request.Files.Count ; i++ )
        {
            var file = Request.Files[i];

            var fileName = Path.GetFileName( file.FileName );

            var path = Path.Combine( Server.MapPath( "~/Junk/" ) , fileName );
            file.SaveAs( path );    
        }

    }
}

.net 6 mapget kullanımı

 app.UseEndpoints(endpoints => {     endpoints.MapGet("/", async context =>     {         var response = JsonConvert.Seriali...