public static List<EmployeeType> GetAll() { using (HMSDBEntities context = new HMSDBEntities()) { return context.EmployeeTypes.AsEnumerable().ToList(); } }
public static List<DoctorName> GetName() { var specializationlist = new string[] { "Consultant Gen/Laproscopic Surgeon", "General Physician", "Obstetrician & Gynecologist", "Pediatrician", "Consultant Physician", "Ortho", "ENT Surgeon", "Physiotherapist" }; DoctorName doctorname ; List<DoctorName> doctornamelist = new List<DoctorName>(); using (HMSDBEntities context = new HMSDBEntities()) { var doctorlist = context.Doctors.Include("EmployeeDetail").Where(d => specializationlist.Contains(d.Specialization.Name)).AsQueryable(); foreach (var item in doctorlist) { doctorname = new DoctorName(); doctorname.ID = item.ID; doctorname.Name = item.EmployeeDetail.FirstName + " " + item.EmployeeDetail.LastName; doctornamelist.Add(doctorname); } } return doctornamelist; }
public static List<DoctorName> GetLabDoctor() { var specializationlist = new string[] { "Pathologist", "Bio Chemistry" }; DoctorName doctorname; List<DoctorName> doctornamelist = new List<DoctorName>(); using (HMSDBEntities context = new HMSDBEntities()) { var doctorlist = context.Doctors.Include("EmployeeDetail").Where(d => specializationlist.Contains(d.Specialization.Name)).AsQueryable(); foreach (var item in doctorlist) { doctorname = new DoctorName(); doctorname.ID = item.ID; doctorname.Name = item.EmployeeDetail.FirstName + " " + item.EmployeeDetail.LastName; doctornamelist.Add(doctorname); } } return doctornamelist; }
public ActionResult AssignValueinReport(int id) { DataTable dtbranchdetails = new DataTable(); DataTable dtpatientvisit = new DataTable(); using (HMSDBEntities context = new HMSDBEntities()) { var branchdetails = context.sp_BranchDetails(1); var patientvisit = context.sp_GetReceipt(id); dtbranchdetails = ExtensionMethods.ConvertToDataTable(branchdetails); dtpatientvisit = ExtensionMethods.ConvertToDataTable(patientvisit); ReportClass rptH = new ReportClass(); //rptH.FileName = Server.MapPath("~/Content/cr_RegReceipt.rpt"); rptH.FileName = @"C:/Users/tanmay/Documents/GitHub/HMSApp/HospitalManagement/HospitalManagement/Content/cr_RegReceipt.rpt"; rptH.Load(); rptH.Subreports["cr_BranchDetails.rpt"].SetDataSource(dtbranchdetails);//datasource for subreport rptH.SetDataSource(dtpatientvisit);//Mainreport datasourcc Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return File(stream, "application/pdf"); } }
public async Task<ActionResult> Register(RegisterViewModel model) { model.EmpDetails.CreatedDate = DateTime.Now; if (model.EmpDetails.EmployeeType_ID != 2) { if (ModelState.ContainsKey("Doctor.Qualification")) { ModelState["Doctor.Qualification"].Errors.Clear(); } if (ModelState.ContainsKey("Doctor.SpecializationDetails")) { ModelState["Doctor.SpecializationDetails"].Errors.Clear(); } if (ModelState.ContainsKey("Doctor.OtherDetails")) { ModelState["Doctor.OtherDetails"].Errors.Clear(); } if (ModelState.ContainsKey("Doctor.RegistrationNo")) { ModelState["Doctor.RegistrationNo"].Errors.Clear(); } if (ModelState.ContainsKey("Shift")) { ModelState["Shift"].Errors.Clear(); } } if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.UserName, Email = model.EmailAddress}; try { using (HMSDBEntities context = new HMSDBEntities()) { EmployeeDetail newEmp = model.EmpDetails; if (model.EmpDetails.EmployeeType_ID == 2) { try { //ShiftType shift = context.ShiftTypes.Find(model.Shift); Doctor doctor = model.Doctor; doctor.CreatedOn = DateTime.Now; doctor.CreatedBy = 1; doctor.UpdatedBy = 1; doctor.UpdatedOn = DateTime.Now; doctor.ShiftTypes = new List<ShiftType>(); //doctor.ShiftTypes.Add(shift); //shift.Doctors.Add(doctor); context.EmployeeDetails.Add(newEmp); newEmp.Doctors.Add(doctor); context.SaveChanges(); } catch (Exception ex) { string exceptionmessage = ex.Message; ViewBag.BranchID = new SelectList(db.BranchDetails, "ID", "Name"); ViewBag.EmployeeTypeID = new SelectList(db.EmployeeTypes, "ID", "Description"); ViewBag.TitleID = new SelectList(db.Titles, "ID", "Name"); ViewBag.ShiftTypes = new SelectList(db.ShiftTypes, "ID", "Name"); ViewBag.States = new SelectList(db.States, "ID", "Name"); return View(model); } } else { context.EmployeeDetails.Add(newEmp); context.SaveChanges(); } user.HMSEmpID = newEmp.ID; user.BranchID = Convert.ToInt32(model.EmpDetails.BranchDetail_ID); var result1 = await UserManager.CreateAsync(user, model.Password); if (result1.Succeeded) { return RedirectToAction("EmpDetails", "Account"); } else { context.EmployeeDetails.Remove(newEmp); context.SaveChanges(); AddErrors(result1); } } } catch (Exception ex) { throw ex; } } // If we got this far, something failed, redisplay form ViewBag.BranchID = new SelectList(db.BranchDetails, "ID", "Name"); ViewBag.EmployeeTypeID = new SelectList(db.EmployeeTypes, "ID", "Description"); ViewBag.TitleID = new SelectList(db.Titles, "ID", "Name"); ViewBag.ShiftTypes = new SelectList(db.ShiftTypes, "ID", "Name"); ViewBag.States = new SelectList(db.States, "ID", "Name"); return View(model); }