コード例 #1
0
        public void ParseTax(Prism810Context context, string[] marketFields)
        {
            var current = context.Current;

            if (current == null || current.ModelType != Type810Types.DetailItem)
            {
                throw new InvalidOperationException();
            }

            var detailItem = current as Type810DetailItem;

            if (detailItem == null)
            {
                throw new InvalidOperationException();
            }

            var model = new Type810DetailItemTax
            {
                TaxTypeCode      = marketFields.AtIndex(2),
                TaxAmount        = marketFields.AtIndex(3),
                RelationshipCode = marketFields.AtIndex(6),
            };

            detailItem.AddTax(model);
        }
コード例 #2
0
        public Type810DetailItemTax[] ListDetailItemTaxes(int detailItemKey)
        {
            using (var connection = new SqlConnection(connectionString))
                using (var command = connection.CreateCommand("esp_810DetailItemTaxList"))
                {
                    command.AddWithValue("@ItemKey", detailItemKey);

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

                    var collection = new List <Type810DetailItemTax>();
                    using (var reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var item = new Type810DetailItemTax
                            {
                                ItemKey = detailItemKey,
                                TaxKey  = reader.GetInt32("Tax_Key"),
                            };

                            reader.TryGetString("TaxTypeCode", x => item.TaxTypeCode           = x);
                            reader.TryGetString("TaxAmount", x => item.TaxAmount               = x);
                            reader.TryGetString("RelationshipCode", x => item.RelationshipCode = x);

                            collection.Add(item);
                        }

                        return(collection.ToArray());
                    }
                }
        }
コード例 #3
0
        public Type810DetailItemTax[] ListDetailItemTaxesByHeader(int headerKey)
        {
            using (var connection = new SqlConnection(connectionString))
                using (var command = connection.CreateCommand("csp810ExportTaxList"))
                {
                    command.AddWithValue("@810Key", headerKey);

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

                    var collection = new List <Type810DetailItemTax>();
                    using (var reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var item = new Type810DetailItemTax
                            {
                                TaxKey = reader.GetInt32("Tax_Key"),
                            };

                            reader.TryGetString("ChargeIndicator", x => item.TaxTypeCode = x);
                            reader.TryGetString("ChargeCode", x => item.TaxAmount        = x);

                            collection.Add(item);
                        }

                        return(collection.ToArray());
                    }
                }
        }
コード例 #4
0
        public Type810DetailItemTax ParseDetailItemTax(XElement element, IDictionary <string, XNamespace> namespaces)
        {
            XNamespace empty;

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

            var model = new Type810DetailItemTax
            {
                TaxTypeCode      = element.GetChildText(empty + "TaxTypeCode"),
                TaxAmount        = element.GetChildText(empty + "TaxAmount"),
                RelationshipCode = element.GetChildText(empty + "RelationshipCode"),
            };

            return(model);
        }
コード例 #5
0
        public int InsertDetailItemTax(Type810DetailItemTax model)
        {
            using (var connection = new SqlConnection(connectionString))
                using (var command = connection.CreateCommand("csp810DetailItemTaxInsert"))
                {
                    command.AddWithValue("@Item_Key", model.ItemKey)
                    .AddIfNotEmptyOrDbNull("@TaxTypeCode", model.TaxTypeCode)
                    .AddIfNotEmptyOrDbNull("@TaxAmount", model.TaxAmount)
                    .AddIfNotEmptyOrDbNull("@RelationshipCode", model.RelationshipCode);

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

                    command.ExecuteNonQuery();

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