示例#1
0
        /// <summary>
        /// 查询固定数据语句
        /// </summary>
        /// <param name="tabID">tableid</param>
        /// <returns></returns>
        public DataTable GetDataSourceSqlId(string tabID, string where)
        {
            try
            {
                Dictionary <string, Dimention> report = GetReport();
                Dimention dimention = report[tabID];
                ArrayList al        = new ArrayList();
                string    sql       = "";
                string    citydatawherecondition = string.Empty;
                DataTable dt = new DataTable();

                sql = dimention.SqlAll.Replace("%Where%", where);

                if (tabID.Equals(""))
                {
                    dt = null;
                }
                else
                {
                    al.Add(sql);
                    dt = MySqlHelpers.Query(al).Tables[0];
                }
                return(dt);
            }
            catch (Exception ex)
            {
                FileLog.WriteLog(ex.ToString());
                return(null);
            }
        }
示例#2
0
        /// <summary>
        /// 返回DataSet
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public DataSet GetDataSetToParamID(Dictionary <string, Newtonsoft.Json.Linq.JArray> param)
        {
            Dictionary <string, Dimention> report = GetReport();
            string        sql    = string.Empty;
            DataSet       ds     = null;
            List <string> repSql = new List <string>();
            ArrayList     al     = new ArrayList();

            try
            {
                if (param != null)
                {
                    foreach (var d in param)
                    {
                        Dimention dimention = report[d.Key];
                        sql = dimention.SqlAll;
                        foreach (var arry in d.Value)
                        {
                            int i = 0;
                            ////替换后的sql语句
                            foreach (var o in Newtonsoft.Json.Linq.JObject.FromObject(arry))
                            {
                                sql = sql.Replace("[@c" + i + "]", o.Value.ToString());
                                i   = i + 1;
                            }
                        }
                    }
                }
                al.Add(sql);
                ds = MySqlHelpers.Query(al);
            }
            catch (Exception ex)
            {
                FileLog.WriteLog(ex.ToString());
            }

            if (ds != null)
            {
                return(ds);
            }
            else
            {
                return(null);
            }
        }
示例#3
0
        /// <summary>
        /// 安装ID编号查找
        /// </summary>
        /// <param name="tabID"></param>
        /// <returns></returns>
        public DataTable GetGridDataSource(string tabID)
        {
            Dictionary <string, Dimention> report = GetReport();
            Dimention dimention = report[tabID];
            ArrayList al        = new ArrayList();
            string    sql       = "";
            DataTable dt        = null;

            sql = dimention.SqlAll.Replace("%Where%", " ");
            al.Add(sql);
            DataSet ds = new DataSet();

            ds = MySqlHelpers.Query(al);
            for (int i = 0; i < ds.Tables.Count; i++)
            {
                if (dt != null)
                {
                    if (ds.Tables[i].Rows.Count > 0)
                    {
                        dt.Merge(ds.Tables[i]);
                    }
                }
                else
                {
                    if (ds.Tables[i].Rows.Count > 0)
                    {
                        dt = ds.Tables[i].Copy();
                    }
                }
            }
            if (dt != null)
            {
                DataView dv = dt.DefaultView;
                //  dv.Sort = "CITYNAME";
                dt = dv.ToTable();
            }
            return(dt);
        }