Пример #1
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            if (TXTKodePajak.Text == "" || TXTNamaPajak.Text == "" || TXTPersentase.Text == "" || TXTKeterangan.Text == "")
            {
                MessageBox.Show("please fill in the blank fields", ("Form Validation"), MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (this.dataPajak != null)
            {
                DataPajakBLL dataPajakBLL = new DataPajakBLL();
                DataPajak    oData        = new DataPajak();
                oData.MapFrom(this.dataPajak);
                oData.KodePajak  = TXTKodePajak.Text;
                oData.NamaPajak  = TXTNamaPajak.Text;
                oData.Persentase = double.Parse(TXTPersentase.Text);
                oData.AkunBeli   = "";
                oData.AkunJual   = "";
                oData.Keterangan = TXTKeterangan.Text;

                if (dataPajakBLL.EditPajak(oData) == true)
                {
                    MessageBox.Show("Tax Data successfully edited");
                }
                else
                {
                    MessageBox.Show("Tax Data failed to edit");
                }
            }
            this.Close();
        }
Пример #2
0
        public int AddPajak(DataPajak oData)
        {
            methodName = "AddPajak";
            traceID    = 1;

            using (var uow = new UnitOfWork(AppConfig.Current.ContextName))
            {
                using (var trans = uow.BeginTransaction())
                {
                    try
                    {
                        traceID = 2;
                        DataPajak oNewDataPajak = new DataPajak();
                        oNewDataPajak.MapFrom(oData);
                        oNewDataPajak = uow.DataPajak.Add(oNewDataPajak);
                        uow.Save();

                        if (oNewDataPajak.Id > 0)
                        {
                            traceID  = 3;
                            oData.Id = oNewDataPajak.Id;
                            ListDataPajak oNewListDataPajak = new ListDataPajak();
                            oNewListDataPajak.MapFrom(oData);

                            traceID = 4;
                            oNewListDataPajak.IdPajak = oData.Id;
                            uow.ListDataPajak.Add(oNewListDataPajak);
                        }

                        traceID = 5;
                        uow.Save();
                        trans.Commit();
                    }
                    catch (Exception ex)
                    {
                        trans.Rollback();
                        throw new AppException(500, methodName, traceID, ex);
                    }
                }
            }

            return(oData.Id);
        }