public int InsertBarthelIndexList(DateTime measure_dt, int user_id, ref string mes) { if (IsInsertBarthelIndexList(user_id, measure_dt) == false) { mes = "すでにデータが存在しています"; return(0); } else { clsDataBase clsdb = new clsDataBase(main.GetConnectionString()); string sql = "insert into [kaigoryoku].[dbo].[T_BarthelIndexMeasurementList] "; sql = sql + "(measure_dt, barthel_list_id, riyousya_id) "; sql = sql + "values('" + measure_dt + "',(select case when max(barthel_list_id) is null then 1 else max(barthel_list_id) + 1 end "; sql = sql + "from [kaigoryoku].[dbo].[T_BarthelIndexMeasurementList]), " + user_id + ")"; clsdb.ExecuteSQL(sql); SqlDataReader reader = clsdb.GetReader("select barthel_list_id from [kaigoryoku].[dbo].[T_BarthelIndexMeasurementList] " + "where riyousya_id =" + user_id + " and measure_dt = '" + measure_dt + "'"); reader.Read(); int tmp_id = int.Parse(reader.GetValue(0).ToString()); clsdb.closedb(); return(tmp_id); } }
public void InsertBarthelIndexScore(int barthel_id, int index_id, int anser_id) { clsDataBase clsdb = new clsDataBase(main.GetConnectionString()); string sql = "insert into [kaigoryoku].[dbo].[T_BarthelIndexMeasurementScore] "; sql = sql + "(barthel_list_id , index_id , anser_id) "; sql = sql + "values(" + barthel_id + "," + index_id + "," + anser_id + " )"; clsdb.ExecuteSQL(sql); clsdb.closedb(); }
protected void bt_UpdateBaseUserInfo_Click(object sender, EventArgs e) { ListItem list = (ListItem)lb_searchedname.SelectedItem; int id = int.Parse(list.Value.ToString()); DateTime birth_dt = DateTime.Parse(this.TB_BirthDay.Text.ToString()); string location = this.TB_HeyaBan.Text.ToString(); clsDataBase clsdb = new clsDataBase(main.GetConnectionString()); string sql = string.Format("update [kaigoryoku].[dbo].[TM_Riyousya] " + "set birth_dt = '{0}' , location_ja = '{1}'" + "where riyousya_id = {2}", birth_dt, location, id); clsdb.ExecuteSQL(sql); clsdb.closedb(); WriteBaseUseInfo(id); this.CB_UnlockBaseUseInfo.Checked = true; lockBaseUserInfo(); }