//insert public static bool InsertIntoPatient(Patient p) { string sqlInsert = @"insert into patient values( @patientName,@age,@sex,@idCard_Num,@in_HospitalNum,@major_Doctor, @main_Symptom,@phone_Num,@in_Date )"; MySqlParameter[] paramArray = new MySqlParameter[] { new MySqlParameter("@patientname", p.PatientName), new MySqlParameter("@age", p.Age), new MySqlParameter("@sex", p.Sex), new MySqlParameter("@idCard_Num", p.IdCard_Num), new MySqlParameter("@in_HospitalNum", p.In_HospitalNum), new MySqlParameter("@major_Doctor", p.Major_Doctor), new MySqlParameter("@main_Symptom", p.Main_Symptom), new MySqlParameter("@phone_Num", p.Phone_Num), new MySqlParameter("@in_Date", p.In_Date) }; if (DBOper.ExecuteCommand(sqlInsert, paramArray) == 1) { return(true); } else { return(false); } }
public static bool UpdatePatient(Patient p) { string sqlUpdate = @"Update Patient set age=@age, sex=@sex,idcard_num=@idCard_Num,in_hospitalnum=@in_HospitalNum, major_doctor=@major_Doctor, main_symptom=@main_Symptom, phone_num=@phone_Num, in_date=@in_Date where PatientName=@patientName "; MySqlParameter[] param = new MySqlParameter[] { new MySqlParameter("@age", p.Age), new MySqlParameter("@sex", p.Sex), new MySqlParameter("@idCard_Num", p.IdCard_Num), new MySqlParameter("@in_HospitalNum", p.In_HospitalNum), new MySqlParameter("@major_Doctor", p.Major_Doctor), new MySqlParameter("@main_Symptom", p.Main_Symptom), new MySqlParameter("@phone_Num", p.Phone_Num), new MySqlParameter("@in_Date", p.In_Date) }; MySqlParameter pIn = new MySqlParameter("@patientName", p.PatientName); if (DBOper.ExecuteCommand(sqlUpdate, pIn, param) == 1) { return(true); } else { return(false); } }
public static bool InsertCheckOutRoomInfo(CheckOutRoom checkOutRoomInfo) { string sqlInsert = @"insert into checkout values(@outId,@inId,@outTime,@roomId,@clientName,@inTime,@price,@foregift,@account,@note,@oper)"; string sqlUpdateRegister = "update checkin set delMark=1 where inId=@inId"; string sqlUpdateRoom = "update room set inPerson=0 where roomId=@roomId"; MySqlParameter p1 = new MySqlParameter("@outId", checkOutRoomInfo.OutId); MySqlParameter p2 = new MySqlParameter("@inId", checkOutRoomInfo.InId); MySqlParameter p3 = new MySqlParameter("@roomId", checkOutRoomInfo.RoomId); MySqlParameter p4 = new MySqlParameter("@price", checkOutRoomInfo.Price.ToString()); MySqlParameter p5 = new MySqlParameter("@foregift", checkOutRoomInfo.Foregift.ToString()); MySqlParameter p6 = new MySqlParameter("@total", checkOutRoomInfo.Total.ToString()); MySqlParameter p7 = new MySqlParameter("@account", checkOutRoomInfo.Account.ToString()); MySqlParameter p8 = new MySqlParameter("@inTime", checkOutRoomInfo.InTime); MySqlParameter p9 = new MySqlParameter("@outTime", checkOutRoomInfo.OutTime); MySqlParameter p10 = new MySqlParameter("@clientName", checkOutRoomInfo.ClietnName); MySqlParameter p11 = new MySqlParameter("@oper", checkOutRoomInfo.Oper); MySqlParameter p12 = new MySqlParameter("@note", checkOutRoomInfo.Note); MySqlParameter[] paramArray = new MySqlParameter[] { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12 }; MySqlParameter n1 = new MySqlParameter("@inId", checkOutRoomInfo.InId); MySqlParameter n2 = new MySqlParameter("@roomId", checkOutRoomInfo.RoomId); if (DBOper.ExecuteCommand(sqlInsert, paramArray) == 1 && DBOper.ExecuteCommand(sqlUpdateRegister, n1) == 1 && DBOper.ExecuteCommand(sqlUpdateRoom, n2) == 1) { return(true); } else { return(false); } }
public static bool InsertRoomInfo(CheckInRoom registerRoomInfo) { string sqlInsert = @"insert into checkin values(null,@roomId,@price,@foregift,@inTime,@outTime,@clientName, @sex,@phone,@cerType,@certId,@address,@personNum,@Oper,@deMark)"; MySqlParameter p1 = new MySqlParameter("@roomId", registerRoomInfo.RoomId); MySqlParameter p2 = new MySqlParameter("@price", registerRoomInfo.Price); MySqlParameter p3 = new MySqlParameter("@foregift", registerRoomInfo.Foregift); MySqlParameter p4 = new MySqlParameter("@inTime", registerRoomInfo.InTime); MySqlParameter p5 = new MySqlParameter("@outTime", registerRoomInfo.OutTime); MySqlParameter p6 = new MySqlParameter("@clientName", registerRoomInfo.ClientName); MySqlParameter p7 = new MySqlParameter("@sex", registerRoomInfo.Sex); MySqlParameter p8 = new MySqlParameter("@phone", registerRoomInfo.Phone); MySqlParameter p9 = new MySqlParameter("@certType", registerRoomInfo.CertType); MySqlParameter p10 = new MySqlParameter("@certId", registerRoomInfo.CertId); MySqlParameter p11 = new MySqlParameter("@address", registerRoomInfo.Address); MySqlParameter p12 = new MySqlParameter("@personNum", registerRoomInfo.PersonNum); MySqlParameter p13 = new MySqlParameter("@Oper", registerRoomInfo.Oper); MySqlParameter p14 = new MySqlParameter("@delMark", registerRoomInfo.DelMark); MySqlParameter[] paramArray = new MySqlParameter[] { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14 }; string sqlUpdate = "update room set inPerson=@inPerson where roomId=@roomId"; MySqlParameter n1 = new MySqlParameter("@roomId", registerRoomInfo.RoomId); MySqlParameter n2 = new MySqlParameter("@inPerson", registerRoomInfo.PersonNum); if (DBOper.ExecuteCommand(sqlInsert, paramArray) == 1 && DBOper.ExecuteCommand(sqlInsert, n1, n2) == 1) { return(true); } else { return(false); } }
public static bool DeletePatient(Patient p) { string sqlDelete = @"Delete from Patient where patientname=@patientName"; MySqlParameter parameter = new MySqlParameter("@patientName", p.PatientName); if (DBOper.ExecuteCommand(sqlDelete, parameter) == 1) { return(true); } else { return(false); } }
public static bool DeleteTableInfo(Room room) { string sqlDelete = @"Delete from Room WHERE patientName=@patientName"; MySqlParameter parameter = new MySqlParameter("@patientName", room.PatientName); if (DBOper.ExecuteCommand(sqlDelete, parameter) == 1) { return(true); } else { return(false); } }
public static bool DeleteInfo_CommonGood(CommonGood cg) { string sqlDelete = @" Delete from CommonGood where good_Num=@good_Num "; MySqlParameter parameter = new MySqlParameter("@good_Num", cg.Good_Num); if (DBOper.ExecuteCommand(sqlDelete, parameter) == 1) { return(true); } else { return(false); } }
public static bool AddUser(User user) { string sql = "insert into user values(@name,@pwd,@role)"; MySqlParameter p1 = new MySqlParameter("@name", user.Name); MySqlParameter p2 = new MySqlParameter("@pwd", user.Pwd); MySqlParameter p3 = new MySqlParameter("@role", user.Role); if (DBOper.ExecuteCommand(sql, p1, p2, p3) == 1) { return(true); } else { return(false); } }
public static bool UpdateInfo_CommonGood(CommonGood cg) { string sqlUpdate = @" Update CommonGood set user_name=@user_Name, status_G=@status_G, where good_Num=@good_Num "; MySqlParameter p = new MySqlParameter("@good_Num", cg.Good_Num); if (DBOper.ExecuteCommand(sqlUpdate, p) == 1) { return(true); } else { return(false); } }
public static bool InsertInfo_CommonGood(CommonGood cg) { string sqlInsert = @" INSERT INTO COMMONGOOD VALUES(@goodName,@status_G,@good_Num,@user_Name,@cost) "; MySqlParameter[] pArray = new MySqlParameter[] { new MySqlParameter("@goodName", cg.GoodName), new MySqlParameter("@status_G", cg.Status_G), new MySqlParameter("@good_Num", cg.GoodName), new MySqlParameter("@user_Name", cg.User_Name), new MySqlParameter("@cost", cg.Cost) }; if (DBOper.ExecuteCommand(sqlInsert, pArray) == 1) { return(true); } else { return(false); } }
public static bool InsertRoom(Room r) { string sqlInsert = @"INSERT INTO ROOM VALUES(@room_Num,@bed_Num,@patientRoom, @sex,@status_R,@administratorOffice"; MySqlParameter[] paramArray = new MySqlParameter[] { new MySqlParameter("@room_Num", r.Room_Num), new MySqlParameter("@bed_Num", r.Bed_Num), new MySqlParameter("@patientRoom", r.PatientName), new MySqlParameter("@sex", r.Sex), new MySqlParameter("@status_R", r.Status_R), new MySqlParameter("@administratorOffice", r.AdministratorOffice) }; if (DBOper.ExecuteCommand(sqlInsert, paramArray) == 1) { return(true); } else { return(false); } }
public static bool UpdateRoom(Room room) { string sqlUpdate = @"Update Room set PatientName=@patientName, Sex=@sex, Status_R=@status_R WHERE Room_Num=@room_Num and Bed_Num=@bed_Num"; MySqlParameter[] parameters = new MySqlParameter[] { new MySqlParameter("@patientName", room.PatientName), new MySqlParameter("@sex", room.Sex), new MySqlParameter("@status_R", room.Status_R), new MySqlParameter("@room_Num", room.Room_Num), new MySqlParameter("@bed_Num", room.Bed_Num) }; if (DBOper.ExecuteCommand(sqlUpdate, parameters) == 1) { return(true); } else { return(false); } }
public static bool UpdateRegister(CheckInRoom registerRoomInfo) { string sqlUpdateRegister = @"update checkin set clientName=@clientName,sex=@sex,phone=@phone,certType=@certType,certId=@certId, address=@address,personNum=@personNum where inId=@inId"; MySqlParameter p1 = new MySqlParameter("@clientName", registerRoomInfo.ClientName); MySqlParameter p2 = new MySqlParameter("@clientName", registerRoomInfo.Sex); MySqlParameter p3 = new MySqlParameter("@clientName", registerRoomInfo.Phone); MySqlParameter p4 = new MySqlParameter("@clientName", registerRoomInfo.CertType); MySqlParameter p5 = new MySqlParameter("@clientName", registerRoomInfo.CertId); MySqlParameter p6 = new MySqlParameter("@clientName", registerRoomInfo.Address); MySqlParameter p7 = new MySqlParameter("@clientName", registerRoomInfo.PersonNum); MySqlParameter p8 = new MySqlParameter("@clientName", registerRoomInfo.InId); MySqlParameter[] paramArray = new MySqlParameter[] { p1, p2, p3, p4, p5, p6, p7, p8 }; if (DBOper.ExecuteCommand(sqlUpdateRegister, paramArray) == 1) { return(true); } else { return(false); } }