Exemplo n.º 1
0
        private int DeleteTblCostCenterType(TblCostCenterType row, int index, string company)
        {
            using (var entity = new ccnewEntities(GetSqlConnectionString(company)))
            {
                var query = (from e in entity.TblCostCenterTypes
                             where e.Iserial == row.Iserial
                             select e).SingleOrDefault();
                if (query != null)
                {
                    entity.DeleteObject(query);
                }

                entity.SaveChanges();
            }
            return(row.Iserial);
        }
Exemplo n.º 2
0
 private TblCostCenterType UpdateOrInsertTblCostCenterTypes(TblCostCenterType newRow, bool save, int index, out int outindex, string company)
 {
     outindex = index;
     using (var entity = new ccnewEntities(GetSqlConnectionString(company)))
     {
         if (save)
         {
             entity.TblCostCenterTypes.AddObject(newRow);
         }
         else
         {
             var oldRow = (from e in entity.TblCostCenterTypes
                           where e.Iserial == newRow.Iserial
                           select e).SingleOrDefault();
             if (oldRow != null)
             {
                 GenericUpdate(oldRow, newRow, entity);
             }
         }
         entity.SaveChanges();
         return(newRow);
     }
 }