Hello there
I've got this code but it has 2 problems:
1. The double value gets and "Only numeric fields are allowed"
2. I can't find the way to repeat calculate throught all rows in the table...
Heres the code:
public void cambios(){
//Navegacion entre campos
XPathNavigator navform = this.CreateNavigator(); //navegador de formulario
XmlNamespaceManager SpaceManager = this.NamespaceManager; //manejador de espacio de nombres
XPathNavigator inicio = navform.SelectSingleNode("/my:myFields/my:Vacaciones/my:Detalle/my:Inicio", SpaceManager);
XPathNavigator culminacion = navform.SelectSingleNode("/my:myFields/my:Vacaciones/my:Detalle/my:Culminacion", SpaceManager);
XPathNavigator Tiempo = navform.SelectSingleNode("/my:myFields/my:Vacaciones/my:Detalle/my:Tiempo", SpaceManager);
XPathNavigator Dias = navform.SelectSingleNode("/my:myFields/my:Vacaciones/my:Detalle/my:Dias", SpaceManager);
DeleteNil(inicio);
DeleteNil(culminacion);
DeleteNil(Tiempo);
DeleteNil(Dias);
int SWcombos = Tiempo.ValueAsInt; //el valor del combo segun selección
DateTime di = new DateTime();
DateTime df = new DateTime();
string ConvDias; //Conversion Dias
if ((string.IsNullOrEmpty(inicio.Value) || (string.IsNullOrEmpty(culminacion.Value))))
{
// MessageBox.Show(" Los campos de Inicio y Culminación deben tener fechas válidas para realizar el cálculo ");
// return;
}
else
{
di = inicio.ValueAsDateTime;
df = culminacion.ValueAsDateTime;
}
//public int ExcluyeFeriados(DateTime start, DateTime end, int dias)
double dias = ExcluyeFeriados(di, df);
if (dias
{
MessageBox.Show("La fecha de inicio no puede estar ANTES de la fecha de Culminación");
Dias.SetValue("0");
return;
}
switch (SWcombos)
{
case 1:
//calcular los dias
//MessageBox.Show("Hice 1");
ConvDias = Convert.ToString(dias);
Dias.SetValue(ConvDias );
//calcular dias y mult por la mitad (porque son medios días) --->Caso Mañanas
MessageBox.Show("No tiene un valor válido, favor contacte al departamento de sistemas a email");
Thanks in advance......