public static Hashtable Search(string key, int index, int size, string sortField, string sortOrder)
        {
            string sql = @"select * from " + tbname + " where name like '%" + key + "%'";

            if (String.IsNullOrEmpty(sortField) == false)
            {
                if (sortOrder != "desc")
                {
                    sortOrder = "asc";
                }
                sql += " order by " + sortField + " " + sortOrder;
            }

            DataTable dt   = DBUtil.SelectDataTablePager(sql, index, size);
            ArrayList data = DBUtil.DataTable2ArrayList(dt);

            int count = DBUtil.ExecuteScalar(sql);

            Hashtable result = new Hashtable();

            result["data"]  = data;
            result["total"] = count;

            return(result);
        }
Beispiel #2
0
        public static Hashtable Search(string key, int index, int size, string sortField, string sortOrder)
        {
            string sql = @"SELECT PumpManager.*, T_Customer.FName as CustomerName FROM PumpManager INNER JOIN  T_Customer ON PumpManager.FCustomerID = T_Customer.ID  where  1=1 and PumpManager.FDeleted !='1'  " + key + "";

            if (String.IsNullOrEmpty(sortField) == false)
            {
                if (sortOrder != "desc")
                {
                    sortOrder = "asc";
                }
                sql += " order by " + sortField + " " + sortOrder;
            }

            DataTable dt   = DBUtil.SelectDataTablePager(sql, index, size);
            ArrayList data = DBUtil.DataTable2ArrayList(dt);

            int count = DBUtil.ExecuteScalar(sql);

            Hashtable result = new Hashtable();

            result["data"]  = data;
            result["total"] = count;

            return(result);
        }
Beispiel #3
0
        public static Hashtable SearchYALI_Year(string strWhere, int index, int size, string sortField, string sortOrder, int year)
        {
            String sql = @"select BASEID,FCustomerID,a.FDTUCode,FName,FMpaUp,FMpaDown,a.FCreateDate
                                   ,FMpa,FBatt,TempTime,Repeat
                             from BASE_YALI a,DATA_YALI_" + year + " b where a.id=b.baseid ";

            sql = sql + strWhere;

            if (String.IsNullOrEmpty(sortField) == false)
            {
                if (sortOrder != "desc")
                {
                    sortOrder = "asc";
                }
                sql += " order by " + sortField + " " + sortOrder;
            }

            DataTable dt = DBUtil.SelectDataTablePager(sql, index, size);

            int count = DBUtil.ExecuteScalar(sql);

            Hashtable result = new Hashtable();

            result["data"]  = dt;
            result["total"] = count;

            return(result);
        }
Beispiel #4
0
        public static Hashtable Search(string key, int index, int size, string sortField, string sortOrder)
        {
            string sqland = "";
            //数据权限
            string isadmin = Sys_UserService.GetSession("FUserType").ToString();

            if (isadmin != "1")
            {
                //数据权限
                string customerid = Sys_UserService.GetSession("FCustomerID").ToString();
                sqland += " and FCustomerID = '" + customerid + "'";
            }



            string sql = @"select * from PumpManager where FDeleted !='1' " + sqland;

            if (String.IsNullOrEmpty(sortField) == false)
            {
                if (sortOrder != "desc")
                {
                    sortOrder = "asc";
                }
                sql += " order by " + sortField + " " + sortOrder;
            }

            DataTable dt = DBUtil.SelectDataTablePager(sql, index, size);

            dt.Columns.Add("DataMain");


            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i]["FIsOnline"].ToString() == "1")
                {
                    string    id       = dt.Rows[i]["ID"].ToString();
                    String    sqlalarm = "select * from  T_Alarm where FPumpID='" + id + "' and FStatus='1' ";
                    DataTable dtalarm  = Dal.DBUtil.SelectDataTable(sqlalarm);

                    if (dtalarm.Rows.Count > 0)
                    {
                        dt.Rows[i]["FIsOnline"] = "2";
                    }
                }

                String    _FPumpID = dt.Rows[i]["ID"].ToString();
                String    sql_data = "select top 1 * from  T_DataMain  where FPumpID='" + _FPumpID + "'";
                DataTable dt_data  = Dal.DBUtil.SelectDataTable(sql_data);

                if (dt_data.Rows.Count == 1)
                {
                    dt.Rows[i]["DataMain"] = new Commond.Json().Dtb2Json(dt_data).ToString();
                }
            }

            ArrayList data = DBUtil.DataTable2ArrayList(dt);

            int count = DBUtil.ExecuteScalar(sql);

            Hashtable result = new Hashtable();

            result["data"]  = data;
            result["total"] = count;

            return(result);
        }