示例#1
0
        private void EditPenanganAction(object obj)
        {
            var data = obj as Penanganan;
            var form = new PenangananView();

            data.WindowClose = form.Close;
            form.DataContext = data;
            form.ShowDialog();
        }
示例#2
0
        private void AddPenangananAction(object obj)
        {
            var typeName = obj.GetType().Name;

            if (typeName.Contains("Terlapor"))
            {
                var terlapor   = obj as TerlaporViewModel;
                var form       = new PenangananView();
                var penanganan = new Penanganan(terlapor, "Terlapor")
                {
                    IdentiasId = terlapor.Id, WindowClose = form.Close
                };
                form.DataContext = penanganan;
                form.ShowDialog();

                if (!string.IsNullOrEmpty(penanganan.Layanan))
                {
                    terlapor.DataPenanganan.Add(penanganan);
                    Terlapors.Refresh();
                }
                else
                {
                    MessageBox.Show("Data Tidak Valid", "Erro", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else if (typeName.Contains("Korban"))
            {
                var korban     = obj as Korban;
                var form       = new PenangananView();
                var penanganan = new Penanganan(korban, "Korban")
                {
                    IdentiasId = korban.Id, WindowClose = form.Close
                };
                form.DataContext = penanganan;
                form.ShowDialog();

                if (!string.IsNullOrEmpty(penanganan.Layanan))
                {
                    korban.DataPenanganan.Add(penanganan);
                    Korbans.Refresh();
                }
                else
                {
                    MessageBox.Show("Data Tidak Valid", "Erro", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }