Cats.Models.Hubs.UserProfile.GetUserById C# (CSharp) Method

GetUserById() public static method

public static GetUserById ( int p ) : UserProfile
p int
return UserProfile
        public static UserProfile GetUserById(int p)
        {
            //CTSContext entities = new CTSContext();
            //return (from u in entities.UserProfiles
            //        where u.UserProfileID == p && !u.LockedInInd && u.ActiveInd
            //        select u).FirstOrDefault();
            return null;
        }

Usage Example

Example #1
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();
            //}
        }
All Usage Examples Of Cats.Models.Hubs.UserProfile::GetUserById