public static string WGrabarOt(string sId, string sNumero, string sFecha, string sIdClienteMunicipio, string sIdRuta, string sIdCamion, string sNombreChoferes, string sCorreos, string sHora) { JavaScriptSerializer scriptSerializer = new JavaScriptSerializer(); List <string> Lista = new List <string>(); Usuario usr = new Usuario(); if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current)) { return(scriptSerializer.Serialize(Lista.ToArray())); } try { if (sCorreos.Trim().Length == 0) { Lista.Add("error"); Lista.Add("Ingrese el dato: Correos"); return(scriptSerializer.Serialize(Lista.ToArray())); } if (!UtilWeb.IsValidMail(sCorreos.Trim())) { Lista.Add("error"); Lista.Add("El dato Correos está incorrecto"); return(scriptSerializer.Serialize(Lista.ToArray())); } double IdNew = 0; Ot ot = new Ot(usr); usr.ReadMunic(); sIdClienteMunicipio = UtilWeb.GetDatoSingular("Id", usr.oClienteMunicipio.Datos); if (sId.Trim().Length == 0) { IdNew = ot.Create(sNumero, sFecha, sIdClienteMunicipio, sIdRuta, sIdCamion, sNombreChoferes, sCorreos, sHora, "0", "0"); } else { ot.Update(sId, sNumero, sFecha, sIdClienteMunicipio, sIdRuta, sIdCamion, sNombreChoferes, sCorreos, sHora, "0", "0"); } //WLeerUsuarioConectadoAndMunicipios_Internal(usr, ref html); Lista.Add("Exito"); Lista.Add(string.Format("OT: {0}", IdNew.ToString())); } catch (Exception ex) { Lista.Add("Exception"); Lista.Add(ex.Message); Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor."); } return(scriptSerializer.Serialize(Lista.ToArray())); }
public static string WGrabarOt(string sIdSolicitud, string sNumero, string sFecha, string sIdCamion, string sNombreChoferes, string sCorreos, string sHora, string sValorRetiro) { JavaScriptSerializer scriptSerializer = new JavaScriptSerializer(); List <string> Lista = new List <string>(); Usuario usr = new Usuario(); if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current)) { return(scriptSerializer.Serialize(Lista.ToArray())); } try { double IdNew = 0; usr.ReadMunic(); string sIdClienteMunicipio = UtilWeb.GetDatoSingular("Id", usr.oClienteMunicipio.Datos); double IdOT = 0; double IdSoltemp = 0; Ot ot = new Ot(usr); if (double.TryParse(sIdSolicitud, out IdSoltemp)) { IdOT = ot.ReadByIdSolicitud(sIdSolicitud); } if (IdOT == 0) { IdNew = ot.Create(sNumero, sFecha, sIdClienteMunicipio, "", sIdCamion, sNombreChoferes, sCorreos, sHora, sValorRetiro, sIdSolicitud); } else { ot.Update(IdOT.ToString(), sNumero, sFecha, sIdClienteMunicipio, "", sIdCamion, sNombreChoferes, sCorreos, sHora, sValorRetiro, sIdSolicitud); } //WLeerUsuarioConectadoAndMunicipios_Internal(usr, ref html); Lista.Add("Exito"); Lista.Add(string.Format("OT: {0}", IdNew.ToString())); } catch (Exception ex) { Lista.Add("Exception"); Lista.Add(ex.Message); Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor."); } return(scriptSerializer.Serialize(Lista.ToArray())); }