public bool AdminActionSave(cAdminHareketleri aH) { bool result = false; SqlConnection con = new SqlConnection(gnl.conString); SqlCommand cmd = new SqlCommand("INSERT INTO adminhareketleri(adminID,islem,tarih) VALUES (@adminID,@islem,@tarih) ", con); try { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Parameters.Add("@adminID", System.Data.SqlDbType.Int).Value = aH._adminID; cmd.Parameters.Add("@islem", System.Data.SqlDbType.VarChar).Value = aH._Islem; cmd.Parameters.Add("@tarih", System.Data.SqlDbType.DateTime).Value = aH._Tarih; result = Convert.ToBoolean(cmd.ExecuteNonQuery()); } catch (SqlException ex) { string hata = ex.Message; throw; } return(result); }
private void girisButon_Click(object sender, EventArgs e) { cGenel gnl = new cGenel(); cAdminler p = new cAdminler(); bool result = p.adminEntryControl(sifreText.Text, cGenel._adminID); if (result) { cAdminHareketleri ch = new cAdminHareketleri(); ch.adminID = cGenel._adminID; ch.Islem = "Giriş Yapıldı"; ch.Tarih = DateTime.Now; ch.AdminActionSave(ch); this.Hide(); frmMenu menu = new frmMenu(); menu.Show(); } }