コード例 #1
0
 public string ChangeFormulaYear(string tableName, IList <FormulaYear> deleteItems, IList <FormulaYear> updateItems, IList <FormulaYear> insertItems)
 {
     try
     {
         foreach (var item in deleteItems)
         {
             Delete delete = new Delete(tableName);
             delete.AddCriterions("KeyID", "myKeyID", item.KeyID, CriteriaOperator.Equal);
             delete.AddCriterions("ID", "myID", item.ID, CriteriaOperator.Equal);
             delete.AddSqlOperator(SqlOperator.AND);
             dataFactory.Remove(delete);
         }
         foreach (var item in updateItems)
         {
             Update <FormulaYear> update = new Update <FormulaYear>(tableName, item);
             update.AddCriterion("KeyID", "myKeyID", item.KeyID, CriteriaOperator.Equal);
             update.AddCriterion("ID", "myID", item.ID, CriteriaOperator.Equal);
             update.AddSqlOperator(SqlOperator.AND);
             update.AddExcludeField("Id");
             dataFactory.Save <FormulaYear>(update);
         }
         foreach (var item in insertItems)
         {
             Insert <FormulaYear> insert = new Insert <FormulaYear>(tableName, item);
             insert.AddExcludeField("Id");
             dataFactory.Save <FormulaYear>(insert);
         }
     }
     catch
     {
         return("0");
     }
     return("1");
 }