public ActionResult Save(produk emp) { bool status = false; if (ModelState.IsValid) { using (MyDatabaseEntities dc = new MyDatabaseEntities()) { if (emp.Idproduk > 0) { //Edit var v = dc.produks.Where(a => a.Idproduk == emp.Idproduk).FirstOrDefault(); if (v != null) { v.nama_produk = emp.nama_produk; v.harga_produk = emp.harga_produk; v.deskripsi = emp.deskripsi; } } else { //Save dc.produks.Add(emp); } dc.SaveChanges(); status = true; } } return(new JsonResult { Data = new { status = status } }); }
public int AddProduk(produk oData) { methodName = "AddProduk"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { using (var trans = uow.BeginTransaction()) { try { traceID = 2; produk oNewProduk = new produk(); oNewProduk.MapFrom(oData); oNewProduk = uow.produk.Add(oNewProduk); uow.Save(); traceID = 3; oData.IdProduk = oNewProduk.IdProduk; trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } return(oData.IdProduk); }
public bool EditProduk(produk oData) { methodName = "EditProduk"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { traceID = 2; var oDBData = uow.produk.Get(oData.IdProduk); if (oDBData != null) { using (var trans = uow.BeginTransaction()) { try { traceID = 3; oDBData.MapFrom(oData); uow.produk.Update(oDBData); uow.Save(); traceID = 4; trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } } return(true); }
public bool RemoveProduk(int id) { methodName = "RemoveProduk"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { using (var trans = uow.BeginTransaction()) { try { traceID = 2; produk oDBProduk = uow.produk.SingleOrDefault(m => m.IdProduk == id); if (oDBProduk != null) { traceID = 3; uow.InternalNote.Remove(id); uow.Save(); } traceID = 5; trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } return(true); }
private void SearchProduk_selectedchange(object sender, SelectionChangedEventArgs e) { this.produkSelected = null; if (srproduk.SelectedItem != null) { this.produkSelected = (produk)srproduk.SelectedItem; } }
private void produk_selectedchange(object sender, SelectionChangedEventArgs e) { this.produkSelected = null; if (srsku.SelectedItem != null) { this.produkSelected = (produk)srsku.SelectedItem; txtunit.Text = this.produkSelected.SatuanDasar; txtprice.Text = this.produkSelected.HargaPokokAverage.ToString(); } }
public bool EditOrderProdukBeli1(ListOrderBeli oData) { methodName = "EditOrderProdukBeli1"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { traceID = 2; var oDBData = uow.ListOrderBeli.Get(oData.Id); if (oDBData != null) { using (var trans = uow.BeginTransaction()) { try { traceID = 3; oDBData.MapFrom(oData); uow.ListOrderBeli.Update(oDBData); traceID = 4; produk oDproduk = uow.produk.SingleOrDefault(m => m.IdProduk == oData.IdProduk); if (oDproduk != null) { traceID = 5; oData.IdProduk = oDproduk.IdProduk; oData.Checkboxaktif = true; oDproduk.MapFrom(oData); traceID = 6; oData.IdProduk = oDproduk.IdProduk; oData.Checkboxaktif = true; oDproduk.JumlahStok = oDBData.Jumlah + oDproduk.JumlahStok; uow.produk.Update(oDproduk); } else { traceID = 7; traceID = 8; } traceID = 14; uow.Save(); trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } } return(true); }
private void produk_selectedchange(object sender, SelectionChangedEventArgs e) { this.produkSelected = null; if (srsku.SelectedItem != null) { this.produkSelected = (produk)srsku.SelectedItem; txtprice.Text = this.produkSelected.HargaJual.ToString(); txtdiskon.Text = this.produkSelected.DiskonProdukPersen; txttax.Text = this.produkSelected.PersentasePajak.ToString(); txtdiskon1.Text = ((float.Parse(txtprice.Text.ToString()) * float.Parse(txtdiskon.Text.ToString()) / 100)).ToString(); } }
public produk GetData() { produk oData = new produk(); oData.SKU = txtSKU.Text; oData.NamaProduk = txtServiceName.Text; oData.HargaPokokAverage = double.Parse(txtCogs.Text); oData.HargaJual = double.Parse(txtSellingPrice.Text); oData.Keterangan = txtRemarks.Text; if (this.kategoriProdukSelected != null) { oData.IdProdukKategori = this.kategoriProdukSelected.Id; oData.ProdukKategori = this.kategoriProdukSelected.ProdukKategori; } if (this.DataMataUangSelected != null) { oData.IdMataUang = this.DataMataUangSelected.Id; oData.MataUang = this.DataMataUangSelected.NamaMataUang; } if (this.satuanDasarSelected != null) { oData.IdSatuanDasar = this.satuanDasarSelected.Id; oData.SatuanDasar = this.satuanDasarSelected.NamaSatuan; } if (this.dataPajakSelected != null) { oData.IdPajak = this.dataPajakSelected.Id; oData.Pajak = this.dataPajakSelected.NamaPajak; } oData.CheckboxPajak = chktaxable.IsChecked; oData.CheckboxDiskonProduk = chkdiskon.IsChecked; oData.N1Calculation = chkN1calculation.IsChecked; oData.TimeBasedUnit = chkTimebased.IsChecked; oData.CheckboxKalender = chkCalendar.IsChecked; oData.CheckBoxTidakAktif = chkInactive.IsChecked; oData.CheckBoxInclusiveTax = chkInclusivetax.IsChecked; oData.TanggalMulaiDiskonProduk = DateTime.Parse(Date1.Text); oData.TanggalBerakhirDiskonProduk = DateTime.Parse(Date2.Text); oData.UploadImage0 = this.UploadFileA; oData.UploadImage1 = this.UploadFileB; oData.UploadImage2 = this.UploadFileC; oData.UploadImage3 = this.UploadFileD; return(oData); }
public void BtnSave_Click(object sender, RoutedEventArgs e) { if (txtTotalUnit.Text == "" || txtPurchasingprice.Text == "" || txtReceivednumber.Text == "" || srvendor.Text == "" || CBLocation.Text == "") { MessageBox.Show("please fill in the blank fields", ("Form Validation"), MessageBoxButton.OK, MessageBoxImage.Error); return; } ProdukBLL receivedProdukBLL = new ProdukBLL(); produk oData = new produk(); if (this.KontakSelected != null) { oData.IdKontak = this.KontakSelected.Id; oData.SuplierA = this.KontakSelected.NamaA; } if (this.lokasiSelected != null) { oData.IdLokasi = this.lokasiSelected.Id; oData.NamaLokasi = this.lokasiSelected.NamaTempatLokasi; } oData.Tanggal = DateTime.Parse(tgl.Text); if (this.dropdownBankSelected != null) { oData.IdDropdownBankkas = this.dropdownBankSelected.Id; oData.DropdownBankkas = this.dropdownBankSelected.DropdownBankkas; } oData.JumlahStok = double.Parse(txtTotalUnit.Text); oData.HargaBeli = double.Parse(txtPurchasingprice.Text); oData.ReceivedNumber = txtReceivednumber.Text; oData.Keterangan = txtNote.Text; oData.AKtif = true; oData.CheckboxManageStok = true; if (receivedProdukBLL.AddProduk(oData) > 0) { // this.ClearForm(); this.newproduk.LoadStok(); } else { } this.Close(); }
static void TambahProduk() { Console.Clear(); Produk produk = new produk(); Console.WriteLine("Tambah Data Produk"); Console.Write("\nKode Produk : "); produk.KodeProduk = Console.ReadLine(); Console.Write("Nama Produk : "); produk.NamaProduk = Console.ReadLine(); Console.Write("Harga Beli : "); produk.HargaBeli = double.Parse(Console.ReadLine()); Console.Write("Harga Jual : "); produk.HargaJual = double.Parse(Console.ReadLine()); daftarProduk.Add(produk); Console.WriteLine("\nTekan ENTER untuk kembali ke menu"); Console.ReadKey(); }
private void LstProduk_SelectionChanged(object sender, SelectionChangedEventArgs e) { // this.ClearForm(); if (LstService.SelectedItem != null) { this.listprodukSelected = (produk)LstService.SelectedItem; if (this.listprodukSelected != null) { using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { this.produk = uow.produk.Get(this.listprodukSelected.IdProduk); txtservice.Text = this.produk.NamaProduk; txtCategory.Text = this.produk.ProdukKategori; txtSKU.Text = this.produk.SKU; txtProductGroup.Text = this.produk.NamaGroupProduk; txtCogs.Text = this.produk.HargaPokokAverage.GetValueOrDefault(0).ToString(); txtPurchasingprice.Text = this.produk.HargaBeli.GetValueOrDefault(0).ToString(); txtSellingprice.Text = this.produk.HargaJual.GetValueOrDefault(0).ToString(); txtBaseUnit.Text = this.produk.SatuanDasar; txtCurrency.Text = this.produk.MataUang; if (this.produk.CheckboxDiskonProduk == true) { txtDiscountyes.Text = "Yes"; } else if (this.produk.CheckboxDiskonProduk == false) { txtDiscountyes.Text = "No"; } txtDiscount.Text = this.produk.DiskonProdukPersen; txtPeriode.Text = this.produk.TanggalMulaiDiskonProduk.GetValueOrDefault().ToShortDateString(); txtPeriode1.Text = this.produk.TanggalBerakhirDiskonProduk.GetValueOrDefault().ToShortDateString(); txtRemarks.Text = this.produk.Keterangan; if (!string.IsNullOrEmpty(this.produk.UploadImage0)) { Image1.Source = new BitmapImage(new Uri(Path.GetFullPath(this.produk.UploadImage0))); } } } } }
public bool EditOrderProdukBeli(ListOrderBeli oData, Quotationrequest oDatas, produk oDatap) { methodName = "EditOrderProdukBeli"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { traceID = 2; var oDBData = uow.ListOrderBeli.Get(oData.Id); if (oDBData != null) { using (var trans = uow.BeginTransaction()) { try { traceID = 3; oDBData.MapFrom(oData); uow.ListOrderBeli.Update(oDBData); traceID = 4; OrderProdukBeli oDBListorderbeli = uow.OrderProdukBeli.SingleOrDefault(m => m.IdOrderProdukBeli == oData.IdOrderBeli); if (oDBListorderbeli != null) { traceID = 5; oDBListorderbeli.MapFrom(oData); traceID = 6; uow.OrderProdukBeli.Update(oDBListorderbeli); } else { traceID = 7; OrderProdukBeli oNewListorderbeli = new OrderProdukBeli(); oNewListorderbeli.MapFrom(oData); traceID = 8; uow.OrderProdukBeli.Add(oNewListorderbeli); } traceID = 9; OrderJasaBeli oDBListorderbeli1 = uow.OrderJasaBeli.SingleOrDefault(m => m.IdOrderJasa == oData.IdOrderBeli); if (oDBListorderbeli1 != null) { traceID = 10; oDBListorderbeli1.MapFrom(oData); traceID = 11; // oDBListorderbeli1.TanggalStartdate = oData.TanggalPengiriman; uow.OrderJasaBeli.Update(oDBListorderbeli1); } else { traceID = 12; traceID = 13; } traceID = 4; produk oDproduk = uow.produk.SingleOrDefault(m => m.IdProduk == oData.IdProduk); if (oDproduk != null) { traceID = 5; oData.IdProduk = oDproduk.IdProduk; oData.Checkboxaktif = true; oDproduk.MapFrom(oData); traceID = 6; oData.IdProduk = oDproduk.IdProduk; oData.Checkboxaktif = true; oDproduk.JumlahStok = oDBData.Jumlah + oDproduk.JumlahStok; uow.produk.Update(oDproduk); } else { traceID = 7; traceID = 8; } traceID = 14; uow.Save(); trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } } return(true); }
private void saveproduk_Click(object sender, RoutedEventArgs e) { if (cbCategory.Text == "" || txtProductName.Text == "" || txtSellingPrice.Text == "" || cbCurrency.Text == "" || cbBaseUnit.Text == "" || txtMinimumOrder.Text == "" || Date1.Text == "" || Date2.Text == "" || cbProductType.Text == "" || cbUnitCost.Text == "" || txtLength.Text == "" || txtWide.Text == "" || txtTall.Text == "" || txtWeight.Text == "" || cbVendorPrimary.Text == "" || txtRemarksVendor.Text == "") { MessageBox.Show("please fill in the blank fields", ("Form Validation"), MessageBoxButton.OK, MessageBoxImage.Error); return; } ProdukBLL ProdukBLL = new ProdukBLL(); if (this.chkmanagestok.IsChecked == false) { if (ProdukBLL.AddProduk(this.GetData()) > 0) { this.ClearForm(); MessageBox.Show("Product successfully added !"); this.produkForm.LoadProduk(""); } else { MessageBox.Show("Product failed to add !"); } } else { if (DGSKUPurchaseDelivery.Items.Count > 0) { foreach (var item in DGSKUPurchaseDelivery.Items) { if (item is produk) { produk oData = (produk)item; if (this.kategoriProdukSelected != null) { oData.IdProdukKategori = this.kategoriProdukSelected.Id; oData.ProdukKategori = this.kategoriProdukSelected.ProdukKategori; } oData.SKU = txtSKU.Text; if (this.GrupProdukSelected != null) { oData.IdGroupProduk = this.GrupProdukSelected.Id; oData.NamaGroupProduk = this.GrupProdukSelected.NamaGrupProduk; } oData.NamaProduk = txtProductName.Text; oData.HargaJual = double.Parse(txtSellingPrice.Text); if (this.DataMataUangSelected != null) { oData.IdMataUang = this.DataMataUangSelected.Id; oData.MataUang = this.DataMataUangSelected.NamaMataUang; } oData.HargaBeli = double.Parse(txtPurchasingPrice.Text); oData.JumlahStok = double.Parse(txtStock.Text); if (this.satuanDasarSelected != null) { oData.IdSatuanDasar = this.satuanDasarSelected.Id; oData.SatuanDasar = this.satuanDasarSelected.NamaSatuan; } oData.MinPemesanan = double.Parse(txtMinimumOrder.Text); oData.CheckboxDiskonProduk = chkdiskon.IsChecked; oData.CheckboxUbahHarga = chkover.IsChecked; if (chkdiskon.IsChecked == false) { oData.DiskonProdukPersen = "0"; } oData.DiskonProdukPersen = txtDiscount.Text; oData.TanggalMulaiDiskonProduk = DateTime.Parse(Date1.Text); oData.TanggalBerakhirDiskonProduk = DateTime.Parse(Date2.Text); oData.BatasStokMin = int.Parse(txtMinStock.Text); if (this.typeProdukSelected != null) { oData.IdTipeProduk = this.typeProdukSelected.Id; oData.TipeProduk = this.typeProdukSelected.NamaTypeProduk; oData.IdAkunHargaPokok = this.typeProdukSelected.IdAkunHargaPokok; oData.IdAkunPenjualan = this.typeProdukSelected.IdAkunPenjualan; oData.IdAkunPersediaan = this.typeProdukSelected.IdAkunPersediaan; oData.IdAkunPengirimanBeli = this.typeProdukSelected.IdAkunPengirimanBeli; oData.IdAkunPengirimanJual = this.typeProdukSelected.IdAkunPengirimanJual; oData.IdAkunReturPenjualan = this.typeProdukSelected.IdAkunReturPenjualan; oData.IdAkunJasa = this.typeProdukSelected.IdAkunService; } if (this.hargaPokokSelected != null) { oData.TipeHargaPokok = hargaPokokSelected.TipeHargaPokok; } oData.Keterangan = txtRemarks.Text; oData.CheckboxPajak = chktaxable.IsChecked; oData.CheckBoxInclusiveTax = chkinclusive.IsChecked; if (this.dataPajakSelected != null) { oData.IdPajak = this.dataPajakSelected.Id; oData.Pajak = this.dataPajakSelected.KodePajak; oData.PersentasePajak = double.Parse(dataPajakSelected.Persentase.ToString()); oData.IdAkunPajak = int.Parse(dataPajakSelected.IdAkunJual.ToString()); } oData.Panjang = txtLength.Text; oData.Lebar = txtWide.Text; oData.Tinggi = txtTall.Text; oData.Berat = txtWeight.Text; oData.CheckBoxTidakAktif = ChkInactive.IsChecked; oData.UploadImage0 = this.UploadFileA; oData.UploadImage1 = this.UploadFileB; oData.UploadImage2 = this.UploadFileC; oData.UploadImage3 = this.UploadFileD; if (this.kontakSelected != null) { oData.IdKontak = this.kontakSelected.Id; oData.SuplierA = this.kontakSelected.NamaA; } if (this.kontakSelected != null) { oData.IdKontak = this.kontakSelected.Id; oData.SuplierB = this.kontakSelected.NamaB; } if (this.kontakSelected != null) { oData.IdKontak = this.kontakSelected.Id; oData.SuplierC = this.kontakSelected.NamaC; } if (this.kontakSelected != null) { oData.IdKontak = this.kontakSelected.Id; oData.SuplierD = this.kontakSelected.NamaD; } oData.KeteranganSuplierA = txtRemarksVendor.Text; oData.KeteranganSuplierB = txtRemarksVendor2.Text; oData.KeteranganSuplierC = txtRemarksVendor3.Text; oData.KeteranganSuplierD = txtRemarksVendor4.Text; oData.AKtif = false; if (ProdukBLL.EditProduk(oData) == true) { MessageBox.Show("Product added successfully !"); this.produkForm.LoadProduk(""); } else { MessageBox.Show("Product failed to add !"); } } } } } Produk v = new Produk(); Switcher.Switchnewproduk(v); }
private produk GetData() { produk oData = new produk(); if (this.kategoriProdukSelected != null) { oData.IdProdukKategori = this.kategoriProdukSelected.Id; oData.ProdukKategori = this.kategoriProdukSelected.ProdukKategori; } oData.SKU = txtSKU.Text; if (this.GrupProdukSelected != null) { oData.IdGroupProduk = this.GrupProdukSelected.Id; oData.NamaGroupProduk = this.GrupProdukSelected.NamaGrupProduk; } oData.NamaProduk = txtProductName.Text; oData.HargaJual = double.Parse(txtSellingPrice.Text); if (this.DataMataUangSelected != null) { oData.IdMataUang = this.DataMataUangSelected.Id; oData.MataUang = this.DataMataUangSelected.NamaMataUang; } if (this.satuanDasarSelected != null) { oData.IdSatuanDasar = this.satuanDasarSelected.Id; oData.SatuanDasar = this.satuanDasarSelected.NamaSatuan; } oData.MinPemesanan = double.Parse(txtMinimumOrder.Text); oData.CheckboxDiskonProduk = chkdiskon.IsChecked; oData.CheckboxUbahHarga = chkover.IsChecked; if (chkdiskon.IsChecked == false) { oData.DiskonProdukPersen = "0"; } oData.DiskonProdukPersen = txtDiscount.Text; oData.TanggalMulaiDiskonProduk = DateTime.Parse(Date1.Text); oData.TanggalBerakhirDiskonProduk = DateTime.Parse(Date2.Text); oData.BatasStokMin = int.Parse(txtMinStock.Text); if (this.typeProdukSelected != null) { oData.IdTipeProduk = this.typeProdukSelected.Id; oData.TipeProduk = this.typeProdukSelected.NamaTypeProduk; oData.IdAkunHargaPokok = this.typeProdukSelected.IdAkunHargaPokok; oData.IdAkunPenjualan = this.typeProdukSelected.IdAkunPenjualan; oData.IdAkunPersediaan = this.typeProdukSelected.IdAkunPersediaan; oData.IdAkunPengirimanBeli = this.typeProdukSelected.IdAkunPengirimanBeli; oData.IdAkunPengirimanJual = this.typeProdukSelected.IdAkunPengirimanJual; oData.IdAkunReturPenjualan = this.typeProdukSelected.IdAkunReturPenjualan; oData.IdAkunJasa = this.typeProdukSelected.IdAkunService; } if (this.hargaPokokSelected != null) { oData.TipeHargaPokok = hargaPokokSelected.TipeHargaPokok; } oData.Keterangan = txtRemarks.Text; oData.CheckboxPajak = chktaxable.IsChecked; oData.CheckBoxInclusiveTax = chkinclusive.IsChecked; if (this.dataPajakSelected != null) { oData.IdPajak = this.dataPajakSelected.Id; oData.Pajak = this.dataPajakSelected.KodePajak; oData.PersentasePajak = double.Parse(dataPajakSelected.Persentase.ToString()); oData.IdAkunPajak = int.Parse(dataPajakSelected.IdAkunJual.ToString()); } oData.Panjang = txtLength.Text; oData.Lebar = txtWide.Text; oData.Tinggi = txtTall.Text; oData.Berat = txtWeight.Text; oData.CheckBoxTidakAktif = ChkInactive.IsChecked; oData.UploadImage0 = this.UploadFileA; oData.UploadImage1 = this.UploadFileB; oData.UploadImage2 = this.UploadFileC; oData.UploadImage3 = this.UploadFileD; if (this.kontakSelected != null) { oData.IdKontak = this.kontakSelected.Id; oData.SuplierA = this.kontakSelected.NamaA; } if (this.kontakSelected != null) { oData.IdKontak = this.kontakSelected.Id; oData.SuplierB = this.kontakSelected.NamaB; } if (this.kontakSelected != null) { oData.IdKontak = this.kontakSelected.Id; oData.SuplierC = this.kontakSelected.NamaC; } if (this.kontakSelected != null) { oData.IdKontak = this.kontakSelected.Id; oData.SuplierD = this.kontakSelected.NamaD; } oData.KeteranganSuplierA = txtRemarksVendor.Text; oData.KeteranganSuplierB = txtRemarksVendor2.Text; oData.KeteranganSuplierC = txtRemarksVendor3.Text; oData.KeteranganSuplierD = txtRemarksVendor4.Text; if (this.produkForm.listprodukSelected != null) { oData.IdProduk = this.produkForm.listprodukSelected.IdProduk; } return(oData); }
private void SaveQuotationrequest_Click(object sender, RoutedEventArgs e) { if (srvendor.Name == "" || txtemail.Name == "" || txthp.Name == "" || dtQuotation.Text == "" || cbCurrency.Text == "" || srnodokumen.Name == "" || txtQuotationNo.Text == "" || cbRequestNo.Name == "" || cbLocation.Text == "" || dtValidaty.Text == "" || cbAnnual.Text == "" || srstaff.Name == "" || txtAnnualFrequency.Text == "" || dtAnnual.Text == "") { MessageBox.Show("please fill in the blank fields", ("Form Validation"), MessageBoxButton.OK, MessageBoxImage.Error); return; } QuotationrequestBLL quotationrequestBLL = new QuotationrequestBLL(); ShopingchartBLL shopingchartBLL = new ShopingchartBLL(); Quotationrequest oNewData1 = new Quotationrequest(); oNewData1.KodeTransaksi = "RQ"; oNewData1.IdKodeTransaksi = 16; if (this.kontakSelected != null) { oNewData1.IdVendor = this.kontakSelected.Id; oNewData1.NamaVendor = this.kontakSelected.NamaA; } oNewData1.Email = txtemail.Text; oNewData1.Nohp = txthp.Text; oNewData1.TanggalPermintaanPenawaranHarga = DateTime.Parse(dtQuotation.Text); if (this.DataMataUangSelected != null) { oNewData1.IdMataUang = this.DataMataUangSelected.Id; oNewData1.MataUang = this.DataMataUangSelected.NamaMataUang; oNewData1.KursTukar = this.DataMataUangSelected.KursTukar; } if (this.dokumenSelected != null) { oNewData1.IdNoReferensiDokumen = this.dokumenSelected.Id; oNewData1.NoReferensiDokumen = this.dokumenSelected.NoReferensiDokumen; } oNewData1.NoPemintaanPenawaranHarga = double.Parse(txtQuotationNo.Text); if (this.shopingchartSelected != null) { oNewData1.IdPermitaanBarang = this.shopingchartSelected.IdPermintaanBarang; oNewData1.NoPermintaanBarang = this.shopingchartSelected.NoPermintaanBarang; oNewData1.IdTransaksi = this.shopingchartSelected.IdPermintaanBarang; } oNewData1.Keterangan = txtNote.Text; if (this.lokasiSelected != null) { oNewData1.IdLokasi = this.lokasiSelected.Id; oNewData1.NamaLokasi = this.lokasiSelected.NamaTempatLokasi; } if (this.dataDepartemenSelected != null) { oNewData1.IdDepartemen = this.dataDepartemenSelected.Id; } if (this.dataProyekSelected != null) { oNewData1.IdProyek = this.dataProyekSelected.Id; } oNewData1.CheckboxHidePrice = chkhide.IsChecked; oNewData1.CheckboxSelesai = chkcomplete.IsChecked; oNewData1.CheckboxInclusiveTax = chkinclusive.IsChecked; oNewData1.CheckboxBerulang = chkannual.IsChecked; oNewData1.TanggalPenutupan = DateTime.Parse(dtValidaty.Text); oNewData1.DurasiBerulang = double.Parse(txtAnnualFrequency.Text); oNewData1.TanggalBerulang = DateTime.Parse(dtAnnual.Text); if (this.optionAnnualSelected != null) { oNewData1.IdOpsiAnnual = this.optionAnnualSelected.IdOptionAnnual; oNewData1.Annual = this.optionAnnualSelected.Annual; } if (this.petugasSelected != null) { oNewData1.IdPetugas = this.petugasSelected.Id; oNewData1.NamaPetugas = this.petugasSelected.NamaA; } if (this.termspembayaranSelected != null) { oNewData1.IdTermPembayaran = this.termspembayaranSelected.IdTermPembayaran; oNewData1.TermPembayaran = this.termspembayaranSelected.NamaSkema; } oNewData1.TotalOrderProduk = double.Parse(txttotalprodukbeforetax.Text); oNewData1.IdTransaksi = int.Parse(txttota.Text); oNewData1.TotalOrderJasa = double.Parse(txttotaljasabeforetax.Text); oNewData1.TotalPajakJasa = double.Parse(txtTotaljasaTax.Text); oNewData1.TotalPajakProduk = double.Parse(txtTotalprodukTax.Text); oNewData1.TotalSebelumPajak = double.Parse(txttotalbeforetax.Text); oNewData1.TotalPajak = double.Parse(txtTotalTax.Text); oNewData1.TotalSetelahPajak = double.Parse(txtAfterTotalTax.Text); oNewData1.RealRecordingTime = DateTime.Now; oNewData1.Checkboxaktif = true; if (quotationrequestBLL.AddQuotationrequests(oNewData1) > 0) { // this.ClearForm(); MessageBox.Show("Quotation Request successfully added !"); } else { MessageBox.Show("Quotation Request failed to add !"); } if (cbRequestNo.Items.Count > 0) { foreach (var item in cbRequestNo.Items) { if (item is Shopingchart) { Shopingchart oNewData2 = (Shopingchart)item; oNewData2.Checkaktif = false; if (shopingchartBLL.EditShopingcharts(oNewData2) == true) { } } } } if (DGSKUQuota.Items.Count > 0) { foreach (var item in DGSKUQuota.Items) { if (item is ListOrderBeli) { ListOrderBeli oNewData3 = (ListOrderBeli)item; produk oDatap = new produk(); oNewData3.Tanggal = DateTime.Parse(dtQuotation.Text); if (this.lokasiSelected != null) { oNewData3.IdLokasi = this.lokasiSelected.Id; oNewData3.NamaLokasi = this.lokasiSelected.NamaTempatLokasi; } if (this.dataDepartemenSelected != null) { oNewData3.IdDepartemen = this.dataDepartemenSelected.Id; } oNewData3.IdTransaksi = oNewData1.IdPermintaanPenawaranHarga; if (this.dataProyekSelected != null) { oNewData3.IdProyek = this.dataProyekSelected.Id; } oNewData3.Checkboxaktif = false; if (quotationrequestBLL.EditOrderProdukBeli(oNewData3, oNewData1, oDatap) == true) { } } } } if (DGSKUQuotaa.Items.Count > 0) { foreach (var item in DGSKUQuota.Items) { if (item is ListOrderBeli) { ListOrderBeli oNewData3 = (ListOrderBeli)item; if (quotationrequestBLL.EditOrderProdukBeli1(oNewData3) == true) { } } } } PurchaseDocument v = new PurchaseDocument(); Switcher.SwitchNewQuotationRequest(v); }
private void Saveshopingchart_Click(object sender, RoutedEventArgs e) { if (sremployee.Name == "" || txtemail.Name == "" || txthp.Name == "" || dtIssued.Text == "" || cbCurrency.Text == "" || srnodokumen.Name == "" || txtRequestNo.Text == "" || txtNote.Text == "" || cbLocation.Text == "" || dtRequired.Text == "" || cbAnnual.Text == "" || srstaff.Name == "" || txtAnnualFrequency.Text == "" || dtAnnual.Text == "") { MessageBox.Show("please fill in the blank fields", ("Form Validation"), MessageBoxButton.OK, MessageBoxImage.Error); return; } ShopingchartBLL shopingBLL = new ShopingchartBLL(); ShopingchartBLL ShopingBLL = new ShopingchartBLL(); Shopingchart shoping = new Shopingchart(); shoping.IdKodeTransaksi = 14; shoping.KodeTransaksi = "MR"; if (this.kontakSelected != null) { shoping.IdEmployee = this.kontakSelected.Id; shoping.NamaManager = this.kontakSelected.NamaA; } shoping.Email = txtemail.Text; shoping.Nohp = txthp.Text; shoping.TanggaldiBuat = DateTime.Parse(dtIssued.Text); if (this.DataMataUangSelected != null) { shoping.IdMataUang = this.DataMataUangSelected.Id; shoping.MataUang = this.DataMataUangSelected.KodeMataUang; shoping.KursTukar = this.DataMataUangSelected.KursTukar; } if (this.dokumenSelected != null) { shoping.IdNoReferensiDokumen = this.dokumenSelected.Id; shoping.NoReferensiDokumen = this.dokumenSelected.NoReferensiDokumen; } shoping.NoPermintaanBarang = txtRequestNo.Text; if (this.lokasiSelected != null) { shoping.IdLokasi = this.lokasiSelected.Id; shoping.NamaLokasi = this.lokasiSelected.NamaTempatLokasi; } shoping.Keterangan = txtNote.Text; if (this.dataDepartemenSelected != null) { shoping.IdDepartemen = this.dataDepartemenSelected.Id; } if (this.dataProyekSelected != null) { shoping.IdProyek = this.dataProyekSelected.Id; } shoping.CheckboxSelesai = chkcomplete.IsChecked; shoping.TanggalDigunakan = DateTime.Parse(dtRequired.Text); shoping.CheckboxBerulang = chkannual.IsChecked; if (this.optionAnnualSelected != null) { shoping.IdOpsiAnnual = this.optionAnnualSelected.IdOptionAnnual; shoping.Annual = this.optionAnnualSelected.Annual; } if (this.petugasSelected != null) { shoping.IdPetugas = this.petugasSelected.Id; shoping.NamaPetugas = this.petugasSelected.NamaA; } shoping.DurasiBerulang = double.Parse(txtAnnualFrequency.Text); shoping.TanggalBerulang = DateTime.Parse(dtAnnual.Text); shoping.Nilai = double.Parse(txttotalbeforetax.Text); shoping.IdUserId = 1; shoping.IdPeriodeAkuntansi = 1; shoping.RealRecordingTime = DateTime.Now; shoping.Checkaktif = true; if (ShopingBLL.AddShopingcharts(shoping) > 0) { // this.ClearForm(); MessageBox.Show("Shoping Chart successfully added !"); } else { MessageBox.Show("Shoping Chart failed to add !"); } if (DGSKUShopingChart.Items.Count > 0) { foreach (var item in DGSKUShopingChart.Items) { if (item is ListOrderBeli) { ListOrderBeli oNewData1 = (ListOrderBeli)item; produk oproduk = new produk(); oNewData1.Tanggal = DateTime.Parse(dtIssued.Text); if (this.lokasiSelected != null) { oNewData1.IdLokasi = this.lokasiSelected.Id; oNewData1.NamaLokasi = this.lokasiSelected.NamaTempatLokasi; } if (this.dataDepartemenSelected != null) { oNewData1.IdDepartemen = this.dataDepartemenSelected.Id; } if (this.dataProyekSelected != null) { oNewData1.IdProyek = this.dataProyekSelected.Id; } oNewData1.IdTransaksi = shoping.IdPermintaanBarang; oNewData1.Checkboxaktif = false; if (shopingBLL.EditOrderProdukBeli(oNewData1, shoping, oproduk) == true) { } } } } PurchaseDocument v = new PurchaseDocument(); Switcher.SwitchNewShopingchart(v); }