예제 #1
0
        private void BtnKaydet_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtPassword.Text) && string.IsNullOrWhiteSpace(txtUserName.Text))
            {
                MessageBox.Show("Kullanıcı Adı ve Şifre boş geçilemez");
                return;
            }

            {
            }
            if (lstKullaniciTipi.SelectedIndex == -1)
            {
                MessageBox.Show("Lütfen kullanıcı tipini seçiniz");
                return;
            }

            UserDTO dto = new UserDTO()
            {
                Password = txtPassword.Text,
                UserName = txtUserName.Text,
            };
            List <RoleDTO> rdto = new List <RoleDTO>();

            foreach (var item in lstKullaniciTipi.SelectedItems)
            {
                rdto.Add((RoleDTO)item);
            }
            var result = _uc.UserAdd(dto, rdto);

            result.NotificationShow();

            if (result.State == ResultState.Success)
            {
                UserAdded.Raise();
                txtPassword.Text = "";
                txtUserName.Text = "";
            }
        }