Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(university.Model.CCOM.Admin_permission model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Admin_permission set ");

            strSql.Append(" User_id = @User_id , ");
            strSql.Append(" Sf_id = @Sf_id  ");
            strSql.Append(" where Ap_id=@Ap_id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@Ap_id",   SqlDbType.Int,    4),
                new SqlParameter("@User_id", SqlDbType.BigInt, 8),
                new SqlParameter("@Sf_id",   SqlDbType.Int, 4)
            };

            parameters[0].Value = model.Ap_id;
            parameters[1].Value = model.User_id;
            parameters[2].Value = model.Sf_id;
            int rows = DBSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public university.Model.CCOM.Admin_permission GetModel(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Ap_id, User_id, Sf_id  ");
            strSql.Append("  from Admin_permission ");
            strSql.Append(" where " + strWhere);


            university.Model.CCOM.Admin_permission model = new university.Model.CCOM.Admin_permission();
            DataSet ds = DBSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Ap_id"].ToString() != "")
                {
                    model.Ap_id = int.Parse(ds.Tables[0].Rows[0]["Ap_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["User_id"].ToString() != "")
                {
                    model.User_id = long.Parse(ds.Tables[0].Rows[0]["User_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Sf_id"].ToString() != "")
                {
                    model.Sf_id = int.Parse(ds.Tables[0].Rows[0]["Sf_id"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(university.Model.CCOM.Admin_permission model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Admin_permission(");
            strSql.Append("User_id,Sf_id");
            strSql.Append(") values (");
            strSql.Append("@User_id,@Sf_id");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@User_id", SqlDbType.BigInt, 8),
                new SqlParameter("@Sf_id",   SqlDbType.Int, 4)
            };

            parameters[0].Value = model.User_id;
            parameters[1].Value = model.Sf_id;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public university.Model.CCOM.Admin_permission GetModel(int Ap_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Ap_id, User_id, Sf_id  ");
            strSql.Append("  from Admin_permission ");
            strSql.Append(" where Ap_id=@Ap_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Ap_id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Ap_id;


            university.Model.CCOM.Admin_permission model = new university.Model.CCOM.Admin_permission();
            DataSet ds = DBSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Ap_id"].ToString() != "")
                {
                    model.Ap_id = int.Parse(ds.Tables[0].Rows[0]["Ap_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["User_id"].ToString() != "")
                {
                    model.User_id = long.Parse(ds.Tables[0].Rows[0]["User_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Sf_id"].ToString() != "")
                {
                    model.Sf_id = int.Parse(ds.Tables[0].Rows[0]["Sf_id"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }