예제 #1
0
 /// <summary>
 /// Primitive way to solve Primary Keys that are not "Identity" in Database.
 /// NOTE: Microsoft recomends use "identity" types in primary key and let SQL Server solve the PK
 /// </summary>
 /// <param name="parRegionInfo"></param>
 public void SolvePrimaryKeyBeforeInsert(RegionInfo parRegionInfo)
 {
     if (parRegionInfo.RegionID == int.MinValue || parRegionInfo.RegionID == 0)
     {
         GenericDAO genericBSN = new GenericDAO(motor);
         long       nextID     = genericBSN.GetMaxPlusOne("RegionID", "Region");
         parRegionInfo.RegionID = (int)nextID;
     }
 }
예제 #2
0
 /// <summary>
 /// Primitive way to solve Primary Keys that are not "Identity" in Database.
 /// NOTE: Microsoft recomends use "identity" types in primary key and let SQL Server solve the PK
 /// </summary>
 /// <param name="parOrderDetailsInfo"></param>
 public void SolvePrimaryKeyBeforeInsert(OrderDetailsInfo parOrderDetailsInfo)
 {
     if (parOrderDetailsInfo.ProductID == int.MinValue || parOrderDetailsInfo.ProductID == 0)
     {
         GenericDAO genericBSN = new GenericDAO(motor);
         long       nextID     = genericBSN.GetMaxPlusOne("ProductID", "OrderDetails");
         parOrderDetailsInfo.ProductID = (int)nextID;
     }
 }