Beispiel #1
0
 /// <summary>
 ///  Get zero or one classifier type by Code
 /// </summary>
 /// <param name="classifierTypeCode">The type code of the classifier to return</param>
 /// <param name="result">The classifier type the the code `classifierTypeCode`</param>
 /// <returns></returns>
 public bool TryGetClassifierType(string classifierTypeCode, out ClassifierType result)
 {
     using (var connection = new SqlConnection(connectionString))
     {
         connection.Open();
         using (var command = new SqlCommand("dbo.GetClassifierType", connection))
         {
             command.CommandType = CommandType.StoredProcedure;
             command.Parameters.AddWithValue("@ClassifierTypeCode", classifierTypeCode);
             using (var reader = command.ExecuteReader())
             {
                 if (reader.HasRows)
                 {
                     reader.Read();
                     result = new ClassifierType(this, reader.GetString(0))
                     {
                         Name        = reader.GetString(1),
                         Description = reader.GetString(2),
                         UpdatedBy   = reader.GetString(3),
                         UpdatedOn   = reader.GetDateTime(4)
                     };
                     return(true);
                 }
                 else
                 {
                     result = null;
                     return(false);
                 }
             }
         }
     }
 }
Beispiel #2
0
        static void Main()
        {
            DAL dal = new DAL("Server=localhost;Database=Classify;Trusted_Connection=True;");

            dal.Reset();
            ClassifierType t  = dal.SaveClassifierType("country", "Country", "Lande");
            var            dk = t.AddMember("DK", "Denmark", "Danmark");

            t.AddMember("DE", "Germany", "Deutschland");
            t.AddMember("SE", "Sweden", "Sverige")
            .AddRelated("Neighbor", dk);



            /*
             * dal.GetContext(t).AddMember("cl", "Cl", "desc"); // Classifier
             * dal["test"]["cl"]["rel"];
             *
             * t.AddMember("c", "C", "Desc");
             * Console.WriteLine(t.Description)
             */
        }
Beispiel #3
0
 public bool Filter(ClassifierType t) => t.Code == ClassifierTypeCode;