public static object EliminarRegistro(string Id, string patente, int start, int take) { long id = long.Parse(Id); EntidadesConosud Contexto = (HttpContext.Current.Session["Contexto"] as EntidadesConosud); IngresosEventuales objEliinar = (from v in Contexto.IngresosEventuales where v.IdIngresoEventual == id select v).First(); Contexto.DeleteObject(objEliinar); Contexto.SaveChanges(); return(GetData(patente, "-1", start, take)); }
public static object EliminarRegistro(string Id, string patente, int start, int take) { long id = long.Parse(Id); using (EntidadesConosud Contexto = new EntidadesConosud()) { IngresosEventuales objEliinar = (from v in Contexto.IngresosEventuales where v.IdIngresoEventual == id select v).First(); Contexto.DeleteObject(objEliinar); Contexto.SaveChanges(); return(GetData(patente, start, take)); } }
public static object Grabar(IDictionary <string, object> Datos, string id, int start, int take) { using (EntidadesConosud Contexto = new EntidadesConosud()) { IngresosEventuales CurrentIngresoEventual = null; if (id != "") { long idIngresoEventual = long.Parse(id); CurrentIngresoEventual = (from L in Contexto.IngresosEventuales where L.IdIngresoEventual == idIngresoEventual select L).FirstOrDefault <IngresosEventuales>(); } else { CurrentIngresoEventual = new IngresosEventuales(); Contexto.AddToIngresosEventuales(CurrentIngresoEventual); } CurrentIngresoEventual.ApellidoNombre = Datos["ApellidoNombre"].ToString(); CurrentIngresoEventual.DNI = Datos["DNI"].ToString(); CurrentIngresoEventual.Empresa = Datos["Empresa"].ToString(); CurrentIngresoEventual.Contrato = Datos["Contrato"].ToString(); CurrentIngresoEventual.Actividad = Datos["Actividad"].ToString(); CurrentIngresoEventual.Citadopor = Datos["Citadopor"].ToString(); if (Datos["FechaSolicitud"] != null) { CurrentIngresoEventual.FechaSolicitud = Convert.ToDateTime(Datos["FechaSolicitud"].ToString()); } else { CurrentIngresoEventual.FechaSolicitud = null; } if (Datos["FechaIngreso1"] != null) { CurrentIngresoEventual.FechaIngreso1 = Convert.ToDateTime(Datos["FechaIngreso1"].ToString()); } else { CurrentIngresoEventual.FechaIngreso1 = null; } if (Datos["FechaIngreso2"] != null) { CurrentIngresoEventual.FechaIngreso2 = Convert.ToDateTime(Datos["FechaIngreso2"].ToString()); } else { CurrentIngresoEventual.FechaIngreso2 = null; } if (Datos["FechaIngreso3"] != null) { CurrentIngresoEventual.FechaIngreso3 = Convert.ToDateTime(Datos["FechaIngreso3"].ToString()); } else { CurrentIngresoEventual.FechaIngreso3 = null; } if (Datos["FechaIngreso4"] != null) { CurrentIngresoEventual.FechaIngreso4 = Convert.ToDateTime(Datos["FechaIngreso4"].ToString()); } else { CurrentIngresoEventual.FechaIngreso4 = null; } if (Datos["FechaIngreso5"] != null) { CurrentIngresoEventual.FechaIngreso5 = Convert.ToDateTime(Datos["FechaIngreso5"].ToString()); } else { CurrentIngresoEventual.FechaIngreso5 = null; } Contexto.SaveChanges(); return(GetData("", start, take)); } }