Ejemplo n.º 1
0
        /// <summary>
        /// 获取物理表的字段
        /// </summary>
        /// <param name="tableName">物理表名</param>
        /// <returns></returns>
        public DataTable GetTableFields(string tableName)
        {
            SqlProcedure sp = SqlBuilder.BuildSqlProcedure("p_sys_GetTableFieldType");

            sp.AddParam("@TableName", SqlDbType.VarChar, 50, tableName);
            return(DataProvider.Instance.GetTable(_Loginer.DBName, sp.SqlCommand, "TableFieldTypeData"));
        }
Ejemplo n.º 2
0
        public DataTable SearchOutstanding(string invoiceNo, string customer, DateTime dateFrom, DateTime dateTo, DateTime dateEnd, string outstandingType)
        {
            //outstandingType:AR/AP/ALL

            if (outstandingType == "AR")
            {
                SqlProcedure sp = SqlBuilder.BuildSqlProcedure("sp_QueryOutstandingAR");
                sp.AddParam("@InvoiceNo", SqlDbType.VarChar, 20, invoiceNo);
                sp.AddParam("@CustomerCode", SqlDbType.VarChar, 20, customer);
                sp.AddParam("@FromDate", SqlDbType.VarChar, 8, ConvertEx.ToCharYYYYMMDD(dateFrom));
                sp.AddParam("@ToDate", SqlDbType.VarChar, 8, ConvertEx.ToCharYYYYMMDD(dateTo));
                sp.AddParam("@EndDate", SqlDbType.VarChar, 8, ConvertEx.ToCharYYYYMMDD(dateEnd));
                return(DataProvider.Instance.GetTable(_Loginer.DBName, sp.SqlCommand, "Outstanding" + outstandingType));
            }

            if (outstandingType == "AP")
            {
                SqlProcedure sp = SqlBuilder.BuildSqlProcedure("sp_QueryOutstandingAP");
                sp.AddParam("@InvoiceNo", SqlDbType.VarChar, 20, invoiceNo);
                sp.AddParam("@SupplierCode", SqlDbType.VarChar, 20, customer);
                sp.AddParam("@FromDate", SqlDbType.VarChar, 8, ConvertEx.ToCharYYYYMMDD(dateFrom));
                sp.AddParam("@ToDate", SqlDbType.VarChar, 8, ConvertEx.ToCharYYYYMMDD(dateTo));
                sp.AddParam("@EndDate", SqlDbType.VarChar, 8, ConvertEx.ToCharYYYYMMDD(dateEnd));
                return(DataProvider.Instance.GetTable(_Loginer.DBName, sp.SqlCommand, "Outstanding" + outstandingType));
            }

            return(null);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 删除用户组
        /// </summary>
        /// <param name="groupCode">用户组编号</param>
        /// <returns></returns>
        public bool DeleteGroupByKey(string groupCode)
        {
            SqlProcedure sp = SqlBuilder.BuildSqlProcedure("p_sys_DeleteGroupData");

            sp.AddParam("@GroupCode", SqlDbType.VarChar, groupCode);
            object o = DataProvider.Instance.ExecuteNoQuery(_Loginer.DBName, sp.SqlCommand);

            return(ConvertEx.ToInt(o) != 0);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 还原数据库
        /// </summary>
        /// <param name="BKFILE">备份的文件。如:C:\HHMES22.Normal_2010.bak</param>
        /// <param name="DBNAME">数据名称。如:HHMES22.Normal</param>
        public bool RestoreDatabase(string BKFILE, string DBNAME)
        {
            SqlProcedure sp = SqlBuilder.BuildSqlProcedure("p_RestoreDB");

            sp.AddParam("@BKFILE", SqlDbType.NVarChar, 1000, BKFILE);
            sp.AddParam("@DBNAME", SqlDbType.NVarChar, 100, DBNAME);
            DataProvider.Instance.ExecuteNoQuery(Globals.DEF_MASTER_DB, sp.SqlCommand);
            return(true);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取当前用户的系统权限
        /// </summary>
        /// <param name="user">当前用户</param>
        /// <returns></returns>
        public DataTable GetUserAuthorities(Loginer user)
        {
            SqlProcedure sp = SqlBuilder.BuildSqlProcedure("p_sys_GetAuthorities");

            sp.AddParam("@UserOrGroup", SqlDbType.VarChar, user.Account);
            sp.AddParam("@Type", SqlDbType.Int, 1);
            DataTable dt = DataProvider.Instance.GetTable(user.DBName, sp.SqlCommand, TUserRole.__TableName);

            return(dt);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 获取窗体的可用权限值
        /// </summary>
        /// <param name="account">登录帐号</param>
        /// <param name="moduleID">模块编号</param>
        /// <param name="menuName">菜单名称</param>
        /// <returns></returns>
        public int GetFormAuthority(string account, int moduleID, string menuName)
        {
            SqlProcedure sp = SqlBuilder.BuildSqlProcedure("p_sys_GetFormAuthority");

            sp.AddParam("@account", SqlDbType.VarChar, account);
            sp.AddParam("@moduleID", SqlDbType.Int, moduleID);
            sp.AddParam("@menuName", SqlDbType.VarChar, menuName);
            object o = DataProvider.Instance.ExecuteScalar(_Loginer.DBName, sp.SqlCommand);

            return(ConvertEx.ToInt(o));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 获取用户组的权限信息,包括组的用户,组的权限
        /// </summary>
        /// <param name="groupCode">用户组编号</param>
        /// <returns></returns>
        public DataSet GetUserGroup(string groupCode)
        {
            SqlProcedure sp = SqlBuilder.BuildSqlProcedure("p_sys_GetGroupData");

            sp.AddParam("@GroupCode", SqlDbType.VarChar, groupCode);
            DataSet ds = DataProvider.Instance.GetDataSet(_Loginer.DBName, sp.SqlCommand);

            ds.Tables[BusinessDataSetIndex.Groups].TableName             = TUserGroup.__TableName;
            ds.Tables[BusinessDataSetIndex.GroupUsers].TableName         = TUserGroupRe.__TableName;
            ds.Tables[BusinessDataSetIndex.GroupAuthorities].TableName   = TUserRole.__TableName;
            ds.Tables[BusinessDataSetIndex.GroupAvailableUser].TableName = "GroupAvailableUser";
            return(ds);
        }