コード例 #1
0
ファイル: Bll_Comm.cs プロジェクト: youthjoy/qxhelper
        public static Sys_Config_ListPage GetListConfig(string moduleName, out Sys_Config_ListPage M_Model, out List<Sys_Config_Fieled> D_List)
        {
            ADOSys_Config_ListPage ListInstance = new ADOSys_Config_ListPage();
            ADOSys_Config_Fieled FieledInstance = new ADOSys_Config_Fieled();
            M_Model = null;
            D_List = null;
            try
            {
                if (!string.IsNullOrEmpty(moduleName))
                {
                    //第一步:根据传入模块获取Grid配置
                    List<Sys_Config_ListPage> _ListPage = ListInstance.GetListByWhere(" AND M_ModuleCode='" +
                    moduleName + "'");
                    if (_ListPage.Count > 0)
                    {
                        M_Model = _ListPage[0];
                    }
                    //第二步:根据模块获取所有字段
                    D_List = FieledInstance.GetListByWhere(" AND D_ModuleCode='" + moduleName + "'");
                }
                else
                {
                    M_Model = null;
                    D_List = null;
                }
            }
            catch (System.Exception ex)
            {
                M_Model = null;
                D_List = null;
            }

            return M_Model;
        }
コード例 #2
0
ファイル: DynQueryExtend.cs プロジェクト: youthjoy/qxhelper
        /// <summary>
        /// 动态解析查询条件
        /// </summary>
        /// <param name="txt"></param>
        /// <param name="module"></param>
        /// <returns></returns>
        public static string BuildSearch(this string txt, string module)
        {
            var QueryLeftTree = string.Empty;
            StringBuilder strQuery = new StringBuilder();
            //Dictionary<string, string> dict = ReturnBuild();
            Dictionary<string, string> dict = new Dictionary<string, string>();
            MetaOper mod = JsonConvert.DeserializeObject<MetaOper>(txt);
            List<MetaRules> oper = JsonConvert.DeserializeObject<List<MetaRules>>(mod.rules.ToString());

            ADOBse_Dict DictInstance = new ADOBse_Dict();
            Sys_Config_ListPage M_Model = new Sys_Config_ListPage();
            List<Sys_Config_Fieled> D_List = new List<Sys_Config_Fieled>();

            GetListConfig(module, out M_Model, out D_List);

            var D_List_Dict = D_List.Where(o => !string.IsNullOrEmpty(o.D_DictKey) && (string.IsNullOrEmpty(o.D_Hidden) || o.D_Hidden == "false"));

            var Str_DictList = D_List.Select(o => o.D_Index);
            var Str_Oper = oper.Select(o => o.field);

            if (D_List_Dict.Count() > 0 && Str_DictList.Intersect(Str_Oper).Count() > 0)
            {

                for (int i = 0; i < oper.Count; i++)
                {
                    string _oper = string.Empty;
                    StringBuilder ConvertData = new StringBuilder();
                    if (i != oper.Count - 1)
                    {
                        _oper = "  " + mod.groupOp + "  ";
                    }
                    var D_ListQuery = D_List_Dict.Where(o => o.D_Index == oper[i].field);

                    if (D_ListQuery.Count() > 0)
                    {
                        dict = ReturnBuildDict();

                        //构建查询条件Field
                        QueryLeftTree = !string.IsNullOrEmpty(D_ListQuery.First().D_DBField) ? D_ListQuery.First().D_DBField : oper[i].field;

                        //获取字典Code
                        if (!string.IsNullOrEmpty(oper[i].data))
                        {
                            var DictResult = DictInstance.GetListByWhere(" AND Dict_Key!=Dict_Code AND Dict_Name like '%" + oper[i].data + "%'");
                            if (DictResult.Count > 0)
                            {
                                foreach (var item in DictResult)
                                {
                                    ConvertData.Append("'" + item.Dict_Code + "',");
                                }
                            }

                            strQuery.Append(dict[oper[i].op].Replace("{field}", QueryLeftTree).Replace("{data}", ConvertData.ToString().TrimEnd(',')) + _oper);
                        }
                    }
                    else
                    {
                        dict = ReturnBuild();
                        if (i != oper.Count - 1)
                        {
                            _oper = "  " + mod.groupOp + "  ";
                        }

                        strQuery.Append(dict[oper[i].op].Replace("{field}", oper[i].field).Replace("{data}", oper[i].data) + _oper);
                    }
                }
            }
            else
            {
                if (oper.Count > 0)
                {
                    dict = ReturnBuild();
                    for (int i = 0; i < oper.Count; i++)
                    {
                        string _oper = string.Empty;
                        if (i != oper.Count - 1)
                        {
                            _oper = "  " + mod.groupOp + "  ";
                        }

                        strQuery.Append(dict[oper[i].op].Replace("{field}", oper[i].field).Replace("{data}", oper[i].data) + _oper);
                    }
                }
            }

            return strQuery.ToString();
        }
コード例 #3
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name='model'>实体</param>
        /// <returns>bool</returns>
        public bool Insert(Sys_Config_ListPage model)
        {
            bool result = false;
            try
            {
                int _result = instance.Add(model);
                if (_result > 0)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return result;
        }
コード例 #4
0
 /// <summary>
 /// 插入数据
 /// </summary>
 /// <param name='model'>实体</param>
 /// <param name='model'>是否完成验证</param>
 /// <returns>bool</returns>
 /// <summary>
 /// 获取实体数据
 /// </summary>
 /// <param name='strCondition'>条件(AND Code='11')</param>
 /// <returns>model</returns>
 public Sys_Config_ListPage GetModel(string strCondition)
 {
     List<Sys_Config_ListPage> list = instance.GetListByWhere(strCondition);
     Sys_Config_ListPage model = new Sys_Config_ListPage();
     if (list != null && list.Count > 0)
     {
         model = list[0];
     }
     else
     {
         model = null;
     }
     return model;
 }
コード例 #5
0
        public static string GenToolbarHelper(this HtmlHelper helper, string moduleName, string prefix, bool HiddeOther, string ToolBarConfig)
        {
            ADOComm comInstance = new ADOComm();

            Sys_Config_ListPage M_Model = new Sys_Config_ListPage();

            //第一步:根据传入模块获取Grid配置
            List<Sys_Config_ListPage> _ListPage = new DAL.ADOSys_Config_ListPage().GetListByWhere(" AND M_ModuleCode='" +
            moduleName + "'");

            //工具条配置
            List<Sys_Config_Toolbar> _Config = new List<Sys_Config_Toolbar>();
            DAL.ADOSys_Config_Toolbar tInstance = new ADOSys_Config_Toolbar();
            _Config = tInstance.GetListByWhere(string.Format("AND CT_Module='{0}' and isnull(CT_Show,'true')='true'", moduleName));

            if (_ListPage.Count > 0)
            {
                M_Model = _ListPage[0];
            }
            //工具条各控件前缀
            string strPrefix = "";

            strPrefix = prefix;

            ToolBar bar = new ToolBar();
            if (!string.IsNullOrEmpty(ToolBarConfig))
            {
                bar = JsonConvert.DeserializeObject<ToolBar>("{" + ToolBarConfig + "}");
            }

            var HasAdd = 1;
            var HasEdit = 1;
            var HasView = 1;
            var HasDel = 1;
            var HasImport = 1;
            var HasExport = 1;

            var IS_OPEN_PERMISSION = ConfigHelper.GetApp("IS_OPEN_PERMISSION");
            ///ToDo:暂时屏蔽
            //if (!string.IsNullOrEmpty(IS_OPEN_PERMISSION) && IS_OPEN_PERMISSION == "true")
            //{
            //    var Permission = comInstance.UserPermissionList(QX.Config.SessionConfig.UserId());
            //    HasAdd = Permission.Where(o => o.Fun_UDef1 == strPrefix + "_add").Count();
            //    HasEdit = Permission.Where(o => o.Fun_UDef1 == strPrefix + "_edit").Count();
            //    HasView = Permission.Where(o => o.Fun_UDef1 == strPrefix + "_view").Count();
            //    HasDel = Permission.Where(o => o.Fun_UDef1 == strPrefix + "_delete").Count();
            //    HasImport = Permission.Where(o => o.Fun_UDef1 == strPrefix + "_import").Count();
            //    HasExport = Permission.Where(o => o.Fun_UDef1 == strPrefix + "_export").Count();
            //}

            #region 按钮Html(定义增删改搜索等模板)
            //{add} -->补充属性  prefix-->id前缀 {toolbar_add}--->样式
            string controlTpl = @"<li {attr}  id='{toolbar_id}' class='{toolbar_class}'><a class='hide'  onclick='{toolbar_event}' href='#'>{addN}</a></li>";

            string Li_edit = @"<li {edit} id='{prefix}_toolbar_edit' class='{toolbar_edit}'><a class='hide' id='{prefix}_edit' onclick='{prefix}ToolBar.Edit()' href='#'>{editN}</a></li>";
            string Li_del = @"<li {del} id='{prefix}_toolbar_delete' class='{toolbar_delete}'><a class='hide' id='{prefix}_delete' onclick='{prefix}ToolBar.Delete()' href='#'>{delN}</a></li> ";
            string Li_view = @"<li {view} id='{prefix}_toolbar_view' class='{toolbar_view}'><a class='hide' id='{prefix}_view' onclick='{prefix}ToolBar.View()' href='#'>{viewN}</a></li> ";
            //string Li_import = @"<li {import} id='{prefix}_toolbar_import' class='{toolbar_import}'><a class='hide' id='{prefix}_import' onclick='{prefix}ToolBar.Import()' href='#'>{importN}</a></li>";
            //string Li_export = @"<li {export} id='{prefix}_toolbar_export' class='{toolbar_export}'><a class='hide' id='{prefix}_export' onclick='{prefix}ToolBar.Export()' href='#'>{exportN}</a></li>";
            string Li_search = @"<li {search} id='{prefix}_toolbar_search'  class='{toolbar_search}'><input style='display:none' id='search_txt' type='text' value='' />
                <a id='{prefix}_search' onclick='{prefix}ToolBar.Search()' href='#'>{searchN}</a>
                </li>  ";
            string Li_Custom = @"<li {add} id='{prefix}_toolbar_add' class='{toolbar_add}'><a id='{prefix}_add' onclick='{prefix}ToolBar.Add()' href='#'>{addN}</a></li>";

            #endregion

            bool toolbar = !string.IsNullOrEmpty(bar.toolbar) ? true : false;
            string validatemethod = @"

                if ($.isFunction(window.{prefix}ToolBar{OpType}))
                {
                    {prefix}ToolBar{OpType}();
                 }
                else
                {
                    {nameSpace}_{moduleName}ToolBar{OpType}();
                }";
            string str = @"
            <div id='{prefix}toolbar' class='toolbar'>
            <ul>
              {Toolbar_Config}
            </ul>
             </div>
             <script type='text/javascript'>
                 var {prefix}ToolBar = {
                    {Toolbar_Function}
                    HideElement:function(id){
                         $('#id').hide();
                    },
                    ChangeElement:function(id,name){
                         $('#id').find('a').val(name);
                    }
                 }
                //插入菜单项:文本,回调,位置(ID),样式
             </script>
            ";
            StringBuilder configSb = new StringBuilder();
            StringBuilder functionSb = new StringBuilder();
            foreach (var m in _Config)
            {
                switch (m.CT_Type)
                {
                    case "add":
                    case "edit":
                    case "del":
                    case "view":
                        {
                            //控件id
                            string id = prefix + "_toolbar_" + m.CT_Type;
                            string eventjs = string.Format(prefix + "ToolBar.{0}()", m.CT_Type);
                            string classjs = string.Format("toolbar_{0}", m.CT_Type);
                            configSb.Append(controlTpl.Replace("{prefix}", prefix)
                                .Replace("{toolbar_id}", id)
                                .Replace("{addN}", m.CT_Name)
                                .Replace("{toolbar_class}", string.IsNullOrEmpty(m.CT_Class) ? classjs : m.CT_Class)
                                .Replace("{toolbar_event}", eventjs)
                                .Replace("{attr}", m.CT_Attr)
                                );
                            if (string.IsNullOrEmpty(m.CT_Event))
                            {
                                m.CT_Event = validatemethod.Replace("{OpType}", m.CT_Type).Replace("{prefix}", strPrefix).Replace("{nameSpace}", prefix).Replace("{moduleName}", moduleName);
                            }
                            //事件定义
                            //string.IsNullOrEmpty(m.CT_Event)?eventjs:m.CT_Event
                            functionSb.AppendLine();
                            functionSb.AppendLine("              " + m.CT_Type + ":function(){");
                            functionSb.AppendLine("              " + m.CT_Event);
                            functionSb.AppendLine("               },");
                            break;
                        }
                    //case "edit":
                    //    {
                    //        break;
                    //    }
                    //case "del":
                    //    {

                    //        break;
                    //    }
                    //case "view":
                    //    {

                    //        break;
                    //    }
                    case "search":
                        {

                            break;
                        }
                    case "text":
                        {

                            break;
                        }
                    case "btn":
                        {
                            string id = prefix + "_toolbar_" + m.CT_Field;
                            string eventjs = string.Format(prefix + "ToolBar.{0}()", m.CT_Field);
                            string classjs = string.Format("toolbar_{0}", m.CT_Field);
                            configSb.Append(controlTpl.Replace("{prefix}", prefix)
                                .Replace("{toolbar_id}", id)
                                .Replace("{addN}", m.CT_Name)
                                .Replace("{toolbar_class}", string.IsNullOrEmpty(m.CT_Class) ? classjs : m.CT_Class)
                                .Replace("{toolbar_event}", eventjs)
                                .Replace("{attr}", m.CT_Attr)
                                );
                            //事件定义
                            //string.IsNullOrEmpty(m.CT_Event)?eventjs:m.CT_Event
                            functionSb.AppendLine();
                            functionSb.AppendLine("              " + m.CT_Type + ":function(){");
                            functionSb.AppendLine("              " + m.CT_Event);
                            functionSb.AppendLine("               },");
                            break;
                        }
                }

            }//end foreach

            str = str.Replace("{prefix}", prefix).Replace("{Toolbar_Config}", configSb.ToString()).Replace("{Toolbar_Function}", functionSb.ToString());
            //#region 按钮解析(配置生成)

            //string add = !string.IsNullOrEmpty(bar.add) ? "style='display:none'" : "style='display:block'";
            //string addN = !string.IsNullOrEmpty(bar.addN) ? bar.addN : "添加";
            //string addClass = !string.IsNullOrEmpty(bar.addClass) ? bar.addClass : "toolbar_add";
            //string edit = !string.IsNullOrEmpty(bar.edit) ? "style='display:none'" : "style='display:block'";
            //string editN = !string.IsNullOrEmpty(bar.editN) ? bar.editN : "修改";
            //string editClass = !string.IsNullOrEmpty(bar.editClass) ? bar.editClass : "toolbar_edit";
            //string del = !string.IsNullOrEmpty(bar.del) ? "style='display:none'" : "style='display:block'";
            //string delN = !string.IsNullOrEmpty(bar.delN) ? bar.delN : "删除";
            //string delClass = !string.IsNullOrEmpty(bar.delClass) ? bar.delClass : "toolbar_delete";
            //string view = !string.IsNullOrEmpty(bar.view) ? "style='display:none'" : "style='display:block'";
            //string viewN = !string.IsNullOrEmpty(bar.viewN) ? bar.viewN : "查看";
            //string viewClass = !string.IsNullOrEmpty(bar.viewClass) ? bar.viewClass : "toolbar_view";
            ////string import = !string.IsNullOrEmpty(bar.import) ? "style='display:none'" : "style='display:block'";
            ////string importN = !string.IsNullOrEmpty(bar.importN) ? bar.importN : "导入";
            ////string importClass = !string.IsNullOrEmpty(bar.importClass) ? bar.importClass : "toolbar_import";
            ////string export = !string.IsNullOrEmpty(bar.export) ? "style='display:none'" : "style='display:block'";
            ////string exportN = !string.IsNullOrEmpty(bar.exportN) ? bar.exportN : "导出";
            ////string exportClass = !string.IsNullOrEmpty(bar.exportClass) ? bar.exportClass : "toolbar_export";
            //string search = !string.IsNullOrEmpty(bar.search) ? "style='display:none'" : "style='display:block'";
            //string searchN = !string.IsNullOrEmpty(bar.searchN) ? bar.searchN : "搜索";
            //string searchClass = !string.IsNullOrEmpty(bar.searchClass) ? bar.searchClass : "toolbar_search";
            //#endregion

            //#region 事件定义

            //string addJS = !string.IsNullOrEmpty(bar.addFunJs) ? "{prefix}" + bar.addFunJs : validatemethod.Replace("{OpType}", "Add");
            //string editJs = !string.IsNullOrEmpty(bar.editFunJs) ? "{prefix}" + bar.editFunJs : validatemethod.Replace("{OpType}", "Edit");
            //string delJs = !string.IsNullOrEmpty(bar.delFunJs) ? "{prefix}" + bar.delFunJs : validatemethod.Replace("{OpType}", "Del");
            //string viewJs = !string.IsNullOrEmpty(bar.viewFunJs) ? "{prefix}" + bar.viewFunJs : validatemethod.Replace("{OpType}", "View");
            ////string importJs = !string.IsNullOrEmpty(bar.importFunJs) ? "{prefix}" + bar.importFunJs : "{prefix}ToolBarImport()";
            ////string exportJs = !string.IsNullOrEmpty(bar.exportFunJs) ? "{prefix}" + bar.exportFunJs : "{prefix}ToolBarExport()";
            //string searchJs = !string.IsNullOrEmpty(bar.searchFunJs) ? "{prefix}" + bar.searchFunJs : "{prefix}ToolBarSearch()";
            //#endregion

            //            #region HTML生成
            //            string str = @"
            //            <div id='{prefix}toolbar' class='toolbar'>
            //            <ul>
            //                {Li_add}
            //                {Li_edit}
            //                {Li_del}
            //                {Li_view}
            //                {Li_search}
            //            </ul>
            //             </div>
            //             <script type='text/javascript'>
            //                 var {prefix}ToolBar = {
            //                     Add: function() {
            //                         {addJs};
            //                     },
            //                     Edit: function() {
            //                         {editJs};
            //                     },
            //                     Delete: function() {
            //                         {delJs};
            //                     },
            //                     View: function() {
            //                         {viewJs};
            //                     },
            //                     Search: function() {
            //                         {searchJs};
            //                     },
            //                     Import: function() {
            //                         {importJs};
            //                     },
            //                     Export: function() {
            //                         {exportJs};
            //                     },
            //                    HideElement:function(id){
            //                         $('#id').hide();
            //                    },
            //                    ChangeElement:function(id,name){
            //                         $('#id').find('a').val(name);
            //                    }
            //                 }
            //                //插入菜单项:文本,回调,位置(ID),样式
            //
            //
            //             </script>
            //            ";
            //            #endregion

            //            Li_add = HasAdd > 0 ? Li_add : "";
            //            Li_edit = HasEdit > 0 ? Li_edit : "";
            //            Li_del = HasDel > 0 ? Li_del : "";
            //            //Li_import = HasImport > 0 ? Li_import : "";
            //            //Li_export = HasExport > 0 ? Li_export : "";
            //            Li_view = HasView > 0 ? Li_view : "";

            //            bool HasConfig = !string.IsNullOrEmpty(ToolBarConfig) ? true : false;
            //            if (HasConfig)
            //            {
            //                str = str.Replace("{Li_add}", ((!string.IsNullOrEmpty(bar.addN) || !string.IsNullOrEmpty(bar.addFunJs))) ? Li_add : "");
            //                str = str.Replace("{Li_edit}", ((!string.IsNullOrEmpty(bar.editN) || !string.IsNullOrEmpty(bar.editFunJs))) ? Li_edit : "");
            //                str = str.Replace("{Li_del}", ((!string.IsNullOrEmpty(bar.delN) || !string.IsNullOrEmpty(bar.delFunJs))) ? Li_del : "");
            //                str = str.Replace("{Li_view}", ((!string.IsNullOrEmpty(bar.viewN) || !string.IsNullOrEmpty(bar.viewFunJs))) ? Li_view : "");
            //                //str = str.Replace("{Li_import}", ((!string.IsNullOrEmpty(bar.importN) || !string.IsNullOrEmpty(bar.importFunJs))) ? Li_import : "");
            //                //str = str.Replace("{Li_export}", ((!string.IsNullOrEmpty(bar.exportN) || !string.IsNullOrEmpty(bar.exportFunJs))) ? Li_export : "");
            //                //str = str.Replace("{Li_search}", ((!string.IsNullOrEmpty(bar.searchN) || !string.IsNullOrEmpty(bar.searchFunJs))) ? Li_search : "");
            //            }
            //            else//默认生成的话根据配置进行生成
            //            {
            //                if (M_Model.M_IsAdd == 1)
            //                {
            //                    str = str.Replace("{Li_add}", Li_add);
            //                }
            //                else
            //                {
            //                    str = str.Replace("{Li_add}", "");
            //                }
            //                if (M_Model.M_IsEdit == 1)
            //                {
            //                    str = str.Replace("{Li_edit}", Li_edit);
            //                }
            //                else
            //                {
            //                    str = str.Replace("{Li_edit}", "");
            //                }
            //                if (M_Model.M_IsDelete == 1)
            //                {
            //                    str = str.Replace("{Li_del}", Li_del);
            //                }
            //                else
            //                {
            //                    str = str.Replace("{Li_del}", "");
            //                }
            //                if (M_Model.M_IsView == "true")
            //                {
            //                    str = str.Replace("{Li_view}", Li_view);
            //                }
            //                else
            //                {
            //                    str = str.Replace("{Li_view}", "");
            //                }
            //                //str = str.Replace("{Li_import}", Li_import);
            //                //str = str.Replace("{Li_export}", Li_export);

            //            }
            //            //搜索 默认输出
            //            str = str.Replace("{Li_search}", Li_search);
            //            if (M_Model.M_IsAdd == 1)
            //            {
            //                str = str.Replace("{toolbar_add}", addClass);
            //            }
            //            else
            //            {
            //                str = str.Replace("{toolbar_add}", "");
            //            }
            //            if (M_Model.M_IsEdit == 1)
            //            {
            //                str = str.Replace("{toolbar_edit}", editClass);
            //            }
            //            else
            //            {
            //                str = str.Replace("{toolbar_edit}", "");
            //            }
            //            str = str.Replace("{toolbar_delete}", delClass);
            //            if (M_Model.M_IsView == "true")
            //            {
            //                str = str.Replace("{toolbar_view}", viewClass);
            //            }
            //            else
            //            {
            //                str = str.Replace("{toolbar_view}", "");
            //            }
            //            //str = str.Replace("{toolbar_import}", importClass);
            //            //str = str.Replace("{toolbar_export}", exportClass);
            //            str = str.Replace("{toolbar_search}", searchClass);

            //            if (M_Model.M_IsAdd == 1)
            //            {
            //                str = str.Replace("{addJs}", addJS);
            //            }
            //            else
            //            {
            //                str = str.Replace("{addJs}", "");
            //            }
            //            if (M_Model.M_IsEdit == 1)
            //            {
            //                str = str.Replace("{editJs}", editJs);
            //            }
            //            else
            //            {
            //                str = str.Replace("{editJs}", "");
            //            }

            //            if (M_Model.M_IsDelete == 1)
            //            {
            //                str = str.Replace("{delJs}", delJs);
            //            }
            //            else
            //            {
            //                str = str.Replace("{delJs}", "");
            //            }

            //            if (M_Model.M_IsView == "true")
            //            {
            //                str = str.Replace("{viewJs}", viewJs);
            //            }
            //            else
            //            {
            //                str = str.Replace("{viewJs}", "");
            //            }

            //            //str = str.Replace("{viewJs}", viewJs);
            //            str = str.Replace("{searchJs}", searchJs);
            //            //str = str.Replace("{importJs}", importJs);
            //            //str = str.Replace("{exportJs}", exportJs);
            //            str = str.Replace("{searchJs}", searchJs);

            //            str = str.Replace("{prefix}", strPrefix);
            //            str = str.Replace("{newprefix}", prefix);
            //            str = str.Replace("{add}", add);
            //            str = str.Replace("{addN}", addN);
            //            str = str.Replace("{edit}", edit);
            //            str = str.Replace("{editN}", editN);
            //            str = str.Replace("{del}", del);
            //            str = str.Replace("{delN}", delN);

            //            str = str.Replace("{view}", view);

            //            str = str.Replace("{viewN}", viewN);
            //            //str = str.Replace("{import}", import);
            //            //str = str.Replace("{importN}", importN);
            //            //str = str.Replace("{export}", export);
            //            //str = str.Replace("{exportN}", exportN);
            //            str = str.Replace("{search}", search);
            //            str = str.Replace("{searchN}", searchN);

            //            str = str.Replace("{moduleName}", M_Model.M_ModuleCode);
            //            str = str.Replace("{nameSpace}", M_Model.M_NameSpace);
            //            if (toolbar)
            //            {
            //                str = "";
            //            }
            return str;
        }
コード例 #6
0
        public static string GenNToolbarHelper(this HtmlHelper helper, string moduleName, string prefix, bool nopermission, Dictionary<string, string> permisons)
        {
            ADOComm comInstance = new ADOComm();

            Sys_Config_ListPage M_Model = new Sys_Config_ListPage();

            //第一步:根据传入模块获取Grid配置
            List<Sys_Config_ListPage> _ListPage = new DAL.ADOSys_Config_ListPage().GetListByWhere(" AND M_ModuleCode='" +
            moduleName + "'");

            //工具条配置
            List<Sys_Config_Toolbar> _Config = new List<Sys_Config_Toolbar>();
            DAL.ADOSys_Config_Toolbar tInstance = new ADOSys_Config_Toolbar();
            _Config = tInstance.GetListByWhere(string.Format("AND CT_Module='{0}' and isnull(CT_Show,'true')='true'", moduleName));

            if (_ListPage.Count > 0)
            {
                M_Model = _ListPage[0];
            }
            //工具条各控件前缀
            string strPrefix = "";

            strPrefix = prefix;

            var IS_OPEN_PERMISSION = ConfigHelper.GetApp("IS_OPEN_PERMISSION");

            #region 按钮Html(定义增删改搜索等模板)
            //{add} -->补充属性  prefix-->id前缀 {toolbar_add}--->样式
            string controlTpl = @"<li {attr}  id='{toolbar_id}' class='{toolbar_class}'><a class='hide'  onclick='{toolbar_event}' href='#'>{addN}</a></li>";
            #endregion

            string validatemethod = @"

                if ($.isFunction(window.{prefix}ToolBar{OpType}))
                {
                    {prefix}ToolBar{OpType}();
                 }
                else
                {
                    {nameSpace}_{moduleName}ToolBar{OpType}();
                }";
            string str = @"
            <div id='{prefix}toolbar' class='toolbar'>
            <ul>
              {Toolbar_Config}
            </ul>
             </div>
             <script type='text/javascript'>
                 var {prefix}ToolBar = {
                    {Toolbar_Function}
                    HideElement:function(id){
                         $('#id').hide();
                    },
                    ChangeElement:function(id,name){
                         $('#id').find('a').val(name);
                    }
                 }
                //插入菜单项:文本,回调,位置(ID),样式
             </script>
            ";
            StringBuilder configSb = new StringBuilder();
            StringBuilder functionSb = new StringBuilder();
            foreach (var m in _Config)
            {
                //控件id
                string cid = prefix + "_toolbar_" + m.CT_Type;
                //默认事件
                string eventjs = string.Format(prefix + "ToolBar.{0}()", m.CT_Type);
                //默认样式
                string classjs = string.Format("toolbar_{0}", m.CT_Type);
                ///如果存在该权限则进行后面的生成操作
                if (nopermission&&(permisons == null || permisons.Values.FirstOrDefault(o => !string.IsNullOrEmpty(o) && cid.ToLower().Equals(o.ToLower())) == null))
                {
                    continue;
                }

                switch (m.CT_Type)
                {
                    case "add":
                    case "edit":
                    case "del":
                    case "view":
                        {
                            configSb.Append(controlTpl.Replace("{prefix}", prefix)
                                .Replace("{toolbar_id}", cid)
                                .Replace("{addN}", m.CT_Name)
                                .Replace("{toolbar_class}", string.IsNullOrEmpty(m.CT_Class) ? classjs : m.CT_Class)
                                .Replace("{toolbar_event}", eventjs)
                                .Replace("{attr}", m.CT_Attr)
                                );
                            if (string.IsNullOrEmpty(m.CT_Event))
                            {
                                m.CT_Event = validatemethod.Replace("{OpType}", m.CT_Type).Replace("{prefix}", strPrefix).Replace("{nameSpace}", prefix).Replace("{moduleName}", moduleName);
                            }
                            //事件定义
                            functionSb.AppendLine();
                            functionSb.AppendLine("              " + m.CT_Type + ":function(){");
                            functionSb.AppendLine("              " + m.CT_Event);
                            functionSb.AppendLine("               },");
                            break;
                        }
                    case "search":
                        {

                            break;
                        }
                    case "text":
                        {

                            break;
                        }
                    case "btn":
                        {
                            string bid = prefix + "_toolbar_" + m.CT_Field;
                            string beventjs = string.Format(prefix + "ToolBar.{0}()", m.CT_Field);
                            string bclassjs = string.Format("toolbar_{0}", m.CT_Field);
                            configSb.Append(controlTpl.Replace("{prefix}", prefix)
                                .Replace("{toolbar_id}", bid)
                                .Replace("{addN}", m.CT_Name)
                                .Replace("{toolbar_class}", string.IsNullOrEmpty(m.CT_Class) ? bclassjs : m.CT_Class)
                                .Replace("{toolbar_event}", beventjs)
                                .Replace("{attr}", m.CT_Attr)
                                );
                            //事件定义
                            functionSb.AppendLine();
                            functionSb.AppendLine("              " + m.CT_Type + ":function(){");
                            functionSb.AppendLine("              " + m.CT_Event);
                            functionSb.AppendLine("               },");
                            break;
                        }
                }

            }//end foreach

            str = str.Replace("{prefix}", prefix).Replace("{Toolbar_Config}", configSb.ToString()).Replace("{Toolbar_Function}", functionSb.ToString());

            return str;
        }
コード例 #7
0
        public static string GenToolbarNoPermissionHelper(this HtmlHelper helper, string moduleName, string prefix, string ToolBarConfig)
        {
            ADOComm comInstance = new ADOComm();
            Sys_Config_ListPage M_Model = new Sys_Config_ListPage();

            //第一步:根据传入模块获取Grid配置
            List<Sys_Config_ListPage> _ListPage = new DAL.ADOSys_Config_ListPage().GetListByWhere(" AND M_ModuleCode='" +
            moduleName + "'");
            if (_ListPage.Count > 0)
            {
                M_Model = _ListPage[0];
            }

            string strPrefix = "";

            strPrefix = prefix;

            ToolBar bar = new ToolBar();
            if (!string.IsNullOrEmpty(ToolBarConfig))
            {
                bar = JsonConvert.DeserializeObject<ToolBar>("{" + ToolBarConfig + "}");
            }

            var HasAdd = 1;
            var HasEdit = 1;
            var HasView = 1;
            var HasDel = 1;
            var HasImport = 1;
            var HasExport = 1;

            //var IS_OPEN_PERMISSION = ConfigHelper.GetApp("IS_OPEN_PERMISSION");
            //if (!string.IsNullOrEmpty(IS_OPEN_PERMISSION) && IS_OPEN_PERMISSION == "true")
            //{
            //    var Permission = comInstance.UserPermissionList(QX.Config.SessionConfig.UserId());
            //    HasAdd = Permission.Where(o => o.Fun_UDef1 == strPrefix + "_add").Count();
            //    HasEdit = Permission.Where(o => o.Fun_UDef1 == strPrefix + "_edit").Count();
            //    HasView = Permission.Where(o => o.Fun_UDef1 == strPrefix + "_view").Count();
            //    HasDel = Permission.Where(o => o.Fun_UDef1 == strPrefix + "_delete").Count();
            //    HasImport = Permission.Where(o => o.Fun_UDef1 == strPrefix + "_import").Count();
            //    HasExport = Permission.Where(o => o.Fun_UDef1 == strPrefix + "_export").Count();
            //}

            #region 按钮Html
            string Li_add = @"<li {add} id='{prefix}_toolbar_add' class='{toolbar_add}'><a class='hide' id='{prefix}_add' onclick='{prefix}ToolBar.Add()' href='#'>{addN}</a></li>";
            string Li_edit = @"<li {edit} id='{prefix}_toolbar_edit' class='{toolbar_edit}'><a class='hide' id='{prefix}_edit' onclick='{prefix}ToolBar.Edit()' href='#'>{editN}</a></li>";
            string Li_del = @"<li {del} id='{prefix}_toolbar_delete' class='{toolbar_delete}'><a class='hide' id='{prefix}_delete' onclick='{prefix}ToolBar.Delete()' href='#'>{delN}</a></li> ";
            string Li_view = @"<li {view} id='{prefix}_toolbar_view' class='{toolbar_view}'><a class='hide' id='{prefix}_view' onclick='{prefix}ToolBar.View()' href='#'>{viewN}</a></li> ";
            //string Li_import = @"<li {import} id='{prefix}_toolbar_import' class='{toolbar_import}'><a class='hide' id='{prefix}_import' onclick='{prefix}ToolBar.Import()' href='#'>{importN}</a></li>";
            //string Li_export = @"<li {export} id='{prefix}_toolbar_export' class='{toolbar_export}'><a class='hide' id='{prefix}_export' onclick='{prefix}ToolBar.Export()' href='#'>{exportN}</a></li>";
            string Li_search = @"<li {search} id='{prefix}_toolbar_search'  class='{toolbar_search}'><input style='display:none' id='search_txt' type='text' value='' />
                <a id='{prefix}_search' onclick='{prefix}ToolBar.Search()' href='#'>{searchN}</a>
                </li>  ";
            string Li_Custom = @"<li {add} id='{prefix}_toolbar_add' class='{toolbar_add}'><a id='{prefix}_add' onclick='{prefix}ToolBar.Add()' href='#'>{addN}</a></li>";

            #endregion

            #region 按钮解析
            bool toolbar = !string.IsNullOrEmpty(bar.toolbar) ? true : false;
            string add = !string.IsNullOrEmpty(bar.add) ? "style='display:none'" : "style='display:block'";
            string addN = !string.IsNullOrEmpty(bar.addN) ? bar.addN : "添加";
            string addClass = !string.IsNullOrEmpty(bar.addClass) ? bar.addClass : "toolbar_add";
            string edit = !string.IsNullOrEmpty(bar.edit) ? "style='display:none'" : "style='display:block'";
            string editN = !string.IsNullOrEmpty(bar.editN) ? bar.editN : "修改";
            string editClass = !string.IsNullOrEmpty(bar.editClass) ? bar.editClass : "toolbar_edit";
            string del = !string.IsNullOrEmpty(bar.del) ? "style='display:none'" : "style='display:block'";
            string delN = !string.IsNullOrEmpty(bar.delN) ? bar.delN : "删除";
            string delClass = !string.IsNullOrEmpty(bar.delClass) ? bar.delClass : "toolbar_delete";
            string view = !string.IsNullOrEmpty(bar.view) ? "style='display:none'" : "style='display:block'";
            string viewN = !string.IsNullOrEmpty(bar.viewN) ? bar.viewN : "查看";
            string viewClass = !string.IsNullOrEmpty(bar.viewClass) ? bar.viewClass : "toolbar_view";
            //string import = !string.IsNullOrEmpty(bar.import) ? "style='display:none'" : "style='display:block'";
            //string importN = !string.IsNullOrEmpty(bar.importN) ? bar.importN : "导入";
            //string importClass = !string.IsNullOrEmpty(bar.importClass) ? bar.importClass : "toolbar_import";
            //string export = !string.IsNullOrEmpty(bar.export) ? "style='display:none'" : "style='display:block'";
            //string exportN = !string.IsNullOrEmpty(bar.exportN) ? bar.exportN : "导出";
            //string exportClass = !string.IsNullOrEmpty(bar.exportClass) ? bar.exportClass : "toolbar_export";
            string search = !string.IsNullOrEmpty(bar.search) ? "style='display:none'" : "style='display:block'";
            string searchN = !string.IsNullOrEmpty(bar.searchN) ? bar.searchN : "搜索";
            string searchClass = !string.IsNullOrEmpty(bar.searchClass) ? bar.searchClass : "toolbar_search";
            #endregion

            #region 事件定义
            string validatemethod = @"
            if ($.isFunction(window.{prefix}ToolBar{OpType}))
            {
              {prefix}ToolBar{OpType}();
            }
            else
            {
            {nameSpace}_{moduleName}ToolBar{OpType}();
            }";
            string addJS = !string.IsNullOrEmpty(bar.addFunJs) ? "{prefix}" + bar.addFunJs : validatemethod.Replace("{OpType}", "Add");
            string editJs = !string.IsNullOrEmpty(bar.editFunJs) ? "{prefix}" + bar.editFunJs : validatemethod.Replace("{OpType}", "Edit");
            string delJs = !string.IsNullOrEmpty(bar.delFunJs) ? "{prefix}" + bar.delFunJs : validatemethod.Replace("{OpType}", "Del");
            string viewJs = !string.IsNullOrEmpty(bar.viewFunJs) ? "{prefix}" + bar.viewFunJs : validatemethod.Replace("{OpType}", "View");
            //string importJs = !string.IsNullOrEmpty(bar.importFunJs) ? "{prefix}" + bar.importFunJs : "{prefix}ToolBarImport()";
            //string exportJs = !string.IsNullOrEmpty(bar.exportFunJs) ? "{prefix}" + bar.exportFunJs : "{prefix}ToolBarExport()";
            string searchJs = !string.IsNullOrEmpty(bar.searchFunJs) ? "{prefix}" + bar.searchFunJs : "{prefix}ToolBarSearch()";
            #endregion

            #region HTML生成
            string str = @"
            <div id='{prefix}toolbar' class='toolbar'>
            <ul>
                {Li_add}
                {Li_edit}
                {Li_del}
                {Li_view}
                {Li_search}
            </ul>
             </div>
             <script type='text/javascript'>
                 var {prefix}ToolBar = {
                     Add: function() {
                         {addJs};
                     },
                     Edit: function() {
                         {editJs};
                     },
                     Delete: function() {
                         {delJs};
                     },
                     View: function() {
                         {viewJs};
                     },
                     Search: function() {
                         {searchJs};
                     },
                     Import: function() {
                         {importJs};
                     },
                     Export: function() {
                         {exportJs};
                     },
                    HideElement:function(id){
                         $('#id').hide();
                    },
                    ChangeElement:function(id,name){
                         $('#id').find('a').val(name);
                    }
                 }
                //插入菜单项:文本,回调,位置(ID),样式

             </script>
            ";
            #endregion

            Li_add = HasAdd > 0 ? Li_add : "";
            Li_edit = HasEdit > 0 ? Li_edit : "";
            Li_del = HasDel > 0 ? Li_del : "";
            //Li_import = HasImport > 0 ? Li_import : "";
            //Li_export = HasExport > 0 ? Li_export : "";
            Li_view = HasView > 0 ? Li_view : "";

            bool HasConfig = !string.IsNullOrEmpty(ToolBarConfig) ? true : false;
            if (HasConfig)
            {
                str = str.Replace("{Li_add}", ((!string.IsNullOrEmpty(bar.addN) || !string.IsNullOrEmpty(bar.addFunJs))) ? Li_add : "");
                str = str.Replace("{Li_edit}", ((!string.IsNullOrEmpty(bar.editN) || !string.IsNullOrEmpty(bar.editFunJs))) ? Li_edit : "");
                str = str.Replace("{Li_del}", ((!string.IsNullOrEmpty(bar.delN) || !string.IsNullOrEmpty(bar.delFunJs))) ? Li_del : "");
                str = str.Replace("{Li_view}", ((!string.IsNullOrEmpty(bar.viewN) || !string.IsNullOrEmpty(bar.viewFunJs))) ? Li_view : "");
                //str = str.Replace("{Li_import}", ((!string.IsNullOrEmpty(bar.importN) || !string.IsNullOrEmpty(bar.importFunJs))) ? Li_import : "");
                //str = str.Replace("{Li_export}", ((!string.IsNullOrEmpty(bar.exportN) || !string.IsNullOrEmpty(bar.exportFunJs))) ? Li_export : "");
                //str = str.Replace("{Li_search}", ((!string.IsNullOrEmpty(bar.searchN) || !string.IsNullOrEmpty(bar.searchFunJs))) ? Li_search : "");
            }
            else//默认生成的话根据配置进行生成
            {
                if (M_Model.M_IsAdd == 1)
                {
                    str = str.Replace("{Li_add}", Li_add);
                }
                else
                {
                    str = str.Replace("{Li_add}", "");
                }
                if (M_Model.M_IsEdit == 1)
                {
                    str = str.Replace("{Li_edit}", Li_edit);
                }
                else
                {
                    str = str.Replace("{Li_edit}", "");
                }
                if (M_Model.M_IsDelete == 1)
                {
                    str = str.Replace("{Li_del}", Li_del);
                }
                else
                {
                    str = str.Replace("{Li_del}", "");
                }
                if (M_Model.M_IsView == "true")
                {
                    str = str.Replace("{Li_view}", Li_view);
                }
                else
                {
                    str = str.Replace("{Li_view}", "");
                }
                //str = str.Replace("{Li_import}", Li_import);
                //str = str.Replace("{Li_export}", Li_export);

            }
            //搜索 默认输出
            str = str.Replace("{Li_search}", Li_search);
            if (M_Model.M_IsAdd == 1)
            {
                str = str.Replace("{toolbar_add}", addClass);
            }
            else
            {
                str = str.Replace("{toolbar_add}", "");
            }
            if (M_Model.M_IsEdit == 1)
            {
                str = str.Replace("{toolbar_edit}", editClass);
            }
            else
            {
                str = str.Replace("{toolbar_edit}", "");
            }
            str = str.Replace("{toolbar_delete}", delClass);
            if (M_Model.M_IsView == "true")
            {
                str = str.Replace("{toolbar_view}", viewClass);
            }
            else
            {
                str = str.Replace("{toolbar_view}", "");
            }
            //str = str.Replace("{toolbar_import}", importClass);
            //str = str.Replace("{toolbar_export}", exportClass);
            str = str.Replace("{toolbar_search}", searchClass);

            if (M_Model.M_IsAdd == 1)
            {
                str = str.Replace("{addJs}", addJS);
            }
            else
            {
                str = str.Replace("{addJs}", "");
            }
            if (M_Model.M_IsEdit == 1)
            {
                str = str.Replace("{editJs}", editJs);
            }
            else
            {
                str = str.Replace("{editJs}", "");
            }

            if (M_Model.M_IsDelete == 1)
            {
                str = str.Replace("{delJs}", delJs);
            }
            else
            {
                str = str.Replace("{delJs}", "");
            }

            if (M_Model.M_IsView == "true")
            {
                str = str.Replace("{viewJs}", viewJs);
            }
            else
            {
                str = str.Replace("{viewJs}", "");
            }

            //str = str.Replace("{viewJs}", viewJs);
            str = str.Replace("{searchJs}", searchJs);
            //str = str.Replace("{importJs}", importJs);
            //str = str.Replace("{exportJs}", exportJs);
            str = str.Replace("{searchJs}", searchJs);

            str = str.Replace("{prefix}", strPrefix);
            str = str.Replace("{newprefix}", prefix);
            str = str.Replace("{add}", add);
            str = str.Replace("{addN}", addN);
            str = str.Replace("{edit}", edit);
            str = str.Replace("{editN}", editN);
            str = str.Replace("{del}", del);
            str = str.Replace("{delN}", delN);

            str = str.Replace("{view}", view);

            str = str.Replace("{viewN}", viewN);
            //str = str.Replace("{import}", import);
            //str = str.Replace("{importN}", importN);
            //str = str.Replace("{export}", export);
            //str = str.Replace("{exportN}", exportN);
            str = str.Replace("{search}", search);
            str = str.Replace("{searchN}", searchN);

            str = str.Replace("{moduleName}", M_Model.M_ModuleCode);
            str = str.Replace("{nameSpace}", M_Model.M_NameSpace);
            if (toolbar)
            {
                str = "";
            }
            return str;
        }
コード例 #8
0
        public ActionResult GridEdit(string oper, string id)
        {
            string ModuleCode = Request["ModuleCode"] == null ? "" : Request["ModuleCode"].ToString();
            string NameSpace = Request["NameSpace"] == null ? "" : Request["NameSpace"].ToString();
            string Form = Request["form"] == null ? "" : Request["form"];
            string FormId = Request["btn"];
            oper = !string.IsNullOrEmpty(oper) ? oper : (Request["oper"] != null ? Request["oper"] : "");
            id = !string.IsNullOrEmpty(id) ? id : (Request["id"] != null ? Request["id"] : "");

            string TableName = "";
            string InertSQL = "";
            string UpdateSQL = "";
            string DeleteSQL = "";
            string TableKey = "";
            string filterKey = "";
            bool result = false;
            string strResult = "fail";
            Dictionary<string, string> FormValue = new Dictionary<string, string>();
            Sys_Config_ListPage model=new Sys_Config_ListPage();
            List<Sys_Config_Fieled> listfiled = new List<Sys_Config_Fieled>();
            StringBuilder ErrorList = new StringBuilder();

            if (!string.IsNullOrEmpty(ModuleCode) && !string.IsNullOrEmpty(NameSpace))
            {
                // var _model = instance.GetListByCode(" AND M_ModuleCode='" + ModuleCode + "' AND M_NameSpace='" + NameSpace + "' ");
                var _model = instance.GetListByCode(" AND M_ModuleCode='" + ModuleCode + "' ");
                model = _model.Count > 0 ? _model[0] : null;
                //var listfiled = filedInstance.GetListByCode(" AND D_ModuleCode='" + ModuleCode + "' AND D_NameSpace='" + NameSpace + "' ");
                listfiled = filedInstance.GetListByCode(" AND D_ModuleCode='" + ModuleCode + "'");
                TableName = model.M_TableName;
                TableKey = listfiled.Where(o => o.D_IsKey == 1).FirstOrDefault().D_Index;
                filterKey = string.Format("{0}='{1}'", TableKey, id);
                if (!string.IsNullOrEmpty(Form))
                {
                    FormValue = FormParse(Form);
                    string _key = "";
                    string _value = "";
                    string _upkey = "";
                    filterKey = string.Format("{0}='{1}'", TableKey, FormValue[TableKey]);

                    var newListFiled = listfiled.Where(o => string.IsNullOrEmpty(o.D_EditHidden)
                        || o.D_EditHidden == "false"
                        || !string.IsNullOrEmpty(o.D_DefaultValue)
                        || o.D_EditType == "loadall");

                    if (!string.IsNullOrEmpty(FormId))
                    {
                        #region 扩展

                        if (FormId.Contains("btn1"))
                        {
                            newListFiled = listfiled.Where(o => !string.IsNullOrEmpty(o.D_UDEF1)
                            && JsonConvert.DeserializeObject<FormEdit>(o.D_UDEF1).Show.ToLower() == "true")
                            .OrderBy(o => JsonConvert.DeserializeObject<FormEdit>(o.D_UDEF1).Order).ToList();
                        }
                        else if (FormId.Contains("btn2"))
                        {
                            newListFiled = listfiled.Where(o => !string.IsNullOrEmpty(o.D_UDEF2)
                            && JsonConvert.DeserializeObject<FormEdit>(o.D_UDEF2).Show.ToLower() == "true")
                            .OrderBy(o => JsonConvert.DeserializeObject<FormEdit>(o.D_UDEF2).Order).ToList();
                        }
                        else if (FormId.Contains("btn3"))
                        {
                            newListFiled = listfiled.Where(o => !string.IsNullOrEmpty(o.D_UDEF3)
                            && JsonConvert.DeserializeObject<FormEdit>(o.D_UDEF3).Show.ToLower() == "true")
                            .OrderBy(o => JsonConvert.DeserializeObject<FormEdit>(o.D_UDEF3).Order).ToList();
                        }
                        else if (FormId.Contains("btn4"))
                        {
                            newListFiled = listfiled.Where(o => !string.IsNullOrEmpty(o.D_UDEF4)
                              && JsonConvert.DeserializeObject<FormEdit>(o.D_UDEF4).Show.ToLower() == "true")
                              .OrderBy(o => JsonConvert.DeserializeObject<FormEdit>(o.D_UDEF4).Order).ToList();
                        }
                        #endregion
                    }

                    foreach (var item in newListFiled)
                    {
                        try
                        {
                            if (!string.IsNullOrEmpty(FormValue[item.D_Index]))
                            {
                                if (!string.IsNullOrEmpty(item.D_Type) && item.D_Type.Contains("int"))
                                {
                                    _value += "" + FormValue[item.D_Index] + "" + ",";
                                    _upkey += item.D_Index + "=" + FormValue[item.D_Index] + "" + ",";
                                }
                                else
                                {
                                    if (item.D_Type.Contains("datetime"))
                                    {
                                        FormValue[item.D_Index] = FormValue[item.D_Index].Replace("+"," ");
                                    }
                                    _value += "'" + FormValue[item.D_Index] + "'" + ",";
                                    _upkey += item.D_Index + "='" + FormValue[item.D_Index] + "'" + ",";
                                }
                                _key += item.D_Index + ",";
                            }
                            else
                            {
                                if (!string.IsNullOrEmpty(item.D_Type) && (item.D_Type.Contains("int") || item.D_Type.Contains("decimal")))
                                {
                                    _value += "0,";
                                    _upkey += item.D_Index + "=0" + ",";
                                }
                                else
                                {
                                    if (item.D_Type.Contains("datetime"))
                                    {
                                        FormValue[item.D_Index] = "1900-01-01";
                                    }
                                    _value += "'" + FormValue[item.D_Index] + "'" + ",";
                                    _upkey += item.D_Index + "='" + FormValue[item.D_Index] + "'" + ",";
                                }
                                _key += item.D_Index + ",";
                            }
                        }
                        catch (System.Exception ex)
                        {
                            ErrorList.AppendLine(ex.ToString());
                            continue;
                        }

                    }
                    //拼接Add sql
                    _key = _key + " CreateTime,";
                    _value = _value + "'" + DateTime.Now + "',";
                    InertSQL = "INSERT INTO  " + TableName + " (" + _key.TrimEnd(',') + ") VALUES (" + _value.TrimEnd(',') + ")  ";
                    //拼接update sql
                    _upkey = _upkey + " UpdateTime='" + DateTime.Now + "',";
                    UpdateSQL = "UPDATE " + TableName + " SET " + _upkey.TrimEnd(',') + " WHERE " + filterKey;

                }
                //拼接 Delete Sql
                DeleteSQL = "UPDATE " + TableName + " SET Stat=1,DeleteTime='" + DateTime.Now + "' WHERE " + filterKey;
            }

            switch (oper)
            {
                case "add":
                    result = instance.SaveData(InertSQL);
                    strResult = result ? "success" : "fail";

                    //功能日志
                    this.OpLog(model.M_ModuleCode,
                        "添加:" + model.M_Title + ",编码:" + FormValue[TableKey],
                        strResult + "," + InertSQL + "," + ErrorList.ToString());

                    return Content(strResult);
                case "edit":
                    result = instance.SaveData(UpdateSQL);
                    strResult = result ? "success" : "fail";

                    //功能日志
                    this.OpLog(model.M_ModuleCode,
                       "修改:" + model.M_Title + ",编码:" + FormValue[TableKey],
                       strResult + "," + InertSQL + "," + ErrorList.ToString());

                    return Content(strResult);
                case "del":
                    result = instance.SaveData(DeleteSQL);
                    strResult = result ? "success" : "fail";

                    //功能日志
                    this.OpLog(model.M_ModuleCode,
                        "删除:" + model.M_Title + ",编码:" + id,
                        strResult + "," + InertSQL + "," + ErrorList.ToString());

                    return Content(strResult);
                case "view":
                    DataTable dt = instance.ListDataByCode(TableName, filterKey);

                    DataTable newDt = dt.Clone();
                    //string json = JsonConvert.SerializeObject(dt, new DataTableConverter(), new JsonDateConverter("yyyy-MM-dd"));

                    for (var x = 0; x < newDt.Columns.Count;x++ )
                    {
                        var D_Index = dt.Columns[x].ColumnName;

                            var tmpModel = listfiled.Where(o => o.D_Index == D_Index);
                            if (tmpModel.Count() > 0)
                            {
                                if (tmpModel.FirstOrDefault().D_EditType == "datetime")
                                {
                                    newDt.Columns[x].DataType = typeof(string);
                                }
                                else if (tmpModel.FirstOrDefault().D_EditType == "date")
                                {
                                    newDt.Columns[x].DataType = typeof(string);
                                }
                            }
                    }

                    newDt.Rows.Clear();
                    for (var i = 0; i < dt.Rows.Count;i++ )
                    {
                        DataRow newRow = newDt.NewRow();
                        for (var j = 0; j < dt.Columns.Count;j++ )
                        {
                            var D_Index = dt.Columns[j].ColumnName;

                            var tmpModel = listfiled.Where(o => o.D_Index == D_Index);
                            if (tmpModel.Count()>0)
                            {
                                if (tmpModel.FirstOrDefault().D_EditType == "datetime")
                               {

                                   newRow[D_Index] = dt.Rows[i][j] != null && !string.IsNullOrEmpty(dt.Rows[i][j].ToString())
                                       ? JsonConvert.SerializeObject(DateTime.Parse(dt.Rows[i][j].ToString()), new JsonDateConverter("yyyy-MM-dd HH:mm:ss")).Replace("\"","") : "";
                               }
                               else if (tmpModel.FirstOrDefault().D_EditType == "date")
                               {
                                   //newDt.Columns[j].DataType = typeof(string);
                                   newRow[D_Index] = dt.Rows[i][j] != null && !string.IsNullOrEmpty(dt.Rows[i][j].ToString())
                                       ? JsonConvert.SerializeObject(DateTime.Parse(dt.Rows[i][j].ToString()), new JsonDateConverter("yyyy-MM-dd")).Replace("\"", "") : "";
                               }
                               else
                               {
                                   newRow[D_Index] = dt.Rows[i][j];
                               }
                            }

                        }
                        newDt.Rows.Add(newRow);
                    }
                    string json = JsonConvert.SerializeObject(newDt, new DataTableConverter());
                    return JavaScript(json);
            }
            return Content("");
        }
コード例 #9
0
 /// <summary>
 /// 获取指定的List报表类型配置表 Sys_Config_ListPage对象集合
 /// </summary>
 public List<Sys_Config_ListPage> GetListByWhere(string strCondition)
 {
     List<Sys_Config_ListPage> ret = new List<Sys_Config_ListPage>();
      string sql = "SELECT  M_ID,M_ModuleCode,M_TableName,M_NameSpace,M_SQL,M_Type,M_Title,M_AutoWidth,M_Width,M_Height,M_URL,M_MType,M_GetDataType,M_SQLParameter,M_RowNum,M_RowList,M_FooterRow,M_ViewURL,M_ViewType,M_Edit,M_EditUrl,M_EditSubmitUrl,M_OnSelectRow,M_GridComplete,M_InlineEditing,M_ImportURL,M_ImportTable,M_ImportExport,M_AltRows,M_Altclass,M_emptyrecords,M_Gridstate,M_EditCloumNum,M_ToolBar,M_ToolBarExtend,Stat,M_ExtendsJs,M_ExtendsControl,M_EditTitle,M_MSelect,M_Parameters,M_GroupingView,M_FormEditing,M_FormMethod,M_IsAdd,M_IsEdit,M_IsDelete,M_IsView FROM Sys_Config_ListPage WHERE 1=1 AND ((Stat is null) or (Stat=0) ) ";
      if(!string.IsNullOrEmpty(strCondition))
      {
     strCondition.Replace('\'','"'); //防sql注入
     sql += strCondition ;
      }
       sql += " ORDER BY M_ID DESC ";
       SqlDataReader dr=null;
        try {
       dr=(SqlDataReader)idb.ReturnReader(sql);
      while(dr.Read())
      {
     Sys_Config_ListPage sys_Config_ListPage = new Sys_Config_ListPage();
     if (dr["M_ID"] != DBNull.Value) sys_Config_ListPage.M_ID = Convert.ToInt32(dr["M_ID"]);
     if (dr["M_ModuleCode"] != DBNull.Value) sys_Config_ListPage.M_ModuleCode = Convert.ToString(dr["M_ModuleCode"]);
     if (dr["M_TableName"] != DBNull.Value) sys_Config_ListPage.M_TableName = Convert.ToString(dr["M_TableName"]);
     if (dr["M_NameSpace"] != DBNull.Value) sys_Config_ListPage.M_NameSpace = Convert.ToString(dr["M_NameSpace"]);
     if (dr["M_SQL"] != DBNull.Value) sys_Config_ListPage.M_SQL = Convert.ToString(dr["M_SQL"]);
     if (dr["M_Type"] != DBNull.Value) sys_Config_ListPage.M_Type = Convert.ToString(dr["M_Type"]);
     if (dr["M_Title"] != DBNull.Value) sys_Config_ListPage.M_Title = Convert.ToString(dr["M_Title"]);
     if (dr["M_AutoWidth"] != DBNull.Value) sys_Config_ListPage.M_AutoWidth = Convert.ToString(dr["M_AutoWidth"]);
     if (dr["M_Width"] != DBNull.Value) sys_Config_ListPage.M_Width = Convert.ToString(dr["M_Width"]);
     if (dr["M_Height"] != DBNull.Value) sys_Config_ListPage.M_Height = Convert.ToString(dr["M_Height"]);
     if (dr["M_URL"] != DBNull.Value) sys_Config_ListPage.M_URL = Convert.ToString(dr["M_URL"]);
     if (dr["M_MType"] != DBNull.Value) sys_Config_ListPage.M_MType = Convert.ToString(dr["M_MType"]);
     if (dr["M_GetDataType"] != DBNull.Value) sys_Config_ListPage.M_GetDataType = Convert.ToString(dr["M_GetDataType"]);
     if (dr["M_SQLParameter"] != DBNull.Value) sys_Config_ListPage.M_SQLParameter = Convert.ToString(dr["M_SQLParameter"]);
     if (dr["M_RowNum"] != DBNull.Value) sys_Config_ListPage.M_RowNum = Convert.ToString(dr["M_RowNum"]);
     if (dr["M_RowList"] != DBNull.Value) sys_Config_ListPage.M_RowList = Convert.ToString(dr["M_RowList"]);
     if (dr["M_FooterRow"] != DBNull.Value) sys_Config_ListPage.M_FooterRow = Convert.ToString(dr["M_FooterRow"]);
     if (dr["M_ViewURL"] != DBNull.Value) sys_Config_ListPage.M_ViewURL = Convert.ToString(dr["M_ViewURL"]);
     if (dr["M_ViewType"] != DBNull.Value) sys_Config_ListPage.M_ViewType = Convert.ToString(dr["M_ViewType"]);
     if (dr["M_Edit"] != DBNull.Value) sys_Config_ListPage.M_Edit = Convert.ToString(dr["M_Edit"]);
     if (dr["M_EditUrl"] != DBNull.Value) sys_Config_ListPage.M_EditUrl = Convert.ToString(dr["M_EditUrl"]);
     if (dr["M_EditSubmitUrl"] != DBNull.Value) sys_Config_ListPage.M_EditSubmitUrl = Convert.ToString(dr["M_EditSubmitUrl"]);
     if (dr["M_OnSelectRow"] != DBNull.Value) sys_Config_ListPage.M_OnSelectRow = Convert.ToString(dr["M_OnSelectRow"]);
     if (dr["M_GridComplete"] != DBNull.Value) sys_Config_ListPage.M_GridComplete = Convert.ToString(dr["M_GridComplete"]);
     if (dr["M_InlineEditing"] != DBNull.Value) sys_Config_ListPage.M_InlineEditing = Convert.ToString(dr["M_InlineEditing"]);
     if (dr["M_ImportURL"] != DBNull.Value) sys_Config_ListPage.M_ImportURL = Convert.ToString(dr["M_ImportURL"]);
     if (dr["M_ImportTable"] != DBNull.Value) sys_Config_ListPage.M_ImportTable = Convert.ToString(dr["M_ImportTable"]);
     if (dr["M_ImportExport"] != DBNull.Value) sys_Config_ListPage.M_ImportExport = Convert.ToString(dr["M_ImportExport"]);
     if (dr["M_AltRows"] != DBNull.Value) sys_Config_ListPage.M_AltRows = Convert.ToString(dr["M_AltRows"]);
     if (dr["M_Altclass"] != DBNull.Value) sys_Config_ListPage.M_Altclass = Convert.ToString(dr["M_Altclass"]);
     if (dr["M_emptyrecords"] != DBNull.Value) sys_Config_ListPage.M_emptyrecords = Convert.ToString(dr["M_emptyrecords"]);
     if (dr["M_Gridstate"] != DBNull.Value) sys_Config_ListPage.M_Gridstate = Convert.ToString(dr["M_Gridstate"]);
     if (dr["M_EditCloumNum"] != DBNull.Value) sys_Config_ListPage.M_EditCloumNum = Convert.ToInt32(dr["M_EditCloumNum"]);
     if (dr["M_ToolBar"] != DBNull.Value) sys_Config_ListPage.M_ToolBar = Convert.ToString(dr["M_ToolBar"]);
     if (dr["M_ToolBarExtend"] != DBNull.Value) sys_Config_ListPage.M_ToolBarExtend = Convert.ToString(dr["M_ToolBarExtend"]);
     if (dr["Stat"] != DBNull.Value) sys_Config_ListPage.Stat = Convert.ToInt32(dr["Stat"]);
     if (dr["M_ExtendsJs"] != DBNull.Value) sys_Config_ListPage.M_ExtendsJs = Convert.ToString(dr["M_ExtendsJs"]);
     if (dr["M_ExtendsControl"] != DBNull.Value) sys_Config_ListPage.M_ExtendsControl = Convert.ToString(dr["M_ExtendsControl"]);
     if (dr["M_EditTitle"] != DBNull.Value) sys_Config_ListPage.M_EditTitle = Convert.ToString(dr["M_EditTitle"]);
     if (dr["M_MSelect"] != DBNull.Value) sys_Config_ListPage.M_MSelect = Convert.ToString(dr["M_MSelect"]);
     if (dr["M_Parameters"] != DBNull.Value) sys_Config_ListPage.M_Parameters = Convert.ToString(dr["M_Parameters"]);
     if (dr["M_GroupingView"] != DBNull.Value) sys_Config_ListPage.M_GroupingView = Convert.ToString(dr["M_GroupingView"]);
     if (dr["M_FormEditing"] != DBNull.Value) sys_Config_ListPage.M_FormEditing = Convert.ToString(dr["M_FormEditing"]);
     if (dr["M_FormMethod"] != DBNull.Value) sys_Config_ListPage.M_FormMethod = Convert.ToString(dr["M_FormMethod"]);
     if (dr["M_IsAdd"] != DBNull.Value) sys_Config_ListPage.M_IsAdd = Convert.ToInt32(dr["M_IsAdd"]);
     if (dr["M_IsEdit"] != DBNull.Value) sys_Config_ListPage.M_IsEdit = Convert.ToInt32(dr["M_IsEdit"]);
     if (dr["M_IsDelete"] != DBNull.Value) sys_Config_ListPage.M_IsDelete = Convert.ToInt32(dr["M_IsDelete"]);
     if (dr["M_IsView"] != DBNull.Value) sys_Config_ListPage.M_IsView = Convert.ToString(dr["M_IsView"]);
     ret.Add(sys_Config_ListPage);
      }
       }catch (System.Exception ex){ throw ex; }  finally { if (dr != null) { dr.Close(); } if (idb.GetConnection() != null && idb.GetConnection().State == ConnectionState.Open) { idb.GetConnection().Close(); }   }
      return ret;
 }
コード例 #10
0
        /// <summary>
        /// 添加List报表类型配置表 Sys_Config_ListPage对象(即:一条记录)
        /// </summary>
        public object AddWithReturn(Sys_Config_ListPage sys_Config_ListPage)
        {
            string sql = "INSERT INTO Sys_Config_ListPage (M_ModuleCode,M_TableName,M_NameSpace,M_SQL,M_Type,M_Title,M_AutoWidth,M_Width,M_Height,M_URL,M_MType,M_GetDataType,M_SQLParameter,M_RowNum,M_RowList,M_FooterRow,M_ViewURL,M_ViewType,M_Edit,M_EditUrl,M_EditSubmitUrl,M_OnSelectRow,M_GridComplete,M_InlineEditing,M_ImportURL,M_ImportTable,M_ImportExport,M_AltRows,M_Altclass,M_emptyrecords,M_Gridstate,M_EditCloumNum,M_ToolBar,M_ToolBarExtend,Stat,M_ExtendsJs,M_ExtendsControl,M_EditTitle,M_MSelect,M_Parameters,M_GroupingView,M_FormEditing,M_FormMethod,M_IsAdd,M_IsEdit,M_IsDelete,M_IsView) VALUES (@M_ModuleCode,@M_TableName,@M_NameSpace,@M_SQL,@M_Type,@M_Title,@M_AutoWidth,@M_Width,@M_Height,@M_URL,@M_MType,@M_GetDataType,@M_SQLParameter,@M_RowNum,@M_RowList,@M_FooterRow,@M_ViewURL,@M_ViewType,@M_Edit,@M_EditUrl,@M_EditSubmitUrl,@M_OnSelectRow,@M_GridComplete,@M_InlineEditing,@M_ImportURL,@M_ImportTable,@M_ImportExport,@M_AltRows,@M_Altclass,@M_emptyrecords,@M_Gridstate,@M_EditCloumNum,@M_ToolBar,@M_ToolBarExtend,@Stat,@M_ExtendsJs,@M_ExtendsControl,@M_EditTitle,@M_MSelect,@M_Parameters,@M_GroupingView,@M_FormEditing,@M_FormMethod,@M_IsAdd,@M_IsEdit,@M_IsDelete,@M_IsView);SELECT @@IDENTITY AS ReturnID;";
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_ModuleCode))
             {
            idb.AddParameter("@M_ModuleCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_ModuleCode", sys_Config_ListPage.M_ModuleCode);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_TableName))
             {
            idb.AddParameter("@M_TableName", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_TableName", sys_Config_ListPage.M_TableName);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_NameSpace))
             {
            idb.AddParameter("@M_NameSpace", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_NameSpace", sys_Config_ListPage.M_NameSpace);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_SQL))
             {
            idb.AddParameter("@M_SQL", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_SQL", sys_Config_ListPage.M_SQL);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_Type))
             {
            idb.AddParameter("@M_Type", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_Type", sys_Config_ListPage.M_Type);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_Title))
             {
            idb.AddParameter("@M_Title", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_Title", sys_Config_ListPage.M_Title);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_AutoWidth))
             {
            idb.AddParameter("@M_AutoWidth", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_AutoWidth", sys_Config_ListPage.M_AutoWidth);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_Width))
             {
            idb.AddParameter("@M_Width", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_Width", sys_Config_ListPage.M_Width);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_Height))
             {
            idb.AddParameter("@M_Height", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_Height", sys_Config_ListPage.M_Height);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_URL))
             {
            idb.AddParameter("@M_URL", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_URL", sys_Config_ListPage.M_URL);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_MType))
             {
            idb.AddParameter("@M_MType", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_MType", sys_Config_ListPage.M_MType);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_GetDataType))
             {
            idb.AddParameter("@M_GetDataType", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_GetDataType", sys_Config_ListPage.M_GetDataType);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_SQLParameter))
             {
            idb.AddParameter("@M_SQLParameter", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_SQLParameter", sys_Config_ListPage.M_SQLParameter);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_RowNum))
             {
            idb.AddParameter("@M_RowNum", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_RowNum", sys_Config_ListPage.M_RowNum);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_RowList))
             {
            idb.AddParameter("@M_RowList", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_RowList", sys_Config_ListPage.M_RowList);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_FooterRow))
             {
            idb.AddParameter("@M_FooterRow", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_FooterRow", sys_Config_ListPage.M_FooterRow);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_ViewURL))
             {
            idb.AddParameter("@M_ViewURL", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_ViewURL", sys_Config_ListPage.M_ViewURL);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_ViewType))
             {
            idb.AddParameter("@M_ViewType", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_ViewType", sys_Config_ListPage.M_ViewType);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_Edit))
             {
            idb.AddParameter("@M_Edit", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_Edit", sys_Config_ListPage.M_Edit);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_EditUrl))
             {
            idb.AddParameter("@M_EditUrl", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_EditUrl", sys_Config_ListPage.M_EditUrl);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_EditSubmitUrl))
             {
            idb.AddParameter("@M_EditSubmitUrl", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_EditSubmitUrl", sys_Config_ListPage.M_EditSubmitUrl);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_OnSelectRow))
             {
            idb.AddParameter("@M_OnSelectRow", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_OnSelectRow", sys_Config_ListPage.M_OnSelectRow);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_GridComplete))
             {
            idb.AddParameter("@M_GridComplete", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_GridComplete", sys_Config_ListPage.M_GridComplete);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_InlineEditing))
             {
            idb.AddParameter("@M_InlineEditing", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_InlineEditing", sys_Config_ListPage.M_InlineEditing);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_ImportURL))
             {
            idb.AddParameter("@M_ImportURL", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_ImportURL", sys_Config_ListPage.M_ImportURL);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_ImportTable))
             {
            idb.AddParameter("@M_ImportTable", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_ImportTable", sys_Config_ListPage.M_ImportTable);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_ImportExport))
             {
            idb.AddParameter("@M_ImportExport", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_ImportExport", sys_Config_ListPage.M_ImportExport);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_AltRows))
             {
            idb.AddParameter("@M_AltRows", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_AltRows", sys_Config_ListPage.M_AltRows);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_Altclass))
             {
            idb.AddParameter("@M_Altclass", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_Altclass", sys_Config_ListPage.M_Altclass);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_emptyrecords))
             {
            idb.AddParameter("@M_emptyrecords", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_emptyrecords", sys_Config_ListPage.M_emptyrecords);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_Gridstate))
             {
            idb.AddParameter("@M_Gridstate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_Gridstate", sys_Config_ListPage.M_Gridstate);
             }
             if (sys_Config_ListPage.M_EditCloumNum == 0)
             {
            idb.AddParameter("@M_EditCloumNum", 0);
             }
             else
             {
            idb.AddParameter("@M_EditCloumNum", sys_Config_ListPage.M_EditCloumNum);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_ToolBar))
             {
            idb.AddParameter("@M_ToolBar", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_ToolBar", sys_Config_ListPage.M_ToolBar);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_ToolBarExtend))
             {
            idb.AddParameter("@M_ToolBarExtend", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_ToolBarExtend", sys_Config_ListPage.M_ToolBarExtend);
             }
             if (sys_Config_ListPage.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", sys_Config_ListPage.Stat);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_ExtendsJs))
             {
            idb.AddParameter("@M_ExtendsJs", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_ExtendsJs", sys_Config_ListPage.M_ExtendsJs);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_ExtendsControl))
             {
            idb.AddParameter("@M_ExtendsControl", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_ExtendsControl", sys_Config_ListPage.M_ExtendsControl);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_EditTitle))
             {
            idb.AddParameter("@M_EditTitle", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_EditTitle", sys_Config_ListPage.M_EditTitle);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_MSelect))
             {
            idb.AddParameter("@M_MSelect", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_MSelect", sys_Config_ListPage.M_MSelect);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_Parameters))
             {
            idb.AddParameter("@M_Parameters", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_Parameters", sys_Config_ListPage.M_Parameters);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_GroupingView))
             {
            idb.AddParameter("@M_GroupingView", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_GroupingView", sys_Config_ListPage.M_GroupingView);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_FormEditing))
             {
            idb.AddParameter("@M_FormEditing", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_FormEditing", sys_Config_ListPage.M_FormEditing);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_FormMethod))
             {
            idb.AddParameter("@M_FormMethod", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_FormMethod", sys_Config_ListPage.M_FormMethod);
             }
             if (sys_Config_ListPage.M_IsAdd == 0)
             {
            idb.AddParameter("@M_IsAdd", 0);
             }
             else
             {
            idb.AddParameter("@M_IsAdd", sys_Config_ListPage.M_IsAdd);
             }
             if (sys_Config_ListPage.M_IsEdit == 0)
             {
            idb.AddParameter("@M_IsEdit", 0);
             }
             else
             {
            idb.AddParameter("@M_IsEdit", sys_Config_ListPage.M_IsEdit);
             }
             if (sys_Config_ListPage.M_IsDelete == 0)
             {
            idb.AddParameter("@M_IsDelete", 0);
             }
             else
             {
            idb.AddParameter("@M_IsDelete", sys_Config_ListPage.M_IsDelete);
             }
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_IsView))
             {
            idb.AddParameter("@M_IsView", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_IsView", sys_Config_ListPage.M_IsView);
             }

             return idb.ReturnValue(sql);
        }
コード例 #11
0
        /// <summary>
        /// 更新List报表类型配置表 Sys_Config_ListPage对象(即:一条记录
        /// </summary>
        public int Update(Sys_Config_ListPage sys_Config_ListPage)
        {
            StringBuilder sbParameter=new StringBuilder();
              StringBuilder sb=new StringBuilder();
              sb.Append(@"UPDATE       Sys_Config_ListPage       SET ");
            if(sys_Config_ListPage.M_ModuleCode_IsChanged){sbParameter.Append("M_ModuleCode=@M_ModuleCode, ");}
              if(sys_Config_ListPage.M_TableName_IsChanged){sbParameter.Append("M_TableName=@M_TableName, ");}
              if(sys_Config_ListPage.M_NameSpace_IsChanged){sbParameter.Append("M_NameSpace=@M_NameSpace, ");}
              if(sys_Config_ListPage.M_SQL_IsChanged){sbParameter.Append("M_SQL=@M_SQL, ");}
              if(sys_Config_ListPage.M_Type_IsChanged){sbParameter.Append("M_Type=@M_Type, ");}
              if(sys_Config_ListPage.M_Title_IsChanged){sbParameter.Append("M_Title=@M_Title, ");}
              if(sys_Config_ListPage.M_AutoWidth_IsChanged){sbParameter.Append("M_AutoWidth=@M_AutoWidth, ");}
              if(sys_Config_ListPage.M_Width_IsChanged){sbParameter.Append("M_Width=@M_Width, ");}
              if(sys_Config_ListPage.M_Height_IsChanged){sbParameter.Append("M_Height=@M_Height, ");}
              if(sys_Config_ListPage.M_URL_IsChanged){sbParameter.Append("M_URL=@M_URL, ");}
              if(sys_Config_ListPage.M_MType_IsChanged){sbParameter.Append("M_MType=@M_MType, ");}
              if(sys_Config_ListPage.M_GetDataType_IsChanged){sbParameter.Append("M_GetDataType=@M_GetDataType, ");}
              if(sys_Config_ListPage.M_SQLParameter_IsChanged){sbParameter.Append("M_SQLParameter=@M_SQLParameter, ");}
              if(sys_Config_ListPage.M_RowNum_IsChanged){sbParameter.Append("M_RowNum=@M_RowNum, ");}
              if(sys_Config_ListPage.M_RowList_IsChanged){sbParameter.Append("M_RowList=@M_RowList, ");}
              if(sys_Config_ListPage.M_FooterRow_IsChanged){sbParameter.Append("M_FooterRow=@M_FooterRow, ");}
              if(sys_Config_ListPage.M_ViewURL_IsChanged){sbParameter.Append("M_ViewURL=@M_ViewURL, ");}
              if(sys_Config_ListPage.M_ViewType_IsChanged){sbParameter.Append("M_ViewType=@M_ViewType, ");}
              if(sys_Config_ListPage.M_Edit_IsChanged){sbParameter.Append("M_Edit=@M_Edit, ");}
              if(sys_Config_ListPage.M_EditUrl_IsChanged){sbParameter.Append("M_EditUrl=@M_EditUrl, ");}
              if(sys_Config_ListPage.M_EditSubmitUrl_IsChanged){sbParameter.Append("M_EditSubmitUrl=@M_EditSubmitUrl, ");}
              if(sys_Config_ListPage.M_OnSelectRow_IsChanged){sbParameter.Append("M_OnSelectRow=@M_OnSelectRow, ");}
              if(sys_Config_ListPage.M_GridComplete_IsChanged){sbParameter.Append("M_GridComplete=@M_GridComplete, ");}
              if(sys_Config_ListPage.M_InlineEditing_IsChanged){sbParameter.Append("M_InlineEditing=@M_InlineEditing, ");}
              if(sys_Config_ListPage.M_ImportURL_IsChanged){sbParameter.Append("M_ImportURL=@M_ImportURL, ");}
              if(sys_Config_ListPage.M_ImportTable_IsChanged){sbParameter.Append("M_ImportTable=@M_ImportTable, ");}
              if(sys_Config_ListPage.M_ImportExport_IsChanged){sbParameter.Append("M_ImportExport=@M_ImportExport, ");}
              if(sys_Config_ListPage.M_AltRows_IsChanged){sbParameter.Append("M_AltRows=@M_AltRows, ");}
              if(sys_Config_ListPage.M_Altclass_IsChanged){sbParameter.Append("M_Altclass=@M_Altclass, ");}
              if(sys_Config_ListPage.M_emptyrecords_IsChanged){sbParameter.Append("M_emptyrecords=@M_emptyrecords, ");}
              if(sys_Config_ListPage.M_Gridstate_IsChanged){sbParameter.Append("M_Gridstate=@M_Gridstate, ");}
              if(sys_Config_ListPage.M_EditCloumNum_IsChanged){sbParameter.Append("M_EditCloumNum=@M_EditCloumNum, ");}
              if(sys_Config_ListPage.M_ToolBar_IsChanged){sbParameter.Append("M_ToolBar=@M_ToolBar, ");}
              if(sys_Config_ListPage.M_ToolBarExtend_IsChanged){sbParameter.Append("M_ToolBarExtend=@M_ToolBarExtend, ");}
              if(sys_Config_ListPage.Stat_IsChanged){sbParameter.Append("Stat=@Stat, ");}
              if(sys_Config_ListPage.M_ExtendsJs_IsChanged){sbParameter.Append("M_ExtendsJs=@M_ExtendsJs, ");}
              if(sys_Config_ListPage.M_ExtendsControl_IsChanged){sbParameter.Append("M_ExtendsControl=@M_ExtendsControl, ");}
              if(sys_Config_ListPage.M_EditTitle_IsChanged){sbParameter.Append("M_EditTitle=@M_EditTitle, ");}
              if(sys_Config_ListPage.M_MSelect_IsChanged){sbParameter.Append("M_MSelect=@M_MSelect, ");}
              if(sys_Config_ListPage.M_Parameters_IsChanged){sbParameter.Append("M_Parameters=@M_Parameters, ");}
              if(sys_Config_ListPage.M_GroupingView_IsChanged){sbParameter.Append("M_GroupingView=@M_GroupingView, ");}
              if(sys_Config_ListPage.M_FormEditing_IsChanged){sbParameter.Append("M_FormEditing=@M_FormEditing, ");}
              if(sys_Config_ListPage.M_FormMethod_IsChanged){sbParameter.Append("M_FormMethod=@M_FormMethod, ");}
              if(sys_Config_ListPage.M_IsAdd_IsChanged){sbParameter.Append("M_IsAdd=@M_IsAdd, ");}
              if(sys_Config_ListPage.M_IsEdit_IsChanged){sbParameter.Append("M_IsEdit=@M_IsEdit, ");}
              if(sys_Config_ListPage.M_IsDelete_IsChanged){sbParameter.Append("M_IsDelete=@M_IsDelete, ");}
              if(sys_Config_ListPage.M_IsView_IsChanged){sbParameter.Append("M_IsView=@M_IsView ");}
              sb.Append(sbParameter.ToString().Trim().TrimEnd(','));
              sb.Append(      " WHERE 1=1 AND ((Stat is null) or (Stat=0))   and M_ID=@M_ID; " );
              string sql=sb.ToString();
             if(sys_Config_ListPage.M_ModuleCode_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_ModuleCode))
             {
            idb.AddParameter("@M_ModuleCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_ModuleCode", sys_Config_ListPage.M_ModuleCode);
             }
              }
             if(sys_Config_ListPage.M_TableName_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_TableName))
             {
            idb.AddParameter("@M_TableName", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_TableName", sys_Config_ListPage.M_TableName);
             }
              }
             if(sys_Config_ListPage.M_NameSpace_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_NameSpace))
             {
            idb.AddParameter("@M_NameSpace", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_NameSpace", sys_Config_ListPage.M_NameSpace);
             }
              }
             if(sys_Config_ListPage.M_SQL_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_SQL))
             {
            idb.AddParameter("@M_SQL", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_SQL", sys_Config_ListPage.M_SQL);
             }
              }
             if(sys_Config_ListPage.M_Type_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_Type))
             {
            idb.AddParameter("@M_Type", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_Type", sys_Config_ListPage.M_Type);
             }
              }
             if(sys_Config_ListPage.M_Title_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_Title))
             {
            idb.AddParameter("@M_Title", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_Title", sys_Config_ListPage.M_Title);
             }
              }
             if(sys_Config_ListPage.M_AutoWidth_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_AutoWidth))
             {
            idb.AddParameter("@M_AutoWidth", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_AutoWidth", sys_Config_ListPage.M_AutoWidth);
             }
              }
             if(sys_Config_ListPage.M_Width_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_Width))
             {
            idb.AddParameter("@M_Width", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_Width", sys_Config_ListPage.M_Width);
             }
              }
             if(sys_Config_ListPage.M_Height_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_Height))
             {
            idb.AddParameter("@M_Height", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_Height", sys_Config_ListPage.M_Height);
             }
              }
             if(sys_Config_ListPage.M_URL_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_URL))
             {
            idb.AddParameter("@M_URL", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_URL", sys_Config_ListPage.M_URL);
             }
              }
             if(sys_Config_ListPage.M_MType_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_MType))
             {
            idb.AddParameter("@M_MType", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_MType", sys_Config_ListPage.M_MType);
             }
              }
             if(sys_Config_ListPage.M_GetDataType_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_GetDataType))
             {
            idb.AddParameter("@M_GetDataType", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_GetDataType", sys_Config_ListPage.M_GetDataType);
             }
              }
             if(sys_Config_ListPage.M_SQLParameter_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_SQLParameter))
             {
            idb.AddParameter("@M_SQLParameter", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_SQLParameter", sys_Config_ListPage.M_SQLParameter);
             }
              }
             if(sys_Config_ListPage.M_RowNum_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_RowNum))
             {
            idb.AddParameter("@M_RowNum", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_RowNum", sys_Config_ListPage.M_RowNum);
             }
              }
             if(sys_Config_ListPage.M_RowList_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_RowList))
             {
            idb.AddParameter("@M_RowList", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_RowList", sys_Config_ListPage.M_RowList);
             }
              }
             if(sys_Config_ListPage.M_FooterRow_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_FooterRow))
             {
            idb.AddParameter("@M_FooterRow", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_FooterRow", sys_Config_ListPage.M_FooterRow);
             }
              }
             if(sys_Config_ListPage.M_ViewURL_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_ViewURL))
             {
            idb.AddParameter("@M_ViewURL", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_ViewURL", sys_Config_ListPage.M_ViewURL);
             }
              }
             if(sys_Config_ListPage.M_ViewType_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_ViewType))
             {
            idb.AddParameter("@M_ViewType", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_ViewType", sys_Config_ListPage.M_ViewType);
             }
              }
             if(sys_Config_ListPage.M_Edit_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_Edit))
             {
            idb.AddParameter("@M_Edit", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_Edit", sys_Config_ListPage.M_Edit);
             }
              }
             if(sys_Config_ListPage.M_EditUrl_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_EditUrl))
             {
            idb.AddParameter("@M_EditUrl", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_EditUrl", sys_Config_ListPage.M_EditUrl);
             }
              }
             if(sys_Config_ListPage.M_EditSubmitUrl_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_EditSubmitUrl))
             {
            idb.AddParameter("@M_EditSubmitUrl", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_EditSubmitUrl", sys_Config_ListPage.M_EditSubmitUrl);
             }
              }
             if(sys_Config_ListPage.M_OnSelectRow_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_OnSelectRow))
             {
            idb.AddParameter("@M_OnSelectRow", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_OnSelectRow", sys_Config_ListPage.M_OnSelectRow);
             }
              }
             if(sys_Config_ListPage.M_GridComplete_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_GridComplete))
             {
            idb.AddParameter("@M_GridComplete", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_GridComplete", sys_Config_ListPage.M_GridComplete);
             }
              }
             if(sys_Config_ListPage.M_InlineEditing_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_InlineEditing))
             {
            idb.AddParameter("@M_InlineEditing", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_InlineEditing", sys_Config_ListPage.M_InlineEditing);
             }
              }
             if(sys_Config_ListPage.M_ImportURL_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_ImportURL))
             {
            idb.AddParameter("@M_ImportURL", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_ImportURL", sys_Config_ListPage.M_ImportURL);
             }
              }
             if(sys_Config_ListPage.M_ImportTable_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_ImportTable))
             {
            idb.AddParameter("@M_ImportTable", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_ImportTable", sys_Config_ListPage.M_ImportTable);
             }
              }
             if(sys_Config_ListPage.M_ImportExport_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_ImportExport))
             {
            idb.AddParameter("@M_ImportExport", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_ImportExport", sys_Config_ListPage.M_ImportExport);
             }
              }
             if(sys_Config_ListPage.M_AltRows_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_AltRows))
             {
            idb.AddParameter("@M_AltRows", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_AltRows", sys_Config_ListPage.M_AltRows);
             }
              }
             if(sys_Config_ListPage.M_Altclass_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_Altclass))
             {
            idb.AddParameter("@M_Altclass", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_Altclass", sys_Config_ListPage.M_Altclass);
             }
              }
             if(sys_Config_ListPage.M_emptyrecords_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_emptyrecords))
             {
            idb.AddParameter("@M_emptyrecords", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_emptyrecords", sys_Config_ListPage.M_emptyrecords);
             }
              }
             if(sys_Config_ListPage.M_Gridstate_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_Gridstate))
             {
            idb.AddParameter("@M_Gridstate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_Gridstate", sys_Config_ListPage.M_Gridstate);
             }
              }
             if(sys_Config_ListPage.M_EditCloumNum_IsChanged)
             {
             if (sys_Config_ListPage.M_EditCloumNum == 0)
             {
            idb.AddParameter("@M_EditCloumNum", 0);
             }
             else
             {
            idb.AddParameter("@M_EditCloumNum", sys_Config_ListPage.M_EditCloumNum);
             }
              }
             if(sys_Config_ListPage.M_ToolBar_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_ToolBar))
             {
            idb.AddParameter("@M_ToolBar", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_ToolBar", sys_Config_ListPage.M_ToolBar);
             }
              }
             if(sys_Config_ListPage.M_ToolBarExtend_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_ToolBarExtend))
             {
            idb.AddParameter("@M_ToolBarExtend", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_ToolBarExtend", sys_Config_ListPage.M_ToolBarExtend);
             }
              }
             if(sys_Config_ListPage.Stat_IsChanged)
             {
             if (sys_Config_ListPage.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", sys_Config_ListPage.Stat);
             }
              }
             if(sys_Config_ListPage.M_ExtendsJs_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_ExtendsJs))
             {
            idb.AddParameter("@M_ExtendsJs", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_ExtendsJs", sys_Config_ListPage.M_ExtendsJs);
             }
              }
             if(sys_Config_ListPage.M_ExtendsControl_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_ExtendsControl))
             {
            idb.AddParameter("@M_ExtendsControl", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_ExtendsControl", sys_Config_ListPage.M_ExtendsControl);
             }
              }
             if(sys_Config_ListPage.M_EditTitle_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_EditTitle))
             {
            idb.AddParameter("@M_EditTitle", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_EditTitle", sys_Config_ListPage.M_EditTitle);
             }
              }
             if(sys_Config_ListPage.M_MSelect_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_MSelect))
             {
            idb.AddParameter("@M_MSelect", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_MSelect", sys_Config_ListPage.M_MSelect);
             }
              }
             if(sys_Config_ListPage.M_Parameters_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_Parameters))
             {
            idb.AddParameter("@M_Parameters", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_Parameters", sys_Config_ListPage.M_Parameters);
             }
              }
             if(sys_Config_ListPage.M_GroupingView_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_GroupingView))
             {
            idb.AddParameter("@M_GroupingView", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_GroupingView", sys_Config_ListPage.M_GroupingView);
             }
              }
             if(sys_Config_ListPage.M_FormEditing_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_FormEditing))
             {
            idb.AddParameter("@M_FormEditing", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_FormEditing", sys_Config_ListPage.M_FormEditing);
             }
              }
             if(sys_Config_ListPage.M_FormMethod_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_FormMethod))
             {
            idb.AddParameter("@M_FormMethod", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_FormMethod", sys_Config_ListPage.M_FormMethod);
             }
              }
             if(sys_Config_ListPage.M_IsAdd_IsChanged)
             {
             if (sys_Config_ListPage.M_IsAdd == 0)
             {
            idb.AddParameter("@M_IsAdd", 0);
             }
             else
             {
            idb.AddParameter("@M_IsAdd", sys_Config_ListPage.M_IsAdd);
             }
              }
             if(sys_Config_ListPage.M_IsEdit_IsChanged)
             {
             if (sys_Config_ListPage.M_IsEdit == 0)
             {
            idb.AddParameter("@M_IsEdit", 0);
             }
             else
             {
            idb.AddParameter("@M_IsEdit", sys_Config_ListPage.M_IsEdit);
             }
              }
             if(sys_Config_ListPage.M_IsDelete_IsChanged)
             {
             if (sys_Config_ListPage.M_IsDelete == 0)
             {
            idb.AddParameter("@M_IsDelete", 0);
             }
             else
             {
            idb.AddParameter("@M_IsDelete", sys_Config_ListPage.M_IsDelete);
             }
              }
             if(sys_Config_ListPage.M_IsView_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_Config_ListPage.M_IsView))
             {
            idb.AddParameter("@M_IsView", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@M_IsView", sys_Config_ListPage.M_IsView);
             }
              }

             idb.AddParameter("@M_ID", sys_Config_ListPage.M_ID);

             return idb.ExeCmd(sql);
        }
コード例 #12
0
ファイル: Bll_Comm.cs プロジェクト: youthjoy/qxhelper
        public static string JsonForJqgrid(string Module, DataTable dt, int pageIndex, int pageSize, int totalCount)
        {
            StringBuilder jsonBuilder = new StringBuilder();
            int total = 0;
            int page = totalCount / pageSize;
            total = totalCount > pageSize ? totalCount / pageSize : 1;
            if (totalCount > pageSize)
            {
                if (totalCount % pageSize > 0)
                {
                    total = total + 1;
                }
            }
            if (totalCount == 0)
            {
                total = 0;
                pageIndex = 0;
            }

            jsonBuilder.Append("{\"Page\":" + pageIndex + ",\"Total\":" + total + ",\"Records\":" + totalCount + ",\"Rows\":");

            #region 对时间进行格式化

            Sys_Config_ListPage M_Model = new Sys_Config_ListPage();
            List<Sys_Config_Fieled> listfiled = new List<Sys_Config_Fieled>();
            GetListConfig(Module, out M_Model, out listfiled);

            DataTable newDt = dt.Clone();
            //DataTable resultDt = dt.Clone();

            //string json = JsonConvert.SerializeObject(dt, new DataTableConverter(), new JsonDateConverter("yyyy-MM-dd"));

            for (var x = 0; x < newDt.Columns.Count; x++)
            {
                var D_Index = dt.Columns[x].ColumnName;

                var tmpModel = listfiled.Where(o => o.D_Index == D_Index);
                if (tmpModel.Count() > 0)
                {
                    if (tmpModel.FirstOrDefault().D_EditType == "datetime")
                    {
                        newDt.Columns[x].DataType = typeof(string);
                    }
                    else if (tmpModel.FirstOrDefault().D_EditType == "date")
                    {
                        newDt.Columns[x].DataType = typeof(string);
                    }
                }
            }

            newDt.Rows.Clear();
            for (var i = 0; i < dt.Rows.Count; i++)
            {
                DataRow newRow = newDt.NewRow();
                for (var j = 0; j < dt.Columns.Count; j++)
                {
                    var D_Index = dt.Columns[j].ColumnName;
                    var tmpModel = listfiled.Where(o => o.D_Index == D_Index);
                    if (tmpModel.Count() > 0)
                    {
                        if (tmpModel.FirstOrDefault().D_EditType == "datetime")
                        {

                            newRow[D_Index] = dt.Rows[i][D_Index] != null && !string.IsNullOrEmpty(dt.Rows[i][D_Index].ToString())
                                ? JsonConvert.SerializeObject(DateTime.Parse(dt.Rows[i][D_Index].ToString()), new JsonDateConverter("yyyy-MM-dd HH:mm:ss")).Replace("\"", " ") : "";
                        }
                        else if (tmpModel.FirstOrDefault().D_EditType == "date")
                        {
                            //newDt.Columns[j].DataType = typeof(string);
                            newRow[D_Index] = dt.Rows[i][D_Index] != null && !string.IsNullOrEmpty(dt.Rows[i][D_Index].ToString())
                                ? JsonConvert.SerializeObject(DateTime.Parse(dt.Rows[i][D_Index].ToString()), new JsonDateConverter("yyyy-MM-dd")).Replace("\"", " ") : "";
                        }
                        else
                        {
                            newRow[D_Index] = dt.Rows[i][D_Index];
                        }
                    }
                }
                newDt.Rows.Add(newRow);
            }
            #endregion

            jsonBuilder.Append(JsonConvert.SerializeObject(newDt, new DataTableConverter()));
            //jsonBuilder.Append(" ,\"UserData\":{ \"PUD_Num\":100 } ");
            jsonBuilder.Append("}");
            return jsonBuilder.ToString();
        }