Exemplo n.º 1
0
        public int Insert(InvoiceDomain newItem)
        {
            var sql = Sql.Builder.Append(" INSERT INTO Invoice (TypeId, ClientId, InvoiceNumber, IssueDate) ")
                .Append(" VALUES (@0, @1, @2, @3) ", EnumHelper.EnumTextToInt(newItem.InvoiceType, typeof(Enums.InvoiceType)), newItem.Client.Id,
                        newItem.InvoiceNumber, newItem.IssueDate);

            sql.Append(" SELECT SCOPE_IDENTITY() ");

            return DataContext.ExecuteScalar<int>(sql);
        }
Exemplo n.º 2
0
        public void Update(InvoiceDomain editedItem)
        {
            var sql = Sql.Builder.Append("UPDATE Invoice ")
                     .Append(" SET TypeId = @0, ClientId = @1, InvoiceNumber = @2, IssueDate = @3 ",
                        EnumHelper.EnumTextToInt(editedItem.InvoiceType, typeof(Enums.InvoiceType)), editedItem.Client.Id,
                        editedItem.InvoiceNumber, editedItem.IssueDate)
                     .Append(" WHERE ID = @0 ", editedItem.Id);

            DataContext.Execute(sql);
        }