Beispiel #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.Examination.advise model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update advise set ");
            strSql.Append("RegisterNo=@RegisterNo,");
            strSql.Append("Name=@Name,");
            strSql.Append("Summary=@Summary,");
            strSql.Append("investigation=@investigation,");
            strSql.Append("content=@content,");
            strSql.Append("content2=@content2,");
            strSql.Append("content3=@content3,");
            strSql.Append("Doctor=@Doctor,");
            strSql.Append("add_time=@add_time");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@RegisterNo",    MySqlDbType.VarChar,   20),
                new MySqlParameter("@Name",          MySqlDbType.VarChar,   20),
                new MySqlParameter("@Summary",       MySqlDbType.Text),
                new MySqlParameter("@investigation", MySqlDbType.Text),
                new MySqlParameter("@content",       MySqlDbType.Text),
                new MySqlParameter("@content2",      MySqlDbType.Text),
                new MySqlParameter("@content3",      MySqlDbType.Text),
                new MySqlParameter("@Doctor",        MySqlDbType.VarChar,   50),
                new MySqlParameter("@add_time",      MySqlDbType.DateTime),
                new MySqlParameter("@id",            MySqlDbType.Int32, 11)
            };
            parameters[0].Value = model.RegisterNo;
            parameters[1].Value = model.Name;
            parameters[2].Value = model.Summary;
            parameters[3].Value = model.investigation;
            parameters[4].Value = model.content;
            parameters[5].Value = model.content2;
            parameters[6].Value = model.content3;
            parameters[7].Value = model.Doctor;
            parameters[8].Value = model.add_time;
            parameters[9].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.Examination.advise DataRowToModel(DataRow row)
 {
     Maticsoft.Model.Examination.advise model = new Maticsoft.Model.Examination.advise();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["RegisterNo"] != null)
         {
             model.RegisterNo = row["RegisterNo"].ToString();
         }
         if (row["Name"] != null)
         {
             model.Name = row["Name"].ToString();
         }
         if (row["Summary"] != null)
         {
             model.Summary = row["Summary"].ToString();
         }
         if (row["investigation"] != null)
         {
             model.investigation = row["investigation"].ToString();
         }
         if (row["content"] != null)
         {
             model.content = row["content"].ToString();
         }
         if (row["content2"] != null)
         {
             model.content2 = row["content2"].ToString();
         }
         if (row["content3"] != null)
         {
             model.content3 = row["content3"].ToString();
         }
         if (row["Doctor"] != null)
         {
             model.Doctor = row["Doctor"].ToString();
         }
         if (row["add_time"] != null && row["add_time"].ToString() != "")
         {
             model.add_time = DateTime.Parse(row["add_time"].ToString());
         }
     }
     return(model);
 }
Beispiel #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.Examination.advise model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into advise(");
            strSql.Append("RegisterNo,Name,Summary,investigation,content,content2,content3,Doctor,add_time)");
            strSql.Append(" values (");
            strSql.Append("@RegisterNo,@Name,@Summary,@investigation,@content,@content2,@content3,@Doctor,@add_time)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@RegisterNo",    MySqlDbType.VarChar, 20),
                new MySqlParameter("@Name",          MySqlDbType.VarChar, 20),
                new MySqlParameter("@Summary",       MySqlDbType.Text),
                new MySqlParameter("@investigation", MySqlDbType.Text),
                new MySqlParameter("@content",       MySqlDbType.Text),
                new MySqlParameter("@content2",      MySqlDbType.Text),
                new MySqlParameter("@content3",      MySqlDbType.Text),
                new MySqlParameter("@Doctor",        MySqlDbType.VarChar, 50),
                new MySqlParameter("@add_time",      MySqlDbType.DateTime)
            };
            parameters[0].Value = model.RegisterNo;
            parameters[1].Value = model.Name;
            parameters[2].Value = model.Summary;
            parameters[3].Value = model.investigation;
            parameters[4].Value = model.content;
            parameters[5].Value = model.content2;
            parameters[6].Value = model.content3;
            parameters[7].Value = model.Doctor;
            parameters[8].Value = model.add_time;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.Examination.advise GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id,RegisterNo,Name,Summary,investigation,content,content2,content3,Doctor,add_time from advise ");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id", MySqlDbType.Int32)
            };
            parameters[0].Value = id;

            Maticsoft.Model.Examination.advise model = new Maticsoft.Model.Examination.advise();
            DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }