예제 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Bitshare.DataDecision.Model.sys_role_Detail model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into sys_role_Detail(");
            strSql.Append("rf_Type,rf_Role_Id,rf_Right_Code)");
            strSql.Append(" values (");
            strSql.Append("@rf_Type,@rf_Role_Id,@rf_Right_Code)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@rf_Type",       SqlDbType.VarChar, 50),
                new SqlParameter("@rf_Role_Id",    SqlDbType.Int,      4),
                new SqlParameter("@rf_Right_Code", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.rf_Type;
            parameters[1].Value = model.rf_Role_Id;
            parameters[2].Value = model.rf_Right_Code;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
예제 #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Bitshare.DataDecision.Model.sys_role_Detail model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update sys_role_Detail set ");
            strSql.Append("rf_Type=@rf_Type,");
            strSql.Append("rf_Role_Id=@rf_Role_Id,");
            strSql.Append("rf_Right_Code=@rf_Right_Code");
            strSql.Append(" where Rid=@Rid");
            SqlParameter[] parameters =
            {
                new SqlParameter("@rf_Type",       SqlDbType.VarChar, 50),
                new SqlParameter("@rf_Role_Id",    SqlDbType.Int,      4),
                new SqlParameter("@rf_Right_Code", SqlDbType.Int,      4),
                new SqlParameter("@Rid",           SqlDbType.Int, 4)
            };
            parameters[0].Value = model.rf_Type;
            parameters[1].Value = model.rf_Role_Id;
            parameters[2].Value = model.rf_Right_Code;
            parameters[3].Value = model.Rid;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Bitshare.DataDecision.Model.sys_role_Detail DataRowToModel(DataRow row)
 {
     Bitshare.DataDecision.Model.sys_role_Detail model = new Bitshare.DataDecision.Model.sys_role_Detail();
     if (row != null)
     {
         if (row["Rid"] != null && row["Rid"].ToString() != "")
         {
             model.Rid = int.Parse(row["Rid"].ToString());
         }
         if (row["rf_Type"] != null)
         {
             model.rf_Type = row["rf_Type"].ToString();
         }
         if (row["rf_Role_Id"] != null && row["rf_Role_Id"].ToString() != "")
         {
             model.rf_Role_Id = int.Parse(row["rf_Role_Id"].ToString());
         }
         if (row["rf_Right_Code"] != null && row["rf_Right_Code"].ToString() != "")
         {
             model.rf_Right_Code = int.Parse(row["rf_Right_Code"].ToString());
         }
     }
     return(model);
 }
예제 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Bitshare.DataDecision.Model.sys_role_Detail GetModel(int Rid)
        {
            StringBuilder strSql = new StringBuilder();

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

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

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