Example #1
0
        public static void AddOrUpdate(SpareEntities db, TA_SUPERLIER selectedData, TS_OPERATOR oper)
        {
            var logType = db.TA_SUPERLIER.Any(p => p.UID == selectedData.UID) ? LogType.BaseDataModify : LogType.BaseDataCreate;

            try
            {
                db.TA_SUPERLIER.AddOrUpdate(p => p.SplyId, selectedData);
                OperLogController.AddLog(db, logType, oper.OperName, selectedData.ToString());
            }
            catch (DbEntityValidationException dbEx)
            {
                Console.WriteLine(dbEx.ToString());
                throw;
            }
        }
Example #2
0
 public static void Delete(SpareEntities db, TA_SUPERLIER data, TS_OPERATOR oper)
 {
     db.Entry(data).State = EntityState.Deleted;
     OperLogController.AddLog(db, LogType.BaseDataDelete, oper.OperName, data.ToString());
 }