-3
I have this code to save the data entered, Dia, Diainicio and Diafim.
protected void btnSavePontuacao_Click(object sender, EventArgs e)
{
decimal id_TipoDia = 0;
string Dia = txtDay.Text;
string DiaInicio = txtStartDate.Text;
string DiaFim = txtEndDate.Text;
DateTime DtInicio, DtFim;
if (!string.IsNullOrEmpty(Dia) && DateTime.TryParse(DiaInicio, out DtInicio))
{
bool result = false;
DateTime? DtFimNullable;
if (DateTime.TryParse(DiaFim, out DtFim))
{
DtFimNullable = DtFim;
}
else
{
DtFimNullable = null;
}
if (CheckIfRatesRangeValuesAreValid(id_TipoDia, DtInicio, DtFimNullable))
{
if (id_TipoDia > 0)
{
result = FlowCreditTaxasProdutoExtensaoPrazoProviderManager.Provider.UpdateProdutoAmortizacaoCreditoDias(id, Dia, DiaInicio, DtFimNullable);
}
else
{
result = FlowCreditTaxasProdutoExtensaoPrazoProviderManager.Provider.InsertProdutoAmortizacaoCreditoDias(Dia, DiaInicio, DiaFim);
}
}
else
{
result = false;
}
if (result)
{
ShowMessageJS("sucesso");
}
else
{
ShowMessageJS("fail");
}
}
else
{
ShowMessageJS("");
}
}
In the
CheckIfRatesRangeValuesAreValid
would like to know how I can do a validation of the dates, ie if the end date is less than the start date
This code does not even compile. There is no implicit conversion of
DateTime
forint
.– Jéf Bueno
Right! Now I’d like to know if it does and how to convert it?
– Ricardo Gonçalves
Your publication does not make any sense compared to your real doubt. Also, there is no way to know what you want to do. Convert a date to an integer? In what way? What date information do you intend to use to put in a number?
– Jéf Bueno
All edited! It may be so to understand better. :)
– Ricardo Gonçalves
I do not understand what the relationship of this code with the previous one and, to be honest, still can not understand anything.
– Jéf Bueno
This code is creating button save the entered data, right? now the question is I need to validate whether the date is correct or not. through Checkifratesrangevaluesarevalid. the goal is to make the Insert in the bd
– Ricardo Gonçalves
@jbueno, this solved can close. Thank you for trying to help
– Ricardo Gonçalves