Exemplo n.º 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");
 }
Exemplo n.º 2
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";
 }
Exemplo n.º 3
0
 public void SavePVFValues(IList <PVFItem> inserted, IList <PVFItem> updated, IList <PVFItem> deleted)
 {
     using (TransactionScope scope = new TransactionScope())
     {
         foreach (var item in inserted)
         {
             Insert <PVFItem> insert = new Insert <PVFItem>("PeakValleyFlat", item);
             insert.AddExcludeField("ID");
             dataFactory.Save <PVFItem>(insert);
         }
         foreach (var item1 in updated)
         {
             Update <PVFItem> update = new Update <PVFItem>("PeakValleyFlat", item1);
             update.AddCriterion("ID", "ID", item1.ID, SqlServerDataAdapter.Infrastruction.CriteriaOperator.Equal);
             update.AddExcludeField("ID");
             dataFactory.Save <PVFItem>(update);
         }
         foreach (var item2 in deleted)
         {
             Delete delete = new Delete("PeakValleyFlat");
             delete.AddCriterions("ID", "ID", item2.ID, SqlServerDataAdapter.Infrastruction.CriteriaOperator.Equal);
             dataFactory.Remove(delete);
         }
         scope.Complete();
     }
 }
Exemplo n.º 4
0
 public void SavePVFValues(IList<PVFItem> inserted, IList<PVFItem> updated, IList<PVFItem> deleted)
 {
     using (TransactionScope scope = new TransactionScope())
     {
         foreach (var item in inserted)
         {
             Insert<PVFItem> insert = new Insert<PVFItem>("PeakValleyFlat", item);
             insert.AddExcludeField("ID");
             dataFactory.Save<PVFItem>(insert);
         }
         foreach (var item1 in updated)
         {
             Update<PVFItem> update = new Update<PVFItem>("PeakValleyFlat", item1);
             update.AddCriterion("ID", "ID", item1.ID, SqlServerDataAdapter.Infrastruction.CriteriaOperator.Equal);
             update.AddExcludeField("ID");
             dataFactory.Save<PVFItem>(update);
         }
         foreach (var item2 in deleted)
         {
             Delete delete = new Delete("PeakValleyFlat");
             delete.AddCriterions("ID", "ID",item2.ID, SqlServerDataAdapter.Infrastruction.CriteriaOperator.Equal);
             dataFactory.Remove(delete);
         }
         scope.Complete();
     }
 }
Exemplo n.º 5
0
        ///////////////////////////////////////////////////////////////////////////

        public void Save(Report entity)
        {
            Update <Report> update = new Update <Report>("Report", entity);

            update.AddCriterion("ID", entity.Id, CriteriaOperator.Equal);
            update.AddExcludeField("ID");

            dataFactory.Save <Report>(update);
        }
Exemplo n.º 6
0
        /////////////////////////////////////////////////////////////////////////////////



        public void Save(ProductLine entity)
        {
            Update <ProductLine> update = new Update <ProductLine>("ProductLine", entity);

            update.AddCriterion("ID", entity.Id, CriteriaOperator.Equal);
            update.AddExcludeField("ID");

            dataFactory.Save <ProductLine>(update);
        }
Exemplo n.º 7
0
        /********************************************************************************************/

        public void Save(TZ entity)
        {
            Update <TZ> update = new Update <TZ>("TZ", entity);

            update.AddCriterion("KeyID", entity.Id, CriteriaOperator.Equal);
            update.AddExcludeField("KeyID");

            dataFactory.Save <TZ>(update);
        }
Exemplo n.º 8
0
        /////////////////////////////////////////////////////////////////////////////////
        public void Save(ProductLine entity)
        {
            Update<ProductLine> update = new Update<ProductLine>("ProductLine", entity);
            update.AddCriterion("ID", entity.Id, CriteriaOperator.Equal);
            update.AddExcludeField("ID");

            dataFactory.Save<ProductLine>(update);
        }
Exemplo n.º 9
0
        ///////////////////////////////////////////////////////////////////////////
        public void Save(Report entity)
        {
            Update<Report> update = new Update<Report>("Report", entity);
            update.AddCriterion("ID", entity.Id, CriteriaOperator.Equal);
            update.AddExcludeField("ID");

            dataFactory.Save<Report>(update);
        }
Exemplo n.º 10
0
        /********************************************************************************************/
        public void Save(TZ entity)
        {
            Update<TZ> update = new Update<TZ>("TZ", entity);
            update.AddCriterion("KeyID", entity.Id, CriteriaOperator.Equal);
            update.AddExcludeField("KeyID");

            dataFactory.Save<TZ>(update);
        }