Ejemplo n.º 1
0
 public ResidentAccessManagement(Resident res, double temp, InOut inout, string notes)
 {
     Resident   = res;
     Tempreture = temp;
     In_Out     = inout;
     Notes      = notes;
 }
Ejemplo n.º 2
0
 //更新
 public static void Update(Resident resident)
 {
     using (var entity = new CommunityEpidemicManagementSystemContext())
     {
         try
         {
             entity.Residents.Remove(Get(resident.ResidentId));
             entity.Residents.Add(resident);
             entity.SaveChanges();
         }
         catch (Exception ex)
         {
             string errorInfo = ex.Message;
             if (ex is DbEntityValidationException)
             {
                 foreach (var validationResult in ((DbEntityValidationException)ex).EntityValidationErrors)
                 {
                     foreach (var error in validationResult.ValidationErrors)
                     {
                         errorInfo = $"{errorInfo}" + "\n" + $"{error.ErrorMessage}";
                     }
                 }
             }
             throw new ApplicationException("更新时出错!\n" + $"{errorInfo}");
         }
     }
 }
Ejemplo n.º 3
0
 public ResidentMission(string id, string description, DateTime ddl_time, Resident resident)
 {
     ResidentMissionId = id;
     Description       = description;
     DDLTime           = ddl_time;
     Resident          = resident;
 }
Ejemplo n.º 4
0
 public Emergency(Resident res, string addr, string emergDetails, string notes) : this()
 {
     this.resident  = res;
     this.Address   = addr;
     this.Details   = emergDetails;
     this.RaiseTime = DateTime.Now;
     this.Notes     = notes;
 }
Ejemplo n.º 5
0
 public TravelRecord(string id, User user, Resident resident, string departure, string destination, DateTime dateLeave,
                     DateTime dateCome, string transport, string transportNumber, string remarks) : this()
 {
     TravelRecordId  = id;
     User            = user;
     Resident        = resident;
     Departure       = departure;
     Destination     = destination;
     DateLeave       = dateLeave;
     DateCome        = dateCome;
     Transport       = transport;
     TransportNumber = transportNumber;
     Remarks         = remarks;
 }
Ejemplo n.º 6
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            Resident resident = ResidentBindingSource.Current as Resident;

            if (resident == null)
            {
                MessageBox.Show("请选择一个家庭成员进行修改");
                return;
            }
            InformationEdit information = new InformationEdit(resident);

            if (information.ShowDialog() == DialogResult.OK)
            {
                ResidentBindingSource.ResetBindings(false);
            }
        }
Ejemplo n.º 7
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);
            }
        }
Ejemplo n.º 8
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);
            }
        }
Ejemplo n.º 9
0
 public InformationEdit(Resident resident) : this()
 {
     this.Resident = resident;
     this.ResidentBindingSource.DataSource = resident;
 }
Ejemplo n.º 10
0
 public HealthInformation(Resident resident) : this()
 {
     this.Resident = resident;
 }