Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.record_Medication model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update record_Medication set ");
            strSql.Append("M_ConsultationID=@M_ConsultationID,");
            strSql.Append("M_StartDate=@M_StartDate,");
            strSql.Append("M_Status=@M_Status");
            strSql.Append(" where MedicationID=@MedicationID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@M_ConsultationID", SqlDbType.Int,       4),
                new SqlParameter("@M_StartDate",      SqlDbType.DateTime),
                new SqlParameter("@M_Status",         SqlDbType.TinyInt,   1),
                new SqlParameter("@MedicationID",     SqlDbType.Int, 4)
            };
            parameters[0].Value = model.M_ConsultationID;
            parameters[1].Value = model.M_StartDate;
            parameters[2].Value = model.M_Status;
            parameters[3].Value = model.MedicationID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.record_Medication model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into record_Medication(");
            strSql.Append("MedicationID,M_ConsultationID,M_StartDate,M_Status)");
            strSql.Append(" values (");
            strSql.Append("@MedicationID,@M_ConsultationID,@M_StartDate,@M_Status)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MedicationID",     SqlDbType.Int,       4),
                new SqlParameter("@M_ConsultationID", SqlDbType.Int,       4),
                new SqlParameter("@M_StartDate",      SqlDbType.DateTime),
                new SqlParameter("@M_Status",         SqlDbType.TinyInt, 1)
            };
            parameters[0].Value = model.MedicationID;
            parameters[1].Value = model.M_ConsultationID;
            parameters[2].Value = model.M_StartDate;
            parameters[3].Value = model.M_Status;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
 private void ShowInfo(int MedicationID)
 {
     Maticsoft.BLL.record_Medication   bll   = new Maticsoft.BLL.record_Medication();
     Maticsoft.Model.record_Medication model = bll.GetModel(MedicationID);
     this.lblMedicationID.Text     = model.MedicationID.ToString();
     this.txtM_ConsultationID.Text = model.M_ConsultationID.ToString();
     this.txtM_StartDate.Text      = model.M_StartDate.ToString();
     this.txtM_Status.Text         = model.M_Status.ToString();
 }
Ejemplo n.º 4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtMedicationID.Text))
            {
                strErr += "用药ID格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtM_ConsultationID.Text))
            {
                strErr += "会诊流水号格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtM_StartDate.Text))
            {
                strErr += "用药开始日期格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtM_Status.Text))
            {
                strErr += "用药状态格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      MedicationID     = int.Parse(this.txtMedicationID.Text);
            int      M_ConsultationID = int.Parse(this.txtM_ConsultationID.Text);
            DateTime M_StartDate      = DateTime.Parse(this.txtM_StartDate.Text);
            int      M_Status         = int.Parse(this.txtM_Status.Text);

            Maticsoft.Model.record_Medication model = new Maticsoft.Model.record_Medication();
            model.MedicationID     = MedicationID;
            model.M_ConsultationID = M_ConsultationID;
            model.M_StartDate      = M_StartDate;
            model.M_Status         = M_Status;

            Maticsoft.BLL.record_Medication bll = new Maticsoft.BLL.record_Medication();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Ejemplo n.º 5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(!PageValidate.IsNumber(txtMedicationID.Text))
            {
                strErr+="用药ID格式错误!\\n";
            }
            if(!PageValidate.IsNumber(txtM_ConsultationID.Text))
            {
                strErr+="会诊流水号格式错误!\\n";
            }
            if(!PageValidate.IsDateTime(txtM_StartDate.Text))
            {
                strErr+="用药开始日期格式错误!\\n";
            }
            if(!PageValidate.IsNumber(txtM_Status.Text))
            {
                strErr+="用药状态格式错误!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int MedicationID=int.Parse(this.txtMedicationID.Text);
            int M_ConsultationID=int.Parse(this.txtM_ConsultationID.Text);
            DateTime M_StartDate=DateTime.Parse(this.txtM_StartDate.Text);
            int M_Status=int.Parse(this.txtM_Status.Text);

            Maticsoft.Model.record_Medication model=new Maticsoft.Model.record_Medication();
            model.MedicationID=MedicationID;
            model.M_ConsultationID=M_ConsultationID;
            model.M_StartDate=M_StartDate;
            model.M_Status=M_Status;

            Maticsoft.BLL.record_Medication bll=new Maticsoft.BLL.record_Medication();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx");
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.record_Medication DataRowToModel(DataRow row)
 {
     Maticsoft.Model.record_Medication model = new Maticsoft.Model.record_Medication();
     if (row != null)
     {
         if (row["MedicationID"] != null && row["MedicationID"].ToString() != "")
         {
             model.MedicationID = int.Parse(row["MedicationID"].ToString());
         }
         if (row["M_ConsultationID"] != null && row["M_ConsultationID"].ToString() != "")
         {
             model.M_ConsultationID = int.Parse(row["M_ConsultationID"].ToString());
         }
         if (row["M_StartDate"] != null && row["M_StartDate"].ToString() != "")
         {
             model.M_StartDate = DateTime.Parse(row["M_StartDate"].ToString());
         }
         if (row["M_Status"] != null && row["M_Status"].ToString() != "")
         {
             model.M_Status = int.Parse(row["M_Status"].ToString());
         }
     }
     return(model);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.record_Medication GetModel(int MedicationID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 MedicationID,M_ConsultationID,M_StartDate,M_Status from record_Medication ");
            strSql.Append(" where MedicationID=@MedicationID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MedicationID", SqlDbType.Int, 4)
            };
            parameters[0].Value = MedicationID;

            Maticsoft.Model.record_Medication model = new Maticsoft.Model.record_Medication();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.record_Medication DataRowToModel(DataRow row)
 {
     Maticsoft.Model.record_Medication model=new Maticsoft.Model.record_Medication();
     if (row != null)
     {
         if(row["MedicationID"]!=null && row["MedicationID"].ToString()!="")
         {
             model.MedicationID=int.Parse(row["MedicationID"].ToString());
         }
         if(row["M_ConsultationID"]!=null && row["M_ConsultationID"].ToString()!="")
         {
             model.M_ConsultationID=int.Parse(row["M_ConsultationID"].ToString());
         }
         if(row["M_StartDate"]!=null && row["M_StartDate"].ToString()!="")
         {
             model.M_StartDate=DateTime.Parse(row["M_StartDate"].ToString());
         }
         if(row["M_Status"]!=null && row["M_Status"].ToString()!="")
         {
             model.M_Status=int.Parse(row["M_Status"].ToString());
         }
     }
     return model;
 }
Ejemplo n.º 9
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.record_Medication GetModel(int MedicationID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 MedicationID,M_ConsultationID,M_StartDate,M_Status from record_Medication ");
            strSql.Append(" where MedicationID=@MedicationID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@MedicationID", SqlDbType.Int,4)			};
            parameters[0].Value = MedicationID;

            Maticsoft.Model.record_Medication model=new Maticsoft.Model.record_Medication();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }