/// <summary> /// 插入新配置的床位信息,覆盖上次的信息 /// </summary> /// <param name="objBedConfigInfo"></param> /// <returns></returns> public int InsertBedInfo(BedConfigInfo objBedConfigInfo) { string sql = "update BedConfig set Bedcount='{0}', Bedrows='{1}' where Bedflag=1"; sql = string.Format(sql, objBedConfigInfo.Bedcount, objBedConfigInfo.Bedrows); return(SQLiteHelper.Update(sql)); }
/// <summary> /// 添加床位信息 /// </summary> public int addBedcount(BedConfigInfo objBedConfigInfo) { string sql = "insert into BedConfig(Bedcount,Bedrows)values({0},{1})"; sql = string.Format(sql, objBedConfigInfo.Bedcount, objBedConfigInfo.Bedrows); try { return(SQLHelper.Update(sql)); } catch (Exception ex) { SQLiteHelper.WriteLog(" public int addBedcount(BedConfigInfo objBedConfigInfo)", ex.Message); throw new Exception("添加数据出错!" + ex.Message); } }
/// 获取上次设置的床位信息 /// </summary> /// <param name="Bedflag"></param> /// <returns></returns> public BedConfigInfo GetBedInfoByBedflag(int Bedflag) { string sql = "select Bedcount,Bedrows from BedConfig where Bedflag={0}"; sql = string.Format(sql, Bedflag); SQLiteDataReader objReader = SQLiteHelper.GetReader(sql); BedConfigInfo objBedConfigInfo = null; if (objReader.Read()) { objBedConfigInfo = new BedConfigInfo() { Bedcount = Convert.ToInt32(objReader["Bedcount"]), Bedrows = Convert.ToInt32(objReader["Bedrows"]) }; } objReader.Close(); return(objBedConfigInfo); }
/// <summary> /// 添加床位 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_setbednum_Click(object sender, EventArgs e) { int x, y; if (this.numdown_bedcount.Text == "" || this.numdown_rowcount.Text == "") { MessageBox.Show("请输入正确的信息!", "系统提示"); return; } if (this.radall.Checked == false && this.radpart.Checked == false) { MessageBox.Show("请选择一种模式!", "系统提示"); return; } x = Convert.ToInt32(this.numdown_bedcount.Text.Trim()); y = Convert.ToInt32(this.numdown_rowcount.Text.Trim()); BedConfigInfo objBedConfigInfo = new BedConfigInfo() { Bedcount = x, Bedrows = y }; objBedConfigInfoService.InsertBedInfo(objBedConfigInfo); if (this.radpart.Checked == true) { objShowInfoService.SetShowInfo(0); Setpartbed(); MessageBox.Show("设置成功!", "系统提示!"); } if (addblock != null & this.radall.Checked == true) { objShowInfoService.SetShowInfo(1); //addblock(x, y); Setpartbed(); MessageBox.Show("设置成功!", "系统提示!"); } else { return; } }