Example #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Bitshare.DataDecision.Model.tblButtonName model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tblButtonName set ");
            strSql.Append("ButtonName=@ButtonName,");
            strSql.Append("Remark=@Remark");
            strSql.Append(" where Rid=@Rid");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ButtonName", SqlDbType.VarChar,  50),
                new SqlParameter("@Remark",     SqlDbType.VarChar, 250),
                new SqlParameter("@Rid",        SqlDbType.Int, 4)
            };
            parameters[0].Value = model.ButtonName;
            parameters[1].Value = model.Remark;
            parameters[2].Value = model.Rid;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Bitshare.DataDecision.Model.tblButtonName model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tblButtonName(");
            strSql.Append("ButtonName,Remark)");
            strSql.Append(" values (");
            strSql.Append("@ButtonName,@Remark)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ButtonName", SqlDbType.VarChar, 50),
                new SqlParameter("@Remark",     SqlDbType.VarChar, 250)
            };
            parameters[0].Value = model.ButtonName;
            parameters[1].Value = model.Remark;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Bitshare.DataDecision.Model.tblButtonName DataRowToModel(DataRow row)
 {
     Bitshare.DataDecision.Model.tblButtonName model = new Bitshare.DataDecision.Model.tblButtonName();
     if (row != null)
     {
         if (row["Rid"] != null && row["Rid"].ToString() != "")
         {
             model.Rid = int.Parse(row["Rid"].ToString());
         }
         if (row["ButtonName"] != null)
         {
             model.ButtonName = row["ButtonName"].ToString();
         }
         if (row["Remark"] != null)
         {
             model.Remark = row["Remark"].ToString();
         }
     }
     return(model);
 }
Example #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Bitshare.DataDecision.Model.tblButtonName GetModel(int Rid)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Rid,ButtonName,Remark from tblButtonName ");
            strSql.Append(" where Rid=@Rid");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Rid", SqlDbType.Int, 4)
            };
            parameters[0].Value = Rid;

            Bitshare.DataDecision.Model.tblButtonName model = new Bitshare.DataDecision.Model.tblButtonName();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Example #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Bitshare.DataDecision.Model.tblButtonName model)
 {
     return(dal.Update(model));
 }
Example #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Bitshare.DataDecision.Model.tblButtonName model)
 {
     return(dal.Add(model));
 }