Example #1
0
        public void Update(Personel personel)
        {
            SqlConnectionControl();
            SqlCommand command = new SqlCommand(
                "Update Personel set Personel_Name=@name, Personel_Surname=@surname, Personel_Nationality_Id=@nationalityid, Personel_BirthDay=@birthday, Personel_Title=@title where Id=@id", _connection);

            command.Parameters.AddWithValue("@id", personel.Id);
            command.Parameters.AddWithValue("@name", personel.Personel_Name);
            command.Parameters.AddWithValue("@surname", personel.Personel_Surname);
            command.Parameters.AddWithValue("@nationalityId", personel.Personel_Nationality_Id);
            command.Parameters.AddWithValue("@birthday", personel.Personel_BirthDay.Year);
            command.Parameters.AddWithValue("@title", personel.Personel_Title);

            command.ExecuteNonQuery();
            _connection.Close();
        }
Example #2
0
        private void btn_Update_Personel_Click(object sender, EventArgs e)
        {
            Personel personel = new Personel
            {
                Id                      = Convert.ToInt32(dgview_Personel.CurrentRow.Cells[0].Value),
                Personel_Name           = txb_PersonelName.Text,
                Personel_Surname        = txb_PersonelSurname.Text,
                Personel_Title          = txb_PersonelTitle.Text,
                Personel_BirthDay       = dTime_Birthday.Value,
                Personel_Nationality_Id = Convert.ToInt32(txb_PersonelIdentity.Text)
            };

            _personelDal.Update(personel);

            MessageBox.Show("updated personel");

            LoadGridView_Personel();
        }
Example #3
0
        public void AddPersonel(Personel personel)
        {
            SqlConnectionControl();

            SqlCommand command = new SqlCommand("INSERT INTO Personel values(@name,@surname,@nationalityId,@birthday,@title)", _connection);

            command.Parameters.AddWithValue("@name", personel.Personel_Name);
            command.Parameters.AddWithValue("@surname", personel.Personel_Surname);
            command.Parameters.AddWithValue("@nationalityId", personel.Personel_Nationality_Id);
            command.Parameters.AddWithValue("@birthday", personel.Personel_BirthDay.Year);
            command.Parameters.AddWithValue("@title", personel.Personel_Title);

            command.ExecuteNonQuery();

            _connection.Close();

            GetAllPersonel();

            MessageBox.Show("Personel Eklendi.");
        }