public void AtualizaDTO() { try { DOCUMENTO_FINANCEIRO_DTO.DATA_ENTREGA = (FormFuncoes.IsDate(mskDataEntrega.Text) ? Convert.ToDateTime(mskDataEntrega.Text) : (DateTime?)null); DOCUMENTO_FINANCEIRO_DTO.DATA_VENCIMENTO = (FormFuncoes.IsDate(mskDataVencimento.Text) ? Convert.ToDateTime(mskDataVencimento.Text) : (DateTime?)null); DOCUMENTO_FINANCEIRO_DTO.ID_DOCUMENTO = DOCUMENTO_FINANCEIRO_DTO.OPERACAO == SysDTO.Operacoes.Inclusao ? Convert.ToInt32(cboDocumento.SelectedValue) : DOCUMENTO_FINANCEIRO_DTO.ID_DOCUMENTO; } catch (Exception ex) { throw ex; } }
public static DateTime?GetMskDate(MaskedTextBox txt) { try { if (FormFuncoes.IsDate(txt.Text)) { return(Convert.ToDateTime(txt.Text)); } return((DateTime?)null); } catch (Exception ex) { throw ex; } }
void AtualizaDTO() { if (boleto_cheque.STATUS_PAGAMENTO.ToLower() != "pago" && cboStatusPagamento.Text.ToLower() == "pago") { boleto_cheque.GeraComprovante = true; } boleto_cheque.DATA_VENCTO = FormFuncoes.IsDate(mskDataVencimento.Text) ? Convert.ToDateTime(mskDataVencimento.Text) : (DateTime?)null; boleto_cheque.DATA_PAGAMENTO = FormFuncoes.IsDate(mskDataPagamento.Text) ? Convert.ToDateTime(mskDataPagamento.Text) : (DateTime?)null; boleto_cheque.STATUS_PAGAMENTO = Convert.ToString(cboStatusPagamento.Text); boleto_cheque.NUMERO = txtNumBolChe.Text; boleto_cheque.VALOR = Convert.ToDecimal(txtValor.Text); boleto_cheque.VALOR_JUROS = Convert.ToDecimal(txtValorJuros.Text); boleto_cheque.ID_FORMA_PAGAMENTO = Convert.ToInt32(cboForma_Pagamento.SelectedValue); boleto_cheque.FORMA_PAGAMENTO = cboForma_Pagamento.Text; boleto_cheque.ID_FORMA_PAGAMENTO_JUROS = Convert.ToInt32(cboFormaPagamentoJuros.SelectedValue); boleto_cheque.FORMA_PAGAMENTO_JUROS = cboFormaPagamentoJuros.Text; boleto_cheque.COBRANCA = Convert.ToString(txtCobranca.Text); boleto_cheque.DATA_PROTESTO = FormFuncoes.IsDate(mskDataProtesto.Text) ? Convert.ToDateTime(mskDataProtesto.Text) : (DateTime?)null; boleto_cheque.CARTA_ANUENCIA = FormFuncoes.IsDate(mskCartaAnuencia.Text) ? Convert.ToDateTime(mskCartaAnuencia.Text) : (DateTime?)null; boleto_cheque.CARTORIO = Convert.ToString(txtCobranca.Text); }
void ValidarDados() { if (boleto_cheque.PARCELA == null || boleto_cheque.PARCELA == 0) { throw new CustomException("Parcela não preenchida. Tente recarregar a tela", "Dados incorretos"); } if (boleto_cheque.STATUS_PAGAMENTO == null || boleto_cheque.PARCELA == 0) { throw new CustomException("Favor informe o status do pagamento", "Dados incorretos"); } if (!FormFuncoes.IsDate(boleto_cheque.DATA_VENCTO.ToString())) { throw new CustomException("Favor informe a data de vencimento", "Dados incorretos"); } if (string.IsNullOrEmpty(boleto_cheque.STATUS_PAGAMENTO.ToString()) || boleto_cheque.STATUS_PAGAMENTO.ToString() == "0") { throw new CustomException("Favor informe o status de pagamento", "Dados incorretos"); } if (boleto_cheque.ID_FORMA_PAGAMENTO == null || boleto_cheque.ID_FORMA_PAGAMENTO == 0) { throw new CustomException("Favor informe a forma de pagamento", "Dados incorretos"); } }
private void MskDataVencimento_Leave(object sender, EventArgs e) { try { if (mskDataVencimento.Text.Replace("_", "").Replace("/", "").Trim().Length > 0 && !FormFuncoes.IsDate(mskDataVencimento.Text)) { ExibeMensagemErro("Data de vencimento inválida"); } else { ExibeMensagemErro("Data de vencimento inválida", true); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Erro ao validar", MessageBoxButtons.OK, MessageBoxIcon.Error); } }