示例#1
0
        public WorkSpacePresenter(StoresEmployees storesEmployees, IStoreDataStore dataStore)
        {
            this.Store            = storesEmployees.Store;
            this.EmployeePosition = storesEmployees.EmployeePosition;
            this.Id             = storesEmployees.Id;
            this.UserEmployeeId = storesEmployees.UserEmployeeId;
            this.FullName       = storesEmployees.FullName;

            StoreDataStore = dataStore;

            DetailCommand = new Command(async() =>
            {
                var work_hour_data = StoreDataStore.GetEmployeeWorkHoursOfStore(UserEmployeeId.ToString(), this.Store.Id.ToString());

                this.EmployeeWork = new List <EmployeeWorkHour>(work_hour_data);
                MessagingCenter.Send <WorkSpacePresenter, WorkSpacePresenter>(this, "WorkSpaceDetail", this);
                await Shell.Current.GoToAsync($"{DetailWorkSpace.Route}");
            });
        }
        public EmployeePresenter(StoresEmployees storesEmployees, IStoreDataStore storeDataStore)
        {
            this.Id             = storesEmployees.Id;
            this.UserEmployeeId = storesEmployees.UserEmployeeId;
            this.StoreId        = storesEmployees.StoreId;
            this.IsAlive        = storesEmployees.IsAlive;
            this.EmployeeWork   = storesEmployees.EmployeeWork;
            this.FullName       = storesEmployees.FullName;
            //this.EmployeeStatus = storesEmployees.EmployeeStatus;
            this.EmployeePosition = storesEmployees.EmployeePosition;

            StoreDataStore = storeDataStore;

            DeleteCommand = new Command(() =>
            {
                var result = storeDataStore.RemoveEmployee(UserEmployeeId.ToString(), StoreId.ToString());

                if (result)
                {
                    MessagingCenter.Send <EmployeePresenter, EmployeePresenter>(this, "ToRemove", this);
                }
            });

            EditCommand = new Command(async() =>
            {
                await Shell.Current.GoToAsync($"{ConfigureEmployeePage.Route}?" + $"employeeID={UserEmployeeId.ToString()}");
            });

            DetailCommand = new Command(async() =>
            {
                var work_hour_data = StoreDataStore.GetEmployeeWorkHoursOfStore(UserEmployeeId.ToString(), StoreId.ToString());

                EmployeeWork = new List <EmployeeWorkHour>(work_hour_data);
                MessagingCenter.Send <EmployeePresenter, EmployeePresenter>(this, "Detail", this);

                await Shell.Current.GoToAsync($"{EmployeeDetailView.Route}");
            });
        }