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

            strSql.Append("update record_MedicationTime set ");
            strSql.Append("M_Time=@M_Time,");
            strSql.Append("MedicationID=@MedicationID");
            strSql.Append(" where MedicationTimeID=@MedicationTimeID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@M_Time",           SqlDbType.VarChar, 20),
                new SqlParameter("@MedicationID",     SqlDbType.Int,      4),
                new SqlParameter("@MedicationTimeID", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.M_Time;
            parameters[1].Value = model.MedicationID;
            parameters[2].Value = model.MedicationTimeID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(this.txtM_Time.Text.Trim().Length==0)
            {
                strErr+="服药时间点(24小时制不能为空!\\n";
            }
            if(!PageValidate.IsNumber(txtMedicationID.Text))
            {
                strErr+="与record_Medicat格式错误!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            string M_Time=this.txtM_Time.Text;
            int MedicationID=int.Parse(this.txtMedicationID.Text);

            Maticsoft.Model.record_MedicationTime model=new Maticsoft.Model.record_MedicationTime();
            model.M_Time=M_Time;
            model.MedicationID=MedicationID;

            Maticsoft.BLL.record_MedicationTime bll=new Maticsoft.BLL.record_MedicationTime();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Maticsoft.Model.record_MedicationTime model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into record_MedicationTime(");
            strSql.Append("M_Time,MedicationID)");
            strSql.Append(" values (");
            strSql.Append("@M_Time,@MedicationID)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@M_Time",       SqlDbType.VarChar, 20),
                new SqlParameter("@MedicationID", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.M_Time;
            parameters[1].Value = model.MedicationID;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtM_Time.Text.Trim().Length == 0)
            {
                strErr += "服药时间点(24小时制不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtMedicationID.Text))
            {
                strErr += "与record_Medicat格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string M_Time       = this.txtM_Time.Text;
            int    MedicationID = int.Parse(this.txtMedicationID.Text);

            Maticsoft.Model.record_MedicationTime model = new Maticsoft.Model.record_MedicationTime();
            model.M_Time       = M_Time;
            model.MedicationID = MedicationID;

            Maticsoft.BLL.record_MedicationTime bll = new Maticsoft.BLL.record_MedicationTime();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Ejemplo n.º 5
0
 private void ShowInfo(int MedicationTimeID)
 {
     Maticsoft.BLL.record_MedicationTime   bll   = new Maticsoft.BLL.record_MedicationTime();
     Maticsoft.Model.record_MedicationTime model = bll.GetModel(MedicationTimeID);
     this.lblMedicationTimeID.Text = model.MedicationTimeID.ToString();
     this.lblM_Time.Text           = model.M_Time;
     this.lblMedicationID.Text     = model.MedicationID.ToString();
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.record_MedicationTime DataRowToModel(DataRow row)
 {
     Maticsoft.Model.record_MedicationTime model = new Maticsoft.Model.record_MedicationTime();
     if (row != null)
     {
         if (row["MedicationTimeID"] != null && row["MedicationTimeID"].ToString() != "")
         {
             model.MedicationTimeID = int.Parse(row["MedicationTimeID"].ToString());
         }
         if (row["M_Time"] != null)
         {
             model.M_Time = row["M_Time"].ToString();
         }
         if (row["MedicationID"] != null && row["MedicationID"].ToString() != "")
         {
             model.MedicationID = int.Parse(row["MedicationID"].ToString());
         }
     }
     return(model);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.record_MedicationTime DataRowToModel(DataRow row)
 {
     Maticsoft.Model.record_MedicationTime model=new Maticsoft.Model.record_MedicationTime();
     if (row != null)
     {
         if(row["MedicationTimeID"]!=null && row["MedicationTimeID"].ToString()!="")
         {
             model.MedicationTimeID=int.Parse(row["MedicationTimeID"].ToString());
         }
         if(row["M_Time"]!=null)
         {
             model.M_Time=row["M_Time"].ToString();
         }
         if(row["MedicationID"]!=null && row["MedicationID"].ToString()!="")
         {
             model.MedicationID=int.Parse(row["MedicationID"].ToString());
         }
     }
     return model;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.record_MedicationTime GetModel(int MedicationTimeID)
        {
            StringBuilder strSql = new StringBuilder();

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

            Maticsoft.Model.record_MedicationTime model = new Maticsoft.Model.record_MedicationTime();
            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.º 9
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.record_MedicationTime GetModel(int MedicationTimeID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 MedicationTimeID,M_Time,MedicationID from record_MedicationTime ");
            strSql.Append(" where MedicationTimeID=@MedicationTimeID");
            SqlParameter[] parameters = {
                    new SqlParameter("@MedicationTimeID", SqlDbType.Int,4)
            };
            parameters[0].Value = MedicationTimeID;

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