Beispiel #1
0
        async Task ExecuteLoadDormsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Dorms.Clear();
                var dorms = await DormDataStore.GetMembersAsync(true);

                foreach (var Dormitory in dorms)
                {
                    Dorms.Add(Dormitory);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Beispiel #2
0
        public void Create(FormCollection collection)
        {
            var msg = new Msg();

            try
            {
                // 初始化对象
                Entity.T_Dorm dorm = new Entity.T_Dorm()
                {
                    Dorm_nickname = collection["name"],
                    Dorm_note     = collection["note"],
                    Dorm_type     = Convert.ToBoolean(Convert.ToInt32(collection["type"])),
                };
                var Dorm = new Dorms();
                if (Dorm.Add(dorm))
                {
                    msg.Message = "添加成功!";
                }
                else
                {
                    throw new Exception("发生未知错误,添加失败!");
                }
            }
            catch (Exception ex)
            {
                msg.Code    = -1;
                msg.Message = ex.Message;
            }
            Response.Write(msg.ToJson());
            Response.End();
        }