/// <summary> /// Deprecated Method for adding a new object to the historials EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTohistorials(historial historial) { base.AddObject("historials", historial); }
/// <summary> /// Guardar Historial /// </summary> /// <param name="dt_fecha">Fecha</param> /// <param name="int_Exp">Expediente</param> /// <param name="str_Usuario">Usuario</param> /// <param name="str_Histo">Texto - Historial</param> /// <param name="sht_Pref">Prefijo</param> /// <returns></returns> public bool guardarHistorial(DateTime dt_fecha, int int_Exp, string str_Usuario, string str_Histo, short sht_Pref) { try { DataAccess.historial da_Hist = new DataAccess.historial(); da_Hist.fecha = dt_fecha; da_Hist.n_expediente = int_Exp; da_Hist.username = str_Usuario; da_Hist.texto = str_Histo; da_Hist.prefijo = sht_Pref; entities.historials.AddObject(da_Hist); entities.SaveChanges(); return true; } catch(Exception e) { return false; } }
/// <summary> /// Create a new historial object. /// </summary> /// <param name="id">Initial value of the id property.</param> /// <param name="n_expediente">Initial value of the n_expediente property.</param> /// <param name="prefijo">Initial value of the prefijo property.</param> /// <param name="fecha">Initial value of the fecha property.</param> /// <param name="username">Initial value of the username property.</param> public static historial Createhistorial(global::System.Int32 id, global::System.Int64 n_expediente, global::System.Int32 prefijo, global::System.DateTime fecha, global::System.String username) { historial historial = new historial(); historial.id = id; historial.n_expediente = n_expediente; historial.prefijo = prefijo; historial.fecha = fecha; historial.username = username; return historial; }
/// <summary> /// Guardar Historial /// </summary> /// <param name="dt_fecha">Fecha</param> /// <param name="int_Exp">Expediente</param> /// <param name="str_Usuario">Usuario</param> /// <param name="str_Histo">Texto - Historial</param> /// <param name="sht_Pref">Prefijo</param> /// <returns></returns> public bool guardarHistorial(DateTime dt_fecha, int int_Exp, string str_Usuario, string str_Histo, short sht_Pref, int id_empleado, int area) { try { var query = from p in entities.usuarios where p.empleado == id_empleado select new { p.username }; DataAccess.historial da_Hist = new DataAccess.historial(); da_Hist.fecha = dt_fecha; da_Hist.n_expediente = int_Exp; da_Hist.username = query.FirstOrDefault().username;//+" "+ query.FirstOrDefault().primer_apellido + " " +query.FirstOrDefault().segundo_apellido; da_Hist.texto = str_Histo; da_Hist.prefijo = sht_Pref; da_Hist.area = area; entities.historials.AddObject(da_Hist); entities.SaveChanges(); return true; } catch(Exception e) { return false; } }