Esempio n. 1
0
 private void autoCompleteDocName_SelectedValueChanged(object sender, object e)
 {
     try
     {
         trn_avia_med_cert mc = bsAviationCert.OfType <trn_avia_med_cert>().FirstOrDefault();
         if (mc != null)
         {
             if (e == null)
             {
                 mc.tamc_doctor_code    = null;
                 mc.tamc_doctor_name    = null;
                 txtDoctorPosition.Text = null;
             }
             else
             {
                 mc.tamc_doctor_code = ((Doctor)e).username;
                 mc.tamc_doctor_name = ((Doctor)e).fullname;
                 DoctorPosition dp = GetDoctorPosition(((Doctor)e).mut_id);
                 txtDoctorPosition.Text = dp.DP_Description;
             }
         }
     }
     catch (Exception ex)
     {
         Program.MessageError(this.Name, "autoCompleteDocName_SelectedValueChanged", ex, false);
     }
 }
Esempio n. 2
0
        public async Task <IActionResult> EditPosition(long id, long positionId, DoctorPosition position)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (!await _positionRepository.Exists(positionId) || position.DoctorId != id)
            {
                return(BadRequest());
            }

            return(Ok(await _positionRepository.Put(position)));
        }
Esempio n. 3
0
        public async Task <IActionResult> AddPosition(long id, DoctorPosition position)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (await _positionRepository.Exists(position) is DoctorPosition)
            {
                return(BadRequest());
            }

            position.DoctorId = id;

            return(Ok(await _positionRepository.Post(position)));
        }
Esempio n. 4
0
        private DoctorPosition GetDoctorPosition(int id)
        {
            DoctorPosition doc = new DoctorPosition();

            try
            {
                using (InhCheckupDataContext dbc = new InhCheckupDataContext())
                {
                    DoctorPosition lstDoc = dbc.mst_user_aviations.Where(x => x.mua_active == true && x.mut_id == id)
                                            .Select(x => new DoctorPosition
                    {
                        DP_ID          = x.mua_id,
                        DP_Description = (x.mua_position).Replace(char.ConvertFromUtf32(10), Environment.NewLine),
                        DP_CreateDate  = (DateTime)x.mua_create_date,
                        DP_CreateBy    = x.mua_create_by
                    }).FirstOrDefault();
                    doc = lstDoc;
                }
                return(doc);
            }
            catch
            { return(doc); }
        }