public bool Create(DoctorDetailModel model) { try { bool isSaved = false; //if (!IsExist(model)) //{ using (var db = new HMSEntities()) { DoctorDetail entity = new DoctorDetail(); entity.FullName = model.FullName; entity.Address = model.Address; entity.Gender = model.Gender; entity.PhoneNumber = model.PhoneNumber; entity.MobileNumber = model.MobileNumber; entity.Age = model.Age; entity.IsInHouse = model.IsInHouse; entity.IsCounsalting = model.IsCounsalting; entity.Qualification = model.Qualification; entity.ClinicName = model.ClinicName; entity.ClinicContact = model.ClinicContact; entity.IsActive = true; entity.IsDeleted = false; entity.CreatedOn = DateTime.Now; entity.CreatedBy = UserDetailSession.Id; db.DoctorDetails.Add(entity); db.SaveChanges(); isSaved = true; } // } return(isSaved); } catch (Exception ex) { throw ex; } }
private void FillFormData(Guid?id) { try { DoctorDetailModel model = service.GetById(id.Value); if (model != null) { DoctorDetails frm = new DoctorDetails(model.Id); if (model.FullName.ToUpper() == "SIR" || model.FullName.ToUpper() == "MADAM") { frm.txtFullName.ReadOnly = true; } frm.txtFullName.Text = model.FullName; frm.txtAddress.Text = model.Address; frm.txtMobileNumber.Text = model.MobileNumber; frm.txtPhoneNumber.Text = model.PhoneNumber; frm.txtQualification.Text = model.Qualification; frm.txtClinic.Text = model.ClinicName; frm.txtClinicContact.Text = model.ClinicContact; frm.txtAge.Text = Convert.ToString(model.Age); frm.chkConsultant.Checked = model.IsCounsalting.HasValue ? model.IsCounsalting.Value : false; frm.chkInHouse.Checked = model.IsInHouse.HasValue ? model.IsInHouse.Value : false; setGender(ref frm, model.Gender.Value); frm.ShowDialog(); if (isSubmited) { Search(); } isSubmited = false; } } catch (Exception ex) { isSubmited = false; Utility.ErrorLog.Logging("Doctor List", ex.Message.ToString(), ex.StackTrace.ToString()); } }
public DoctorDetailModel GetByParentId(Guid id) { try { DoctorDetailModel model = new DoctorDetailModel(); using (var db = new HMSEntities()) { DoctorDetail entity = db.DoctorDetails.FirstOrDefault(); if (entity != null) { model.Id = entity.Id; model.FullName = entity.FullName; model.Address = entity.Address; model.Gender = entity.Gender; model.PhoneNumber = entity.PhoneNumber; model.MobileNumber = entity.MobileNumber; model.Age = entity.Age; model.IsInHouse = entity.IsInHouse; model.IsCounsalting = entity.IsCounsalting; model.Qualification = entity.Qualification; model.ClinicName = entity.ClinicName; model.ClinicContact = entity.ClinicContact; model.IsActive = entity.IsActive; model.IsDeleted = entity.IsDeleted; model.CreatedOn = entity.CreatedOn; model.CreatedBy = entity.CreatedBy; model.ModifiedOn = entity.ModifiedOn; model.ModifiedBy = entity.ModifiedBy; } } return(model); } catch (Exception ex) { throw ex; } }