/// <summary> /// 增加一条数据 /// </summary> public bool Add(RuRo.Model.PatientDiagnose model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into PatientDiagnose("); strSql.Append("Cardno,Csrq00,PatientName,Sex,Brithday,CardId,Tel,RegisterNo,Icd,Diagnose,Type,Flag,DiagnoseDate,IsDel)"); strSql.Append(" values ("); strSql.Append("@Cardno,@Csrq00,@PatientName,@Sex,@Brithday,@CardId,@Tel,@RegisterNo,@Icd,@Diagnose,@Type,@Flag,@DiagnoseDate,@IsDel)"); SqlParameter[] parameters = { new SqlParameter("@Cardno", SqlDbType.NVarChar, 50), new SqlParameter("@Csrq00", SqlDbType.NVarChar, 50), new SqlParameter("@PatientName", SqlDbType.NVarChar, 50), new SqlParameter("@Sex", SqlDbType.NChar, 10), new SqlParameter("@Brithday", SqlDbType.DateTime), new SqlParameter("@CardId", SqlDbType.NVarChar, 50), new SqlParameter("@Tel", SqlDbType.NVarChar, 50), new SqlParameter("@RegisterNo", SqlDbType.NVarChar, 50), new SqlParameter("@Icd", SqlDbType.NVarChar, 50), new SqlParameter("@Diagnose", SqlDbType.NVarChar, 50), new SqlParameter("@Type", SqlDbType.NVarChar, 50), new SqlParameter("@Flag", SqlDbType.NVarChar, 50), new SqlParameter("@DiagnoseDate", SqlDbType.NVarChar, 50), new SqlParameter("@IsDel", SqlDbType.Bit, 1) }; parameters[0].Value = model.Cardno; parameters[1].Value = model.Csrq00; parameters[2].Value = model.PatientName; parameters[3].Value = model.Sex; parameters[4].Value = model.Brithday; parameters[5].Value = model.CardId; parameters[6].Value = model.Tel; parameters[7].Value = model.RegisterNo; parameters[8].Value = model.Icd; parameters[9].Value = model.Diagnose; parameters[10].Value = model.Type; parameters[11].Value = model.Flag; parameters[12].Value = model.DiagnoseDate; parameters[13].Value = model.IsDel; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
private void ShowInfo(int id) { RuRo.BLL.PatientDiagnose bll = new RuRo.BLL.PatientDiagnose(); RuRo.Model.PatientDiagnose model = bll.GetModel(id); this.lblid.Text = model.id.ToString(); this.lblCardno.Text = model.Cardno; this.lblCsrq00.Text = model.Csrq00; this.lblPatientName.Text = model.PatientName; this.lblSex.Text = model.Sex; this.lblBrithday.Text = model.Brithday.ToString(); this.lblCardId.Text = model.CardId; this.lblTel.Text = model.Tel; this.lblRegisterNo.Text = model.RegisterNo; this.lblIcd.Text = model.Icd; this.lblDiagnose.Text = model.Diagnose; this.lblType.Text = model.Type; this.lblFlag.Text = model.Flag; this.lblDiagnoseDate.Text = model.DiagnoseDate; this.lblIsDel.Text = model.IsDel?"是":"否"; }
private void ShowInfo(int id) { RuRo.BLL.PatientDiagnose bll = new RuRo.BLL.PatientDiagnose(); RuRo.Model.PatientDiagnose model = bll.GetModel(id); this.lblid.Text = model.id.ToString(); this.txtCardno.Text = model.Cardno; this.txtCsrq00.Text = model.Csrq00; this.txtPatientName.Text = model.PatientName; this.txtSex.Text = model.Sex; this.txtBrithday.Text = model.Brithday.ToString(); this.txtCardId.Text = model.CardId; this.txtTel.Text = model.Tel; this.txtRegisterNo.Text = model.RegisterNo; this.txtIcd.Text = model.Icd; this.txtDiagnose.Text = model.Diagnose; this.txtType.Text = model.Type; this.txtFlag.Text = model.Flag; this.txtDiagnoseDate.Text = model.DiagnoseDate; this.chkIsDel.Checked = model.IsDel; }
/// <summary> /// 得到一个对象实体 /// </summary> public RuRo.Model.PatientDiagnose GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,Cardno,Csrq00,PatientName,Sex,Brithday,CardId,Tel,RegisterNo,Icd,Diagnose,Type,Flag,DiagnoseDate,IsDel from PatientDiagnose "); strSql.Append(" where id=@id "); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; RuRo.Model.PatientDiagnose model = new RuRo.Model.PatientDiagnose(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
protected void btnSave_Click(object sender, EventArgs e) { string strErr=""; if(!PageValidate.IsNumber(txtid.Text)) { strErr+="id格式错误!\\n"; } if(this.txtCardno.Text.Trim().Length==0) { strErr+="卡号不能为空!\\n"; } if(this.txtCsrq00.Text.Trim().Length==0) { strErr+="查询日期不能为空!\\n"; } if(this.txtPatientName.Text.Trim().Length==0) { strErr+="姓名不能为空!\\n"; } if(this.txtSex.Text.Trim().Length==0) { strErr+="性别不能为空!\\n"; } if(!PageValidate.IsDateTime(txtBrithday.Text)) { strErr+="出生日期格式错误!\\n"; } if(this.txtCardId.Text.Trim().Length==0) { strErr+="身份证号不能为空!\\n"; } if(this.txtTel.Text.Trim().Length==0) { strErr+="Tel不能为空!\\n"; } if(this.txtRegisterNo.Text.Trim().Length==0) { strErr+="RegisterNo不能为空!\\n"; } if(this.txtIcd.Text.Trim().Length==0) { strErr+="ICD码不能为空!\\n"; } if(this.txtDiagnose.Text.Trim().Length==0) { strErr+="诊断名称不能为空!\\n"; } if(this.txtType.Text.Trim().Length==0) { strErr+="诊断类型:1:中医疾病 2:中不能为空!\\n"; } if(this.txtFlag.Text.Trim().Length==0) { strErr+="诊断类别:1:西医诊断 2 中不能为空!\\n"; } if(this.txtDiagnoseDate.Text.Trim().Length==0) { strErr+="诊断日期不能为空!\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } int id=int.Parse(this.txtid.Text); string Cardno=this.txtCardno.Text; string Csrq00=this.txtCsrq00.Text; string PatientName=this.txtPatientName.Text; string Sex=this.txtSex.Text; DateTime Brithday=DateTime.Parse(this.txtBrithday.Text); string CardId=this.txtCardId.Text; string Tel=this.txtTel.Text; string RegisterNo=this.txtRegisterNo.Text; string Icd=this.txtIcd.Text; string Diagnose=this.txtDiagnose.Text; string Type=this.txtType.Text; string Flag=this.txtFlag.Text; string DiagnoseDate=this.txtDiagnoseDate.Text; bool isDel=this.chkisDel.Checked; RuRo.Model.PatientDiagnose model=new RuRo.Model.PatientDiagnose(); model.id=id; model.Cardno=Cardno; model.Csrq00=Csrq00; model.PatientName=PatientName; model.Sex=Sex; model.Brithday=Brithday; model.CardId=CardId; model.Tel=Tel; model.RegisterNo=RegisterNo; model.Icd=Icd; model.Diagnose=Diagnose; model.Type=Type; model.Flag=Flag; model.DiagnoseDate=DiagnoseDate; model.isDel=isDel; RuRo.BLL.PatientDiagnose bll=new RuRo.BLL.PatientDiagnose(); bll.Add(model); RuRo.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx"); }
/// <summary> /// 得到一个对象实体 /// </summary> public RuRo.Model.PatientDiagnose GetModel(int id) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 id,Cardno,Csrq00,PatientName,Sex,Brithday,CardId,Tel,RegisterNo,Icd,Diagnose,Type,Flag,DiagnoseDate,isDel from PatientDiagnose "); strSql.Append(" where id=@id "); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int,4) }; parameters[0].Value = id; RuRo.Model.PatientDiagnose model=new RuRo.Model.PatientDiagnose(); 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.PatientDiagnose DataRowToModel(DataRow row) { RuRo.Model.PatientDiagnose model=new RuRo.Model.PatientDiagnose(); if (row != null) { if(row["id"]!=null && row["id"].ToString()!="") { model.id=int.Parse(row["id"].ToString()); } if(row["Cardno"]!=null) { model.Cardno=row["Cardno"].ToString(); } if(row["Csrq00"]!=null) { model.Csrq00=row["Csrq00"].ToString(); } if(row["PatientName"]!=null) { model.PatientName=row["PatientName"].ToString(); } if(row["Sex"]!=null) { model.Sex=row["Sex"].ToString(); } if(row["Brithday"]!=null && row["Brithday"].ToString()!="") { model.Brithday=DateTime.Parse(row["Brithday"].ToString()); } if(row["CardId"]!=null) { model.CardId=row["CardId"].ToString(); } if(row["Tel"]!=null) { model.Tel=row["Tel"].ToString(); } if(row["RegisterNo"]!=null) { model.RegisterNo=row["RegisterNo"].ToString(); } if(row["Icd"]!=null) { model.Icd=row["Icd"].ToString(); } if(row["Diagnose"]!=null) { model.Diagnose=row["Diagnose"].ToString(); } if(row["Type"]!=null) { model.Type=row["Type"].ToString(); } if(row["Flag"]!=null) { model.Flag=row["Flag"].ToString(); } if(row["DiagnoseDate"]!=null) { model.DiagnoseDate=row["DiagnoseDate"].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.PatientDiagnose model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(RuRo.Model.PatientDiagnose model) { return(dal.Add(model)); }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtCardno.Text.Trim().Length == 0) { strErr += "卡号不能为空!\\n"; } if (this.txtCsrq00.Text.Trim().Length == 0) { strErr += "查询日期不能为空!\\n"; } if (this.txtPatientName.Text.Trim().Length == 0) { strErr += "姓名不能为空!\\n"; } if (this.txtSex.Text.Trim().Length == 0) { strErr += "性别不能为空!\\n"; } if (!PageValidate.IsDateTime(txtBrithday.Text)) { strErr += "出生日期格式错误!\\n"; } if (this.txtCardId.Text.Trim().Length == 0) { strErr += "身份证号不能为空!\\n"; } if (this.txtTel.Text.Trim().Length == 0) { strErr += "Tel不能为空!\\n"; } if (this.txtRegisterNo.Text.Trim().Length == 0) { strErr += "RegisterNo不能为空!\\n"; } if (this.txtIcd.Text.Trim().Length == 0) { strErr += "ICD码不能为空!\\n"; } if (this.txtDiagnose.Text.Trim().Length == 0) { strErr += "诊断名称不能为空!\\n"; } if (this.txtType.Text.Trim().Length == 0) { strErr += "诊断类型:1:中医疾病 2:中不能为空!\\n"; } if (this.txtFlag.Text.Trim().Length == 0) { strErr += "诊断类别:1:西医诊断 2 中不能为空!\\n"; } if (this.txtDiagnoseDate.Text.Trim().Length == 0) { strErr += "诊断日期不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int id = int.Parse(this.lblid.Text); string Cardno = this.txtCardno.Text; string Csrq00 = this.txtCsrq00.Text; string PatientName = this.txtPatientName.Text; string Sex = this.txtSex.Text; DateTime Brithday = DateTime.Parse(this.txtBrithday.Text); string CardId = this.txtCardId.Text; string Tel = this.txtTel.Text; string RegisterNo = this.txtRegisterNo.Text; string Icd = this.txtIcd.Text; string Diagnose = this.txtDiagnose.Text; string Type = this.txtType.Text; string Flag = this.txtFlag.Text; string DiagnoseDate = this.txtDiagnoseDate.Text; bool IsDel = this.chkIsDel.Checked; RuRo.Model.PatientDiagnose model = new RuRo.Model.PatientDiagnose(); model.id = id; model.Cardno = Cardno; model.Csrq00 = Csrq00; model.PatientName = PatientName; model.Sex = Sex; model.Brithday = Brithday; model.CardId = CardId; model.Tel = Tel; model.RegisterNo = RegisterNo; model.Icd = Icd; model.Diagnose = Diagnose; model.Type = Type; model.Flag = Flag; model.DiagnoseDate = DiagnoseDate; model.IsDel = IsDel; RuRo.BLL.PatientDiagnose bll = new RuRo.BLL.PatientDiagnose(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
/// <summary> /// 得到一个对象实体 /// </summary> public RuRo.Model.PatientDiagnose DataRowToModel(DataRow row) { RuRo.Model.PatientDiagnose model = new RuRo.Model.PatientDiagnose(); if (row != null) { if (row["id"] != null && row["id"].ToString() != "") { model.id = int.Parse(row["id"].ToString()); } if (row["Cardno"] != null) { model.Cardno = row["Cardno"].ToString(); } if (row["Csrq00"] != null) { model.Csrq00 = row["Csrq00"].ToString(); } if (row["PatientName"] != null) { model.PatientName = row["PatientName"].ToString(); } if (row["Sex"] != null) { model.Sex = row["Sex"].ToString(); } if (row["Brithday"] != null && row["Brithday"].ToString() != "") { model.Brithday = DateTime.Parse(row["Brithday"].ToString()); } if (row["CardId"] != null) { model.CardId = row["CardId"].ToString(); } if (row["Tel"] != null) { model.Tel = row["Tel"].ToString(); } if (row["RegisterNo"] != null) { model.RegisterNo = row["RegisterNo"].ToString(); } if (row["Icd"] != null) { model.Icd = row["Icd"].ToString(); } if (row["Diagnose"] != null) { model.Diagnose = row["Diagnose"].ToString(); } if (row["Type"] != null) { model.Type = row["Type"].ToString(); } if (row["Flag"] != null) { model.Flag = row["Flag"].ToString(); } if (row["DiagnoseDate"] != null) { model.DiagnoseDate = row["DiagnoseDate"].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.PatientDiagnose model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update PatientDiagnose set "); strSql.Append("Cardno=@Cardno,"); strSql.Append("Csrq00=@Csrq00,"); strSql.Append("PatientName=@PatientName,"); strSql.Append("Sex=@Sex,"); strSql.Append("Brithday=@Brithday,"); strSql.Append("CardId=@CardId,"); strSql.Append("Tel=@Tel,"); strSql.Append("RegisterNo=@RegisterNo,"); strSql.Append("Icd=@Icd,"); strSql.Append("Diagnose=@Diagnose,"); strSql.Append("Type=@Type,"); strSql.Append("Flag=@Flag,"); strSql.Append("DiagnoseDate=@DiagnoseDate,"); strSql.Append("IsDel=@IsDel"); strSql.Append(" where id=@id "); SqlParameter[] parameters = { new SqlParameter("@Cardno", SqlDbType.NVarChar, 50), new SqlParameter("@Csrq00", SqlDbType.NVarChar, 50), new SqlParameter("@PatientName", SqlDbType.NVarChar, 50), new SqlParameter("@Sex", SqlDbType.NChar, 10), new SqlParameter("@Brithday", SqlDbType.DateTime), new SqlParameter("@CardId", SqlDbType.NVarChar, 50), new SqlParameter("@Tel", SqlDbType.NVarChar, 50), new SqlParameter("@RegisterNo", SqlDbType.NVarChar, 50), new SqlParameter("@Icd", SqlDbType.NVarChar, 50), new SqlParameter("@Diagnose", SqlDbType.NVarChar, 50), new SqlParameter("@Type", SqlDbType.NVarChar, 50), new SqlParameter("@Flag", SqlDbType.NVarChar, 50), new SqlParameter("@DiagnoseDate", SqlDbType.NVarChar, 50), new SqlParameter("@IsDel", SqlDbType.Bit, 1), new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = model.Cardno; parameters[1].Value = model.Csrq00; parameters[2].Value = model.PatientName; parameters[3].Value = model.Sex; parameters[4].Value = model.Brithday; parameters[5].Value = model.CardId; parameters[6].Value = model.Tel; parameters[7].Value = model.RegisterNo; parameters[8].Value = model.Icd; parameters[9].Value = model.Diagnose; parameters[10].Value = model.Type; parameters[11].Value = model.Flag; parameters[12].Value = model.DiagnoseDate; parameters[13].Value = model.IsDel; parameters[14].Value = model.id; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }