<?xml version="1.0" encoding="utf-8" ?><?xml-stylesheet type="text/css" href="/Content/rss.css"?><rss version="2.0"><channel><title>.net denemeleri</title><link>http://ayrilmaz.com</link><description>Emre Ayrılmaz'ın .Net Framework içerikli kişisel web sitesi.</description><copyright>Yusuf Emre AYRILMAZ</copyright><item><title>codeSubDirectories</title><description><![CDATA[<p>
	Kimi zaman&nbsp;bir <strong>Web Site</strong> (Application değil) kodlaması&nbsp;yaparken (<em>Class Library<sup>Sınıf K&uuml;t&uuml;phanesi</sup></em> değil) birden fazla <strong>.Net Framework</strong> dilini kullanmak durumda kalınabilir.</p>
<p>
	&Ouml;rneğin;<br />
	Projede dil değişikliğine gidilebilir. Vb.Net dilinden C# diline ge&ccedil;mek gibi. Bu durumda adım adım ilerlermek daha mantıklı olacaktır. Lakin Web Site Şablonu<sup>Template</sup> ile uygulama geliştirirken t&uuml;m class<sup>sınıf</sup> lar <strong>App_Code </strong>klas&ouml;r&uuml;nde olmalı ve klas&ouml;r i&ccedil;inde tek dil uzantılı class dosyaları bulunmalıdır.</p>
<p>
	Peki b&ouml;yle bir sorunu nasıl &ccedil;&ouml;zebiliriz.</p>
<p>
	İlk &ouml;nce;<br />
	<strong>App_Code</strong> klas&ouml;r&uuml; her bil dil i&ccedil;in alt klas&ouml;rlere ayırılır. Ka&ccedil; farklı dil kullanılacaksa o kadar klas&ouml;r olmalı.</p>
<p>
	<img alt="" src="\blogImages\codeSubDirectories.png" /></p>
<p>
	Daha sonra ise;<br />
	Derleyici<sup>compiler </sup>ye gerekli bilgileri <strong>web.config</strong> dosyası ile belirtmek yeterli olacaktır.</p>
<pre class="brush:xml;">
&lt;configuration&gt;
&nbsp;&nbsp;&nbsp; &lt;system.web&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;compilation debug=&quot;false&quot; targetFramework=&quot;4.0&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;codeSubDirectories&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;add directoryName=&quot;vb-codes&quot;/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;add directoryName=&quot;cs-codes&quot;/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/codeSubDirectories&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/compilation&gt;
&nbsp;&nbsp;&nbsp; &lt;/system.web&gt;
&lt;/configuration&gt;</pre>
<p>
	&nbsp;Ctr + Shft + B</p>
]]></description><link>http://ayrilmaz.com/Post/2011/11/25/codesubdirectories.aspx</link><pubDate>25.11.2011 11:31</pubDate></item><item><title>Start Experimental Instance of Microsoft Visual Studio 2010 SP1</title><description><![CDATA[<p>
	Sıkıntıdan&nbsp;gezinirken (bu genelde MS Windows başlat<sup>Start</sup> men&uuml;s&uuml;nde olur);<br />
	<em>Microsoft Visual Studio 2010 SDK SP1 </em>-&gt; <em>Tool</em> altında <strong>Start Experimental Instance of Microsoft Visual Studio 2010 SP1 </strong>adında bir kısayol olduğunu farkettim.</p>
<p>
	<img alt="Experimental Instance of Visual Stuido" height="299" src="/blogimages/expre1.png" width="411" /></p>
<p>
	Şu şekilde de &ccedil;alıştırabilirsiniz:<br />
	<img alt="Experimental Instance of Visual Stuido" height="235" src="/blogimages/expre2.png" width="427" /></p>
<p>
	Nedir bunun hikayesi diye azıcık araştırdım.</p>
<p>
	Ama&ccedil; <strong>Visual Studio</strong>&nbsp;i&ccedil;in bir nevi test ortamı oluşturmakmış.<br />
	&Ouml;rneğin bir Extension&#39;ı denemek istiyorsunu ama &ccedil;ok &ouml;nemli de bir proje &uuml;zerinde&nbsp;de&nbsp;&ccedil;alışıyoruz ve&nbsp;Extension&#39; dan doğacak bir probleminde Visual Studio&#39;ya yansımasını istemiyoruz. Bu durumda deneysel<sup>Experimental</sup> olan verisyonu a&ccedil;ıyoruz (<strong>devenv /RootSuffiz Exp</strong>), Extension&#39;ı kuruyoruz ve test ediyoruz. Beğenmedik kaldırıyoruz.. Bu işlem&nbsp;standart olarak&nbsp;kullandığımız Visual Studio&#39;yu (<strong>devenv</strong>) etkilemiyor. Başka bir deyişle Geliştirme Aray&uuml;z&uuml;<sup>IDE</sup>&nbsp;ile ilgli herşeyi (<strong>options, toolbox ,extension vb</strong>) soyutlanmış oluyor.</p>
<p>
	<strong><em>Not:</em></strong><em> Şu </em><a href="http://www.microsoft.com/download/en/details.aspx?id=21835"><em>adresten</em></a><em> Visual Studio 2010 SP1 SDK y&uuml;klemeniz gerekiyor.</em></p>
]]></description><link>http://ayrilmaz.com/Post/2011/6/30/start-experimental-instance-of-microsoft-visual-studio-2010-sp1.aspx</link><pubDate>30.06.2011 23:11</pubDate></item><item><title>Javascipt İpuçları 1</title><description><![CDATA[<p>
	Uzun zamandır Javascript ile yazışmıyordum. Son zamanlarda ise yediğimiz i&ccedil;tiğimiz ayrı gitmez oldu. Sık kıllandığım ipu&ccedil;larını paylaşıyorum.</p>
<p>
	İlk ipucu;<br />
	Js dosyalarını referans ekleme.<br />
	<em><strong>Snippet -&gt; ref</strong></em></p>
<p>
	Burada ama&ccedil;,&nbsp;başka bir&nbsp;Js dosyasından (IntelliSense olarak) faydalanabilmek. Referans vermek istediğiniz Js dosyasını s&uuml;r&uuml;kleyip bırakmanız yeterli.</p>
<p>
	<img alt="reference" height="213" src="/blogimages/js_ip1.png" width="667" /></p>
<p>
	Diğer bir ipucu;<br />
	Javascript fonksiyonları i&ccedil;in kullanım bilgisi ekleme.<br />
	<strong><em>Snippet -&gt; summary, param, returns</em></strong></p>
<pre class="brush:jscript;" style="font-family: Consolas; background: white; color: black; font-size: 13px">
function KartEkle(kartno,ay,yil) {
&nbsp;///&lt;summary&gt;Yeni Kredi Kartı Ekleme&lt;/summary&gt;
&nbsp;///&lt;param name=&quot;kartno&quot; type=&quot;string&quot;&gt;16 haneli kredi kart bilgisi&lt;/param&gt;
&nbsp;///&lt;param name=&quot;ay&quot; type=&quot;int&quot;&gt;2 haneli ay bilgisi -&gt; son kullanma tarihi&lt;/param&gt;
&nbsp;///&lt;param name=&quot;yil&quot; type=&quot;int&quot;&gt;4 haneli yıl bilgisi -&gt; son kullanma tarihi&lt;/param&gt;
&nbsp;///&lt;returns&gt;Kart başarılı olarak sisteme eklenirse 0 hata olursa -1 d&ouml;ner&lt;/returns&gt;
&nbsp;
&nbsp;var kredikart ....</pre>
<p>
	Buradaki ama&ccedil;, fonksiyonu kullanırken a&ccedil;ıklayıcı bilgiler vermek. <strong>param</strong> i&ccedil;indeki <em>name</em> &ouml;zelliği ile fonsiyon parametre adının aynı olması &ouml;nemli. <em>type</em> bilgisinin ger&ccedil;ekliği tamamen mantıksal.</p>
<p>
	<img alt="Method" height="151" src="/blogimages/js_ip2.png" width="308" /></p>
<p>
	Bu yazının son ipucu ise;<br />
	IntelliSense&#39;den kopya &ccedil;ekme tekniği.</p>
<p>
	Şahsen bizzat ben kendim &ccedil;oğu zaman Javascript (built-in) fonksiyon adlarını hatırlayamam.</p>
<p>
	-Bu gibi durumlar&nbsp;i&ccedil;in bir adet dummy değişken oluşturulur.<br />
	-Başlangı&ccedil; değerini fonksiyon tip k&uuml;mesine (&ouml;rneğin <strong>string</strong>)&nbsp;uygun bir değer atanır.<br />
	-Gerisini IntelliSense halleder.</p>
<p>
	<img alt="string methods" height="223" src="/blogimages/js_ip3.png" width="360" /></p>
]]></description><link>http://ayrilmaz.com/Post/2011/6/8/javascipt-ipuclari-1.aspx</link><pubDate>08.06.2011 00:00</pubDate></item><item><title>Setup And Attach Database</title><description><![CDATA[<p>
	Bug&uuml;n daha &ouml;nce&nbsp;yazmış olduğum <a href="http://ayrilmaz.com/Post/2008/3/15/setup-ve-connectionstring.aspx">Setup &amp; ConnectionString</a> yazısına ek yapacağız.<br />
	S&ouml;z konusu ek;<br />
	mdf<sup>DataFile</sup> ve ldf<sup>LogFile</sup> dosyalarını Veritabanı<sup>Database</sup> sunucusuna eklemek<sup>Attach</sup>.</p>
<p>
	İlk&nbsp;&ouml;ğrenmemiz&nbsp;gereken bu işi yapan&nbsp;DDL kodları;<br />
	<em>(şu </em><a href="http://ayrilmaz.com/Post/2010/10/10/sql-server-management-studio-dan-kod-calma.aspx"><em>yazıda</em></a><em> bunu nasıl yapabileceğiniz g&ouml;rebilirsiniz)</em></p>
<pre class="brush:sql;" style="font-family: Consolas; background: white; color: black; font-size: 13px">
CREATE DATABASE [ornek] ON 
(FILENAME = N&#39;E:\DataBases\ornek.mdf&#39;),
(FILENAME = N&#39;E:\DataBases\ornek_log.ldf&#39;)
FOR ATTACH</pre>
<p>
	Daha sonra bu kodları kurulum<sup>setup</sup> sırasında (OnAfterInstall) Ado.Net komutları ile&nbsp;&ccedil;alıştırmak<sup>Execute</sup> etmek.</p>
<pre class="brush:csharp;" style="font-family: Consolas; background: white; color: black; font-size: 13px">
//DDL kodlarını oluşturalım
StringBuilder sb = new StringBuilder();
sb.Append(&quot;CREATE DATABASE [Ornek] ON\r\n&quot;);
sb.AppendFormat(&quot;(FILENAME = N&#39;{0}&#39;),\r\n&quot;,
&nbsp;&nbsp;&nbsp; thisAss.Location.Replace(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; thisAss.GetName().Name + &quot;.exe&quot;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;ornek.mdf&quot;)
&nbsp;&nbsp;&nbsp; );
sb.AppendFormat(&quot;(FILENAME = N&#39;{0}&#39;)\r\n&quot;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; thisAss.Location.Replace(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; thisAss.GetName().Name + &quot;.exe&quot;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;ornek_log.ldf&quot;)
&nbsp;&nbsp;&nbsp; );
sb.Append(&quot;FOR ATTACH\r\n&quot;);
&nbsp;
//oluşan DDL kodlarını ADO.NET ile &ccedil;alıştıralım
using (SqlConnection con = new SqlConnection(value.Replace(&quot;ornek&quot;, &quot;Master&quot;)))
{
&nbsp;&nbsp;&nbsp; using (SqlCommand com = new SqlCommand(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sb.ToString(), con))
&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; con.Open();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; com.ExecuteNonQuery();
&nbsp;&nbsp;&nbsp; }
}</pre>
]]></description><link>http://ayrilmaz.com/Post/2011/5/14/setup-and-attach-database.aspx</link><pubDate>14.05.2011 00:00</pubDate></item><item><title>QueryExtender İle Kolay Arama</title><description><![CDATA[<p>
	Ge&ccedil;enlerde bir takım verileri<sup>data</sup> WebForm&#39; unda g&ouml;r&uuml;nt&uuml;lemem<sup>View</sup> ve filtrelemem<sup>Filter|Search</sup>&nbsp;gerekti (zaman da dar bu arada).</p>
<p>
	Bakın ne yaptım;</p>
<ol>
	<li>
		<strong>TextBox </strong>kontrol&uuml; ekledim. ID &ouml;zelliği&nbsp;productname</li>
	<li>
		<strong>Button</strong> kontrol&uuml; ekledim. Text &ouml;zelliği Ara</li>
	<li>
		<strong>GridView</strong> kontrol&uuml; ekledim. ID&nbsp;&ouml;zelliği allproducts</li>
	<li>
		<strong>EntityDataSource</strong> bileşeni<sup>Component</sup> ekledim ve t&uuml;m &uuml;r&uuml;nleri &ccedil;ektim. ID&nbsp;&ouml;zelliği EntityDataSource1.</li>
	<li>
		GridView&nbsp;kontrol&uuml;ne <em>EntityDataSource1</em>&nbsp;ID &ouml;zellikli bileşenini bağladım.</li>
	<li>
		<strong>QueryExtender</strong> bileşeni ekledim. Aşağıdaki gibi ayarladım;</li>
</ol>
<pre class="brush:xml;" style="font-family: Consolas; background: white; color: black; font-size: 13px">
&lt;asp:QueryExtender ID=&quot;QueryExtender1&quot; runat=&quot;server&quot; TargetControlID=&quot;EntityDataSource1&quot;&gt;
&nbsp;&lt;asp:SearchExpression DataFields=&quot;ProductName&quot; SearchType=&quot;StartsWith&quot;&gt;
&nbsp;&nbsp;&lt;asp:ControlParameter ControlID=&quot;productname&quot; /&gt;
&nbsp;&lt;/asp:SearchExpression&gt;
&lt;/asp:QueryExtender&gt;</pre>
<ol start="7">
	<li>
		Button kontrol&uuml;n&uuml;n <strong>Click</strong> olayına<sup>Event</sup> aşağıdaki kodu yazdım.</li>
</ol>
<pre class="brush:csharp;" style="font-family: Consolas; background: white; color: black; font-size: 13px">
protected void Button1_Click(object sender, EventArgs e)
{
&nbsp;&nbsp;&nbsp; QueryExtender1.DataBind();
}</pre>
<p>
	Alternatif olarak; TextBox kontrol&uuml;n&uuml;n <em>Autopostback</em> &ouml;zelliğini <strong>True</strong> olarak ayarlanırsa Button kontrol&uuml;ne ihtiya&ccedil; kalmadan da filtrelemeyi tetiklemek m&uuml;mk&uuml;n olur.</p>
<p>
	<em>Biraz a&ccedil;ıklama:</em><br />
	<a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.queryextender.aspx" onclick="window.open(this.href,'','resizable=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,fullscreen=no,dependent=no,status'); return false">QueryExtender</a>, Framework 4.0 bileşenidir. LINQ ifadeleri i&ccedil;in geliştirilmiş Expressionlara<sup>İfade</sup> sahiptir.<br />
	&Ouml;rneğimizde <strong>SearchExpression </strong>kullandık. Nasıl kullandık?<br />
	<strong>DataFields </strong>&ouml;zelliği ile filtre uygulanacak alanı belirledik.(Daha fazla alan virg&uuml;l ile belirtilebilir) Bu &ouml;zellik klasik <strong>Sql </strong>sorgusunda <em>where</em> ifadesinden sonra kullanılan field<sup>Alan</sup> tanımlaması gibi d&uuml;ş&uuml;nebilir.<br />
	<strong>SearchType </strong>&ouml;zelliği ise <em>like</em> ifadesinin karşılığıdır. StartsWith <strong>&#39;parametre%&#39;</strong>, EndsWith <strong>&#39;%parametre&#39;</strong> ve Contains <strong>&#39;%parametre%&#39;</strong> gibi &ccedil;alışır.<br />
	Son olarak filtreleme i&ccedil;in kullanılacak parametre kaynağını belirtmek. Bu bir kontrol olabileceği gibi <em>session, cookie </em>gidi kaynaklar da olabilir.</p>
<p>
	<img alt="QueryExtender" height="313" src="/blogimages/queryextender.png" width="462" /></p>
<p>
	Projeyi indirmek i&ccedil;in <a class="download" href="/ress/EasySearch.rar">tıklayın</a>.</p>
]]></description><link>http://ayrilmaz.com/Post/2011/4/3/queryextender-ile-kolay-arama.aspx</link><pubDate>03.04.2011 00:00</pubDate></item><item><title>Repeater İle Satır Taşıma</title><description><![CDATA[<p>
	Repeater ile verileri listemek yada <a href="http://www.ayrilmaz.com/Post/2010/4/25/repeater-kontrolu-ile-veri-siralama.aspx">sıralamak</a><sup>sort</sup> m&uuml;mk&uuml;n. Peki sıralamasını manuel nasıl yaparız?</p>
<p>
	Bunu ger&ccedil;ekleştirmek i&ccedil;in taşıma yapmak istediğimiz&nbsp;tablomuza <strong>RowNumber </strong>adlı bir kolon<sup>field</sup> ekliyoruz. Bu kolondaki değer verinin sıra numarasını temsil edecek. Taşıma işlemi ise bu numaraları değiştirmekten ibaret olacaktır.</p>
<p>
	<img alt="Table" height="304" src="/blogimages/moverow_db.png" width="474" /></p>
<p>
	Repeater i&ccedil;ine sıralama olayını ger&ccedil;ekleştirmek i&ccedil;in&nbsp;iki adet <strong>ImageButton</strong> kontrol&uuml; ekliyoruz.<strong> CommandArgument</strong> &ouml;zelliğine<sup>property</sup> taşınacak satırın&nbsp;Id değerini&nbsp;atıyoruz<sup>set</sup>. CommandName &ouml;zelliğine atanan <strong>up </strong>ve <strong>down</strong> değerleri ile de taşıma y&ouml;n&uuml;n&uuml; bildiriyoruz.</p>
<pre class="brush:xml;" style="font-family: Consolas; background: white; color: black; font-size: 13px">
&lt;td style=&quot;width: 24px; text-align: center;&quot;&gt;
&nbsp;&nbsp;&nbsp; &lt;asp:ImageButton runat=&quot;server&quot;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ID=&quot;moveup&quot;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ImageUrl=&quot;~/Images/up.png&quot;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ToolTip=&quot;Yukarı Taşı&quot;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CommandArgument=&#39;&lt;%# Eval(&quot;Id&quot;)%&gt;&#39; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CommandName=&quot;up&quot; /&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 24px; text-align: center;&quot;&gt;
&nbsp;&nbsp;&nbsp; &lt;asp:ImageButton runat=&quot;server&quot;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ID=&quot;movedown&quot; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ImageUrl=&quot;~/Images/down.png&quot; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ToolTip=&quot;Aşağı Taşı&quot;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CommandArgument=&#39;&lt;%# Eval(&quot;Id&quot;)%&gt;&#39; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CommandName=&quot;down&quot; /&gt;
&lt;/td&gt;</pre>
<p>
	Repeater kontrol&uuml;n&uuml;n <strong>ItemCommand </strong>olayı<sup>event</sup> na aşağıdaki kodları yazarak taşıma işlemini ger&ccedil;ekleştiriyoruz.</p>
<pre class="brush:csharp;" style="font-family: Consolas; background: white; color: black; font-size: 13px">
using (NorthwindDataContext db = new NorthwindDataContext())
{
&nbsp;&nbsp;&nbsp; //taşınacak verinin Id bilgisi alınıyor
&nbsp;&nbsp;&nbsp; Guid Id = new Guid(e.CommandArgument.ToString());
&nbsp;&nbsp;&nbsp; //taşınacak veri
&nbsp;&nbsp;&nbsp; OrderedProduct moveproduct = db.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OrderedProducts.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FirstOrDefault(p =&gt; p.Id == Id);
&nbsp;&nbsp;&nbsp; //yeni numara hesapla
&nbsp;&nbsp;&nbsp; int RowNumber = e.CommandName == &quot;up&quot; ? 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; moveproduct.RowNumber - 1 : //yukarı ise
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; moveproduct.RowNumber + 1; //aşağı ise
&nbsp;&nbsp;&nbsp; //yeri değişecek veri
&nbsp;&nbsp;&nbsp; OrderedProduct targetproduct = db.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OrderedProducts.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FirstOrDefault(p =&gt; p.RowNumber == RowNumber);
&nbsp;&nbsp;&nbsp; if (e.CommandName == &quot;up&quot;)
&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //yukarı taşı
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; moveproduct.RowNumber -= 1;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; targetproduct.RowNumber += 1;
&nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp; else if (e.CommandName == &quot;down&quot;)
&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //aşağo taşı
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; moveproduct.RowNumber += 1;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; targetproduct.RowNumber -= 1;
&nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp; //değişiklikleri yap
&nbsp;&nbsp;&nbsp; db.SubmitChanges();
}
//tekrar listele
BindData();</pre>
<p>
	Daha sonra ise, ilk satırdaki <strong>Yukarı Ok</strong> u ve en alt satırdaki <strong>Aşağı Ok</strong>&nbsp;ImageButton&#39;larını basit bir script kodu ile kaldırıyoruz. Bu kod sayesinde sunucu<sup>server</sup> tarafındaki <em>ilk kayıt mı son kayıt mı</em> kontrol&uuml;n&uuml; yapmaktan yırtıyoruz :)</p>
<pre class="brush:jscript;" style="font-family: Consolas; background: white; color: black; font-size: 13px">
&lt;script src=&quot;Scripts/jquery-1.4.1-vsdoc.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&nbsp;&nbsp;&nbsp; $(document).ready(function () {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(&quot;table tbody tr:first td:eq(3)&quot;).empty();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(&quot;table tbody tr:last td:eq(4)&quot;).empty();
&nbsp;&nbsp;&nbsp; });
&lt;/script&gt;</pre>
<p>
	Repeater kontrol&uuml; render<sup>Html koduna d&ouml;n&uuml;şmek</sup> edildiğinde aşağıdaki g&ouml;r&uuml;nt&uuml; oluşacaktır. Kullanıcı yukarı aşağı ok tuşları ile satırları manuel olarak sıralayabilecek.</p>
<p>
	<img alt="Grid" height="296" src="/blogimages/moverow_grid.png" width="592" /></p>
<p>
	Projeyi <a href="/ress/RepeaterRowMoving.rar">indir</a>.</p>
]]></description><link>http://ayrilmaz.com/Post/2011/2/22/repeater-ile-satir-tasima.aspx</link><pubDate>22.02.2011 00:00</pubDate></item><item><title>DropDownList Validation</title><description><![CDATA[<p><img alt="Validation" width="672" height="236" src="/blogimages/ddVal.png" /></p>]]></description><link>http://ayrilmaz.com/Post/2011/2/2/dropdownlist-validation.aspx</link><pubDate>02.02.2011 00:00</pubDate></item><item><title>Linq İle Pivot</title><description><![CDATA[<p>
	<strong>Pivot </strong>hazırlamak benim i&ccedil;in hep eziyet olmuştur (<em>Sql </em>ile).&nbsp; Lakin <strong>Linq </strong>ile &ccedil;ok daha basitmiş onu kavradım :)</p>
<p>
	Ş&ouml;yleki;<br />
	Diagramda g&ouml;r&uuml;ld&uuml;ğ&uuml;&nbsp;gibi bir yapı olsun. Yazılar ve Kategoriler adlı iki adet ana tablo ve bunları bağlayan bir adet yardımcı tablo.</p>
<p>
	<img alt="Diagram" height="303" src="/blogimages/pivot_diagram.png" width="495" /></p>
<p>
	Amacımız;<br />
	Kategori bazında 2010 yılında aylık ka&ccedil; adet yazı yayınlanmış onu bulmak ve listelemek.</p>
<pre class="brush:csharp;" style="font-family: Consolas; background: white; color: black; font-size: 13px">
from p in db.EntryCategories
where p.Entry.EntryTime.Year == 2010
group p by p.Category.CategoryName into g
select new
{
&nbsp;&nbsp;&nbsp; Kategori = g.Key,
&nbsp;&nbsp;&nbsp; Ocak = g.Where(t =&gt; t.Entry.EntryTime.Month == 1).Count(),
&nbsp;&nbsp;&nbsp; Şubat = g.Where(t =&gt; t.Entry.EntryTime.Month == 2).Count(),
&nbsp;&nbsp;&nbsp; Mart = g.Where(t =&gt; t.Entry.EntryTime.Month == 3).Count(),
&nbsp;&nbsp;&nbsp; Nisan = g.Where(t =&gt; t.Entry.EntryTime.Month == 4).Count(),
&nbsp;&nbsp;&nbsp; Mayıs = g.Where(t =&gt; t.Entry.EntryTime.Month == 5).Count(),
&nbsp;&nbsp;&nbsp; Haziran = g.Where(t =&gt; t.Entry.EntryTime.Month == 6).Count(),
&nbsp;&nbsp;&nbsp; Temmuz = g.Where(t =&gt; t.Entry.EntryTime.Month == 7).Count(),
&nbsp;&nbsp;&nbsp; Ağustos = g.Where(t =&gt; t.Entry.EntryTime.Month == 8).Count(),
&nbsp;&nbsp;&nbsp; Eyl&uuml;l = g.Where(t =&gt; t.Entry.EntryTime.Month == 9).Count(),
&nbsp;&nbsp;&nbsp; Ekim = g.Where(t =&gt; t.Entry.EntryTime.Month == 10).Count(),
&nbsp;&nbsp;&nbsp; Kasım = g.Where(t =&gt; t.Entry.EntryTime.Month == 11).Count(),
&nbsp;&nbsp;&nbsp; Aralık = g.Where(t =&gt; t.Entry.EntryTime.Month == 12).Count(),
};
</pre>
<p>
	Sonu&ccedil;;<br />
	<img alt="Table" height="245" src="/blogimages/pivot_result.png" width="564" /></p>
]]></description><link>http://ayrilmaz.com/Post/2011/1/31/linq-ile-pivot.aspx</link><pubDate>31.01.2011 00:00</pubDate></item><item><title>No Cache</title><description><![CDATA[<p>
	&nbsp;Sayfanın <strong>Cache<sup>&Ouml;nBellek</sup></strong> lenmesini engellemek i&ccedil;in <em>Head </em>i&ccedil;ine;</p>
<pre class="brush:xml;" style="font-family: Consolas; background: white; color: black; font-size: 13px">
&lt;meta http-equiv=&quot;Pragma&quot; content=&quot;no-cache&quot; /&gt;
&lt;meta http-equiv=&quot;Expires&quot; content=&quot;-1&quot; /&gt;
</pre>
]]></description><link>http://ayrilmaz.com/Post/2011/1/30/no-cache.aspx</link><pubDate>30.01.2011 00:00</pubDate></item><item><title>Big Big BigInteger</title><description><![CDATA[<p>
	<strong>Decimal</strong> kadar b&uuml;y&uuml;k <strong>Integer</strong> kadar tam değer saklamak isterseniz alın size <strong><a href="http://msdn.microsoft.com/en-us/library/system.numerics.biginteger.aspx" target="_blank">BigInteger</a></strong>.&nbsp;Baştan ifade edeyim bu bir <em>Buit-in Type</em><sup>Yerleşik Tip</sup> değil bir <strong>Struct</strong><sup>Yapı</sup> dır ve sadece <em>.Net Framework 4.0</em> ile kullanabilirsiniz.</p>
<p>
	Son olarak, bu yapıyı kullanabilmek i&ccedil;in <em>System.Numerics</em> namespace ini referans olarak projenize eklemeniz gerekir.</p>
<pre class="brush:csharp;" style="font-family: Consolas; background: white; color: black; font-size: 13px">
class Program
{
&nbsp;&nbsp;&nbsp; static void Main(string[] args)
&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //en b&uuml;y&uuml;k decimal değer
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; decimal dec = decimal.MaxValue;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //decimal değerden biginteger oluşturalım
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BigInteger big = new BigInteger(dec);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //ekranda g&ouml;sterelim
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine(&quot;dec={0}\nbig={1}&quot;, dec, big);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //bir arttıralım
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; big++;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //bakalım artmış mı?
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine(&quot;\nbig={0}&quot;, big);</pre>
<p>
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <img alt="BigInteger Result" height="73" src="/BlogImages/big2.png" width="251" /></p>
<pre class="brush:csharp;" style="font-family: Consolas; background: white; color: black; font-size: 13px">
//Math sınıfı kullanılamadığı i&ccedil;in
BigInteger max1 = Math.Max(big1, big2);
//kendi metotları mevcut
BigInteger max2 = BigInteger.Max(big1, big2);</pre>
]]></description><link>http://ayrilmaz.com/Post/2010/12/5/big-big-biginteger.aspx</link><pubDate>05.12.2010 00:00</pubDate></item></channel></rss>
