Ejemplo n.º 1
0
 public bool DeleteAudit(Audit audit)
 {
     if (audit == null) return false;
     _unitOfWork.AuditRepository.Delete(audit);
     _unitOfWork.Save();
     return true;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FieldChange"/> class.
        /// </summary>
        /// <param name="a">A.</param>
        /// <param name="property">The property.</param>
        /// <param name="foreignTable">The foreign table.</param>
        /// <param name="foreignFeildName">Name of the foreign feild.</param>
        /// <param name="foreignFeildKey">The foreign feild key.</param>
        public FieldChange(Audit a, string property, string foreignTable, string foreignFeildName, string foreignFeildKey)
        {
            //FieldChange x = new FieldChange(a, property);
              //todo:refactor  CTSContext db = new CTSContext();

             //   this.ChangeDate = a.DateTime;
            UserProfile user = UserProfile.GetUserById(a.LoginID);
            this.ChangedBy = (user != null) ? user.UserName : "******";
            this.FieldName = property;

            this.PreviousValue = a.OldValue;
            this.ChangedValue = a.NewValue;

            this.FieldName = property;

            var prevKey = Convert.ToInt32(this.PreviousValue);
            var CurrentKey = Convert.ToInt32(this.ChangedValue);
            //modified Banty:24/5/2013 from db.ExecuteStoreQuery to (db as IObjectContextAdapter).ObjectContext.ExecuteStoreQuery
              //todo:  var Prev = (db as IObjectContextAdapter).ObjectContext.ExecuteStoreQuery<string>(" SELECT " + foreignFeildName + " as field FROM " + foreignTable + " WHERE " + foreignFeildKey + " = " + prevKey).FirstOrDefault();
               //todo: var now = (db as IObjectContextAdapter).ObjectContext.ExecuteStoreQuery<string>(" SELECT " + foreignFeildName + " as field FROM " + foreignTable + " WHERE " + foreignFeildKey + " = " + CurrentKey).FirstOrDefault(); ;
             // var Prev = db.AuditForeignFeild(foreignTable,foreignFeildName,prevKey,foreignFeildKey).SingleOrDefault();
             // var now = db.AuditForeignFeild(foreignTable, foreignFeildName, CurrentKey, foreignFeildKey).SingleOrDefault();

            //todo:if(Prev != null)
            //{
            //    this.PreviousValue = Prev.ToString();
            //    //this.PreviousValue = Prev.field;
            //}
            //if(now != null)
            //{
            //    this.ChangedValue = now.ToString();
            //}
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FieldChange"/> class.
        /// </summary>
        /// <param name="audit">The audit.</param>
        /// <param name="proprtyName">Name of the proprty.</param>
        public FieldChange(Audit audit, string proprtyName)
        {
            //  this.ChangeDate = audit.DateTime;
            UserProfile user = UserProfile.GetUserById(audit.LoginID);
            this.ChangedBy = (user != null) ? user.UserName : "******";
            this.FieldName = proprtyName;

            this.PreviousValue = audit.OldValue;
            this.ChangedValue = audit.NewValue;
        }
Ejemplo n.º 4
0
 public bool EditAudit(Audit audit)
 {
     _unitOfWork.AuditRepository.Edit(audit);
     _unitOfWork.Save();
     return true;
 }
Ejemplo n.º 5
0
 public bool AddAudit(Audit audit)
 {
     _unitOfWork.AuditRepository.Add(audit);
     _unitOfWork.Save();
     return true;
 }