Пример #1
0
        /// <summary>
        /// 初始化Grid
        /// </summary>
        /// <param name="ModuleCode"></param>
        /// <param name="Namespace"></param>
        /// <param name="param"></param>
        /// <returns></returns>
        public DataTable GetListPageAllRecords(string ModuleCode, string Namespace, Dictionary <string, string> param)
        {
            //读出配置存储过程及参数
            Bll_Sys_Config_ListPage ConfigMInstance = new Bll_Sys_Config_ListPage();
            Bll_Bse_Dict            DictInstance    = new Bll_Bse_Dict();
            Bll_Sys_Config_Fieled   FieldInstance   = new Bll_Sys_Config_Fieled();

            Sys_Config_ListPage      config    = ConfigMInstance.GetListByCode(" AND M_ModuleCode='" + ModuleCode + "' ")[0];
            List <Sys_Config_Fieled> ListField = FieldInstance.GetListByCode(" AND D_ModuleCode='" + ModuleCode + "'");


            List <SqlParameter> list   = new List <SqlParameter>();
            SqlParameter        search = new SqlParameter("@Search", param["@Search"]);

            list.Add(search);
            SqlParameter sidx = new SqlParameter("@Sidx", param["@Sidx"]);

            list.Add(sidx);
            SqlParameter sord = new SqlParameter("@Sord", param["@Sord"]);

            list.Add(sord);
            SqlParameter userid = new SqlParameter("@Userid", param["@Userid"]);

            list.Add(userid);
            SqlParameter deptid = new SqlParameter("@Deptid", param["@Deptid"]);

            list.Add(deptid);
            SqlParameter modulecode = new SqlParameter("@ModuleCode", ModuleCode);

            list.Add(modulecode);
            SqlParameter _namespace = new SqlParameter("@NameSpace", Namespace);

            list.Add(_namespace);
            SqlParameter InlineType = new SqlParameter("@InlineType", param["@InlineType"]);

            list.Add(InlineType);
            SqlParameter GeneralType = new SqlParameter("@GeneralType", param["@GeneralType"]);

            list.Add(GeneralType);
            DataTable newDt = instance.idb.RunProcReturnDatatable(config.M_SQL, list.ToArray());


            #region Old,已被废弃掉的代码片段 By Ye Fei  2011-01-30
            //首先获取config_filed表中有数据字典的列及相关数据字典标示
            //var newList = ListField.Where(o => !string.IsNullOrEmpty(o.D_DictKey) && o.D_EditType.ToLower()=="dict" && o.D_Hidden!="true" );
            //if (newList.Count()>0)
            //{
            //    for (int i = 0; i < newDt.Rows.Count; i++)
            //    {
            //        foreach (Sys_Config_Fieled item in newList)
            //        {
            //            var DictResult = DictInstance.GetListByCode(" AND Dict_Code='" +
            //                                                          newDt.Rows[i][item.D_Index].ToString()
            //                                                          + "' AND Dict_Key='"+item.D_DictKey+"' ");
            //            if (DictResult.Count > 0)
            //            {
            //                newDt.Rows[i][item.D_Index] = DictResult.FirstOrDefault().Dict_Name;
            //            }

            //            if (param["@InlineType"].Length > 0)
            //            {
            //                //物料动态字典取值
            //                string dynKey = param["@InlineType"] + "TYPE";
            //                var Result = DictInstance.GetListByCode(" AND Dict_Code='" +
            //                                                         newDt.Rows[i][item.D_Index].ToString()
            //                                                         + "' AND Dict_Key='" + dynKey.ToUpper() + "' ");
            //                if (Result.Count > 0)
            //                {
            //                    newDt.Rows[i][item.D_Index] = Result.FirstOrDefault().Dict_Name;
            //                }
            //            }

            //        }
            //    }
            //}

            ///排序
            //if (!string.IsNullOrEmpty(config.M_TableName))
            //{
            //    Bll_Comm commInstance = new Bll_Comm();
            //    DataSet ds = commInstance.GetTableInfo(config.M_TableName);
            //    string TableKey = commInstance.GetTableKey(ds);
            //    if (!string.IsNullOrEmpty(TableKey))
            //    {
            //        DataView dv = newDt.DefaultView;
            //        dv.Sort = TableKey + " desc";
            //        newDt = dv.ToTable();
            //    }
            //}
            #endregion
            return(newDt);
        }
Пример #2
0
        /// <summary>
        /// 初始化Grid
        /// </summary>
        /// <param name="ModuleCode"></param>
        /// <param name="Namespace"></param>
        /// <param name="param"></param>
        /// <returns></returns>
        public DataTable GetListPageAllRecords(string ModuleCode,string Namespace,Dictionary<string,string> param)
        {
            //读出配置存储过程及参数
            Bll_Sys_Config_ListPage ConfigMInstance = new Bll_Sys_Config_ListPage();
            Bll_Bse_Dict DictInstance = new Bll_Bse_Dict();
            Bll_Sys_Config_Fieled FieldInstance = new Bll_Sys_Config_Fieled();

            Sys_Config_ListPage config = ConfigMInstance.GetListByCode(" AND M_ModuleCode='" + ModuleCode + "' ")[0];
            List<Sys_Config_Fieled> ListField = FieldInstance.GetListByCode(" AND D_ModuleCode='" + ModuleCode + "'");

            List<SqlParameter> list = new List<SqlParameter>();
            SqlParameter search = new SqlParameter("@Search",param["@Search"]);
            list.Add(search);
            SqlParameter sidx = new SqlParameter("@Sidx", param["@Sidx"]);
            list.Add(sidx);
            SqlParameter sord = new SqlParameter("@Sord", param["@Sord"]);
            list.Add(sord);
            SqlParameter userid = new SqlParameter("@Userid", param["@Userid"]);
            list.Add(userid);
            SqlParameter deptid = new SqlParameter("@Deptid", param["@Deptid"]);
            list.Add(deptid);
            SqlParameter modulecode = new SqlParameter("@ModuleCode", ModuleCode);
            list.Add(modulecode);
            SqlParameter _namespace = new SqlParameter("@NameSpace", Namespace);
            list.Add(_namespace);
            SqlParameter InlineType = new SqlParameter("@InlineType", param["@InlineType"]);
            list.Add(InlineType);
            SqlParameter GeneralType = new SqlParameter("@GeneralType", param["@GeneralType"]);
            list.Add(GeneralType);
            DataTable newDt=instance.idb.RunProcReturnDatatable(config.M_SQL,list.ToArray());

            #region Old,已被废弃掉的代码片段 By Ye Fei  2011-01-30
            //首先获取config_filed表中有数据字典的列及相关数据字典标示
            //var newList = ListField.Where(o => !string.IsNullOrEmpty(o.D_DictKey) && o.D_EditType.ToLower()=="dict" && o.D_Hidden!="true" );
            //if (newList.Count()>0)
            //{
            //    for (int i = 0; i < newDt.Rows.Count; i++)
            //    {
            //        foreach (Sys_Config_Fieled item in newList)
            //        {
            //            var DictResult = DictInstance.GetListByCode(" AND Dict_Code='" +
            //                                                          newDt.Rows[i][item.D_Index].ToString()
            //                                                          + "' AND Dict_Key='"+item.D_DictKey+"' ");
            //            if (DictResult.Count > 0)
            //            {
            //                newDt.Rows[i][item.D_Index] = DictResult.FirstOrDefault().Dict_Name;
            //            }

            //            if (param["@InlineType"].Length > 0)
            //            {
            //                //物料动态字典取值
            //                string dynKey = param["@InlineType"] + "TYPE";
            //                var Result = DictInstance.GetListByCode(" AND Dict_Code='" +
            //                                                         newDt.Rows[i][item.D_Index].ToString()
            //                                                         + "' AND Dict_Key='" + dynKey.ToUpper() + "' ");
            //                if (Result.Count > 0)
            //                {
            //                    newDt.Rows[i][item.D_Index] = Result.FirstOrDefault().Dict_Name;
            //                }
            //            }

            //        }
            //    }
            //}

            ///排序
            //if (!string.IsNullOrEmpty(config.M_TableName))
            //{
            //    Bll_Comm commInstance = new Bll_Comm();
            //    DataSet ds = commInstance.GetTableInfo(config.M_TableName);
            //    string TableKey = commInstance.GetTableKey(ds);
            //    if (!string.IsNullOrEmpty(TableKey))
            //    {
            //        DataView dv = newDt.DefaultView;
            //        dv.Sort = TableKey + " desc";
            //        newDt = dv.ToTable();
            //    }
            //}
            #endregion
            return newDt;
        }