void SetValues(VLPayment payment) { this.PaymentDate.Text = payment.PaymentDate.ToString("yyyy-MM-dd"); this.Comment.Text = payment.Comment; this.CustomCode1.Text = payment.CustomCode1; this.CustomCode2.Text = payment.CustomCode2; this.frmResourceType.SelectedValue = ((Int32)payment.CreditType).ToString(); this.Quantity.Text = payment.Quantity.ToString(CultureInfo.InvariantCulture); this.QuantityUsed.Text = payment.QuantityUsed.ToString(CultureInfo.InvariantCulture); if (payment.QuantityUsed > 0) { this.frmResourceType.Enabled = false; } else { var collectorPayments = SystemManager.GetCollectorPaymentsForPayment(this.SelectedPayment.PaymentId); if (collectorPayments.Count > 0) { this.frmResourceType.Enabled = false; } } }
void GetValues(VLPayment payment) { payment.CreditType = (CreditType)Enum.Parse(typeof(CreditType), this.frmResourceType.SelectedValue); payment.Quantity = Int32.Parse(this.Quantity.Text); payment.PaymentDate = DateTime.ParseExact(this.PaymentDate.Text, "yyyy-MM-dd", CultureInfo.InvariantCulture); if (string.IsNullOrWhiteSpace(this.CustomCode1.Text)) { payment.CustomCode1 = null; } else { payment.CustomCode1 = this.CustomCode1.Text; } if (string.IsNullOrWhiteSpace(this.CustomCode2.Text)) { payment.CustomCode2 = null; } else { payment.CustomCode2 = this.CustomCode2.Text; } payment.Comment = this.Comment.Text; }