예제 #1
0
 private static string GetFormatedText(EF6.Pipeline 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);
 }
예제 #2
0
        /// <summary>
        /// Get a EF6.Pipeline object from the database using the given PipelineId
        /// </summary>
        /// <param name="pipelineId">The primary key value</param>
        /// <returns>A EF6.Pipeline object</returns>
        public static EF6.Pipeline Get(Guid pipelineId)
        {
            EF6.Pipeline result = null;

            using (var ctx = new EF6.RT2020Entities())
            {
                result = ctx.Pipeline.Where(x => x.PipelineId == pipelineId).AsNoTracking().FirstOrDefault();
            }

            return(result);
        }
예제 #3
0
        /// <summary>
        /// Get a EF6.Pipeline object from the database using the given QueryString
        /// </summary>
        /// <param name="pipelineId">The primary key value</param>
        /// <returns>A EF6.Pipeline object</returns>
        public static EF6.Pipeline Get(string whereClause)
        {
            EF6.Pipeline result = null;

            using (var ctx = new EF6.RT2020Entities())
            {
                result = ctx.Pipeline
                         .SqlQuery(string.Format("Select * from Pipeline Where {0}", whereClause))
                         .AsNoTracking()
                         .FirstOrDefault();
            }

            return(result);
        }
예제 #4
0
        public static bool Save(Guid id, string subject, string content, int status, DateTime createdOn, Guid createdBy)
        {
            var result = false;

            using (var ctx = new EF6.RT2020Entities())
            {
                var item = new EF6.Pipeline()
                {
                    PipelineId = id,
                    Subject    = subject,
                    Content    = content,
                    Status     = status,
                    CreatedOn  = createdOn,
                    CreatedBy  = createdBy
                };
                ctx.Pipeline.Add(item);
                ctx.SaveChanges();
                result = true;
            }

            return(result);
        }