public string update(string Patient_id, string disease, string doctor_id, string a, string b, string c) { string s = ""; try { HospitalManagementEntity context = new HospitalManagementEntity(); Patient_record u = context.Patient_record.Find(Convert.ToInt32(Patient_id)); u.disease = disease; int id = Convert.ToInt32(doctor_id); User sUser = context.Users.Find(id); if (sUser == null) { return("Invalide Doctor Id "); } u.Doctor_id = Convert.ToInt32(doctor_id); u.Description = a; u.Appoinment_id = Convert.ToInt32(b); //u.Discharge_date = c; context.Entry(u).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); s = "Update Successfull"; return(s); } catch (Exception e) { return("Id's Can't be Updated"); } }
public string update(string Apppoinment_id, string patient_name, string a, string b, string c, string doc_id) { try { HospitalManagementEntity context = new HospitalManagementEntity(); Patient_Appoinment u = context.Patient_Appoinment.Find(Convert.ToInt32(Apppoinment_id)); u.Patient_name = patient_name; u.Appoinment_date = Convert.ToDateTime(a); int id = Convert.ToInt32(doc_id); User s = context.Users.Find(id); if (s == null) { return("Invalide Doctor Id "); } u.Doctor_id = Convert.ToInt32(doc_id); u.Address = b; u.Mobile_no = c; context.Entry(u).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); return("Updation Successfull"); } catch (Exception e) { return("Can't Update Id's"); } }
public string insert() { try { HospitalManagementEntity context = new HospitalManagementEntity(); Patient_Appoinment appo = new Patient_Appoinment(); appo.Address = address; appo.Appoinment_date = date2; if (doc_id == "") { return("Doctor id must be Required"); } int id = Convert.ToInt32(doc_id); User s = context.Users.Find(id); if (s == null) { return("Doctor Id Invalide"); } appo.Doctor_id = Convert.ToInt32(doc_id); appo.Start_date = date1; appo.Mobile_no = mobile; appo.Patient_name = name; context.Patient_Appoinment.Add(appo); context.SaveChanges(); return("Appointment Recorded"); } catch (Exception e) { return("Doctor Id Must Be Integer"); } }
public string insert() { try { HospitalManagementEntity context = new HospitalManagementEntity(); Patient_record p = new Patient_record(); p.Description = description; if (disease == "") { return("Disease Name Must Be Required"); } p.disease = disease; p.Discharge_date = date1; int id = Convert.ToInt32(UserAuthentication.Id); User sUser = context.Users.Find(id); if (sUser == null) { return("Invalide Doctor Id "); } p.Doctor_id = UserAuthentication.Id; p.Appoinment_id = 1007; context.Patient_record.Add(p); context.SaveChanges(); return("Patient Recored Inserted Successfully"); } catch (Exception e) { return("Disease Name Must Be Required"); } }
public string delete(string username, string password) { try { HospitalManagementEntity context = new HospitalManagementEntity(); context.Users.Remove(context.Users.Where(x => x.Username == username && x.Password == password).FirstOrDefault()); context.SaveChanges(); return("Deletion Successfull"); } catch (Exception eq) { return("User Still Have Clients Frist Remove Clients"); } }
public string delete(string appoinmentid) { try { int id = Convert.ToInt32(appoinmentid); HospitalManagementEntity context = new HospitalManagementEntity(); context.Patient_Appoinment.Remove(context.Patient_Appoinment.Where(x => x.Appoinment_Id == id).FirstOrDefault()); context.SaveChanges(); return("Deletion Successfull"); } catch (Exception e) { return("Can't Remove With This Id"); } }
public string delete(string patientid) { try { int id = Convert.ToInt32(patientid); HospitalManagementEntity context = new HospitalManagementEntity(); context.Medicine_details.Remove(context.Medicine_details.Where(x => x.Medicine_Id == id).FirstOrDefault()); context.SaveChanges(); return "Deletion Successfull"; } catch (Exception e) { return "Can't Record With This ID"; } }
public string update(string id, string username, string password) { try { HospitalManagementEntity context = new HospitalManagementEntity(); User u = context.Users.Find(Convert.ToInt32(id)); u.Username = username; u.Password = password; context.Entry(u).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); return("Updation Successfull"); } catch (Exception e) { return("Can't Update Id's"); } }
public string delete(string patientid) { string s = ""; try { int id = Convert.ToInt32(patientid); HospitalManagementEntity context = new HospitalManagementEntity(); context.Patient_record.Remove(context.Patient_record.Where(x => x.Patient_Id == id).FirstOrDefault()); context.SaveChanges(); s = "Deletion Success"; } catch (Exception e) { return("Can't Remove Record, Id's Invalide"); } return(s); }
public string insert() { try { HospitalManagementEntity context = new HospitalManagementEntity(); Medicine_details m = new Medicine_details(); m.Name = name; m.price = price; m.Quantity = quantity; m.Mfg_date = date1; m.Expiry_date = date2; context.Medicine_details.Add(m); context.SaveChanges(); return m.Medicine_Id.ToString(); } catch (Exception e) { return "All Values are required"; } }
public string Register() { try { HospitalManagementEntity context = new HospitalManagementEntity(); User s = context.Users.FirstOrDefault(x => x.Username == this.username && x.Password == this.password); if (s != null) { return("Username and Password Already Exist"); } User user = new User(); user.Password = this.password; user.Username = this.username; user.Designation = this.designation; context.Users.Add(user); context.SaveChanges(); return("Registration Successfull for Username : "******"Invalide Input"); } }
public string update(string Patient_id, string name, string price, string e_date, string m_date, string quantity) { try { HospitalManagementEntity context = new HospitalManagementEntity(); Medicine_details u = context.Medicine_details.Find(Convert.ToInt32(Patient_id)); u.Mfg_date = Convert.ToDateTime( m_date); u.Medicine_Id = Convert.ToInt32(Patient_id); u.Name = name; u.Expiry_date = Convert.ToDateTime(e_date); u.price = Convert.ToInt32(price); u.Quantity = Convert.ToInt32(quantity); context.Entry(u).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); return "Updation Successfull"; } catch (Exception e) { return "Can't Update Record Id's"; } }