/// <summary> /// 增加一条数据 /// </summary> public int Add(RuRo.Model.NormalLisReport model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into NormalLisReport("); strSql.Append("hospnum,patname,Sex,Age,age_month,ext_mthd,chinese,result,units,ref_flag,lowvalue,highvalue,print_ref,check_date,check_by_name,prnt_order,IsDel)"); strSql.Append(" values ("); strSql.Append("@hospnum,@patname,@Sex,@Age,@age_month,@ext_mthd,@chinese,@result,@units,@ref_flag,@lowvalue,@highvalue,@print_ref,@check_date,@check_by_name,@prnt_order,@IsDel)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@hospnum", SqlDbType.NVarChar, 50), new SqlParameter("@patname", SqlDbType.NVarChar, 50), new SqlParameter("@Sex", SqlDbType.NChar, 10), new SqlParameter("@Age", SqlDbType.NChar, 10), new SqlParameter("@age_month", SqlDbType.NChar, 10), new SqlParameter("@ext_mthd", SqlDbType.NVarChar, 50), new SqlParameter("@chinese", SqlDbType.NVarChar, 50), new SqlParameter("@result", SqlDbType.NVarChar), new SqlParameter("@units", SqlDbType.NChar, 10), new SqlParameter("@ref_flag", SqlDbType.NChar, 10), new SqlParameter("@lowvalue", SqlDbType.NVarChar, 50), new SqlParameter("@highvalue", SqlDbType.NVarChar, 50), new SqlParameter("@print_ref", SqlDbType.NVarChar, 50), new SqlParameter("@check_date", SqlDbType.NVarChar, 50), new SqlParameter("@check_by_name", SqlDbType.NVarChar, 50), new SqlParameter("@prnt_order", SqlDbType.NVarChar, 50), new SqlParameter("@IsDel", SqlDbType.Bit, 1) }; parameters[0].Value = model.hospnum; parameters[1].Value = model.patname; parameters[2].Value = model.Sex; parameters[3].Value = model.Age; parameters[4].Value = model.age_month; parameters[5].Value = model.ext_mthd; parameters[6].Value = model.chinese; parameters[7].Value = model.result; parameters[8].Value = model.units; parameters[9].Value = model.ref_flag; parameters[10].Value = model.lowvalue; parameters[11].Value = model.highvalue; parameters[12].Value = model.print_ref; parameters[13].Value = model.check_date; parameters[14].Value = model.check_by_name; parameters[15].Value = model.prnt_order; parameters[16].Value = model.IsDel; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
private void ShowInfo(int Id) { RuRo.BLL.NormalLisReport bll = new RuRo.BLL.NormalLisReport(); RuRo.Model.NormalLisReport model = bll.GetModel(Id); this.lblId.Text = model.Id.ToString(); this.lblhospnum.Text = model.hospnum; this.lblpatname.Text = model.patname; this.lblSex.Text = model.Sex; this.lblAge.Text = model.Age; this.lblage_month.Text = model.age_month; this.lblext_mthd.Text = model.ext_mthd; this.lblchinese.Text = model.chinese; this.lblresult.Text = model.result; this.lblunits.Text = model.units; this.lblref_flag.Text = model.ref_flag; this.lbllowvalue.Text = model.lowvalue; this.lblhighvalue.Text = model.highvalue; this.lblprint_ref.Text = model.print_ref; this.lblcheck_date.Text = model.check_date; this.lblcheck_by_name.Text = model.check_by_name; this.lblprnt_order.Text = model.prnt_order; this.lblIsDel.Text = model.IsDel?"是":"否"; }
private void ShowInfo(int Id) { RuRo.BLL.NormalLisReport bll = new RuRo.BLL.NormalLisReport(); RuRo.Model.NormalLisReport model = bll.GetModel(Id); this.lblId.Text = model.Id.ToString(); this.txthospnum.Text = model.hospnum; this.txtpatname.Text = model.patname; this.txtSex.Text = model.Sex; this.txtAge.Text = model.Age; this.txtage_month.Text = model.age_month; this.txtext_mthd.Text = model.ext_mthd; this.txtchinese.Text = model.chinese; this.txtresult.Text = model.result; this.txtunits.Text = model.units; this.txtref_flag.Text = model.ref_flag; this.txtlowvalue.Text = model.lowvalue; this.txthighvalue.Text = model.highvalue; this.txtprint_ref.Text = model.print_ref; this.txtcheck_date.Text = model.check_date; this.txtcheck_by_name.Text = model.check_by_name; this.txtprnt_order.Text = model.prnt_order; this.chkIsDel.Checked = model.IsDel; }
/// <summary> /// 得到一个对象实体 /// </summary> public RuRo.Model.NormalLisReport GetModel(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 Id,hospnum,patname,Sex,Age,age_month,ext_mthd,chinese,result,units,ref_flag,lowvalue,highvalue,print_ref,check_date,check_by_name,prnt_order,IsDel from NormalLisReport "); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = Id; RuRo.Model.NormalLisReport model = new RuRo.Model.NormalLisReport(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txthospnum.Text.Trim().Length == 0) { strErr += "病人门诊号、住院号不能为空!\\n"; } if (this.txtpatname.Text.Trim().Length == 0) { strErr += "姓名不能为空!\\n"; } if (this.txtSex.Text.Trim().Length == 0) { strErr += "性别不能为空!\\n"; } if (this.txtAge.Text.Trim().Length == 0) { strErr += "年龄不能为空!\\n"; } if (this.txtage_month.Text.Trim().Length == 0) { strErr += "月不能为空!\\n"; } if (this.txtext_mthd.Text.Trim().Length == 0) { strErr += "项目总称不能为空!\\n"; } if (this.txtchinese.Text.Trim().Length == 0) { strErr += "项目名称不能为空!\\n"; } if (this.txtresult.Text.Trim().Length == 0) { strErr += "结果不能为空!\\n"; } if (this.txtunits.Text.Trim().Length == 0) { strErr += "单位不能为空!\\n"; } if (this.txtref_flag.Text.Trim().Length == 0) { strErr += "高低 不能为空!\\n"; } if (this.txtlowvalue.Text.Trim().Length == 0) { strErr += "正常低值不能为空!\\n"; } if (this.txthighvalue.Text.Trim().Length == 0) { strErr += "正常高值不能为空!\\n"; } if (this.txtprint_ref.Text.Trim().Length == 0) { strErr += "正常范围不能为空!\\n"; } if (this.txtcheck_date.Text.Trim().Length == 0) { strErr += "批准时间不能为空!\\n"; } if (this.txtcheck_by_name.Text.Trim().Length == 0) { strErr += "批准人不能为空!\\n"; } if (this.txtprnt_order.Text.Trim().Length == 0) { strErr += "打印顺序序号不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int Id = int.Parse(this.lblId.Text); string hospnum = this.txthospnum.Text; string patname = this.txtpatname.Text; string Sex = this.txtSex.Text; string Age = this.txtAge.Text; string age_month = this.txtage_month.Text; string ext_mthd = this.txtext_mthd.Text; string chinese = this.txtchinese.Text; string result = this.txtresult.Text; string units = this.txtunits.Text; string ref_flag = this.txtref_flag.Text; string lowvalue = this.txtlowvalue.Text; string highvalue = this.txthighvalue.Text; string print_ref = this.txtprint_ref.Text; string check_date = this.txtcheck_date.Text; string check_by_name = this.txtcheck_by_name.Text; string prnt_order = this.txtprnt_order.Text; bool IsDel = this.chkIsDel.Checked; RuRo.Model.NormalLisReport model = new RuRo.Model.NormalLisReport(); model.Id = Id; model.hospnum = hospnum; model.patname = patname; model.Sex = Sex; model.Age = Age; model.age_month = age_month; model.ext_mthd = ext_mthd; model.chinese = chinese; model.result = result; model.units = units; model.ref_flag = ref_flag; model.lowvalue = lowvalue; model.highvalue = highvalue; model.print_ref = print_ref; model.check_date = check_date; model.check_by_name = check_by_name; model.prnt_order = prnt_order; model.IsDel = IsDel; RuRo.BLL.NormalLisReport bll = new RuRo.BLL.NormalLisReport(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(RuRo.Model.NormalLisReport model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(RuRo.Model.NormalLisReport model) { return(dal.Add(model)); }
protected void btnSave_Click(object sender, EventArgs e) { string strErr=""; if(this.txthospnum.Text.Trim().Length==0) { strErr+="病人门诊号、住院号不能为空!\\n"; } if(this.txtpatname.Text.Trim().Length==0) { strErr+="姓名不能为空!\\n"; } if(this.txtsex.Text.Trim().Length==0) { strErr+="性别不能为空!\\n"; } if(this.txtage.Text.Trim().Length==0) { strErr+="年龄不能为空!\\n"; } if(this.txtage_month.Text.Trim().Length==0) { strErr+="月不能为空!\\n"; } if(this.txtext_mthd.Text.Trim().Length==0) { strErr+="项目总称不能为空!\\n"; } if(this.txtchinese.Text.Trim().Length==0) { strErr+="项目名称不能为空!\\n"; } if(this.txtresult.Text.Trim().Length==0) { strErr+="结果不能为空!\\n"; } if(this.txtunits.Text.Trim().Length==0) { strErr+="单位不能为空!\\n"; } if(this.txtref_flag.Text.Trim().Length==0) { strErr+="高低 不能为空!\\n"; } if(this.txtlowvalue.Text.Trim().Length==0) { strErr+="正常低值不能为空!\\n"; } if(this.txthighvalue.Text.Trim().Length==0) { strErr+="正常高值不能为空!\\n"; } if(this.txtprint_ref.Text.Trim().Length==0) { strErr+="正常范围不能为空!\\n"; } if(this.txtcheck_date.Text.Trim().Length==0) { strErr+="批准时间不能为空!\\n"; } if(this.txtcheck_by_name.Text.Trim().Length==0) { strErr+="批准人不能为空!\\n"; } if(this.txtprnt_order.Text.Trim().Length==0) { strErr+="打印顺序序号不能为空!\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } string hospnum=this.txthospnum.Text; string patname=this.txtpatname.Text; string sex=this.txtsex.Text; string age=this.txtage.Text; string age_month=this.txtage_month.Text; string ext_mthd=this.txtext_mthd.Text; string chinese=this.txtchinese.Text; string result=this.txtresult.Text; string units=this.txtunits.Text; string ref_flag=this.txtref_flag.Text; string lowvalue=this.txtlowvalue.Text; string highvalue=this.txthighvalue.Text; string print_ref=this.txtprint_ref.Text; string check_date=this.txtcheck_date.Text; string check_by_name=this.txtcheck_by_name.Text; string prnt_order=this.txtprnt_order.Text; bool isDel=this.chkisDel.Checked; RuRo.Model.NormalLisReport model=new RuRo.Model.NormalLisReport(); model.hospnum=hospnum; model.patname=patname; model.sex=sex; model.age=age; model.age_month=age_month; model.ext_mthd=ext_mthd; model.chinese=chinese; model.result=result; model.units=units; model.ref_flag=ref_flag; model.lowvalue=lowvalue; model.highvalue=highvalue; model.print_ref=print_ref; model.check_date=check_date; model.check_by_name=check_by_name; model.prnt_order=prnt_order; model.isDel=isDel; RuRo.BLL.NormalLisReport bll=new RuRo.BLL.NormalLisReport(); bll.Add(model); RuRo.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx"); }
/// <summary> /// 得到一个对象实体 /// </summary> public RuRo.Model.NormalLisReport GetModel(int Id) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 Id,hospnum,patname,sex,age,age_month,ext_mthd,chinese,result,units,ref_flag,lowvalue,highvalue,print_ref,check_date,check_by_name,prnt_order,isDel from NormalLisReport "); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int,4) }; parameters[0].Value = Id; RuRo.Model.NormalLisReport model=new RuRo.Model.NormalLisReport(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }
/// <summary> /// 得到一个对象实体 /// </summary> public RuRo.Model.NormalLisReport DataRowToModel(DataRow row) { RuRo.Model.NormalLisReport model=new RuRo.Model.NormalLisReport(); if (row != null) { if(row["Id"]!=null && row["Id"].ToString()!="") { model.Id=int.Parse(row["Id"].ToString()); } if(row["hospnum"]!=null) { model.hospnum=row["hospnum"].ToString(); } if(row["patname"]!=null) { model.patname=row["patname"].ToString(); } if(row["sex"]!=null) { model.sex=row["sex"].ToString(); } if(row["age"]!=null) { model.age=row["age"].ToString(); } if(row["age_month"]!=null) { model.age_month=row["age_month"].ToString(); } if(row["ext_mthd"]!=null) { model.ext_mthd=row["ext_mthd"].ToString(); } if(row["chinese"]!=null) { model.chinese=row["chinese"].ToString(); } if(row["result"]!=null) { model.result=row["result"].ToString(); } if(row["units"]!=null) { model.units=row["units"].ToString(); } if(row["ref_flag"]!=null) { model.ref_flag=row["ref_flag"].ToString(); } if(row["lowvalue"]!=null) { model.lowvalue=row["lowvalue"].ToString(); } if(row["highvalue"]!=null) { model.highvalue=row["highvalue"].ToString(); } if(row["print_ref"]!=null) { model.print_ref=row["print_ref"].ToString(); } if(row["check_date"]!=null) { model.check_date=row["check_date"].ToString(); } if(row["check_by_name"]!=null) { model.check_by_name=row["check_by_name"].ToString(); } if(row["prnt_order"]!=null) { model.prnt_order=row["prnt_order"].ToString(); } if(row["isDel"]!=null && row["isDel"].ToString()!="") { if((row["isDel"].ToString()=="1")||(row["isDel"].ToString().ToLower()=="true")) { model.isDel=true; } else { model.isDel=false; } } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public RuRo.Model.NormalLisReport DataRowToModel(DataRow row) { RuRo.Model.NormalLisReport model = new RuRo.Model.NormalLisReport(); if (row != null) { if (row["Id"] != null && row["Id"].ToString() != "") { model.Id = int.Parse(row["Id"].ToString()); } if (row["hospnum"] != null) { model.hospnum = row["hospnum"].ToString(); } if (row["patname"] != null) { model.patname = row["patname"].ToString(); } if (row["Sex"] != null) { model.Sex = row["Sex"].ToString(); } if (row["Age"] != null) { model.Age = row["Age"].ToString(); } if (row["age_month"] != null) { model.age_month = row["age_month"].ToString(); } if (row["ext_mthd"] != null) { model.ext_mthd = row["ext_mthd"].ToString(); } if (row["chinese"] != null) { model.chinese = row["chinese"].ToString(); } if (row["result"] != null) { model.result = row["result"].ToString(); } if (row["units"] != null) { model.units = row["units"].ToString(); } if (row["ref_flag"] != null) { model.ref_flag = row["ref_flag"].ToString(); } if (row["lowvalue"] != null) { model.lowvalue = row["lowvalue"].ToString(); } if (row["highvalue"] != null) { model.highvalue = row["highvalue"].ToString(); } if (row["print_ref"] != null) { model.print_ref = row["print_ref"].ToString(); } if (row["check_date"] != null) { model.check_date = row["check_date"].ToString(); } if (row["check_by_name"] != null) { model.check_by_name = row["check_by_name"].ToString(); } if (row["prnt_order"] != null) { model.prnt_order = row["prnt_order"].ToString(); } if (row["IsDel"] != null && row["IsDel"].ToString() != "") { if ((row["IsDel"].ToString() == "1") || (row["IsDel"].ToString().ToLower() == "true")) { model.IsDel = true; } else { model.IsDel = false; } } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(RuRo.Model.NormalLisReport model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update NormalLisReport set "); strSql.Append("hospnum=@hospnum,"); strSql.Append("patname=@patname,"); strSql.Append("Sex=@Sex,"); strSql.Append("Age=@Age,"); strSql.Append("age_month=@age_month,"); strSql.Append("ext_mthd=@ext_mthd,"); strSql.Append("chinese=@chinese,"); strSql.Append("result=@result,"); strSql.Append("units=@units,"); strSql.Append("ref_flag=@ref_flag,"); strSql.Append("lowvalue=@lowvalue,"); strSql.Append("highvalue=@highvalue,"); strSql.Append("print_ref=@print_ref,"); strSql.Append("check_date=@check_date,"); strSql.Append("check_by_name=@check_by_name,"); strSql.Append("prnt_order=@prnt_order,"); strSql.Append("IsDel=@IsDel"); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@hospnum", SqlDbType.NVarChar, 50), new SqlParameter("@patname", SqlDbType.NVarChar, 50), new SqlParameter("@Sex", SqlDbType.NChar, 10), new SqlParameter("@Age", SqlDbType.NChar, 10), new SqlParameter("@age_month", SqlDbType.NChar, 10), new SqlParameter("@ext_mthd", SqlDbType.NVarChar, 50), new SqlParameter("@chinese", SqlDbType.NVarChar, 50), new SqlParameter("@result", SqlDbType.NVarChar), new SqlParameter("@units", SqlDbType.NChar, 10), new SqlParameter("@ref_flag", SqlDbType.NChar, 10), new SqlParameter("@lowvalue", SqlDbType.NVarChar, 50), new SqlParameter("@highvalue", SqlDbType.NVarChar, 50), new SqlParameter("@print_ref", SqlDbType.NVarChar, 50), new SqlParameter("@check_date", SqlDbType.NVarChar, 50), new SqlParameter("@check_by_name", SqlDbType.NVarChar, 50), new SqlParameter("@prnt_order", SqlDbType.NVarChar, 50), new SqlParameter("@IsDel", SqlDbType.Bit, 1), new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = model.hospnum; parameters[1].Value = model.patname; parameters[2].Value = model.Sex; parameters[3].Value = model.Age; parameters[4].Value = model.age_month; parameters[5].Value = model.ext_mthd; parameters[6].Value = model.chinese; parameters[7].Value = model.result; parameters[8].Value = model.units; parameters[9].Value = model.ref_flag; parameters[10].Value = model.lowvalue; parameters[11].Value = model.highvalue; parameters[12].Value = model.print_ref; parameters[13].Value = model.check_date; parameters[14].Value = model.check_by_name; parameters[15].Value = model.prnt_order; parameters[16].Value = model.IsDel; parameters[17].Value = model.Id; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }