Jquery_Linq Son fiş numarası getirme(db.Max)

Blog Detay

Jquery_Linq Son fiş numarası getirme(db.Max)

Jquery_Linq Son fiş numarası getirme(db.Max)

<p>Yeni fiş kaydı yapıldığında veritabanında ki en büyük numaranın 1 artırılması için yazdığım kod .&nbsp;</p> <p>&nbsp;</p> <blockquote> <p>&nbsp;public JsonResult sonfisno()<br /> &nbsp; &nbsp; &nbsp; &nbsp; {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string[] dizi = new string[1];<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var fisno = db.S_FIS.Max(a =&gt; a.fisno).ToString();</p> <p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (fisno != null &amp;&amp; fisno != &quot;&quot;)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string ilkfisno = fisno;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int fisnnoint = int.Parse(fisno);<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fisnnoint++;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int length = Convert.ToString(fisnnoint).Length;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string sonfisno = ilkfisno.Substring(0, 5 - length);</p> <p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string SonFisNumarası = sonfisno + fisnnoint.ToString();</p> <p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dizi[0] = SonFisNumarası;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Json(dizi, JsonRequestBehavior.AllowGet);<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dizi[0] = &quot;00001&quot;;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Json(dizi, JsonRequestBehavior.AllowGet);<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p> <p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; }</p> </blockquote> <p>Html tarafı&nbsp;</p> <blockquote> <p>&nbsp; function sonfisbul(param1)<br /> &nbsp; &nbsp; &nbsp; &nbsp; {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$.ajax({<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;type: &quot;POST&quot;,<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;url: &quot;/hareket/sonfisno&quot;,<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;contentType: &quot;application/json; charset=utf-8&quot;,<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dataType: &quot;json&quot;,<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;success: function (data) {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$(param1).val(data);<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</p> </blockquote> <p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;});<br /> &nbsp; &nbsp; &nbsp; &nbsp; };</p> <p>&nbsp;</p>

Bunu paylaş
E-Arşiv Mühürleme sorunu-256 Versiyon Sorunu
Json_Ajax Fiş ve Satır Gönderimi
Yazar erydogan
1992 yılı İstanbul doğumluyum. "Beykent Üniversitesi/Bilgisayar Programcılığı" bölümü mezunuyum, 7 yılı aşkın süredir Logo firmasının üretmiş olduğu ERP ürünlerine teknik destek vermek üzere “Logo Erp Danışmanı/Sistem Uzmanı” olarak çalıştım. 2020 Şubat ayında yıllardır hayalini kurduğum "kendi işimi yapma" düşüncemi hayata geçirmek üzere DGN Yazılım firmasını kurdum. Ayrıca .Net C# (MVC) yazılım dilini kullanarak Web tabanlı/Mobil Uyumlu, Logo yazılım entegreli ya da tamamen bağımsız uygulamalar geliştiriyorum.

İlişkili Bloglar:

0 Yorum

Copyrights © 2020 All Rights Reserved by DGN Software.