Exemple #1
0
        /// <summary>
        /// Loads a <see cref="NoticeColl"/> collection from the database.
        /// </summary>
        protected void DataPortal_Fetch(string searchText)
        {
            var args = new DataPortalHookArgs();

            OnFetchPre(args);
            using (var dalManager = DalFactoryGetManager.GetManager())
            {
                var dal  = dalManager.GetProvider <INoticeCollDal>();
                var data = dal.Fetch(searchText);
                Fetch(data);
            }
            OnFetchPost(args);
        }
Exemple #2
0
 private void DataPortal_Delete(Int64 id)
 {
     using (var dalManager = DalFactoryGetManager.GetManager())
     {
         var args = new DataPortalHookArgs();
         OnDeletePre(args);
         var dal = dalManager.GetProvider <IUserDal>();
         using (BypassPropertyChecks)
         {
             dal.Delete(id);
         }
         OnDeletePost(args);
     }
 }
Exemple #3
0
        /// <summary>
        /// Loads a <see cref="UserColl"/> collection from the database.
        /// </summary>
        protected void DataPortal_Fetch(Criteria criteria)
        {
            var args = new DataPortalHookArgs();

            OnFetchPre(args);
            using (var dalManager = DalFactoryGetManager.GetManager())
            {
                var dal   = dalManager.GetProvider <IUserCollDal>();
                int total = 0;
                var data  = dal.Fetch(criteria.PageIndex, criteria.PageSize, criteria.FullName, criteria.Username, criteria.Tel, criteria.Email, ref total);
                this.TotalRow = total;
                Fetch(data);
            }
            OnFetchPost(args);
        }
Exemple #4
0
        /// <summary>
        /// Loads a <see cref="User"/> object from the database, based on given criteria.
        /// </summary>
        /// <param name="id">The id.</param>
        protected void DataPortal_Fetch(Int64 id)
        {
            var args = new DataPortalHookArgs(id);

            OnFetchPre(args);
            using (var dalManager = DalFactoryGetManager.GetManager())
            {
                var dal  = dalManager.GetProvider <IUserDal>();
                var data = dal.Fetch(id);
                Fetch(data);
            }
            OnFetchPost(args);
            // check all object rules and property rules
            BusinessRules.CheckRules();
        }
Exemple #5
0
 private void DataPortal_Fetch(string username)
 {
     CoreuiApi.Dto.UserDto data = null;
     using (var ctx = DalFactoryGetManager.GetManager())
     {
         var dal = ctx.GetProvider <IUserDal>();
         try
         {
             data = dal.Fetch(username);
         } catch
         {
             data = null;
         }
         LoadUser(data);
     }
 }
Exemple #6
0
        private void DataPortal_Fetch(UsernameCriteria criteria)
        {
            UserDto data = null;

            using (var ctx = DalFactoryGetManager.GetManager())
            {
                var dal = ctx.GetProvider <IUserDal>();
                try
                {
                    data = dal.Fetch(criteria.Username);
                    if (data.Id == 0)
                    {
                        status = LoginStatus.Failure;
                        return;
                    }

                    if (data.Is_lock)
                    {
                        status = LoginStatus.LockedOut;
                        return;
                    }

                    if (!data.Is_approved)
                    {
                        status = LoginStatus.IsNotApproved;
                        return;
                    }
                    var salt            = data.Password_salt;
                    var hash            = StringUtils.Encode(criteria.Password, salt);
                    var passwordMatches = hash == data.Password;
                    if (!passwordMatches)
                    {
                        status = LoginStatus.Failure;
                        return;
                    }
                } catch (Exception ex)
                {
                    data   = null;
                    status = LoginStatus.Failure;
                    return;
                }
                LoadUser(data);
                status = LoginStatus.Success;
            }
        }
Exemple #7
0
        protected override void DataPortal_Update()
        {
            var dto = new UserDto();

            dto.Id                                          = Id;
            dto.User_name                                   = User_name;
            dto.Password                                    = Password;
            dto.Password_salt                               = Password_salt;
            dto.Password_question                           = Password_question;
            dto.Password_answer                             = Password_answer;
            dto.Is_approved                                 = Is_approved;
            dto.Fullname                                    = Fullname;
            dto.Email                                       = Email;
            dto.Tel                                         = Tel;
            dto.Last_login_date                             = ReadProperty(Last_login_dateProperty);
            dto.Last_password_changed_date                  = ReadProperty(Last_password_changed_dateProperty);
            dto.Last_lockout_date                           = ReadProperty(Last_lockout_dateProperty);
            dto.Failed_password_attempt_count               = Failed_password_attempt_count;
            dto.Failed_password_attempt_window_start        = ReadProperty(Failed_password_attempt_window_startProperty);
            dto.Failed_password_answer_attempt_count        = Failed_password_answer_attempt_count;
            dto.Failed_password_answer_attempt_window_start = ReadProperty(Failed_password_answer_attempt_window_startProperty);
            dto.Birthday                                    = ReadProperty(BirthdayProperty);
            dto.Address                                     = Address;
            dto.Website                                     = Website;
            dto.Avatar                                      = Avatar;
            dto.Is_lock                                     = Is_lock;
            dto.User_type                                   = User_type;
            dto.Last_modified                               = ReadProperty(Last_modifiedProperty);
            dto.Last_username                               = Last_username;
            using (var dalManager = DalFactoryGetManager.GetManager())
            {
                var args = new DataPortalHookArgs(dto);
                OnUpdatePre(args);
                var dal = dalManager.GetProvider <IUserDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Update(dto);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnUpdatePost(args);
            }
        }
Exemple #8
0
        protected override void DataPortal_Update()
        {
            var dto = new NoticeDto();

            dto.NoticeId     = NoticeId;
            dto.Title        = Title;
            dto.Content      = Content;
            dto.Url          = Url;
            dto.LastUser     = LastUser;
            dto.LastModefied = ReadProperty(LastModefiedProperty);
            using (var dalManager = DalFactoryGetManager.GetManager())
            {
                var args = new DataPortalHookArgs(dto);
                OnUpdatePre(args);
                var dal = dalManager.GetProvider <INoticeDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Update(dto);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnUpdatePost(args);
            }
        }