public static int Stok_Katsayi2_Bul(int stokid) { try { _sqlProvider = new SqlProvider("SELECT KATSAYI2 FROM STOK WHERE STOKID = @STOKID ", false); _sqlProvider.AddParameter("STOKID", stokid); int num = Convert.ToInt32(_sqlProvider.ExecuteScalar()); return((num == 0) ? 1 : num); } catch (Exception) { return(1); } }
public static string PartiNoUret(DateTime tarih, string tableName) { string partiNo = ""; _sqlProvider = new SqlProvider("SELECT MAX(SIRANO) FROM PARTI_NO WHERE TABLENAME=@TABLENAME AND TARIH=@TARIH", false); _sqlProvider.AddParameter("TARIH", tarih); _sqlProvider.AddParameter("TABLENAME", tableName); string pNo = _sqlProvider.ExecuteScalar().ToString(); if (pNo == "") { switch (tableName) { case "HAMMADDEPARTINO": partiNo = string.Format("{0:ddMMyy}{1}", tarih, "1001"); break; case "PARCALAMAPARTINO": partiNo = string.Format("{0:ddMMyy}{1}", tarih, "2001"); break; case "PROCESSPARTINO": partiNo = string.Format("{0:ddMMyy}{1}", tarih, "3001"); break; } PartiNoInsert(partiNo, tarih, tableName); } else { int parti = Convert.ToInt32(pNo.Substring(6, 4)) + 1; partiNo = string.Format("{0:ddMMyy}{1}", tarih, parti); PartiNoInsert(partiNo, tarih, tableName); } return(partiNo); }
public static int SiraNoVer(string tableName) { int siraNo = 0; var sqlProvider = new SqlProvider("SELECT SIRANO FROM SAYACLAR WHERE TABLENAME=@TABLENAME", false); sqlProvider.AddParameter("TABLENAME", tableName); var result = sqlProvider.ExecuteScalar(); if (result == null) { SAYACLARInsert(tableName); siraNo = 1; } else { siraNo = Convert.ToInt32(result); } sqlProvider = new SqlProvider("UPDATE SAYACLAR SET SIRANO=@SIRANO WHERE TABLENAME=@TABLENAME", false); sqlProvider.AddParameter("TABLENAME", tableName); sqlProvider.AddParameter("SIRANO", siraNo + 1); sqlProvider.ExecuteNonQuery(); return(siraNo); }
internal static int DepoIDbul(string depoadi) { _sqlProvider = new SqlProvider("SELECT DEPOID FROM DEPO WHERE DEPOADI = @DEPOADI ", false); _sqlProvider.AddParameter("DEPOADI", depoadi); return(Convert.ToInt32(_sqlProvider.ExecuteScalar())); }
private void tSBtnKaydet_Click(object sender, EventArgs e) { _sqlProvider = new SqlProvider("SELECT COUNT(*) FROM ARTETIKETDETAY WHERE STOKID=@STOKID", false); _sqlProvider.AddParameter("STOKID", _dtStokDetay.Rows[0]["STOKID"]); bool update = Convert.ToBoolean(_sqlProvider.ExecuteScalar()); if (update) { _sqlProvider = new SqlProvider( " UPDATE ARTETIKETDETAY " + " SET " + " EK1=@EK1, EK2=@EK2 ,EK3=@EK3, EK4=@EK4, EK5=@EK5, EK6=@EK6, EK7=@EK7, EK8=@EK8, EK9=@EK9, EK10=@EK10, " + " ADET1=@ADET1, ADET2=@ADET2 ,ADET3=@ADET3, ADET4=@ADET4, ADET5=@ADET5, ADET6=@ADET6, ADET7=@ADET7, ADET8=@ADET8, ADET9=@ADET9, " + " DARA1=@DARA1, DARA2=@DARA2 ,DARA3=@DARA3, DARA4=@DARA4, DARA5=@DARA5, DARA6=@DARA6, DARA7=@DARA7, DARA8=@DARA8, DARA9=@DARA9 " + " WHERE STOKID=@STOKID", false); _sqlProvider.AddParameter("STOKID", _dtStokDetay.Rows[0]["STOKID"]); _sqlProvider.AddParameter("EK1", txtEk1.Text); _sqlProvider.AddParameter("EK2", txtEk2.Text); _sqlProvider.AddParameter("EK3", txtEk3.Text); _sqlProvider.AddParameter("EK4", txtEk4.Text); _sqlProvider.AddParameter("EK5", txtEk5.Text); _sqlProvider.AddParameter("EK6", txtEk6.Text); _sqlProvider.AddParameter("EK7", txtEk7.Text); _sqlProvider.AddParameter("EK8", txtEk8.Text); _sqlProvider.AddParameter("EK9", txtEk9.Text); _sqlProvider.AddParameter("EK10", txtEk10.Text); _sqlProvider.AddParameter("ADET1", txtAdet1.Text); _sqlProvider.AddParameter("ADET2", txtAdet2.Text); _sqlProvider.AddParameter("ADET3", txtAdet3.Text); _sqlProvider.AddParameter("ADET4", txtAdet4.Text); _sqlProvider.AddParameter("ADET5", txtAdet5.Text); _sqlProvider.AddParameter("ADET6", txtAdet6.Text); _sqlProvider.AddParameter("ADET7", txtAdet7.Text); _sqlProvider.AddParameter("ADET8", txtAdet8.Text); _sqlProvider.AddParameter("ADET9", txtAdet9.Text); _sqlProvider.AddParameter("DARA1", txtDara1.Text); _sqlProvider.AddParameter("DARA2", txtDara2.Text); _sqlProvider.AddParameter("DARA3", txtDara3.Text); _sqlProvider.AddParameter("DARA4", txtDara4.Text); _sqlProvider.AddParameter("DARA5", txtDara5.Text); _sqlProvider.AddParameter("DARA6", txtDara6.Text); _sqlProvider.AddParameter("DARA7", txtDara7.Text); _sqlProvider.AddParameter("DARA8", txtDara8.Text); _sqlProvider.AddParameter("DARA9", txtDara9.Text); _sqlProvider.ExecuteNonQuery(); } else { _sqlProvider = new SqlProvider("INSERT INTO ARTETIKETDETAY (STOKID,EK1,EK2,EK3,EK4,EK5,EK6,EK7,EK8,EK9,EK10,ADET1,ADET2,ADET3,ADET4,ADET5,ADET6,ADET7,ADET8,ADET9,DARA1,DARA2,DARA3,DARA4,DARA5,DARA6,DARA7,DARA8,DARA9) VALUES (@STOKID,@EK1,@EK2,@EK3,@EK4,@EK5,@EK6,@EK7,@EK8,@EK9,@EK10,@ADET1,@ADET2,@ADET3,@ADET4,@ADET5,@ADET6,@ADET7,@ADET8,@ADET9,@DARA1,@DARA2,@DARA3,@DARA4,@DARA5,@DARA6,@DARA7,@DARA8,@DARA9)", false); _sqlProvider.AddParameter("STOKID", _dtStokDetay.Rows[0]["STOKID"]); _sqlProvider.AddParameter("EK1", txtEk1.Text); _sqlProvider.AddParameter("EK2", txtEk2.Text); _sqlProvider.AddParameter("EK3", txtEk3.Text); _sqlProvider.AddParameter("EK4", txtEk4.Text); _sqlProvider.AddParameter("EK5", txtEk5.Text); _sqlProvider.AddParameter("EK6", txtEk6.Text); _sqlProvider.AddParameter("EK7", txtEk7.Text); _sqlProvider.AddParameter("EK8", txtEk8.Text); _sqlProvider.AddParameter("EK9", txtEk9.Text); _sqlProvider.AddParameter("EK10", txtEk10.Text); _sqlProvider.AddParameter("ADET1", txtAdet1.Text); _sqlProvider.AddParameter("ADET2", txtAdet2.Text); _sqlProvider.AddParameter("ADET3", txtAdet3.Text); _sqlProvider.AddParameter("ADET4", txtAdet4.Text); _sqlProvider.AddParameter("ADET5", txtAdet5.Text); _sqlProvider.AddParameter("ADET6", txtAdet6.Text); _sqlProvider.AddParameter("ADET7", txtAdet7.Text); _sqlProvider.AddParameter("ADET8", txtAdet8.Text); _sqlProvider.AddParameter("ADET9", txtAdet9.Text); _sqlProvider.AddParameter("DARA1", txtDara1.Text); _sqlProvider.AddParameter("DARA2", txtDara2.Text); _sqlProvider.AddParameter("DARA3", txtDara3.Text); _sqlProvider.AddParameter("DARA4", txtDara4.Text); _sqlProvider.AddParameter("DARA5", txtDara5.Text); _sqlProvider.AddParameter("DARA6", txtDara6.Text); _sqlProvider.AddParameter("DARA7", txtDara7.Text); _sqlProvider.AddParameter("DARA8", txtDara8.Text); _sqlProvider.AddParameter("DARA9", txtDara9.Text); _sqlProvider.ExecuteNonQuery(); } //int index = Convert.ToInt32(_frm.dataGridView1.CurrentRow.Index); _frm.StokDoldur(); _frm.Focuss(); _frm.StokSearch(); Close(); //_frm.dataGridView1.Rows[index].Selected = true; //_frm.dataGridView1.FirstDisplayedScrollingRowIndex = index; //_frm.dataGridView1.Refresh(); }
public static string DepofisEno() { SqlProvider sqlProvider = new SqlProvider("SELECT MAX(ENO)+1 FROM DEPOFIS WHERE SUBEID=01 AND LEN(ENO)=7 AND ENO<='9999999999999'", false); return(sqlProvider.ExecuteScalar().ToString()); }