public bool EditFinishedproduk(OrderFinishedproduk oData, production oDatas) { methodName = "EditFinishedproduk"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { traceID = 2; var oDBData = uow.OrderFinishedproduk.Get(oData.IdOrderFinishProduk); if (oDBData != null) { using (var trans = uow.BeginTransaction()) { try { traceID = 3; oDBData.MapFrom(oData); uow.OrderFinishedproduk.Update(oDBData); traceID = 6; uow.Save(); trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } } return(true); }
public int AddOrderFinishedproduk(OrderFinishedproduk oData) { methodName = "AddOrderFinishedproduk"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { using (var trans = uow.BeginTransaction()) { try { traceID = 2; OrderFinishedproduk oNewumum = new OrderFinishedproduk(); oNewumum.MapFrom(oData); oNewumum = uow.OrderFinishedproduk.Add(oNewumum); uow.Save(); traceID = 3; oData.IdOrderFinishProduk = oNewumum.IdOrderFinishProduk; trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } return(oData.IdOrderFinishProduk); }
public OrderFinishedproduk GetData() { OrderFinishedproduk oData = new OrderFinishedproduk(); if (this.produkSelected != null) { oData.IdProduk = this.produkSelected.IdProduk; oData.Sku = this.produkSelected.SKU; oData.IdSatuanDasar = this.produkSelected.IdSatuanDasar; oData.SatuanDasar = this.produkSelected.SatuanDasar; oData.HargaProduk = this.produkSelected.HargaPokokAverage; oData.NamaProduk = this.produkSelected.NamaProduk; oData.IdAkunPersediaan = this.produkSelected.IdAkunPersediaan; } oData.TotalProduk = double.Parse(txttotal.Text); oData.TotalBiaya = double.Parse(txttotal1.Text); oData.CheckboxAktif = true; return(oData); }
private void SaveProduction_Click(object sender, RoutedEventArgs e) { if (txtProductionNumber.Text == "") { MessageBox.Show("please fill in the blank fields", ("Form Validation"), MessageBoxButton.OK, MessageBoxImage.Error); return; } ProductionBLL productionBLL = new ProductionBLL(); ProductionBLL ProductionBLL = new ProductionBLL(); production production = new production(); production.IdKodeTransaksi = 28; if (this.dokumenSelected != null) { production.IdDocumentReference = this.dokumenSelected.Id; production.DokumenReference = this.dokumenSelected.NoReferensiDokumen; } production.Tanggal = DateTime.Parse(tanggal.Text); if (this.lokasiSelected != null) { production.IdLokasi = this.lokasiSelected.Id; production.Location = this.lokasiSelected.NamaTempatLokasi; } if (this.kontakSelected != null) { production.IdKontak = this.kontakSelected.Id; production.NamaPetugas = this.kontakSelected.NamaA; } production.Note = txtNote.Text; production.ProductionNumber = double.Parse(txtProductionNumber.Text); production.TotalDebitAkunPersediaanProduk = double.Parse(txtTotal.Text); production.TotalKreditAkunPersediaanProduk = double.Parse(txtTotalinput.Text); if (this.dataDepartemenSelected != null) { production.IdDepartmen = this.dataDepartemenSelected.Id; } if (this.dataProyekSelected != null) { production.IdProyek = this.dataProyekSelected.Id; } if (ProductionBLL.AddProduction(production) > 0) { // this.ClearForm(); MessageBox.Show("Productions successfully added !"); } else { MessageBox.Show("Productions failed to add !"); } if (DGSKUProduction.Items.Count > 0) { foreach (var item in DGSKUProduction.Items) { if (item is ListOrderProduction) { ListOrderProduction oNewData1 = (ListOrderProduction)item; if (this.lokasiSelected != null) { oNewData1.IdLokasi = this.lokasiSelected.Id; oNewData1.NamaLokasi = this.lokasiSelected.NamaTempatLokasi; } oNewData1.Tanggal = DateTime.Parse(tanggal.Text); oNewData1.CheckboxAktif = false; oNewData1.IdTransaksi = production.Id; if (this.dataDepartemenSelected != null) { oNewData1.IdDepartemen = this.dataDepartemenSelected.Id; } if (this.dataProyekSelected != null) { oNewData1.IdProyek = this.dataProyekSelected.Id; } if (productionBLL.EditProductioninput(oNewData1, production) == true) { } } } } if (DGSKUFinishedProduction.Items.Count > 0) { foreach (var item in DGSKUFinishedProduction.Items) { if (item is OrderFinishedproduk) { OrderFinishedproduk oNewData1 = (OrderFinishedproduk)item; if (this.lokasiSelected != null) { oNewData1.IdLokasi = this.lokasiSelected.Id; oNewData1.NamaLokasi = this.lokasiSelected.NamaTempatLokasi; } oNewData1.Tanggal = DateTime.Parse(tanggal.Text); oNewData1.CheckboxAktif = false; if (this.dataDepartemenSelected != null) { oNewData1.IdDepartemen = this.dataDepartemenSelected.Id; } if (this.dataProyekSelected != null) { oNewData1.IdProyek = this.dataProyekSelected.Id; } if (productionBLL.EditFinishedproduk(oNewData1, production) == true) { } } } Production v = new Production(); Switcher.SwitchNewProduction(v); } }