Ejemplo n.º 1
0
        private void OnModifyStudent()
        {
            if (UserSource.Count == 0)
            {
                return;
            }
            var lastStudent = UserSource.Last();

            lastStudent.Remark = $"该同学于{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}被修改了备注";
        }
Ejemplo n.º 2
0
        private void OnDeleteStudentAsync()
        {
            if (UserSource.Count == 0)
            {
                return;
            }
            var lastStudent = UserSource.Last();

            UserSource.Remove(lastStudent);
        }
Ejemplo n.º 3
0
        private async void OnDeleteData()
        {
            if (UserSource.Count == 0)
            {
                return;
            }
            var lastUser = UserSource.Last();
            var result   = await CustomDataApi.DeleteCustomDataAsync(_tableName, new[] { lastUser._id });

            if (!result.IsOk)
            {
                Mg.Get <IMgDialog>().ShowDesktopAlert("删除最后一个学生数据失败", result.Message);
                return;
            }
            Refresh();
        }
Ejemplo n.º 4
0
        private async void OnUpdateData()
        {
            if (UserSource.Count == 0)
            {
                return;
            }
            var lastUser = UserSource.Last();
            var record   = lastUser.AsDictionary().As <DynamicRecord>();

            record["Remark"] = $"于{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}被修改了备注信息";
            var data = new List <IRecord> {
                record
            };
            var result = await CustomDataApi.UpdateCustomDataAsync(_tableName, data.ToArray());

            if (!result.IsOk)
            {
                Mg.Get <IMgDialog>().ShowDesktopAlert("修改最后一个学生的备注信息失败", result.Message);
                return;
            }
            Refresh();
        }