private void SaveAction(object obj)
 {
     try
     {
         if (this.context.Save(Selected))
         {
             if (Message.QuestionYesNo("Data Berhasil Disimpan, Print Faktur ?"))
             {
                 Selected.NamaCustomer = Selected.Customer.NamaCustomer;
                 Selected.KodeCustomer = Selected.Customer.KodeCustomer;
                 var layout = "MainApp.Reports.Layouts.FakturPernjualan.rdlc";
                 if (Selected.Pembayaran == StatusPembayaran.Kredit)
                 {
                     layout = "MainApp.Reports.Layouts.FakturPernjualanKredit.rdlc";
                 }
                 HelperPrint.PrintWithFormActionTwoSource("Print Preview",
                                                          new ReportDataSource {
                     Name = "Header", Value = new List <Penjualan> {
                         Selected
                     }
                 },
                                                          new ReportDataSource {
                     Name = "DataSet1", Value = Selected.Details.ToList()
                 },
                                                          layout, null);
             }
             BarangSourceView.Refresh();
             CancelCommand.Execute(null);
         }
     }
     catch (Exception ex)
     {
         Message.Error(ex.Message);
     }
 }
Пример #2
0
 private void SaveAction(object obj)
 {
     try
     {
         if (this.barangContext.Save(Selected))
         {
             Message.Info("Data Berhasil Disimpan");
             BarangSourceView.Refresh();
             CancelCommand.Execute(null);
         }
     }
     catch (Exception ex)
     {
         Message.Error(ex.Message);
     }
 }
        private void DeleteAction(object obj)
        {
            MessageBoxResult result = MessageBox.Show("Yakin Hapus Data ? ", "Perhatian", MessageBoxButton.YesNo, MessageBoxImage.Question);

            try
            {
                if (result == MessageBoxResult.Yes)
                {
                    if (context.Delete(SelectedItem))
                    {
                        Message.Success("Data Berhasil Dihapus");
                        NewCommand.Execute(null);
                        BarangSourceView.Refresh();
                    }
                }
            }
            catch (Exception ex)
            {
                Message.Error(ex.Message);
            }
        }