Beispiel #1
0
 public DBContextResult<MST_UserInfo> GetUserValidity(string p_Email)
 {
     return ExecuteDALMethod(db, (DataContext, P_Email) =>
      {
          MST_UserInfo UserObj = DataContext.MST_UserInfo.SingleOrDefault(x => x.Email.Equals(P_Email) && x.IsActive == true);
          return UserObj;
      }, p_Email);
 }
Beispiel #2
0
 public DBContextResult<MST_UserInfo> Insert(MST_UserInfo p_MST_UserInfo)
 {
     return ExecuteDALMethod(db, (DataContext, P_MST_UserInfo) =>
     {
         DataContext.MST_UserInfo.Add(P_MST_UserInfo);
         DataContext.SaveChanges();
         return DataContext.MST_UserInfo.OrderByDescending(x => x.UserId).FirstOrDefault();
     }, p_MST_UserInfo);
 }
Beispiel #3
0
 public DBContextResult<object> Delete(int p_UserId)
 {
     return ExecuteDALMethod<int, object>(db, (DataContext, P_UserId) =>
      {
          MST_UserInfo Obj = DataContext.MST_UserInfo.Find(P_UserId);
          Obj.IsActive = false;
          DataContext.SaveChanges();
          return null;
      }, p_UserId);
 }
Beispiel #4
0
 public DBContextResult<object> Update(MST_UserInfo p_MST_UserInfo)
 {
     return ExecuteDALMethod<MST_UserInfo, object>(db, (DataContext, P_MST_UserInfo) =>
     {
         MST_UserInfo UserObj = DataContext.MST_UserInfo.Find(P_MST_UserInfo.UserId);
         UserObj.FirstName = P_MST_UserInfo.FirstName;
         UserObj.LastName = P_MST_UserInfo.LastName;
         UserObj.CountryId = P_MST_UserInfo.CountryId;
         UserObj.Email = P_MST_UserInfo.Email;
         UserObj.Password = P_MST_UserInfo.Password;
         DataContext.SaveChanges();
         return null;
     }, p_MST_UserInfo);
 }
Beispiel #5
0
 public bool SaveNewPassword(string p_Email, string NewHashedPassword)
 {
     try
     {
         MST_UserInfo MST_UserInfo = db.MST_UserInfo.FirstOrDefault(x => x.Email.Equals(p_Email));
         MST_UserInfo.Password = NewHashedPassword;
         db.SaveChanges();
         return true;
     }
     catch (Exception ex)
     {
         new LogError(ex);
         return false;
     }
 }
 public bool AddOrRemoveAdmin(List <string> lstUserIds, bool p_IsAdmin)
 {
     try
     {
         foreach (var UserId in lstUserIds)
         {
             MST_UserInfo User = db.MST_UserInfo.Find(Convert.ToInt32(UserId));
             User.IsAdmin = p_IsAdmin;
             db.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         new LogError(ex);
         return(false);
     }
 }