public static bool Register(string userName, string firstName, string lastName, string passWord, string mobileNo, string degree, string description) { PhysicUser UserEntity = new PhysicUser() { FirstName = firstName, IsActive = true, Mobile = mobileNo, LastName = lastName, Password = EncryptPassword(userName, passWord), Username = userName, Degree = degree, Description = description, }; var Validation = new PhysicUserValidation.PhysicUserEntityValidation().Validate(UserEntity); if (Validation.IsValid) { using (var db = new Model.PhysicManagementEntities()) { if (!IsUserValidByUserName(userName)) { throw new ValidationException("این نام کاربری تکراری است"); } else { db.PhysicUser.Add(UserEntity); return(db.SaveChanges() == 1); } } } throw new ValidationException(Validation.Errors); }
private bool CheckUserCanRecieveSMS(PhysicUser physicUser) { var alarmRecord = alarmService.GetPhysicUserAlarmByPhysicUserId(physicUser.Id); if (alarmRecord == null) { return(true); } else { if (alarmRecord.IsSmsRecieveActive == true) { return(true); } return(false); } }