static public bool f_IsSerialValidForThisMachine(string _sKey) { long decimalCpuId = long.Parse(Lisans.f_GetCPUId(), System.Globalization.NumberStyles.HexNumber); string sDecimalCpuId = decimalCpuId.ToString(); string sSerialThisMachine = sDecimalCpuId.Substring(sDecimalCpuId.Length - 6); return(Lisans.f_GetSerialFromKey(_sKey).Equals(sSerialThisMachine)); }
public bool f_KullaniciEkle(string _sAnahtar, string _sSeriNo, string _sKurumAdi, int _iBolge_id, string _sYetkili) { if (string.IsNullOrEmpty(_sAnahtar) || string.IsNullOrEmpty(_sSeriNo)) { throw new ArgumentNullException("Parametreler boş ya da null olamaz!"); } try { string key, time; Lisans.f_GenerateDateTimeAndCpuId(M_Authentication.Username, out key, out time); SqlCommand cmd = cnn.CreateCommand(); cmd.CommandText = @" INSERT INTO KULLANICILAR (KurumAdi, YetkiliAdSoyad, refBolge_id, Anahtar, SeriNo, CpuId) VALUES (@KURUM, @YETKILI, @BOLGE, @ANAHTAR, @SERINO, @CPUID)"; cmd.Parameters.Add("@KURUM", SqlDbType.VarChar, 250).Value = _sKurumAdi; cmd.Parameters.Add("@YETKILI", SqlDbType.VarChar, 50).Value = _sYetkili; cmd.Parameters.Add("@BOLGE", SqlDbType.Int, 4).Value = _iBolge_id; cmd.Parameters.Add("@ANAHTAR", SqlDbType.VarChar, 500).Value = _sAnahtar; cmd.Parameters.Add("@SERINO", SqlDbType.VarChar, 500).Value = _sSeriNo; cmd.Parameters.Add("@CPUID", SqlDbType.VarChar, 50).Value = key.Substring(0, 18); if (cnn.State != ConnectionState.Open) { cnn.Open(); } int iEtkilenen = cmd.ExecuteNonQuery(); if (iEtkilenen > 0) { return(true); } } catch (Exception ex) { throw (ex); } return(false); }
bool f_KullaniciValidasyonu() { try { if (M_Authentication == null || string.IsNullOrEmpty(M_Authentication.Username) || string.IsNullOrEmpty(M_Authentication.Password)) { return(false); } if (cnn.State != ConnectionState.Open) { cnn.Open(); } string key, time; Lisans.f_GenerateDateTimeAndCpuId(M_Authentication.Username, out key, out time); SqlCommand cmd = cnn.CreateCommand(); cmd.CommandText = "SELECT SeriNo FROM KULLANICILAR WHERE Anahtar LIKE '%" + key.Substring(0, 18).ReverseString().SqlAsteriks() + "'"; object objSeriNo = cmd.ExecuteScalar(); // Kullanıcı Validasyonu if (objSeriNo != null) { if (M_Authentication.Password.Equals(objSeriNo.ToString())) { return(true); } } } catch (Exception ex) { throw (ex); } return(false); }
static public bool f_IsSerialValid(string _sKey, string _sSerial) { return(Lisans.f_GetSerialFromKey(_sKey).Equals(_sSerial)); }