Exemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public CardCenter.Entity.Para_IdentificationType DataRowToModel(DataRow row)
 {
     CardCenter.Entity.Para_IdentificationType model = new CardCenter.Entity.Para_IdentificationType();
     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();
         }
     }
     return(model);
 }
Exemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(CardCenter.Entity.Para_IdentificationType model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Para_IdentificationType set ");
            strSql.Append("Name=@Name");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Name", SqlDbType.NVarChar, 16),
                new SqlParameter("@ID",   SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Name;
            parameters[1].Value = model.ID;

            TranHelper.AddTran(strSql, parameters);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(CardCenter.Entity.Para_IdentificationType model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Para_IdentificationType(");
            strSql.Append("Name)");
            strSql.Append(" values (");
            strSql.Append("@Name)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Name", SqlDbType.NVarChar, 16)
            };
            parameters[0].Value = model.Name;

            TranHelper.AddTran(strSql, parameters);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public CardCenter.Entity.Para_IdentificationType GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,Name from Para_IdentificationType ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            CardCenter.Entity.Para_IdentificationType model = new CardCenter.Entity.Para_IdentificationType();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

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