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(); }
private void saveservice_click(object sender, RoutedEventArgs e) { if (cbCategory.Text == "" || txtSKU.Text == "" || txtServiceName.Text == "" || txtCogs.Text == "" || txtSellingPrice.Text == "" || cbCurrency.Text == "" || cbBaseUnit.Text == "" || Date1.Text == "" || Date2.Text == "") { MessageBox.Show("please fill in the blank fields", ("Form Validation"), MessageBoxButton.OK, MessageBoxImage.Error); return; } ProdukBLL produkBLL = new ProdukBLL(); if (produkBLL.AddProduk(this.GetData()) > 0) { MessageBox.Show("Service successfully added !"); } else { MessageBox.Show("Service failed to be added !"); } Service v = new Service(); Switcher.SwitchNewService(v); }
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); }