Example #1
0
        private int DeleteTblCurrency(TblCurrency row)
        {
            using (var context = new WorkFlowManagerDBEntities())
            {
                var oldRow = (from e in context.TblCurrencies
                              where e.Iserial == row.Iserial
                              select e).SingleOrDefault();
                if (oldRow != null)
                {
                    context.DeleteObject(oldRow);
                }

                context.SaveChanges();
            }
            return(row.Iserial);
        }
Example #2
0
 private TblCurrency UpdateOrInsertTblCurrency(TblCurrency newRow, bool save, int index, out int outindex)
 {
     outindex = index;
     using (var context = new WorkFlowManagerDBEntities())
     {
         if (save)
         {
             context.TblCurrencies.AddObject(newRow);
         }
         else
         {
             var oldRow = (from e in context.TblCurrencies
                           where e.Iserial == newRow.Iserial
                           select e).SingleOrDefault();
             if (oldRow != null)
             {
                 GenericUpdate(oldRow, newRow, context);
             }
         }
         context.SaveChanges();
         return(newRow);
     }
 }
Example #3
0
        public TblCurrency GetCurrencyById(int id)
        {
            TblCurrency cur = _db.TblCurrencies.FirstOrDefault(x => x.Id == id);

            return(cur);
        }
Example #4
0
 public void DeleteCurrency(TblCurrency cur)
 {
     cur.Del = 0;
     _db.TblCurrencies.Update(cur);
     _db.SaveChanges();
 }
Example #5
0
 public void UpdateCurrency(TblCurrency cur)
 {
     _db.TblCurrencies.Update(cur);
     _db.SaveChanges();
 }
Example #6
0
 public void CreateCurrency(TblCurrency cur)
 {
     _db.TblCurrencies.Add(cur);
     _db.SaveChanges();
 }