private void btnTypeSave_Click(object sender, EventArgs e) { currentPay = new PaymentType(); currentPay.Description = txtPayType.Text; PayType = _paymentTypeController.GetPaymentTypes(); foreach (PaymentType item in PayType) { if (txtPayType.Text == item.Description) { throw new PaymentTypeException(); } } try { bool result = _paymentTypeController.Add(currentPay); if (result) { MessageBox.Show("Ödeme tip ekleme başarılı"); FillList(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void FillComboBoxes() { foreach (var item in _prController.GetPaymentReasons()) { cmbReason.Items.Add(item); } cmbReason.DataSource = _prController.GetPaymentReasons(); cmbType.DataSource = _ptController.GetPaymentTypes(); }
public async Task GetPaymentTypes_Returns_OkObjectResult() { //Arrange _fixture.MockPaymentTypeRepository.Setup(x => x.GetPaymentTypesAsync()) .ReturnsAsync(_fixture.PaymentTypes); var controller = new PaymentTypeController(_fixture.MockPaymentTypeRepository.Object); //Act var result = await controller.GetPaymentTypes(); //Assert var okResult = result.Should().BeOfType <OkObjectResult>().Subject; var paymentTypes = okResult.Value.Should().BeAssignableTo <IEnumerable <GetPaymentTypeDto> >().Subject; okResult.StatusCode.Should().Be(200); paymentTypes.Should().HaveCount(2); }
protected void Page_Load(object sender, EventArgs e) { if (Session["roleid"] == null || Int32.Parse((string)Session["roleid"]) != Constants.Roles.USER_ROLE) { Response.Redirect(Constants.Routes.HOME_ROUTE); return; } this.userID = Int32.Parse(Session["userid"].ToString()); this.loadDataProduct(); var paymentList = payment.GetPaymentTypes(); txtpayment.Items.Add(new ListItem("-----", "", false)); foreach (PaymentType productType in paymentList) { txtpayment.Items.Add(new ListItem(productType.Type, productType.ID.ToString())); } }
public void loadDataPaymentType() { payment = new PaymentTypeController(); dataProductTypes.DataSource = payment.GetPaymentTypes(); dataProductTypes.DataBind(); }