Base solution for your next web application

Activities of "murat.yuceer"

Answer

Hi @bobingham did you try is your sulution work with separated tenant database?

Question

Hello i working on task management system like https://github.com/aspnetboilerplate/aspnetboilerplate-samples/tree/master/SimpleTaskSystem but it also have to reminder system. If user select some datetime, system must send mail to user for notify. First i decided to add backgroundworker for scan UserTasks table every 30 minute and send mail if user selected remindertime after i didnt like it, because it make busy system also user could select more sensetive minutes So how can i add background job for a specific date(reminder date) in zero?

Also i have some questions For example user added task and after user changed reminder date or closed status, than i have to delete to old jobs from backgroundjob system.. how can i do that in zero easly I thinked anoter way, with dont delete from backgroundjob table but check it when job start to work (if reminder time diffirent from current task or status closed dont send) For this way i have some question for make it ddd patterns

My entity like that have some bugs i want to manage it in my entity like ddd convenient

[Table("UserTasks")]
    [Audited]
    public class UserTask : FullAuditedAggregateRoot<Guid>, IMayHaveTenant
    {
        public int? TenantId { get; set; }

        [Required]
        [StringLength(UserTaskConsts.MaxTitleLength, MinimumLength = UserTaskConsts.MinTitleLength)]
        public virtual string Title { get; protected set; }

        [StringLength(UserTaskConsts.MaxDescriptionLength, MinimumLength = UserTaskConsts.MinDescriptionLength)]
        public virtual string Description { get; protected set; }

        public virtual DateTime? ReminderDate { get; protected set; }

        public virtual TaskState State { get; protected set; }

        //foreign keys
        public virtual long UserId { get; protected set; }
        [ForeignKey("UserId")]
        public User User { get; protected set; }



        protected UserTask() { }
        public UserTask(int? tenantId, User user, string title, string description, TaskState taskState, DateTime? reminderDate = null)
        {
            TenantId = tenantId;
            UserId = user.Id;
            User = user;
            SetTitle(title);
            SetDescription(description);
            SetState(taskState);
            SetReminderDate(reminderDate);
        }

        public void SetTitle(string title)
        {
            Title = title;
        }

        public void SetDescription(string description)
        {
            Description = description;
        }

        public void SetState(TaskState taskState)
        {
            State = taskState;

            TrigerUserTaskReminderDateChangedEvent();
        }

        public void SetReminderDate(DateTime? reminderDate)
        {
            if (reminderDate == ReminderDate)
                return;

            if (reminderDate < Clock.Now)
            {
                throw new UserFriendlyException("Can not set an reminder date in the past!");
            }

            ReminderDate = reminderDate;

            TrigerUserTaskReminderDateChangedEvent();
        }

        private UserTaskReminderDateChangedEvent _userTaskReminderDateChangedEvent;
        private void TrigerUserTaskReminderDateChangedEvent()
        {
            if (_userTaskReminderDateChangedEvent == null)
            {
                _userTaskReminderDateChangedEvent = new UserTaskReminderDateChangedEvent();//i have to pass current usertask id but its work before commit
                DomainEvents.Add(_userTaskReminderDateChangedEvent);
            }
        }
    }

Thank you @velu i received

Hi @ismcagdas , velu i guess not here, do you have this project?

Answer

I created example for you understand what is bug

this is correct result for current datetime (5.3.2) https://stackblitz.com/edit/angular-qbj9cv?file=app/ngx-bootstrap-demo.component.ts

after change package.json "ngx-bootstrap": "5.3.2" to "ngx-bootstrap": "5.2.0" then you will see time wrong

Answer

I fixed problem, bsDatepicker have bug on 5.20 versiyon i updated it 5.3 and problem resolved

Answer

Actualy my problem is, when i save db is save correct but when i show form is show wrong hours (showing utc hours)

bsDatepicker

<input class="form-control m-input" type="datetime" bsDatepicker [bsConfig]="{ dateInputFormat: 'DD-MM-YYYY, HH:mm'}" [(ngModel)]="reminderTime" id="UserTask_ReminderTime" name="UserTask_ReminderTime">

show function

show(userTaskId?: string): void {
    this.reminderTime = null;

    if (!userTaskId) {
        this.userTask = new CreateOrEditUserTaskDto();
        this.userTask.id = userTaskId;
        this.userTask.state = TaskState.Open;

        this.active = true;
        this.modal.show();
    } else {
        this._userTasksServiceProxy.getUserTaskForEdit(userTaskId).subscribe(result => {
            this.userTask = result.userTask;
            if (this.userTask.reminderTime) {
                this.reminderTime = this.userTask.reminderTime.toDate();
            }

            this.active = true;
            this.modal.show();
        });
    }
}

save function save(): void { this.saving = true;

    if (this.reminderTime) {
        if (!this.userTask.reminderTime) {
            this.userTask.reminderTime = moment(this.reminderTime, "DD-MM-YYYY, HH:mm");
        }
        else {
            this.userTask.reminderTime = moment(this.reminderTime, "DD-MM-YYYY, HH:mm");
        }
    }
    else {
        this.userTask.reminderTime = null;
    }
    this._userTasksServiceProxy.createOrEdit(this.userTask)
        .pipe(finalize(() => { this.saving = false; }))
        .subscribe(() => {
            this.notify.info(this.l('SavedSuccessfully'));
            this.close();
            this.modalSave.emit(null);
        });
}
Answer

I guess bsDatepicker bind moment wrong??

Question

Hello,

I using zero with default utc settings (ClockProviders.Unspecified)

My Task entity store ReminderTime and in database its look like 2019-11-04 12:06:05 When api get this record its look like reminderTime: "2019-11-13T12:06:05"

But when i write to angular app => console.log(this.userTask.reminderTime); its look like bellow _isUTC field is true. Because of that when i call console.log(this.userTask.reminderTime.toDate()); function its write Wed Nov 13 2019 12:06:05 GMT+0300 (GMT+03:00) and bsDatepicker add 3 hours I confused its should _isUTC false right?

Moment {_isAMomentObject: true, _i: "2019-11-13T12:06:05", _f: "YYYY-MM-DDTHH:mm:ss", _isUTC: false, _pf: {…}, …} _a: (7) [2019, 10, 13, 12, 6, 5, 0] _d: Wed Nov 13 2019 15:06:05 GMT+0300 (GMT+03:00) {} _f: "YYYY-MM-DDTHH:mm:ss" _i: "2019-11-13T12:06:05" _isAMomentObject: true _isUTC: true _isValid: true _locale: Locale {_calendar: {…}, _longDateFormat: {…}, _invalidDate: "Invalid date", _dayOfMonthOrdinalParse: /\d{1,2}/, ordinal: ƒ, …} _offset: 0 _pf: {empty: false, unusedTokens: Array(0), unusedInput: Array(0), overflow: -1, charsLeftOver: 0, …} _z: null proto: Object

Hello,

I need some advice for extend User table

For example i need to add some details for persons like IdentificionNumber, Age, Gender etc..

What is best practices to do that, Extend user table or split user table with one to one relation to Person table (move name and lastname to person)?

Showing 51 to 60 of 63 entries