コード例 #1
0
        public bool Exists(string strvalue, int id)
        {
            bool   blFlag = false;
            int    num    = -1;
            string strSql = "select count(*) from bas_org where org_name='{0}' {1} ";

            if (id < 1)
            {
                strSql = string.Format(strSql, strvalue, "");
            }
            else
            {
                strSql = string.Format(strSql, strvalue, " and id <>" + id.ToString());
            }
            try
            {
                num = int.Parse(DataBase.ExecuteScalarToStr(strSql).ToString());
            }
            catch (Exception exception)
            {
                throw exception;
            }
            blFlag = (num > 0 ? true : false);
            return(blFlag);
        }
コード例 #2
0
ファイル: User.cs プロジェクト: fengxing1121/Hi
        public bool Exists(string strWhere)
        {
            string strSql   = " select count(*) from bas_user where 1=1 " + strWhere;
            string strValue = DataBase.ExecuteScalarToStr(strSql);

            return(int.Parse(strValue) > 0 ? true : false);
        }
コード例 #3
0
 public int TotalCount(Dictionary <string, string> hash)
 {
     try
     {
         string strSql = " select count(*) from (" + DepartmentSql(hash) + ") a ";
         return(int.Parse(DataBase.ExecuteScalarToStr(strSql).ToString()));
     }
     catch
     {
         return(0);
     }
 }
コード例 #4
0
 public int RoleTotalCount()
 {
     try
     {
         string strSql = " select count(*) from (" + RoleSql() + ") a ";
         return(int.Parse(DataBase.ExecuteScalarToStr(strSql).ToString()));
     }
     catch
     {
         return(0);
     }
 }
コード例 #5
0
        /// <summary>
        /// 一级菜单是否有子菜单

        /// </summary>
        public bool ExistsChild(string module_father)
        {
            int    num    = -1;
            bool   blFlag = false;
            string strSql = "select count(*) from Bas_Module where module_father=" + module_father;

            try
            {
                num = int.Parse(DataBase.ExecuteScalarToStr(strSql));
            }
            catch (Exception e)
            {
                throw e;
            }
            blFlag = (num > 0 ? true : false);
            return(blFlag);
        }
コード例 #6
0
        public bool Delete(string id)
        {
            bool   blFlag = false;
            int    num    = -1;
            string sql    = "delete from bas_org where id=" + id;
            string count  = DataBase.ExecuteScalarToStr("select count(*) from bas_user where orgid=" + id);

            if (Hi.Common.Utils.StrToInt(count) > 0)
            {
                return(false);
            }

            try
            {
                num = DataBase.ExecuteNonQuery(sql);
            }
            catch (Exception exception)
            {
                throw exception;
            }
            blFlag = (num > 0 ? true : false);
            return(blFlag);
        }
コード例 #7
0
        //ID是否被引用
        public bool IsUsing(string department_id)
        {
            bool   InPerson     = false;
            bool   InPlanPerson = false;
            string strValue     = "";
            string strSql       = "";

            strSql   = "select count(*) from bas_user where orgid=" + department_id;
            strValue = DataBase.ExecuteScalarToStr(strSql);
            if (int.Parse(strValue) > 0)
            {
                InPerson = true;
            }


            if (InPlanPerson || InPerson)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #8
0
ファイル: User.cs プロジェクト: fengxing1121/Hi
        /// <summary>
        /// 获得数据总记录数
        /// </summary>
        public int TotalCount(Dictionary <string, string> dict)
        {
            string strSql = "select count(*) from (" + GetSql(dict) + ") t ";

            return(int.Parse(DataBase.ExecuteScalarToStr(strSql)));
        }
コード例 #9
0
ファイル: Log.cs プロジェクト: fengxing1121/Hi
        /// <summary>
        /// 获得数据总记录数
        /// </summary>
        public int TotalCount(Hashtable hash)
        {
            string strSql = "select count(*) from (" + GetSql(hash) + ") a ";

            return(int.Parse(DataBase.ExecuteScalarToStr(strSql)));
        }
コード例 #10
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool ParamExists(string strWhere)
        {
            string strSql = " select count(*) from bas_param where 1=1 " + strWhere;

            return(int.Parse(DataBase.ExecuteScalarToStr(strSql)) > 0 ? true : false);
        }