示例#1
0
        public void DeletePersonel(PersonelTable personel)
        {
            ConnectionControl();
            SqlCommand command = new SqlCommand("Delete From PersonelTable where Personel_Id=@personel_ıd", _connection);

            command.Parameters.AddWithValue("@personel_ıd", personel.Personel_Id);
            command.ExecuteNonQuery();
            command.Dispose();
            _connection.Close();
        }
示例#2
0
        private void btnPersonelChange_Click(object sender, EventArgs e)
        {
            ///////////çalışan işlemleri

            if (_EmployeesIslemTuru == 0)//Güncelleme
            {
                PersonelTable personelTable = new PersonelTable
                {
                    Personel_Id   = (int)dgwEmployeess.CurrentRow.Cells["Personel_Id"].Value,
                    Name          = txtPersonelName.Text,//ıd i aldır
                    Surname       = txtPersonelSurname.Text,
                    TelNumber     = long.Parse(txtPersonelTel.Text),
                    Department_Id = (int)cmbPersonelPosition.SelectedValue,
                    ManagerName   = cmbPersonelStatus.Text,
                };
                personelDal.UpdatePersonel(personelTable);
                MessageBox.Show("Personel Güncellendi");
            }
            else if (_EmployeesIslemTuru == 1)//Silme
            {
                // personelDal.DeletePersonel(deletePersonel);
                int    deletePersonel   = Convert.ToInt32(dgwEmployeess.CurrentRow.Cells["Personel_Id"].Value);
                string employeesName    = dgwEmployeess.CurrentRow.Cells["Name"].Value.ToString();
                string employeesSurname = dgwEmployeess.CurrentRow.Cells["Surname"].Value.ToString();

                string managerStatusName    = dgwEmployeess.CurrentRow.Cells["ManagerStatus"].Value.ToString();
                string employeesNameSurname = employeesName + " " + employeesSurname;

                if (personelDal.ManagerController(employeesNameSurname) == true)
                {
                    MessageBox.Show("Kullanıcı Yönetici", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    PersonelTable personelTable = new PersonelTable
                    {
                        Personel_Id = deletePersonel,
                    };
                    personelDal.DeletePersonel(personelTable);
                    MessageBox.Show("Kullanıcı silindi");
                }
            }
            else if (_EmployeesIslemTuru == 2)
            {
                cmbEmployeesEventsChoose.SelectedIndex = 0;
            }
            else
            {
                cmbEmployeesEventsChoose.SelectedIndex = 0;
            }
            EmployeesLoader();
        }
示例#3
0
        public void AddPersonel(PersonelTable personel)//departman olayını ayarla
        {
            ConnectionControl();
            SqlCommand command = new SqlCommand("Insert into PersonelTable values(@name,@surname,@telnumber,@status,@department)", _connection);

            command.Parameters.AddWithValue("@name", personel.Name);
            command.Parameters.AddWithValue("@surname", personel.Surname);
            command.Parameters.AddWithValue("@telnumber", personel.TelNumber);
            command.Parameters.AddWithValue("@status", personel.ManagerName);
            command.Parameters.AddWithValue("@department", personel.Department_Id);
            command.ExecuteNonQuery();
            command.Dispose();
            _connection.Close();
        }
示例#4
0
        public void UpdatePersonel(PersonelTable personel)
        {
            ConnectionControl();
            SqlCommand command = new SqlCommand("Update PersonelTable set Name=@name,Surname=@surname,TelNumber=@telnumber,ManagerStatus=@managerStatus,Department_Id=@department_ıd where Personel_Id=@ıd", _connection);

            command.Parameters.AddWithValue("@name", personel.Name);
            command.Parameters.AddWithValue("@surname", personel.Surname);
            command.Parameters.AddWithValue("@telnumber", personel.TelNumber);
            command.Parameters.AddWithValue("@managerStatus", personel.ManagerName);
            command.Parameters.AddWithValue("@department_ıd", personel.Department_Id);
            command.Parameters.AddWithValue("@ıd", personel.Personel_Id);
            command.ExecuteNonQuery();
            command.Dispose();
            _connection.Close();
        }