Beispiel #1
0
        public async Task <OfficeEntity> Update(OfficeEntity entity)
        {
            var update = context.Offices.Update(entity);
            await context.SaveChangesAsync();

            return(update.Entity);
        }
        public async Task <OfficeEntity> Update(OfficeEntity entity)
        {
            var updateEntity = _coworkingDbContext.Offices.Update(entity);
            await _coworkingDbContext.SaveChangesAsync();

            return(updateEntity.Entity);
        }
Beispiel #3
0
        public async Task <OfficeEntity> Add(OfficeEntity element)
        {
            await context.Offices.AddAsync(element);

            await context.SaveChangesAsync();

            return(element);
        }
        public async Task <OfficeEntity> Add(OfficeEntity entity)
        {
            await _coworkingDbContext.Offices.AddAsync(entity);

            await _coworkingDbContext.SaveChangesAsync();

            return(entity);
        }
        public async Task <OfficeEntity> Update(int idEntity, OfficeEntity updateEntity)
        {
            var entity = await Get(idEntity);

            entity.Name = updateEntity.Name;

            _coworkingDbContext.Offices.Update(entity);
            await _coworkingDbContext.SaveChangesAsync();

            return(entity);
        }
Beispiel #6
0
        public async Task <OfficeEntity> Update(int idEntity, OfficeEntity updateEnt)
        {
            var entity = await Get(idEntity);

            entity.NumberWorkSpaces = updateEnt.NumberWorkSpaces;

            _coworkingDBContext.Offices.Update(entity);

            await _coworkingDBContext.SaveChangesAsync();

            return(entity);
        }
Beispiel #7
0
        public async Task <OfficeEntity> UpdateAsync(int id, OfficeEntity element)
        {
            var entity = await Get(id);

            entity.Name = element.Name;


            var update = context.Offices.Update(entity);
            await context.SaveChangesAsync();


            return(update.Entity);
        }
        public OfficeEntity GetOffice()
        {
            object obj = cmbOffices.SelectedValue;

            if (obj == null)
            {
                return(null);
            }
            string       ofid = obj.ToString();
            OfficeEntity of   = _offices.Find((i) => { return(i.officeId == ofid); });

            return(of);
        }
Beispiel #9
0
 /// <summary>
 /// Creates an office
 /// </summary>
 /// <param name="office"></param>
 /// <returns></returns>
 public int CreateOffice(Office office)
 {
     using (var scope = new TransactionScope())
     {
         var newOffice = new OfficeEntity()
         {
             Name = office.Name
         };
         _unitOfWork.OfficeRepository.Insert(newOffice);
         _unitOfWork.Save();
         scope.Complete();
         return(newOffice.Id);
     }
 }
        private void btnGo_Click(object sender, EventArgs e)
        {
            Hospital     selectedHospital = _hoctl.GetHosptial();
            OfficeEntity selectedOffice   = _hoctl.GetOffice();

            if (selectedHospital == null || selectedOffice == null)
            {
                _hoctl.SetMsg("请选择登录院区和科室!");
                return;
            }
            if (SelectHospital != null)
            {
                SelectHospital(new HospitalEventArgs(selectedHospital, selectedOffice));
            }
        }
Beispiel #11
0
 public static Office Map(OfficeEntity dto)
 {
     return(new Office
     {
         Id = dto.Id,
         Name = dto.Name,
         Acctive = dto.Acctive,
         Address = dto.Address,
         City = dto.City,
         HasIndividualWorkSpace = dto.HasIndividualWorkSpace,
         IdAdmin = dto.IdAdmin,
         NumberWorSpace = dto.NumberWorSpace,
         Phone = dto.Phone,
         PriceWorKpaceDay = dto.PriceWorKpaceDay,
         PriceWorkSpaceMonth = dto.PriceWorkSpaceMonth
     });
 }
Beispiel #12
0
 public static Office Map(OfficeEntity entity)
 {
     return(new Office()
     {
         Active = entity.Active,
         Address = entity.Address,
         City = entity.City,
         HasIndividualWorkSpace = entity.HasIndividualWorkSpace,
         Id = entity.Id,
         IdAdmin = entity.IdAdmin,
         Name = entity.Name,
         NumberWorkSpaces = entity.NumberWorkSpaces,
         Phone = entity.Phone,
         PriceWorkSpaceDaily = entity.PriceWorkSpaceDaily,
         PriceWorkSpaceMonthly = entity.PriceWorkSpaceMonthly
     });
 }
        public void SetHospitalsOffices(UserEntity user)
        {
            panel1.Controls.Clear();
            _hoctl = new SelectHospitalOfficeControl(user.Hospitals, user.Offices);
            _hoctl.EnterEventHandler += _hoctl_EnterEventHandler;
            _hoctl.Dock = DockStyle.Fill;
            panel1.Controls.Add(_hoctl);
            _hoctl.SetValue(user.PreviousOffice.hospitalId, user.PreviousOffice.officeId);

            if (user.Hospitals.Count == 1 && user.Offices.Count == 1)
            {
                if (SelectHospital != null)
                {
                    Hospital     hp = user.Hospitals[0];
                    OfficeEntity of = user.Offices[0];
                    user.CurrentHospital = hp;
                    user.CurrentOffice   = of;
                    SelectHospital(new HospitalEventArgs(hp, of));
                    return;
                }
            }
            else if (user.AutoLogin == true)
            {
                OfficeEntity of = user.Offices.Find((i) => { return(i.officeId == user.CurrentOffice.officeId); });
                Hospital     hp = user.Hospitals.Find((i) => { return(i.hospitalId == user.CurrentHospital.hospitalId); });

                if (SelectHospital != null && hp != null && of != null)
                {
                    user.CurrentHospital = hp;
                    user.CurrentOffice   = of;
                    SelectHospital(new HospitalEventArgs(hp, of));
                    return;
                }
            }

            _hoctl.SetFocus();
        }