コード例 #1
0
        private async void ClassesViewDeleteClassButton_Click(object sender, RoutedEventArgs e)
        {
            if (selectedClassName.Tag != null)
            {
                mUC.iNotifierBoxOKCancel iNotifierBoxOKCancel = new mUC.iNotifierBoxOKCancel();
                iNotifierBoxOKCancel.Text = "Do you want to delete " + selectedClassName.Text + " ?";
                iNotifierBoxOKCancel.ShowDialog();
                if (iNotifierBoxOKCancel.result == mUC.iNotifierBoxOKCancel.Result.OK)
                {
                    bool resultYN = await Controllers.Controller.Instance.DeleteClass(Convert.ToInt32(selectedClassName.Tag.ToString()));

                    if (resultYN)
                    {
                        PanelClassview_Loaded();
                        selectedClassName.Tag  = null;
                        selectedClassName.Text = "";
                        iNotifierBox.Text      = "Xoá thành công !";
                        iNotifierBox.ShowDialog();
                    }
                    else
                    {
                        iNotifierBox.Text = "Lỗi";
                        iNotifierBox.ShowDialog();
                    }
                }
            }
        }
コード例 #2
0
        private async void ClassesViewDeleteClassButton_Click(object sender, RoutedEventArgs e)
        {
            if (selectedClassName.Tag != null)
            {
                //Delete selected Class
                //MessageBoxResult result = MessageBox.Show("Do you want to delete " + selectedClassName.Text + " ?", "Delete", MessageBoxButton.OKCancel);
                //if (result == MessageBoxResult.OK)
                //{
                //    ResultYN resultYN = await Controllers.Controller.Instance.DeleteClass(Convert.ToInt32(selectedClassName.Tag.ToString()));

                //    PanelClassview_Loaded();
                //    selectedClassName.Tag = null;
                //    selectedClassName.Text = "";
                //}
                mUC.iNotifierBoxOKCancel iNotifierBoxOKCancel = new mUC.iNotifierBoxOKCancel();
                iNotifierBoxOKCancel.Text = "Do you want to delete " + selectedClassName.Text + " ?";
                iNotifierBoxOKCancel.ShowDialog();
                if (iNotifierBoxOKCancel.result == mUC.iNotifierBoxOKCancel.Result.OK)
                {
                    ResultYN resultYN = await Controllers.Controller.Instance.DeleteClass(Convert.ToInt32(selectedClassName.Tag.ToString()));

                    PanelClassview_Loaded();
                    selectedClassName.Tag  = null;
                    selectedClassName.Text = "";
                }
            }
        }
コード例 #3
0
        private async void StudentsListviewDeleteStudentButton_Click(object sender, RoutedEventArgs e)
        {
            if (studentsLv.SelectedValue != null)
            {
                //Delete selected Student
                mUC.iNotifierBoxOKCancel iNotifierBoxOKCancel = new mUC.iNotifierBoxOKCancel();
                iNotifierBoxOKCancel.Text = "Do you want to delete " + selectedStudentTbName.Text + " ?";
                iNotifierBoxOKCancel.ShowDialog();
                if (iNotifierBoxOKCancel.result == mUC.iNotifierBoxOKCancel.Result.OK)
                {
                    for (int i = 0; i < studentInfos.Count; i++)
                    {
                        if (studentInfos.ElementAt(i).MaHS.ToString() == studentsLv.SelectedValue.ToString())
                        {
                            bool resultYN = await Controllers.Controller.Instance.DeleteStudent(Convert.ToInt32(studentsLv.SelectedValue.ToString()));

                            if (resultYN)
                            {
                                studentsLv_Loaded();
                                CollectionViewSource.GetDefaultView(studentsLv.ItemsSource).Refresh();
                                iNotifierBox.Text = "Xoá thành công !";
                                iNotifierBox.ShowDialog();
                                break;
                            }
                            else
                            {
                                iNotifierBox.Text = "Lỗi";
                                iNotifierBox.ShowDialog();
                            }
                        }
                    }
                }
            }
        }