示例#1
0
文件: COPDType.cs 项目: windygu/his2
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.COPDType model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update COPDType set ");
            strSql.Append("Name=@Name,");
            strSql.Append("Type=@Type");
            strSql.Append(" where ID=@ID");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@Name", OleDbType.VarChar, 50),
                new OleDbParameter("@Type", OleDbType.VarChar, 50),
                new OleDbParameter("@ID",   OleDbType.Integer, 4)
            };
            parameters[0].Value = model.Name;
            parameters[1].Value = model.Type;
            parameters[2].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
文件: COPDType.cs 项目: windygu/his2
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.COPDType model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into COPDType(");
            strSql.Append("Name,Type)");
            strSql.Append(" values (");
            strSql.Append("@Name,@Type)");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@Name", OleDbType.VarChar, 50),
                new OleDbParameter("@Type", OleDbType.VarChar, 50)
            };
            parameters[0].Value = model.Name;
            parameters[1].Value = model.Type;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
文件: COPDType.cs 项目: windygu/his2
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.COPDType DataRowToModel(DataRow row)
 {
     Maticsoft.Model.COPDType model = new Maticsoft.Model.COPDType();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["Name"] != null)
         {
             model.Name = row["Name"].ToString();
         }
         if (row["Type"] != null)
         {
             model.Type = row["Type"].ToString();
         }
     }
     return(model);
 }
示例#4
0
文件: COPDType.cs 项目: windygu/his2
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.COPDType GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,Name,Type from COPDType ");
            strSql.Append(" where ID=@ID");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@ID", OleDbType.Integer, 4)
            };
            parameters[0].Value = ID;

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

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