private static string GetFormatedText(EF6.EPOSBatchDetails 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.EPOSBatchDetails object from the database using the given DetailsId /// </summary> /// <param name="detailsId">The primary key value</param> /// <returns>A EF6.EPOSBatchDetails object</returns> public static EF6.EPOSBatchDetails Get(Guid detailsId) { EF6.EPOSBatchDetails result = null; using (var ctx = new EF6.RT2020Entities()) { result = ctx.EPOSBatchDetails.Where(x => x.DetailsId == detailsId).AsNoTracking().FirstOrDefault(); } return(result); }
/// <summary> /// Get a EF6.EPOSBatchDetails object from the database using the given QueryString /// </summary> /// <param name="detailsId">The primary key value</param> /// <returns>A EF6.EPOSBatchDetails object</returns> public static EF6.EPOSBatchDetails Get(string whereClause) { EF6.EPOSBatchDetails result = null; using (var ctx = new EF6.RT2020Entities()) { result = ctx.EPOSBatchDetails .SqlQuery(string.Format("Select * from EPOSBatchDetails Where {0}", whereClause)) .AsNoTracking() .FirstOrDefault(); } return(result); }