public void UpdateTest() { var obj = new Supplier { supplier_id = "5b3704f5-83a4-4b98-a7a7-1b09fd62d356", nama_supplier = "Sigma Computer", alamat = "Sleman - Yogyakarta", kontak = "Andi", telepon = "" }; var validationError = new ValidationError(); var result = _bll.Update(obj, ref validationError); Console.WriteLine("Error : " + validationError.Message); Assert.IsTrue(result != 0); var updatedObj = _bll.GetByID(obj.supplier_id); Assert.IsNotNull(updatedObj); Assert.AreEqual(obj.supplier_id, updatedObj.supplier_id); Assert.AreEqual(obj.nama_supplier, updatedObj.nama_supplier); Assert.AreEqual(obj.alamat, updatedObj.alamat); Assert.AreEqual(obj.kontak, updatedObj.kontak); Assert.AreEqual(obj.telepon, updatedObj.telepon); }
public void UpdateTest() { var obj = new Supplier { supplier_id = "7859f705-6b0f-4c06-9bd0-e9f5f7b87414", nama_supplier = "Sigma Computer", alamat = "Yogyakarta", kontak = "Andi", telepon = "" }; var validationError = new ValidationError(); var result = _bll.Update(obj, ref validationError); Console.WriteLine("Error : " + validationError.Message); Assert.IsTrue(result != 0); var updatedObj = _bll.GetByID(obj.supplier_id); Assert.IsNotNull(updatedObj); Assert.AreEqual(obj.supplier_id, updatedObj.supplier_id); Assert.AreEqual(obj.nama_supplier, updatedObj.nama_supplier); Assert.AreEqual(obj.alamat, updatedObj.alamat); Assert.AreEqual(obj.kontak, updatedObj.kontak); Assert.AreEqual(obj.telepon, updatedObj.telepon); }
protected override void Simpan() { if (_isNewData) { _supplier = new Supplier(); } _supplier.nama_supplier = txtSupplier.Text; _supplier.alamat = txtAlamat.Text; _supplier.kontak = txtKontak.Text; _supplier.telepon = txtTelepon.Text; var result = 0; var validationError = new ValidationError(); using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0))) { if (_isNewData) { result = _bll.Save(_supplier, ref validationError); } else { result = _bll.Update(_supplier, ref validationError); } if (result > 0) { Listener.Ok(this, _isNewData, _supplier); if (_isNewData) { base.ResetForm(this); txtSupplier.Focus(); } else { this.Close(); } } else { if (validationError.Message.NullToString().Length > 0) { MsgHelper.MsgWarning(validationError.Message); base.SetFocusObject(validationError.PropertyName, this); } else { MsgHelper.MsgUpdateError(); } } } }