public ActionResult Main(int id, string password) { var d = new List <PatientInfo>(); string doctorname; SQLHandle sqlhandle = new SQLHandle(); IUser user = sqlhandle; doctorname = user.GetUser(id, password).Rows[0][1].ToString(); ViewData["id"] = id; ViewData["password"] = password; ViewData["key"] = doctorname; for (int i = 0; i < user.GetAllPatient(doctorname).Rows.Count; i++) { var patientinfo = new PatientInfo(); patientinfo.id = Convert.ToInt32(user.GetAllPatient(doctorname).Rows[i][0].ToString()); patientinfo.name = user.GetAllPatient(doctorname).Rows[i][1].ToString(); patientinfo.sex = user.GetAllPatient(doctorname).Rows[i][2].ToString(); patientinfo.age = user.GetAllPatient(doctorname).Rows[i][3].ToString(); patientinfo.department = user.GetAllPatient(doctorname).Rows[i][4].ToString(); d.Add(patientinfo); } ViewBag.msg = d; return(View()); }
// GET: UserAjax /// <summary> /// 登录 /// 1:登录成功 /// 0:登录失败 /// </summary> /// <param name="id"></param> /// <param name="password"></param> /// <returns></returns> public ActionResult Login(int id, string password) { SQLHandle sqlhandle = new SQLHandle(); IUser user = sqlhandle; if (user.GetUser(id, password).Rows.Count == 0) { return(Content("0")); } return(Content("1")); }
public ActionResult Delete(int id) { SQLHandle sqlhandle = new SQLHandle(); IUser user = sqlhandle; //if (user.DeletePatient(id)) if (id != 100) { return(Content("删除成功")); } return(Content("删除失败")); }
public ActionResult Search(string name) { var patientinfo = new PatientInfo(); var d = new List <PatientInfo>(); SQLHandle sqlhandle = new SQLHandle(); IUser user = sqlhandle; if (user.GetPatient(name).Rows.Count == 0) { return(Content("0")); } return(Content("1")); }
public ActionResult Edit(int id) { ViewData["key"] = id; SQLHandle sqlhandle = new SQLHandle(); IUser user = sqlhandle; user.GetPatientID(id); ViewData["name"] = user.GetPatientID(id).Rows[0][0].ToString(); ViewData["sex"] = user.GetPatientID(id).Rows[0][1].ToString(); ViewData["age"] = user.GetPatientID(id).Rows[0][2].ToString(); ViewData["department"] = user.GetPatientID(id).Rows[0][3].ToString(); return(View()); }
public ActionResult Add(int id, string name, string sex, string age) { var patientinfo = new PatientInfo(); patientinfo.id = id; patientinfo.name = name; patientinfo.sex = sex; patientinfo.age = age; patientinfo.department = "11"; SQLHandle sqlhandle = new SQLHandle(); IUser user = sqlhandle; if (user.AddPatient(patientinfo)) { return(Content("1")); } return(Content("0")); }
public ActionResult Search(string name) { var patientinfo = new PatientInfo(); var d = new List <PatientInfo>(); SQLHandle sqlhandle = new SQLHandle(); IUser user = sqlhandle; user.GetPatient(name); patientinfo.name = name; patientinfo.id = Convert.ToInt32(user.GetPatient(name).Rows[0][0].ToString()); patientinfo.sex = user.GetPatient(name).Rows[0][2].ToString(); patientinfo.age = user.GetPatient(name).Rows[0][3].ToString(); patientinfo.department = user.GetPatient(name).Rows[0][4].ToString(); d.Add(patientinfo); ViewBag.msg = d; return(View()); }