Пример #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(PMIS.Model.PM_RoleFp model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into PM_RoleFp(");
            strSql.Append("pm_TRFpUid,pm_TRFpRid");
            strSql.Append(") values (");
            strSql.Append("@pm_TRFpUid,@pm_TRFpRid");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                        new SqlParameter("@pm_TRFpUid", SqlDbType.Int,4) ,
                        new SqlParameter("@pm_TRFpRid", SqlDbType.Int,4)

            };

            parameters[0].Value = model.pm_TRFpUid;
            parameters[1].Value = model.pm_TRFpRid;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {

                return Convert.ToInt32(obj);

            }
        }
Пример #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(PMIS.Model.PM_Role model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into PM_Role(");
            strSql.Append("pm_TRNanme,pm_TRFid,pm_TRBz,pm_TRState,Version");
            strSql.Append(") values (");
            strSql.Append("@pm_TRNanme,@pm_TRFid,@pm_TRBz,@pm_TRState,@Version");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                        new SqlParameter("@pm_TRNanme", SqlDbType.VarChar,50) ,
                        new SqlParameter("@pm_TRFid", SqlDbType.Int,4) ,
                        new SqlParameter("@pm_TRBz", SqlDbType.VarChar,50) ,
                        new SqlParameter("@pm_TRState", SqlDbType.VarChar,2) ,
                        new SqlParameter("@Version", SqlDbType.Int,4)

            };

            parameters[0].Value = model.pm_TRNanme;
            parameters[1].Value = model.pm_TRFid;
            parameters[2].Value = model.pm_TRBz;
            parameters[3].Value = model.pm_TRState;
            parameters[4].Value = model.Version;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {

                return Convert.ToInt32(obj);

            }
        }
Пример #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(PMIS.Model.PM_Role model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("update PM_Role set ");

            strSql.Append(" pm_TRNanme = @pm_TRNanme , ");
            strSql.Append(" pm_TRFid = @pm_TRFid , ");
            strSql.Append(" pm_TRBz = @pm_TRBz , ");
            strSql.Append(" pm_TRState = @pm_TRState , ");
            strSql.Append(" Version = @Version  ");
            strSql.Append(" where pm_TRId=@pm_TRId ");

            SqlParameter[] parameters = {
                        new SqlParameter("@pm_TRId", SqlDbType.Int,4) ,
                        new SqlParameter("@pm_TRNanme", SqlDbType.VarChar,50) ,
                        new SqlParameter("@pm_TRFid", SqlDbType.Int,4) ,
                        new SqlParameter("@pm_TRBz", SqlDbType.VarChar,50) ,
                        new SqlParameter("@pm_TRState", SqlDbType.VarChar,2) ,
                        new SqlParameter("@Version", SqlDbType.Int,4)

            };

            parameters[0].Value = model.pm_TRId;
            parameters[1].Value = model.pm_TRNanme;
            parameters[2].Value = model.pm_TRFid;
            parameters[3].Value = model.pm_TRBz;
            parameters[4].Value = model.pm_TRState;
            parameters[5].Value = model.Version;
            int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Пример #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(PMIS.Model.PM_RoleFp model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("update PM_RoleFp set ");

            strSql.Append(" pm_TRFpUid = @pm_TRFpUid , ");
            strSql.Append(" pm_TRFpRid = @pm_TRFpRid  ");
            strSql.Append(" where pm_TRFpId=@pm_TRFpId ");

            SqlParameter[] parameters = {
                        new SqlParameter("@pm_TRFpId", SqlDbType.Int,4) ,
                        new SqlParameter("@pm_TRFpUid", SqlDbType.Int,4) ,
                        new SqlParameter("@pm_TRFpRid", SqlDbType.Int,4)

            };

            parameters[0].Value = model.pm_TRFpId;
            parameters[1].Value = model.pm_TRFpUid;
            parameters[2].Value = model.pm_TRFpRid;
            int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }