Esempio n. 1
0
        public string GetChildMaxOrder(string oid)
        {
            string strSQL = @" SELECT COUNT(1)+1 FROM TBLFUNCTION WHERE functionparentid=@OID ";

            string[] paramNames  = new string[1];
            object[] paramValues = new object[1];

            paramNames[0]  = "OID";
            paramValues[0] = oid;
            SqlDBBroker broker = new SqlDBBroker();

            broker.Open();
            return(broker.ExecuteScalar(strSQL, CommandType.Text, paramNames, paramValues));
        }
Esempio n. 2
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="fun"></param>
        /// <returns></returns>
        public bool UpdateFunction(FunctionEntity fun)
        {
            if (fun != null)
            {
                string   strSQL      = @" UPDATE TBLFUNCTION SET functionkey=@functionkey,functionname=@functionname, functionurl=@functionurl ,
	                                functionstatus=@functionstatus ,functionorder=@functionorder,memo=@memo,muser=@muser,mdate=GETDATE()
	                                WHERE oid=@OID "    ;
                string[] paramNames  = new string[8];
                object[] paramValues = new object[8];

                paramNames[0] = "OID";
                paramNames[1] = "functionkey";
                paramNames[2] = "functionname";
                paramNames[3] = "functionurl";
                paramNames[4] = "functionstatus";
                paramNames[5] = "functionorder";
                paramNames[6] = "memo";
                paramNames[7] = "muser";

                paramValues[0] = fun.OID;
                paramValues[1] = fun.FUNCTIONKEY;
                paramValues[2] = fun.FUNCTIONNAME;
                paramValues[3] = fun.FUNCTIONURL;
                paramValues[4] = fun.FUNCTIONSTATUS;
                paramValues[5] = fun.FUNCTIONORDER;
                paramValues[6] = fun.MEMO;
                paramValues[7] = fun.MUSER;
                SqlDBBroker broker = new SqlDBBroker();
                try
                {
                    broker.Open();
                    broker.BeginTrans();
                    broker.ExecuteNonQuery(strSQL, CommandType.Text, paramNames, paramValues);
                    broker.CommitTrans();
                }
                catch
                {
                    broker.RollbackTrans();
                    return(false);
                }
                finally
                {
                    broker.Close();
                }
            }
            return(true);
        }
Esempio n. 3
0
        public FunctionEntity GetFunc(string oid)
        {
            string strSQL = @" SELECT * FROM TBLFUNCTION WHERE oid=@OID ";

            string[] paramNames  = new string[1];
            object[] paramValues = new object[1];

            paramNames[0]  = "OID";
            paramValues[0] = oid;
            SqlDBBroker broker = new SqlDBBroker();

            broker.Open();
            DataSet dst = broker.ExecuteDataset(strSQL, CommandType.Text, paramNames, paramValues);

            broker.Close();
            if (dst != null && dst.Tables[0] != null && dst.Tables[0].Rows.Count > 0)
            {
                return(Datarow2Entity(dst.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 4
0
        public DataSet QueryPersons(int pageIndex, int pageSize, out int rowCount, string userAccount, string userName)
        {
            string strSql = @" SELECT  oid ,
                                        personaccount ,
                                        personname ,
                                        personsex ,
                                        personofficephone ,
                                        personmobilephone ,
                                        personemail ,
                                        personmemo
                                FROM    TBLPERSON where 1=1 ";

            if (!string.IsNullOrEmpty(userAccount))
            {
                strSql += " and personaccount like @PersonAccount ";
            }
            if (!string.IsNullOrEmpty(userName))
            {
                strSql += " and personname like @PersonName ";
            }
            string[] paramNames  = new string[2];
            object[] paramValues = new object[2];

            paramNames[0] = "PersonAccount";
            paramNames[1] = "PersonName";

            paramValues[0] = "%" + userAccount + "%";
            paramValues[1] = "%" + userName + "%";
            SqlDBBroker broker = new SqlDBBroker();

            broker.Open();
            DataSet dst = broker.QueryPageFromSql(strSql, paramNames, paramValues, pageIndex, pageSize, out rowCount);

            broker.Close();
            return(dst);
        }