本文整理汇总了C#中DomainObject.isNull方法的典型用法代码示例。如果您正苦于以下问题:C# DomainObject.isNull方法的具体用法?C# DomainObject.isNull怎么用?C# DomainObject.isNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DomainObject
的用法示例。
在下文中一共展示了DomainObject.isNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: delete
public void delete(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
{
try
{
Territory territory = (Territory)subject;
SqlCommand command = new SqlCommand(
"DELETE FROM Territories WHERE TerritoryID = @TerritoryId AND VersionId = @VersionId",
connection, transaction);
command.Parameters.Add("@VersionId", territory.Timestamp.Value);
if(subject.isNull("TerritoryId"))
{
command.Parameters.Add("@TerritoryId", DBNull.Value );
}
else
{
command.Parameters.Add("@TerritoryId", territory.TerritoryId);
}
if(command.ExecuteNonQuery() <= 0)
{
throw new ConcurrencyException();
}
}
catch(SqlException sqle)
{
throw new ApplicationException(sqle.Message);
}
catch(Exception e)
{
throw new ApplicationException(e.Message);
}
}
示例2: delete
public void delete(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
{
try
{
Employee employee = (Employee)subject;
SqlCommand command = new SqlCommand(
"DELETE FROM Employees WHERE EmployeeID = @EmployeeId AND VersionId = @VersionId",
connection, transaction);
command.Parameters.Add("@VersionId", employee.Timestamp.Value);
if(subject.isNull("EmployeeId"))
{
command.Parameters.Add("@EmployeeId", DBNull.Value );
}
else
{
command.Parameters.Add("@EmployeeId", employee.EmployeeId);
}
if(command.ExecuteNonQuery() <= 0)
{
throw new ConcurrencyException();
}
}
catch(SqlException sqle)
{
throw new ApplicationException(sqle.Message);
}
catch(Exception e)
{
throw new ApplicationException(e.Message);
}
}
示例3: delete
public void delete(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
{
try
{
Person person = (Person)subject;
SqlCommand command = new SqlCommand(
"DELETE FROM Persons WHERE PersonID = @PersonId AND chTimestamp = @chTimestamp",
connection, transaction);
command.Parameters.Add("@chTimestamp", person.Timestamp.Value);
if(subject.isNull("PersonId"))
{
command.Parameters.Add("@PersonId", DBNull.Value );
}
else
{
command.Parameters.Add("@PersonId", person.PersonId);
}
if(command.ExecuteNonQuery() <= 0)
{
throw new ConcurrencyException();
}
}
catch(SqlException sqle)
{
throw new ApplicationException(sqle.Message);
}
catch(Exception e)
{
throw new ApplicationException(e.Message);
}
}
示例4: delete
public void delete(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
{
try
{
OrderDetail orderdetail = (OrderDetail)subject;
SqlCommand command = new SqlCommand(
"DELETE FROM OrderDetails WHERE OrderID = @Order AND ProductID = @Product AND chTimestamp = @chTimestamp",
connection, transaction);
command.Parameters.Add("@chTimestamp", orderdetail.Timestamp.Value);
if(subject.isNull("Order") || orderdetail.Order.isNull("OrderId"))
{
command.Parameters.Add("@Order", DBNull.Value );
}
else
{
command.Parameters.Add("@Order", orderdetail.Order.Id[0]);
}
if(subject.isNull("Product") || orderdetail.Product.isNull("ProductId"))
{
command.Parameters.Add("@Product", DBNull.Value );
}
else
{
command.Parameters.Add("@Product", orderdetail.Product.Id[0]);
}
if(command.ExecuteNonQuery() <= 0)
{
throw new ConcurrencyException();
}
}
catch(SqlException sqle)
{
throw new ApplicationException(sqle.Message);
}
catch(Exception e)
{
throw new ApplicationException(e.Message);
}
}
示例5: insert
public void insert(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
{
try
{
Order order = (Order)subject;
SqlCommand command = new SqlCommand(
"INSERT INTO Orders (ShippedDate, OrderDate, PersonID, OrderState) VALUES (@ShippedDate, @OrderDate, @Person, @OrderState) ; SELECT OrderID, chTimestamp FROM Orders WHERE OrderID = SCOPE_IDENTITY()",
connection, transaction);
if(subject.isNull("ShippedDate"))
{
command.Parameters.Add("@ShippedDate", DBNull.Value );
}
else
{
command.Parameters.Add("@ShippedDate", order.ShippedDate);
}
if(subject.isNull("OrderDate"))
{
command.Parameters.Add("@OrderDate", DBNull.Value );
}
else
{
command.Parameters.Add("@OrderDate", order.OrderDate);
}
if(subject.isNull("Person") || order.Person.isNull("PersonId"))
{
command.Parameters.Add("@Person", DBNull.Value );
}
else
{
command.Parameters.Add("@Person", order.Person.PersonId);
}
if(subject.isNull("OrderState"))
{
command.Parameters.Add("@OrderState", DBNull.Value );
}
else
{
command.Parameters.Add("@OrderState", order.OrderState);
}
SqlDataReader reader = command.ExecuteReader();
if(reader.Read())
{
order.Id = new Key(new object[] {
safeGetInt32(reader, "OrderID")});
order.Timestamp = safeGetTimestamp(reader);
subject.FireIdChanged();
reader.Close();
}
else
{
reader.Close();
throw new ConcurrencyException();
}
}
catch(SqlException sqle)
{
throw new ApplicationException(sqle.Message);
}
catch(Exception e)
{
throw new ApplicationException(e.Message);
}
}
示例6: update
public void update(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
{
try
{
Employee employee = (Employee)subject;
SqlCommand command = new SqlCommand(
"UPDATE Employees SET Title = @Title, FirstName = @FirstName, BirthDate = @BirthDate, ReportsTo = @ReportsTo, City = @City, LastName = @LastName, HireDate = @HireDate WHERE EmployeeID = @EmployeeId AND VersionId = @VersionId IF @@ROWCOUNT > 0 BEGIN SELECT VersionId FROM Employees WHERE EmployeeID = @EmployeeId END",
connection, transaction);
command.Parameters.Add("@VersionId", employee.Timestamp.Value);
if(subject.isNull("EmployeeId"))
{
command.Parameters.Add("@EmployeeId", DBNull.Value );
}
else
{
command.Parameters.Add("@EmployeeId", employee.EmployeeId);
}
if(subject.isNull("Title"))
{
command.Parameters.Add("@Title", DBNull.Value );
}
else
{
command.Parameters.Add("@Title", employee.Title);
}
if(subject.isNull("FirstName"))
{
command.Parameters.Add("@FirstName", DBNull.Value );
}
else
{
command.Parameters.Add("@FirstName", employee.FirstName);
}
if(subject.isNull("BirthDate"))
{
command.Parameters.Add("@BirthDate", DBNull.Value );
}
else
{
command.Parameters.Add("@BirthDate", employee.BirthDate);
}
if(subject.isNull("ReportsTo") || employee.ReportsTo.isNull("ReportsTo"))
{
command.Parameters.Add("@ReportsTo", DBNull.Value );
}
else
{
command.Parameters.Add("@ReportsTo", employee.ReportsTo.Id[0]);
}
if(subject.isNull("City"))
{
command.Parameters.Add("@City", DBNull.Value );
}
else
{
command.Parameters.Add("@City", employee.City);
}
if(subject.isNull("LastName"))
{
command.Parameters.Add("@LastName", DBNull.Value );
}
else
{
command.Parameters.Add("@LastName", employee.LastName);
}
if(subject.isNull("HireDate"))
{
command.Parameters.Add("@HireDate", DBNull.Value );
}
else
{
command.Parameters.Add("@HireDate", employee.HireDate);
}
SqlDataReader reader = command.ExecuteReader();
if(reader.Read())
{
employee.Timestamp = safeGetTimestamp(reader);
reader.Close();
}
else
{
reader.Close();
throw new ConcurrencyException();
}
subject.FireIdChanged();
}
catch(SqlException sqle)
{
throw new ApplicationException(sqle.Message);
}
catch(Exception e)
{
throw new ApplicationException(e.Message);
}
}
示例7: insert
public void insert(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
{
try
{
Employee employee = (Employee)subject;
SqlCommand command = new SqlCommand(
"INSERT INTO Employees (Title, FirstName, BirthDate, ReportsTo, City, LastName, HireDate) VALUES (@Title, @FirstName, @BirthDate, @ReportsTo, @City, @LastName, @HireDate) ; SELECT EmployeeID, VersionId FROM Employees WHERE EmployeeID = SCOPE_IDENTITY()",
connection, transaction);
if(subject.isNull("Title"))
{
command.Parameters.Add("@Title", DBNull.Value );
}
else
{
command.Parameters.Add("@Title", employee.Title);
}
if(subject.isNull("FirstName"))
{
command.Parameters.Add("@FirstName", DBNull.Value );
}
else
{
command.Parameters.Add("@FirstName", employee.FirstName);
}
if(subject.isNull("BirthDate"))
{
command.Parameters.Add("@BirthDate", DBNull.Value );
}
else
{
command.Parameters.Add("@BirthDate", employee.BirthDate);
}
if(subject.isNull("ReportsTo") || employee.ReportsTo.isNull("ReportsTo"))
{
command.Parameters.Add("@ReportsTo", DBNull.Value );
}
else
{
command.Parameters.Add("@ReportsTo", employee.ReportsTo.ReportsTo);
}
if(subject.isNull("City"))
{
command.Parameters.Add("@City", DBNull.Value );
}
else
{
command.Parameters.Add("@City", employee.City);
}
if(subject.isNull("LastName"))
{
command.Parameters.Add("@LastName", DBNull.Value );
}
else
{
command.Parameters.Add("@LastName", employee.LastName);
}
if(subject.isNull("HireDate"))
{
command.Parameters.Add("@HireDate", DBNull.Value );
}
else
{
command.Parameters.Add("@HireDate", employee.HireDate);
}
SqlDataReader reader = command.ExecuteReader();
if(reader.Read())
{
employee.Id = new Key(new object[] {
safeGetInt32(reader, "EmployeeID")});
employee.Timestamp = safeGetTimestamp(reader);
subject.FireIdChanged();
reader.Close();
}
else
{
reader.Close();
throw new ConcurrencyException();
}
}
catch(SqlException sqle)
{
throw new ApplicationException(sqle.Message);
}
catch(Exception e)
{
throw new ApplicationException(e.Message);
}
}
示例8: update
public void update(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
{
try
{
Address address = (Address)subject;
SqlCommand command = new SqlCommand(
"UPDATE Addresses SET Email = @Email, Street = @Street, City = @City, PersonID = @Person, Phone = @Phone, PostalCode = @PostalCode WHERE AddressID = @AddressId AND chTimeStamp = @chTimeStamp IF @@ROWCOUNT > 0 BEGIN SELECT chTimeStamp FROM Addresses WHERE AddressID = @AddressId END",
connection, transaction);
command.Parameters.Add("@chTimeStamp", address.Timestamp.Value);
if(subject.isNull("AddressId"))
{
command.Parameters.Add("@AddressId", DBNull.Value );
}
else
{
command.Parameters.Add("@AddressId", address.AddressId);
}
if(subject.isNull("Email"))
{
command.Parameters.Add("@Email", DBNull.Value );
}
else
{
command.Parameters.Add("@Email", address.Email);
}
if(subject.isNull("Street"))
{
command.Parameters.Add("@Street", DBNull.Value );
}
else
{
command.Parameters.Add("@Street", address.Street);
}
if(subject.isNull("City"))
{
command.Parameters.Add("@City", DBNull.Value );
}
else
{
command.Parameters.Add("@City", address.City);
}
if(subject.isNull("Person") || address.Person.isNull("PersonId"))
{
command.Parameters.Add("@Person", DBNull.Value );
}
else
{
command.Parameters.Add("@Person", address.Person.Id[0]);
}
if(subject.isNull("Phone"))
{
command.Parameters.Add("@Phone", DBNull.Value );
}
else
{
command.Parameters.Add("@Phone", address.Phone);
}
if(subject.isNull("PostalCode"))
{
command.Parameters.Add("@PostalCode", DBNull.Value );
}
else
{
command.Parameters.Add("@PostalCode", address.PostalCode);
}
SqlDataReader reader = command.ExecuteReader();
if(reader.Read())
{
address.Timestamp = safeGetTimestamp(reader);
reader.Close();
}
else
{
reader.Close();
throw new ConcurrencyException();
}
subject.FireIdChanged();
}
catch(SqlException sqle)
{
throw new ApplicationException(sqle.Message);
}
catch(Exception e)
{
throw new ApplicationException(e.Message);
}
}
示例9: update
public void update(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
{
try
{
Product product = (Product)subject;
SqlCommand command = new SqlCommand(
"UPDATE Products SET UnitPrice = @UnitPrice, Category = @Category, ProductName = @ProductName, QuantityPerUnit = @QuantityPerUnit WHERE ProductID = @ProductId AND chTimestamp = @chTimestamp IF @@ROWCOUNT > 0 BEGIN SELECT chTimestamp FROM Products WHERE ProductID = @ProductId END",
connection, transaction);
command.Parameters.Add("@chTimestamp", product.Timestamp.Value);
if(subject.isNull("ProductId"))
{
command.Parameters.Add("@ProductId", DBNull.Value );
}
else
{
command.Parameters.Add("@ProductId", product.ProductId);
}
if(subject.isNull("UnitPrice"))
{
command.Parameters.Add("@UnitPrice", DBNull.Value );
}
else
{
command.Parameters.Add("@UnitPrice", product.UnitPrice);
}
if(subject.isNull("Category"))
{
command.Parameters.Add("@Category", DBNull.Value );
}
else
{
command.Parameters.Add("@Category", product.Category);
}
if(subject.isNull("ProductName"))
{
command.Parameters.Add("@ProductName", DBNull.Value );
}
else
{
command.Parameters.Add("@ProductName", product.ProductName);
}
if(subject.isNull("QuantityPerUnit"))
{
command.Parameters.Add("@QuantityPerUnit", DBNull.Value );
}
else
{
command.Parameters.Add("@QuantityPerUnit", product.QuantityPerUnit);
}
SqlDataReader reader = command.ExecuteReader();
if(reader.Read())
{
product.Timestamp = safeGetTimestamp(reader);
reader.Close();
}
else
{
reader.Close();
throw new ConcurrencyException();
}
subject.FireIdChanged();
}
catch(SqlException sqle)
{
throw new ApplicationException(sqle.Message);
}
catch(Exception e)
{
throw new ApplicationException(e.Message);
}
}
示例10: insert
public void insert(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
{
try
{
OrderDetail orderdetail = (OrderDetail)subject;
SqlCommand command = new SqlCommand(
"INSERT INTO OrderDetails (Quantity, UnitPrice, OrderID, ProductID) VALUES (@Quantity, @UnitPrice, @Order, @Product) ; SELECT chTimestamp FROM OrderDetails WHERE OrderID= @Order AND ProductID= @Product",
connection, transaction);
if(subject.isNull("Quantity"))
{
command.Parameters.Add("@Quantity", DBNull.Value );
}
else
{
command.Parameters.Add("@Quantity", orderdetail.Quantity);
}
if(subject.isNull("UnitPrice"))
{
command.Parameters.Add("@UnitPrice", DBNull.Value );
}
else
{
command.Parameters.Add("@UnitPrice", orderdetail.UnitPrice);
}
if(subject.isNull("Order") || orderdetail.Order.isNull("OrderId"))
{
command.Parameters.Add("@Order", DBNull.Value );
}
else
{
command.Parameters.Add("@Order", orderdetail.Order.OrderId);
}
if(subject.isNull("Product") || orderdetail.Product.isNull("ProductId"))
{
command.Parameters.Add("@Product", DBNull.Value );
}
else
{
command.Parameters.Add("@Product", orderdetail.Product.ProductId);
}
SqlDataReader reader = command.ExecuteReader();
if(reader.Read())
{
orderdetail.Timestamp = safeGetTimestamp(reader);
subject.FireIdChanged();
reader.Close();
}
else
{
reader.Close();
throw new ConcurrencyException();
}
}
catch(SqlException sqle)
{
throw new ApplicationException(sqle.Message);
}
catch(Exception e)
{
throw new ApplicationException(e.Message);
}
}
示例11: update
public void update(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
{
try
{
Region region = (Region)subject;
SqlCommand command = new SqlCommand(
"UPDATE Region SET RegionDescription = @Description WHERE RegionID = @RegionId AND VersionId = @VersionId IF @@ROWCOUNT > 0 BEGIN SELECT VersionId FROM Region WHERE RegionID = @RegionId END",
connection, transaction);
command.Parameters.Add("@VersionId", region.Timestamp.Value);
if(subject.isNull("RegionId"))
{
command.Parameters.Add("@RegionId", DBNull.Value );
}
else
{
command.Parameters.Add("@RegionId", region.RegionId);
}
if(subject.isNull("Description"))
{
command.Parameters.Add("@Description", DBNull.Value );
}
else
{
command.Parameters.Add("@Description", region.Description);
}
SqlDataReader reader = command.ExecuteReader();
if(reader.Read())
{
region.Timestamp = safeGetTimestamp(reader);
reader.Close();
}
else
{
reader.Close();
throw new ConcurrencyException();
}
subject.FireIdChanged();
}
catch(SqlException sqle)
{
throw new ApplicationException(sqle.Message);
}
catch(Exception e)
{
throw new ApplicationException(e.Message);
}
}
示例12: insert
public void insert(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
{
try
{
Region region = (Region)subject;
SqlCommand command = new SqlCommand(
"INSERT INTO Region (RegionDescription) VALUES (@Description) ; SELECT RegionID, VersionId FROM Region WHERE RegionID = SCOPE_IDENTITY()",
connection, transaction);
if(subject.isNull("Description"))
{
command.Parameters.Add("@Description", DBNull.Value );
}
else
{
command.Parameters.Add("@Description", region.Description);
}
SqlDataReader reader = command.ExecuteReader();
if(reader.Read())
{
region.Id = new Key(new object[] {
safeGetInt32(reader, "RegionID")});
region.Timestamp = safeGetTimestamp(reader);
subject.FireIdChanged();
reader.Close();
}
else
{
reader.Close();
throw new ConcurrencyException();
}
}
catch(SqlException sqle)
{
throw new ApplicationException(sqle.Message);
}
catch(Exception e)
{
throw new ApplicationException(e.Message);
}
}
示例13: insert
public void insert(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
{
try
{
Territory territory = (Territory)subject;
SqlCommand command = new SqlCommand(
"INSERT INTO Territories (TerritoryDescription, TerritoryID, RegionID) VALUES (@TerritoryDescription, @TerritoryId, @Region) ; SELECT VersionId FROM Territories WHERE TerritoryID= @TerritoryId",
connection, transaction);
if(subject.isNull("TerritoryDescription"))
{
command.Parameters.Add("@TerritoryDescription", DBNull.Value );
}
else
{
command.Parameters.Add("@TerritoryDescription", territory.TerritoryDescription);
}
if(subject.isNull("TerritoryId"))
{
command.Parameters.Add("@TerritoryId", DBNull.Value );
}
else
{
command.Parameters.Add("@TerritoryId", territory.TerritoryId);
}
if(subject.isNull("Region") || territory.Region.isNull("RegionId"))
{
command.Parameters.Add("@Region", DBNull.Value );
}
else
{
command.Parameters.Add("@Region", territory.Region.RegionId);
}
SqlDataReader reader = command.ExecuteReader();
if(reader.Read())
{
territory.Timestamp = safeGetTimestamp(reader);
subject.FireIdChanged();
reader.Close();
}
else
{
reader.Close();
throw new ConcurrencyException();
}
}
catch(SqlException sqle)
{
throw new ApplicationException(sqle.Message);
}
catch(Exception e)
{
throw new ApplicationException(e.Message);
}
}
示例14: update
public void update(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
{
try
{
Order order = (Order)subject;
SqlCommand command = new SqlCommand(
"UPDATE Orders SET ShippedDate = @ShippedDate, OrderDate = @OrderDate, PersonID = @Person, OrderState = @OrderState WHERE OrderID = @OrderId AND chTimestamp = @chTimestamp IF @@ROWCOUNT > 0 BEGIN SELECT chTimestamp FROM Orders WHERE OrderID = @OrderId END",
connection, transaction);
command.Parameters.Add("@chTimestamp", order.Timestamp.Value);
if(subject.isNull("OrderId"))
{
command.Parameters.Add("@OrderId", DBNull.Value );
}
else
{
command.Parameters.Add("@OrderId", order.OrderId);
}
if(subject.isNull("ShippedDate"))
{
command.Parameters.Add("@ShippedDate", DBNull.Value );
}
else
{
command.Parameters.Add("@ShippedDate", order.ShippedDate);
}
if(subject.isNull("OrderDate"))
{
command.Parameters.Add("@OrderDate", DBNull.Value );
}
else
{
command.Parameters.Add("@OrderDate", order.OrderDate);
}
if(subject.isNull("Person") || order.Person.isNull("PersonId"))
{
command.Parameters.Add("@Person", DBNull.Value );
}
else
{
command.Parameters.Add("@Person", order.Person.Id[0]);
}
if(subject.isNull("OrderState"))
{
command.Parameters.Add("@OrderState", DBNull.Value );
}
else
{
command.Parameters.Add("@OrderState", order.OrderState);
}
SqlDataReader reader = command.ExecuteReader();
if(reader.Read())
{
order.Timestamp = safeGetTimestamp(reader);
reader.Close();
}
else
{
reader.Close();
throw new ConcurrencyException();
}
subject.FireIdChanged();
}
catch(SqlException sqle)
{
throw new ApplicationException(sqle.Message);
}
catch(Exception e)
{
throw new ApplicationException(e.Message);
}
}
示例15: update
public void update(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
{
try
{
OrderDetail orderdetail = (OrderDetail)subject;
SqlCommand command = new SqlCommand(
"UPDATE OrderDetails SET UnitPrice = @UnitPrice, Quantity = @Quantity WHERE OrderID = @Order AND ProductID = @Product AND chTimestamp = @chTimestamp IF @@ROWCOUNT > 0 BEGIN SELECT chTimestamp FROM OrderDetails WHERE OrderID = @Order AND ProductID = @Product END",
connection, transaction);
command.Parameters.Add("@chTimestamp", orderdetail.Timestamp.Value);
if(subject.isNull("Order") || orderdetail.Order.isNull("OrderId"))
{
command.Parameters.Add("@Order", DBNull.Value );
}
else
{
command.Parameters.Add("@Order", orderdetail.Order.Id[0]);
}
if(subject.isNull("Product") || orderdetail.Product.isNull("ProductId"))
{
command.Parameters.Add("@Product", DBNull.Value );
}
else
{
command.Parameters.Add("@Product", orderdetail.Product.Id[0]);
}
if(subject.isNull("UnitPrice"))
{
command.Parameters.Add("@UnitPrice", DBNull.Value );
}
else
{
command.Parameters.Add("@UnitPrice", orderdetail.UnitPrice);
}
if(subject.isNull("Quantity"))
{
command.Parameters.Add("@Quantity", DBNull.Value );
}
else
{
command.Parameters.Add("@Quantity", orderdetail.Quantity);
}
SqlDataReader reader = command.ExecuteReader();
if(reader.Read())
{
orderdetail.Timestamp = safeGetTimestamp(reader);
reader.Close();
}
else
{
reader.Close();
throw new ConcurrencyException();
}
subject.FireIdChanged();
}
catch(SqlException sqle)
{
throw new ApplicationException(sqle.Message);
}
catch(Exception e)
{
throw new ApplicationException(e.Message);
}
}