private static string GetFormatedText(EF6.EPOSBatchHeader target, string[] textField, string textFormatString) { for (int i = 0; i < textField.Length; i++) { PropertyInfo pi = target.GetType().GetProperty(textField[i]); textFormatString = textFormatString.Replace("{" + i.ToString() + "}", pi != null ? pi.GetValue(target, null).ToString() : string.Empty); } return(textFormatString); }
/// <summary> /// Get a EF6.EPOSBatchHeader object from the database using the given HeaderId /// </summary> /// <param name="headerId">The primary key value</param> /// <returns>A EF6.EPOSBatchHeader object</returns> public static EF6.EPOSBatchHeader Get(Guid headerId) { EF6.EPOSBatchHeader result = null; using (var ctx = new EF6.RT2020Entities()) { result = ctx.EPOSBatchHeader.Where(x => x.HeaderId == headerId).AsNoTracking().FirstOrDefault(); } return(result); }
/// <summary> /// Get a EF6.EPOSBatchHeader object from the database using the given QueryString /// </summary> /// <param name="headerId">The primary key value</param> /// <returns>A EF6.EPOSBatchHeader object</returns> public static EF6.EPOSBatchHeader Get(string whereClause) { EF6.EPOSBatchHeader result = null; using (var ctx = new EF6.RT2020Entities()) { result = ctx.EPOSBatchHeader .SqlQuery(string.Format("Select * from EPOSBatchHeader Where {0}", whereClause)) .AsNoTracking() .FirstOrDefault(); } return(result); }