Beispiel #1
0
 /// <summary>
 /// Delete the specified contract formula.
 /// </summary>
 /// <param name="contractFormula">The contract formula to be deleted.</param>
 /// <returns>Number of affected rows.</returns>
 public static int Delete(ContractFormula contractFormula)
 {
     using (SqlConnection connection = SamenSterkerDB.GetConnection())
     {
         return connection.Execute(
             sql: "DELETE FROM ContractFormula WHERE Id = @Id",
             param: contractFormula
         );
     }
 }
Beispiel #2
0
 /// <summary>
 /// Save the specified contract formula.
 /// </summary>
 /// <param name="contractFormula">The contract formula to be saved.</param>
 /// <returns>Number of affected rows.</returns>
 public static int Save(ContractFormula contractFormula)
 {
     using (SqlConnection connection = SamenSterkerDB.GetConnection())
     {
         int rowsAffected = connection.Execute(
             sql: isNew(contractFormula) ? insertCommand : updateCommand,
             param: contractFormula
         );
         //SetIdentity<int>(connection, id => subCategory.Id = id);
         return rowsAffected;
     }
 }
Beispiel #3
0
 private static bool isNew(ContractFormula contractFormula)
 {
     return contractFormula.Id == 0;
 }
Beispiel #4
0
 private static Contract Mapper(Contract ct, Company cmp, ContractFormula f)
 {
     ct.Company = cmp;
     ct.Formula = f;
     return ct;
 }