Esempio n. 1
0
        /// <summary>
        /// 得到资产信息(分页)
        /// </summary>
        /// <param name="start">起始页</param>
        /// <param name="max">最大条数</param>
        /// <returns></returns>
        public static DataTable getLogList(int start, int max, string departId, string power)
        {
            sqlHandler sh  = new sqlHandler();
            string     sql = "";

            if (power == "0" || power == "1")
            {
                sql = "select * from View_FixLog order by 流水号";
            }
            else if (power == "2")
            {
                sql = string.Format("select * from View_FixLog where 部门编号 like '{0}%'order by 流水号", departId.Substring(0, 2));
            }
            else
            {
                sql = string.Format("select * from View_FixLog where 部门编号='{0}'order by 流水号", departId);
            }

            DataTable dt = sh.GetDataTable_Page(sql, start, max);

            if (dt != null)
            {
                return(dt);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 得到资产信息(分页)
        /// </summary>
        /// <param name="start">起始页</param>
        /// <param name="max">最大条数</param>
        /// <returns></returns>
        public static DataTable getEqList(int start, int max)
        {
            sqlHandler sh  = new sqlHandler();
            string     sql = "select * from view_eqInfo select * from view_eqInfo  order by  资产编号 desc ";

            DataTable dt = sh.GetDataTable_Page(sql, start, max);

            if (dt != null)
            {
                return(dt);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 得到筛选资产信息(分页)
        /// </summary>
        /// <param name="start">起始页</param>
        /// <param name="max">最大条数</param>
        /// <returns></returns>
        public static DataTable getSortEqList(int start, int max, string departId, string power, List <string> SelectedColumns, Dictionary <String, String> SortsString, string OrderString)
        {
            string selectItem = "";

            foreach (string field in SelectedColumns)
            {
                if (field.Contains("/") || field.Contains("("))
                {
                    selectItem += "[" + field + "]" + ", ";
                }
                else
                {
                    selectItem += field + ", ";
                }
            }
            selectItem = selectItem.Substring(0, selectItem.Length - 2);
            string sortSet = "";
            int    index   = 0;

            foreach (KeyValuePair <string, string> kvp in SortsString)
            {
                if (string.IsNullOrEmpty(kvp.Value))
                {
                    continue;
                }
                if (index == 0)
                {
                    sortSet = kvp.Value;
                }
                else
                {
                    sortSet = sortSet + " and " + kvp.Value;
                }
                index++;
            }
            sqlHandler sh  = new sqlHandler();
            string     sql = "";

            if (string.IsNullOrEmpty(sortSet))
            {
                if (string.IsNullOrEmpty(OrderString))
                {
                    if (power == "0" || power == "1")
                    {
                        sql = string.Format("select {0} from View_FixLog order by 流水号", selectItem);
                    }
                    else if (power == "2")
                    {
                        sql = string.Format("select {1} from View_FixLog where 部门编号 like '{0}%'order by 流水号", departId.Substring(0, 2), selectItem);
                    }
                    else
                    {
                        sql = string.Format("select {1} from View_FixLog where 部门编号='{0}'order by 流水号", departId, selectItem);
                    }
                }
                else
                {
                    if (power == "0" || power == "1")
                    {
                        sql = string.Format("select {0} from View_FixLog order by {1}", selectItem, OrderString);
                    }
                    else if (power == "2")
                    {
                        sql = string.Format("select {1} from View_FixLog where 部门编号 like '{0}%'order by {2}", departId.Substring(0, 2), selectItem, OrderString);
                    }
                    else
                    {
                        sql = string.Format("select {1} from View_FixLog where 部门编号='{0}'order by {2}", departId, selectItem, OrderString);
                    }
                }
            }
            else
            {
                if (string.IsNullOrEmpty(OrderString))
                {
                    if (power == "0" || power == "1")
                    {
                        sql = string.Format("select {0} from View_FixLog where {1} order by 流水号", selectItem, sortSet);
                    }
                    else if (power == "2")
                    {
                        sql = string.Format("select {1} from View_FixLog where 部门编号 like '{0}%' and {2} order by 流水号", departId.Substring(0, 2), selectItem, sortSet);
                    }
                    else
                    {
                        sql = string.Format("select {1} from View_FixLog where 部门编号='{0}'and {2} order by 流水号", departId, selectItem, sortSet);
                    }
                }
                else
                {
                    if (power == "0" || power == "1")
                    {
                        sql = string.Format("select {0} from View_FixLog where {1} order by {2}", selectItem, sortSet, OrderString);
                    }
                    else if (power == "2")
                    {
                        sql = string.Format("select {1} from View_FixLog where 部门编号 like '{0}%' and {2} order by {3}", departId.Substring(0, 2), selectItem, sortSet, OrderString);
                    }
                    else
                    {
                        sql = string.Format("select {1} from View_FixLog where 部门编号='{0}' and {2} order by {3}", departId, selectItem, sortSet, OrderString);
                    }
                }
            }

            DataTable dt = sh.GetDataTable_Page(sql, start, max);

            if (dt != null)
            {
                return(dt);
            }
            else
            {
                return(null);
            }
        }