public static ZhuyuanModel GetZhuyuanInfoById(int t_zhuyuan_id) { string sqlString = "select * from [t_zhuyuan] where t_zhuyuan_id=" + t_zhuyuan_id; DataBase db = new DataBase(); DataSet ds = db.GetDataSet(sqlString); ZhuyuanModel zhuyuanModel = null; if (ds.Tables[0].Rows.Count > 0) { zhuyuanModel = new ZhuyuanModel(); DataRow dr = ds.Tables[0].Rows[0]; zhuyuanModel.setT_zhuyuan_id(t_zhuyuan_id); zhuyuanModel.setName(dr["name"].ToString()); zhuyuanModel.setSex(dr["sex"].ToString()); zhuyuanModel.setAge(Convert.ToInt32(dr["age"])); zhuyuanModel.setRoomNo(dr["roomNo"].ToString()); zhuyuanModel.setArriveTime(Convert.ToDateTime(dr["arriveTime"])); zhuyuanModel.setIsLeave(Convert.ToInt32(dr["isLeave"])); zhuyuanModel.setLeaveTime(Convert.ToDateTime(dr["leaveTime"])); zhuyuanModel.setMoney(Convert.ToSingle(dr["money"])); zhuyuanModel.setCheckinOperator(dr["checkinOperator"].ToString()); zhuyuanModel.setCheckoutOperator(dr["checkoutOperator"].ToString()); } return(zhuyuanModel); }
protected void Btn_GuaHao_Click(object sender, EventArgs e) { string name = this.Name.Text; string sex = this.Sex.SelectedValue; int age = Int32.Parse(this.Age.Text); string roomNo = this.RoomNo.Text; ZhuyuanModel zhuyuanModel = new ZhuyuanModel(); zhuyuanModel.setName(name); zhuyuanModel.setSex(sex); zhuyuanModel.setAge(age); zhuyuanModel.setRoomNo(roomNo); zhuyuanModel.setCheckinOperator(Session["username"].ToString()); ZhuyuanLogic zhuyuanLogic = new ZhuyuanLogic(); if (zhuyuanLogic.AddZhuyuanInfo(zhuyuanModel)) { Response.Write("<script>alert('病人住院信息登记成功!');location.href='PatientSignIn.aspx';</script>"); } }