/// <summary> /// 更新一条数据 /// </summary> public bool Update(Maticsoft.Model.record_FollowUp model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update record_FollowUp set "); strSql.Append("F_PatientID=@F_PatientID,"); strSql.Append("F_Type=@F_Type,"); strSql.Append("F_Date=@F_Date,"); strSql.Append("F_Status=@F_Status"); strSql.Append(" where FollowUpID=@FollowUpID"); SqlParameter[] parameters = { new SqlParameter("@F_PatientID", SqlDbType.Int, 4), new SqlParameter("@F_Type", SqlDbType.TinyInt, 1), new SqlParameter("@F_Date", SqlDbType.DateTime), new SqlParameter("@F_Status", SqlDbType.TinyInt, 1), new SqlParameter("@FollowUpID", SqlDbType.Int, 4) }; parameters[0].Value = model.F_PatientID; parameters[1].Value = model.F_Type; parameters[2].Value = model.F_Date; parameters[3].Value = model.F_Status; parameters[4].Value = model.FollowUpID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.record_FollowUp DataRowToModel(DataRow row) { Maticsoft.Model.record_FollowUp model = new Maticsoft.Model.record_FollowUp(); if (row != null) { if (row["FollowUpID"] != null && row["FollowUpID"].ToString() != "") { model.FollowUpID = int.Parse(row["FollowUpID"].ToString()); } if (row["F_PatientID"] != null && row["F_PatientID"].ToString() != "") { model.F_PatientID = int.Parse(row["F_PatientID"].ToString()); } if (row["F_Type"] != null && row["F_Type"].ToString() != "") { model.F_Type = int.Parse(row["F_Type"].ToString()); } if (row["F_Date"] != null && row["F_Date"].ToString() != "") { model.F_Date = DateTime.Parse(row["F_Date"].ToString()); } if (row["F_Status"] != null && row["F_Status"].ToString() != "") { model.F_Status = int.Parse(row["F_Status"].ToString()); } } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Maticsoft.Model.record_FollowUp model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into record_FollowUp("); strSql.Append("F_PatientID,F_Type,F_Date,F_Status)"); strSql.Append(" values ("); strSql.Append("@F_PatientID,@F_Type,@F_Date,@F_Status)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@F_PatientID", SqlDbType.Int, 4), new SqlParameter("@F_Type", SqlDbType.TinyInt, 1), new SqlParameter("@F_Date", SqlDbType.DateTime), new SqlParameter("@F_Status", SqlDbType.TinyInt, 1) }; parameters[0].Value = model.F_PatientID; parameters[1].Value = model.F_Type; parameters[2].Value = model.F_Date; parameters[3].Value = model.F_Status; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.record_FollowUp DataRowToModel(DataRow row) { Maticsoft.Model.record_FollowUp model=new Maticsoft.Model.record_FollowUp(); if (row != null) { if(row["FollowUpID"]!=null && row["FollowUpID"].ToString()!="") { model.FollowUpID=int.Parse(row["FollowUpID"].ToString()); } if(row["F_PatientID"]!=null && row["F_PatientID"].ToString()!="") { model.F_PatientID=int.Parse(row["F_PatientID"].ToString()); } if(row["F_Type"]!=null && row["F_Type"].ToString()!="") { model.F_Type=int.Parse(row["F_Type"].ToString()); } if(row["F_Date"]!=null && row["F_Date"].ToString()!="") { model.F_Date=DateTime.Parse(row["F_Date"].ToString()); } if(row["F_Status"]!=null && row["F_Status"].ToString()!="") { model.F_Status=int.Parse(row["F_Status"].ToString()); } } return model; }
/// <summary> /// 点击确定按钮执行的方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { Maticsoft.BLL.record_FollowUp record_FollowUp_bll = new Maticsoft.BLL.record_FollowUp(); Maticsoft.Model.record_FollowUp record_FollowUp_model = record_FollowUp_bll.GetModel(FollowUpID); if (record_FollowUp_model == null) { record_FollowUp_model = new Maticsoft.Model.record_FollowUp(); } record_FollowUp_model.F_PatientID = (int)Common.sink(this.F_PatientID.UniqueID, MethodType.Post, 255, 0, DataType.Int); record_FollowUp_model.F_Type = Convert.ToInt32(F_Type.SelectedValue); record_FollowUp_model.F_Date = (DateTime)Common.sink(this.F_Date.UniqueID, MethodType.Post, 255, 0, DataType.Dat); record_FollowUp_model.F_Status = Convert.ToInt32(F_Status.SelectedValue); record_FollowUp_model.F_Doctor = UserData.GetUserDate.UserID; switch (CMD) { case "New": CMD_Txt = "增加"; //如果是增加操作,就调用Add方法 record_FollowUp_model.FollowUpID = record_FollowUp_bll.Add(record_FollowUp_model); break; case "Edit": CMD_Txt = "修改"; //如果是修改操作,就调用Update方法 record_FollowUp_bll.Update(record_FollowUp_model); break; } All_Title_Txt = CMD_Txt + App_Txt; //以下方法的第4个参数需要更改 EventMessage.MessageBox(1, "操作成功", string.Format("{1}ID({0})成功!", record_FollowUp_model.FollowUpID, All_Title_Txt), Icon_Type.OK, Common.GetHomeBaseUrl("default.aspx")); }
private void ShowInfo(int FollowUpID) { Maticsoft.BLL.record_FollowUp bll = new Maticsoft.BLL.record_FollowUp(); Maticsoft.Model.record_FollowUp model = bll.GetModel(FollowUpID); this.lblFollowUpID.Text = model.FollowUpID.ToString(); this.lblF_PatientID.Text = model.F_PatientID.ToString(); this.lblF_Type.Text = model.F_Type.ToString(); this.lblF_Date.Text = model.F_Date.ToString(); this.lblF_Status.Text = model.F_Status.ToString(); }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtF_PatientID.Text)) { strErr += "病人ID格式错误!\\n"; } if (!PageValidate.IsNumber(txtF_Type.Text)) { strErr += "随访类型格式错误!\\n"; } if (!PageValidate.IsDateTime(txtF_Date.Text)) { strErr += "下次随访日期格式错误!\\n"; } if (!PageValidate.IsNumber(txtF_Status.Text)) { strErr += "随访状态 1:为完成格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int FollowUpID = int.Parse(this.lblFollowUpID.Text); int F_PatientID = int.Parse(this.txtF_PatientID.Text); int F_Type = int.Parse(this.txtF_Type.Text); DateTime F_Date = DateTime.Parse(this.txtF_Date.Text); int F_Status = int.Parse(this.txtF_Status.Text); Maticsoft.Model.record_FollowUp model = new Maticsoft.Model.record_FollowUp(); model.FollowUpID = FollowUpID; model.F_PatientID = F_PatientID; model.F_Type = F_Type; model.F_Date = F_Date; model.F_Status = F_Status; Maticsoft.BLL.record_FollowUp bll = new Maticsoft.BLL.record_FollowUp(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
public void btnSave_Click(object sender, EventArgs e) { string strErr=""; if(!PageValidate.IsNumber(txtF_PatientID.Text)) { strErr+="病人ID格式错误!\\n"; } if(!PageValidate.IsNumber(txtF_Type.Text)) { strErr+="随访类型格式错误!\\n"; } if(!PageValidate.IsDateTime(txtF_Date.Text)) { strErr+="下次随访日期格式错误!\\n"; } if(!PageValidate.IsNumber(txtF_Status.Text)) { strErr+="随访状态 1:为完成格式错误!\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } int FollowUpID=int.Parse(this.lblFollowUpID.Text); int F_PatientID=int.Parse(this.txtF_PatientID.Text); int F_Type=int.Parse(this.txtF_Type.Text); DateTime F_Date=DateTime.Parse(this.txtF_Date.Text); int F_Status=int.Parse(this.txtF_Status.Text); Maticsoft.Model.record_FollowUp model=new Maticsoft.Model.record_FollowUp(); model.FollowUpID=FollowUpID; model.F_PatientID=F_PatientID; model.F_Type=F_Type; model.F_Date=F_Date; model.F_Status=F_Status; Maticsoft.BLL.record_FollowUp bll=new Maticsoft.BLL.record_FollowUp(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx"); }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.record_FollowUp GetModel(int FollowUpID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 FollowUpID,F_PatientID,F_Type,F_Date,F_Status from record_FollowUp "); strSql.Append(" where FollowUpID=@FollowUpID"); SqlParameter[] parameters = { new SqlParameter("@FollowUpID", SqlDbType.Int, 4) }; parameters[0].Value = FollowUpID; Maticsoft.Model.record_FollowUp model = new Maticsoft.Model.record_FollowUp(); 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 Maticsoft.Model.record_FollowUp GetModel(int FollowUpID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 FollowUpID,F_PatientID,F_Type,F_Date,F_Status from record_FollowUp "); strSql.Append(" where FollowUpID=@FollowUpID"); SqlParameter[] parameters = { new SqlParameter("@FollowUpID", SqlDbType.Int,4) }; parameters[0].Value = FollowUpID; Maticsoft.Model.record_FollowUp model=new Maticsoft.Model.record_FollowUp(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }