Пример #1
0
        /// <summary>Get data by keyword.</summary>
        /// <Modified>
        /// Name     Date         Comments
        /// quangnt2  16/03/2020   created
        /// </Modified>
        private async Task SearchData(string keyword)
        {
            CongNhans.Clear();

            var congnhans = await _congnhanService.GetCongNhansAsync(keyword);

            foreach (var congnhan in congnhans)
            {
                CongNhans.Add(new CongNhanViewModel(congnhan));
            }
        }
Пример #2
0
        /// <summary>Subscribe message Events.CongNhanUpdated from FormCongNhanViewModel.</summary>
        /// <param name="source">The source.</param>
        /// <param name="congnhan">The congnhan.</param>
        /// <Modified>
        /// Name     Date         Comments
        /// quangnt2  16/03/2020   created
        /// </Modified>
        private void OnContactUpdated(FormCongNhanViewModel source, CongNhan congnhan)
        {
            var item = CongNhans.Single(c => c.Id == congnhan.ID);

            item.Id      = congnhan.ID;
            item.Name    = congnhan.Name;
            item.Address = congnhan.Address;
            item.Phone   = congnhan.Phone;
            item.Hobbit  = congnhan.Hobbit;
            item.Birth   = congnhan.Birth;
            item.Gender  = congnhan.Gender;
        }
Пример #3
0
        /// <summary>Function for DeleteCongNhanCommand.</summary>
        /// <Modified>
        /// Name     Date         Comments
        /// quangnt2  16/03/2020   created
        /// </Modified>
        private async Task DeleteCongNhan(CongNhanViewModel congnhanModel)
        {
            if (congnhanModel != null)
            {
                if (await _pageService.DisplayAlert("Cảnh báo", $"Bạn có chắc chắn muốn xóa công nhân {congnhanModel.Name}.", "Đồng ý", "Không"))
                {
                    CongNhans.Remove(congnhanModel);

                    var congnhan = await _congnhanService.GetCongNhan(congnhanModel.Id);

                    await _congnhanService.DeleteCongNhan(congnhan);
                }
            }
        }
Пример #4
0
        /// <summary>Load data for BindingContext.</summary>
        /// <Modified>
        /// Name     Date         Comments
        /// quangnt2  16/03/2020   created
        /// </Modified>
        private async Task LoadData()
        {
            if (_isDataLoaded)
            {
                return;
            }

            _isDataLoaded = true;
            var congnhans = await _congnhanService.GetCongNhansAsync("");

            foreach (var congnhan in congnhans)
            {
                CongNhans.Add(new CongNhanViewModel(congnhan));
            }
        }
Пример #5
0
 /// <summary>Subscribe message Events.CongNhanAdded from FormCongNhanViewModel.</summary>
 /// <param name="source">The source.</param>
 /// <param name="congnhan">The congnhan.</param>
 /// <Modified>
 /// Name     Date         Comments
 /// quangnt2  16/03/2020   created
 /// </Modified>
 private void OnContactAdded(FormCongNhanViewModel source, CongNhan congnhan)
 {
     CongNhans.Add(new CongNhanViewModel(congnhan));
 }