示例#1
0
        public Type824TechError ParseTechError(XElement element, IDictionary <string, XNamespace> namespaces)
        {
            XNamespace empty;

            if (!namespaces.TryGetValue(string.Empty, out empty))
            {
                empty = XNamespace.None;
            }

            var model = new Type824TechError
            {
                TechErrorCode  = element.GetChildText(empty + "TechErrorCode"),
                BadElementCopy = element.GetChildText(empty + "BadElementCopy"),
                TechErrorNote  = element.GetChildText(empty + "TechErrorNote"),
            };

            return(model);
        }
示例#2
0
        public int InsertTechError(Type824TechError model)
        {
            using (var connection = new SqlConnection(connectionString))
                using (var command = connection.CreateCommand("csp824TechErrorInsert"))
                {
                    command.AddWithValue("@Reference_Key", model.ReferenceKey)
                    .AddIfNotEmptyOrDbNull("@TechErrorCode", model.TechErrorCode)
                    .AddIfNotEmptyOrDbNull("@BadElementCopy", model.BadElementCopy)
                    .AddIfNotEmptyOrDbNull("@TechErrorNote", model.TechErrorNote);

                    if (connection.State != ConnectionState.Open)
                    {
                        connection.Open();
                    }

                    command.ExecuteNonQuery();

                    model.TechErrorKey = 1;
                    return(1);
                }
        }