示例#1
0
 /// <summary>
 /// Loads a LineOfOperation object from the database using the given LineOfOperationId
 /// </summary>
 /// <param name="lineOfOperationId">The primary key value</param>
 /// <returns>A LineOfOperation object</returns>
 public static LineOfOperation Load(Guid lineOfOperationId)
 {
     SqlParameter[] parameterValues = new SqlParameter[] { new SqlParameter("@LineOfOperationId", lineOfOperationId) };
     using (SqlDataReader reader = SqlHelper.Default.ExecuteReader("spLineOfOperation_SelRec", parameterValues))
     {
         if (reader.Read())
         {
             LineOfOperation result = new LineOfOperation();
             result.LoadFromReader(reader);
             return(result);
         }
         else
         {
             return(null);
         }
     }
 }
示例#2
0
        private static bool IgnorThis(LineOfOperation target, string parentFilter)
        {
            bool result = true;

            parentFilter = parentFilter.Replace(" ", "");                       // remove spaces
            parentFilter = parentFilter.Replace("'", "");                       // remove '
            string [] parsed = parentFilter.Split('=');                         // parse

            if (target.ParentLine == Guid.Empty)
            {
                PropertyInfo pi          = target.GetType().GetProperty(parsed[0]);
                string       filterField = (string)pi.GetValue(target, null);
                if (filterField.ToLower() == parsed[1].ToLower())
                {
                    result = false;
                }
            }
            else
            {
                LineOfOperation parentTemplate = LineOfOperation.Load(target.ParentLine);
                result = IgnorThis(parentTemplate, parentFilter);
            }
            return(result);
        }