Exemplo n.º 1
0
        public InformationResident(User user) : this()
        {
            CurrentUser = user;
            List <Resident> residents = ResidentService.QueryByUser(CurrentUser.UserId);

            InfoBindingSource.DataSource = residents;
        }
Exemplo n.º 2
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            switch (cmbQuery.SelectedIndex)
            {
            case 0:     // 全部
                InfoBindingSource.DataSource = ResidentService.GetAll();
                break;

            case 1:     // 根据姓名查询
                InfoBindingSource.DataSource = ResidentService.QueryByName(txtQuery.Text);
                break;

            case 2:     // 根据用户名查询
                InfoBindingSource.DataSource = ResidentService.QueryByUser(txtQuery.Text);
                break;

            case 3:    //查询健康的居民
                InfoBindingSource.DataSource = ResidentService.QueryByHealthStatus(HealthStatus.Health);
                break;

            case 4:    //查询隔离的居民
                InfoBindingSource.DataSource = ResidentService.QueryByHealthStatus(HealthStatus.quarantine);
                break;

            case 5:    //查询患病的居民
                InfoBindingSource.DataSource = ResidentService.QueryByHealthStatus(HealthStatus.sick);
                break;
            }
        }
Exemplo n.º 3
0
        public InformationAdministrator(User user) : this()
        {
            CurrentUser = user;
            List <Resident> residents = ResidentService.GetAll();

            InfoBindingSource.DataSource = residents;
        }
Exemplo n.º 4
0
        public HealthInfoAdministrator(User user) : this()
        {
            CurrentUser = user;
            List <Resident>          residents         = ResidentService.GetAll();
            List <HealthInformation> healthInformation = null;

            for (int i = 0; i < residents.Count(); i++)
            {
                healthInformation.Add(new HealthInformation(residents[i]));
            }
            HealthBindingSource.DataSource = healthInformation;
        }
Exemplo n.º 5
0
        // Residents
        private void btnCreate_Click(object sender, EventArgs e)
        {
            MissionAddResident addResident = new MissionAddResident(new ResidentMission());

            if (addResident.ShowDialog() == DialogResult.OK)
            {
                addResident.Mission.CreatedTime = DateTime.Now;
                addResident.Mission.Resident    = ResidentService.Get(CurrentUser.UserId);
                addResident.Mission.State       = MissionStatus.未接受;
                ResidentMissionService.Add(addResident.Mission);
                QueryAll(CurrentUser);
            }
        }
Exemplo n.º 6
0
        public HealthInfoResident(User user) : this()
        {
            CurrentUser = user;
            List <Resident>          residents         = ResidentService.QueryByUser(CurrentUser.UserId);
            List <HealthInformation> healthInformation = null;

            for (int i = 0; i < residents.Count(); i++)
            {
                healthInformation.Add(new HealthInformation(residents[i]));
            }
            TodayBindingSource.DataSource  = healthInformation;
            HealthBindingSource.DataSource = HealthInformationService.QueryByUser(CurrentUser.UserId);
        }
Exemplo n.º 7
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            EmergencyAddResident addResident = new EmergencyAddResident(new Emergency());

            if (addResident.ShowDialog() == DialogResult.OK)
            {
                addResident.emergency.RaiseTime  = DateTime.Now;
                addResident.emergency.resident   = ResidentService.Get(CurrentUser.UserId);
                addResident.emergency.EmergState = EmergencyStatus.未处理;
                EmergencyService.Add(addResident.emergency);
                QueryAll(CurrentUser);
            }
        }
Exemplo n.º 8
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            HealthStatus HealthStatus = ResidentService.Get(txtId.Text).HealthStatus;

            if (HealthStatus == HealthStatus.Health)
            {
                MessageBox.Show("该居民健康,可以放行");
            }
            else if (HealthStatus == HealthStatus.quarantine)
            {
                MessageBox.Show("该居民隔离,不建议放行");
            }
            else if (HealthStatus == HealthStatus.sick)
            {
                MessageBox.Show("该居民患病,不能放行");
            }
        }
Exemplo n.º 9
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            Resident resident = UserBindingSource.Current as Resident;

            if (resident == null)
            {
                MessageBox.Show("请选择一个家庭成员进行删除");
                return;
            }
            DialogResult MsgBoxResult;

            MsgBoxResult = MessageBox.Show("您确定要删除吗?", "提示", MessageBoxButtons.YesNo);
            if (MsgBoxResult == DialogResult.Yes)
            {
                ResidentService.Remove(resident.ResidentId);
                UserBindingSource.ResetBindings(false);
            }
        }
Exemplo n.º 10
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            InformationEdit information = new InformationEdit(new Resident());

            try
            {
                if (information.ShowDialog() == DialogResult.OK)
                {
                    information.Resident.ResidentId = txtUserId.Text;
                    ResidentService.Add(information.Resident);
                    ResidentBindingSource.ResetBindings(false);
                }
            }
            catch (Exception e2)
            {
                MessageBox.Show(e2.Message);
            }
        }
Exemplo n.º 11
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            Resident resident = InfoBindingSource.Current as Resident;

            if (resident == null)
            {
                MessageBox.Show("请选择一个信息进行修改");
                return;
            }
            resident = ResidentService.Get(resident.ResidentId);
            InformationEdit informationEdit = new InformationEdit(resident);

            if (informationEdit.ShowDialog() == DialogResult.OK)
            {
                ResidentService.Update(informationEdit.Resident);
                InfoBindingSource.DataSource = ResidentService.QueryByUser(CurrentUser.UserId);
                InfoBindingSource.ResetBindings(false);
            }
        }