コード例 #1
0
        // 初始数据
        private void Init()
        {
            ModelManage  model;
            SelectParams selParams;
            DataTable    modelTB;

            model     = new ModelManage();
            selParams = new SelectParams();

            selParams.S1 = this.modelID;
            selParams.I1 = 1;
            modelTB      = model.GetList("ONE", selParams);
            this.dtField = dal.GetField(this.modelID);
            this.rootUrl = GetRootUrl();

            if (modelTB.Rows.Count > 0)
            {
                foreach (DataColumn item in modelTB.Columns)
                {
                    this.hsModel.Add(item.ColumnName, modelTB.Rows[0][item.ColumnName]);
                }
            }

            if (this.hsModel.Count > 0)
            {
                this.hsModel["ListLink"]   = this.hsModel["ListLink"].ToString().Replace("{WebSite}", this.rootUrl);
                this.hsModel["ListButton"] = this.hsModel["ListButton"].ToString().Replace("{WebSite}", this.rootUrl);
            }
            this.showColumn = "," + this.hsModel["TableName"].ToString() + "." + "ID," + this.hsModel["TableName"].ToString() + ".FlowState,";
            SetKeepUrlParam();  // 设置要传递的URL参数
        }
コード例 #2
0
        // 初始数据
        private void Init()
        {
            ModelManage  model;
            SelectParams selParams;
            DataTable    modelTB;

            model = new ModelManage();

            selParams    = new SelectParams();
            selParams.S1 = this.modelID;
            selParams.I1 = 1;
            modelTB      = model.GetList("ONE", selParams);
            this.dtField = dal.GetField(this.modelID);

            if (modelTB.Rows.Count > 0)
            {
                foreach (DataColumn item in modelTB.Columns)
                {
                    this.hsModel.Add(item.ColumnName, modelTB.Rows[0][item.ColumnName]);
                }
            }

            if (!string.IsNullOrEmpty(this.hsModel["ListHeight"].ToString().Trim()) && Utils.ParseInt(this.hsModel["ListHeight"].ToString().Trim(), 0) > 0) // 设置列表列显示高
            {
                this.listHeight = "height:" + this.hsModel["ListHeight"].ToString().Trim() + "px;";
            }
            else
            {
                this.listHeight = "";
            }
        }
コード例 #3
0
        private Queue <Link> GetLink(string strID, bool isButtonList)
        {
            Queue <Link> linkQueue;

            string[]          arrID;            // 保存配置文件中节点ID
            string            configPath;       // 链接配置文件路径
            string            xpath;
            XPathNodeIterator navNodeXPath;     // 链接/按钮配置根节点指针
            XPathNodeIterator currentNav;       // 临时指针

            linkQueue = new Queue <Link>();

            arrID      = strID.Split(new char[] { ',' });
            configPath = AppDomain.CurrentDomain.BaseDirectory + Utils.GetResourcesValue("Model", "ListPath");

            if (isButtonList)
            {
                xpath = "/config/listbutton";
            }
            else
            {
                xpath = "/config/listlink";
            }

            navNodeXPath = ModelManage.GetNodeIterator(configPath, xpath);
            navNodeXPath.MoveNext();

            foreach (string strItem in arrID)
            {
                if (string.IsNullOrEmpty(strItem))
                {
                    continue;
                }

                currentNav = navNodeXPath.Current.Select("link[@id=" + strItem + "]");

                if (currentNav != null && currentNav.Count > 0)
                {
                    try
                    {
                        Link lnk = new Link();

                        currentNav.MoveNext();
                        lnk.Text  = currentNav.Current.GetAttribute("text", "");
                        lnk.Value = currentNav.Current.SelectSingleNode("value").InnerXml;
                        lnk.Value = lnk.Value.Replace("{#EditUrlParam#}", this.keepUrlParam);
                        linkQueue.Enqueue(lnk);
                    }
                    catch
                    {
                        continue;
                    }
                }
            }

            return(linkQueue);
        }
コード例 #4
0
        // 分页控件数据绑定
        private void SplitDataBind(Dictionary <string, string> dicWhere)
        {
            KingTop.Model.Pager             p         = new KingTop.Model.Pager();
            KingTop.BLL.Content.ModelManage objsource = new KingTop.BLL.Content.ModelManage();

            p.Aspnetpage  = Split;
            p.RptControls = rptModelManage;
            p.DicWhere    = dicWhere;
            objsource.PageData(p);
        }
コード例 #5
0
        /// <summary>
        /// 查询当前状态id
        /// </summary>
        /// <param name="strModelId"></param>
        /// <param name="strFlowStateId"></param>
        /// <returns></returns>
        public string GetFlowStateId(string strModelId, string strNewsId)
        {
            ModelManage BLLModelManage = new ModelManage();

            Model.SelectParams param = new KingTop.Model.SelectParams();
            param.S1 = strModelId;
            DataTable dtModelManage = BLLModelManage.GetList("ONE", param);
            string    strTableName  = dtModelManage.Rows[0]["tableName"].ToString();

            dtModelManage.Dispose();
            return(dal.GetFlowStateId(strTableName, strNewsId));
        }
コード例 #6
0
        private bool EditSysField(ref StringBuilder sbSysFields, string sysFieldID)
        {
            string            controlHtml;       // 当前节点的HTML代码
            string            itemHtml;          // 临时变量
            string            configPath;        // 链接配置文件路径
            string            xpath;
            XPathNodeIterator navNodeXPath;      // 链接/按钮配置根节点指针
            XPathNodeIterator currentNav;        // 临时指针
            Regex             reg;               // 用于配置字段标签如{FieldName}
            MatchCollection   matchCollection;   // 配置的字段标签集合
            bool isSuccess;                      // 解析是否成功

            isSuccess    = true;
            reg          = new Regex(@"(?<1>\{\$(?<2>([0-9a-zA-Z_]+))\$\})");
            configPath   = AppDomain.CurrentDomain.BaseDirectory + Utils.GetResourcesValue("Model", "SysFieldPath");
            xpath        = "/config";
            navNodeXPath = ModelManage.GetNodeIterator(configPath, xpath);
            navNodeXPath.MoveNext();
            currentNav = navNodeXPath.Current.Select("field[@id=" + sysFieldID + "]/edit");

            if (currentNav != null && currentNav.Count > 0)
            {
                currentNav.MoveNext();
                controlHtml     = currentNav.Current.InnerXml;
                controlHtml     = controlHtml.Replace("{#TableName#}", this.hsModel["TableName"].ToString()); // 解析预定义标签
                matchCollection = reg.Matches(controlHtml);

                foreach (Match match in matchCollection)                                                    // 字段标签替换成绑定标签
                {
                    controlHtml = controlHtml.Replace(match.Groups[1].Value, "<%=hsFieldValue[\"" + match.Groups[2].Value + "\"] %>");
                }

                controlHtml = containerItemTemplate.Replace(containerContent, controlHtml);                      // 加标签如 <li>
                currentNav  = navNodeXPath.Current.Select("field[@id=" + sysFieldID + "]");

                if (currentNav != null && currentNav.Count > 0)                                                  // 配置节点在编辑页显示
                {
                    itemHtml    = SetFieldParam(currentNav);                                                     // 设置缺省值并获取显示标题
                    itemHtml    = containerItemHeaderTemplate.Replace(containerContent, itemHtml);               // 标题
                    controlHtml = containerTemplate.Replace(containerContent, itemHtml + controlHtml);
                    sbSysFields.Append(controlHtml);
                }
            }
            else
            {
                isSuccess = false;
            }

            return(isSuccess);
        }
コード例 #7
0
        /// <summary>
        /// 审核状态更改

        /// </summary>
        /// <param name="strModelId"></param>
        /// <param name="strFlowStateId"></param>
        /// <returns></returns>
        public string FlowStateUpdate(string strModelId, string strFlowStateId, string strNewsId, bool isScuess, Model.Content.ReviewFlowLog modelReviewFlowLog)
        {
            ModelManage BLLModelManage = new ModelManage();

            Model.SelectParams param = new KingTop.Model.SelectParams();
            param.S1 = strModelId;
            DataTable dtModelManage = BLLModelManage.GetList("ONE", param);
            string    strTableName  = dtModelManage.Rows[0]["tableName"].ToString();

            dtModelManage.Dispose();
            if (strFlowStateId == "")  //选择状态,则直接给值

            {
                strFlowStateId = dal.GetFlowStateId(strTableName, strNewsId);
            }
            return(FlowStateUpdateNext1(strTableName, strFlowStateId, isScuess, strNewsId, modelReviewFlowLog));
        }
コード例 #8
0
        private bool SysFieldSearch(DataRowView dr, ref StringBuilder sbSearchHtml)
        {
            StringBuilder sbSysFieldSearchHtml;  // 保存解析后的自定义字段解析搜索代码

            string            controlHtml;       // 当前节点的HTML代码
            string            itemHtml;          // 临时变量
            string            configPath;        // 链接配置文件路径
            string            xpath;
            XPathNodeIterator navNodeXPath;      // 链接/按钮配置根节点指针
            XPathNodeIterator currentNav;        // 临时指针
            string            styleWidth;        // {#StyleWidth#}标签(控件的宽度)值
            bool result;                         // 处理结果

            sbSysFieldSearchHtml = new StringBuilder();
            styleWidth           = "0";
            result       = true;
            configPath   = AppDomain.CurrentDomain.BaseDirectory + Utils.GetResourcesValue("Model", "SysFieldPath");
            xpath        = "/config";
            navNodeXPath = ModelManage.GetNodeIterator(configPath, xpath);
            navNodeXPath.MoveNext();
            currentNav = navNodeXPath.Current.Select("field[@id=" + dr["SystemFirerdHtml"].ToString() + "]/search");

            if (currentNav != null && currentNav.Count > 0)
            {
                currentNav.MoveNext();
                controlHtml = currentNav.Current.InnerXml;
                controlHtml = searchContainerItemTemplate.Replace(containerContent, controlHtml);                      // 加标签如 <li>
                currentNav  = navNodeXPath.Current.Select("field[@id=" + dr["SystemFirerdHtml"].ToString().Trim() + "]");
                itemHtml    = GetSysFieldSearchParam(currentNav, ref styleWidth);                                      // 设置缺省值并获取显示标题
                itemHtml    = searchContainerItemHeaderTemplate.Replace(containerContent, itemHtml);                   // 标题
                controlHtml = searchContainerTemplate.Replace(containerContent, itemHtml + controlHtml);
                controlHtml = controlHtml.Replace("{#StyleWidth#}", styleWidth);
                sbSysFieldSearchHtml.Append(controlHtml);
            }
            else
            {
                result = false;
            }

            if (result)     // 解析成功
            {
                sbSearchHtml.Append(sbSysFieldSearchHtml);
            }

            return(result);
        }
コード例 #9
0
        private void GetOperationColumn(ref StringBuilder sbOperationColumn, ref string columnWidth)
        {
            string operationColumn;             // 当前模型中的操作

            string[]          arrOperationColumn;
            string            configPath;       // 配置文件路径
            string            xpath;
            XPathNodeIterator navNodeXPath;     // 字段配置根节点指针

            XPathNodeIterator currentNav;       // 临时指针
            string            link;             // 临时变量

            operationColumn    = this.hsModel["OperationColumn"].ToString();
            arrOperationColumn = operationColumn.Split(new char[] { ',' });

            configPath   = AppDomain.CurrentDomain.BaseDirectory + Utils.GetResourcesValue("Model", "ListPath");
            xpath        = "/config/rptbutton";
            navNodeXPath = ModelManage.GetNodeIterator(configPath, xpath);
            navNodeXPath.MoveNext();

            columnWidth = navNodeXPath.Current.GetAttribute("width", "");

            foreach (string nodeID in arrOperationColumn)   // 遍历所有当前模型中的配置节点

            {
                if (!string.IsNullOrEmpty(nodeID))
                {
                    currentNav = navNodeXPath.Current.Select("link[@id=" + nodeID + "]");

                    if (currentNav != null && currentNav.Count > 0)
                    {
                        currentNav.MoveNext();
                        link = currentNav.Current.GetAttribute("btName", "");
                        link = "<input type=\"button\"  value=\"" + link + "\" />";
                        sbOperationColumn.Append(link);
                    }
                }
            }
        }
コード例 #10
0
        public string GetControlHtml(string strModelId)
        {
            // StrModelId = "5230a9b-2d6f-49";
            ModelField  bllModelField = new ModelField();
            ModelManage bllManage     = new ModelManage();
            DataTable   dtModelField  = bllModelField.GetList("ALLModelId", Utils.getTwoParams(strModelId, "1"));
            DataTable   dtModelManage = bllManage.GetList("ONE", Utils.getOneParams(strModelId));

            if (dtModelField.Rows.Count > 0 && dtModelManage.Rows.Count > 0)
            {
                DtModelFiled      = dtModelField;
                strModelTableName = dtModelManage.Rows[0]["tablename"].ToString();
                dtModelField.Dispose();
                dtModelManage.Dispose();
                return(Create(strModelId));
            }
            else
            {
                dtModelField.Dispose();
                dtModelManage.Dispose();
                return("");
            }
        }
コード例 #11
0
        public string Save(string modelID)
        {
            string            effectRow;        // 操作受影响行数
            Hashtable         hsListWidth;      // 列表列宽更新参数
            Hashtable         hsListOrder;      // 列表列顺序更新参数
            string            operColumnWidth;  // 操作列宽度
            string            configPath;       // 配置文件路径
            string            xpath;
            XPathNodeIterator navNodeXPath;     // 字段配置根节点指针
            XPathNodeIterator currentNav;       // 临时指针
            Hashtable         advancedConfig;   // 高级设置参数,对应k_ModelManage中的字段

            hsListWidth    = new Hashtable();
            hsListOrder    = new Hashtable();
            advancedConfig = new Hashtable();

            operColumnWidth = string.Empty;
            configPath      = AppDomain.CurrentDomain.BaseDirectory + Utils.GetResourcesValue("Model", "SysFieldPath");
            xpath           = "/config";
            navNodeXPath    = ModelManage.GetNodeIterator(configPath, xpath);
            navNodeXPath.MoveNext();

            // 高级设置赋值
            advancedConfig.Add("ListHeight", HttpContext.Current.Request.Form["ListHeight"]);                               // 列表高
            advancedConfig.Add("DeliverAndSearchUrlParam", HttpContext.Current.Request.Form["DeliverAndSearchUrlParam"]);   // URL传递且参与查询的参数
            advancedConfig.Add("DeliverUrlParam", HttpContext.Current.Request.Form["DeliverUrlParam"]);                     // URL传递参数
            advancedConfig.Add("FieldFromUrlParamValue", HttpContext.Current.Request.Form["FieldFromUrlParamValue"]);       // 字段值来源于URL参数值的字段
            advancedConfig.Add("BackDeliverUrlParam", HttpContext.Current.Request.Form["BackDeliverUrlParam"]);             // 页面返回时需传递的参数
            advancedConfig.Add("NotSearchField", HttpContext.Current.Request.Form["NotSearchField"]);                       // 不参与列表显示查询的字段

            foreach (string key in HttpContext.Current.Request.Form.AllKeys)
            {
                string fieldName;       // 字段名

                string fieldValue;      // 字段值


                fieldValue = HttpContext.Current.Request.Form[key];
                if (key.Contains("HQB_ListWidth_0_"))     // 基本字段列宽设置
                {
                    fieldName = key.Replace("HQB_ListWidth_0_", "");
                    hsListWidth.Add(fieldName, fieldValue);
                    continue;
                }

                if (key.Contains("HQB_Orders_0_"))        // 基本字段顺序设置
                {
                    fieldName = key.Replace("HQB_Orders_0_", "");
                    hsListOrder.Add(fieldName, fieldValue);
                    continue;
                }

                if (key.Contains("HQB_ListWidth_1_"))      // 自定义系统字段列宽

                {
                    string   sysFieldID;
                    string[] arrFieldName;
                    sysFieldID = key.Replace("HQB_ListWidth_1_", "");
                    currentNav = navNodeXPath.Current.Select("field[@id=" + sysFieldID + "]");
                    currentNav.MoveNext();

                    if (currentNav.Current.SelectSingleNode("name") != null)
                    {
                        arrFieldName = currentNav.Current.SelectSingleNode("name").Value.Split(new char[] { '|' });

                        foreach (string field in arrFieldName)
                        {
                            if (!string.IsNullOrEmpty(field))
                            {
                                hsListWidth.Add(field, fieldValue);
                            }
                        }
                    }
                    continue;
                }

                if (key.Contains("HQB_ListOrders_1_"))     // 自定义系统字段顺序设置

                {
                    string   sysFieldID;
                    string[] arrFieldName;
                    sysFieldID = key.Replace("HQB_ListOrders_1_", "");

                    if (!string.IsNullOrEmpty(sysFieldID))
                    {
                        currentNav = navNodeXPath.Current.Select("field[@id=" + sysFieldID + "]");
                        currentNav.MoveNext();

                        if (currentNav.Current.SelectSingleNode("name") != null)
                        {
                            arrFieldName = currentNav.Current.SelectSingleNode("name").Value.Split(new char[] { '|' });

                            foreach (string field in arrFieldName)
                            {
                                if (!string.IsNullOrEmpty(field))
                                {
                                    hsListOrder.Add(field, fieldValue);
                                }
                            }
                        }
                    }
                    continue;
                }

                if (key.Contains("HQB_ListWidth_OpColumn"))  // 列表操作列宽度

                {
                    operColumnWidth = fieldValue;
                }
            }

            effectRow = dal.SaveConfig(hsListWidth, hsListOrder, modelID, operColumnWidth, advancedConfig);

            return(effectRow);
        }
コード例 #12
0
        /// <summary>
        /// sysFieldID为模型表ModelManage
        // 中的系统字段SysField的值

        /// </summary>
        /// <returns></returns>
        private void ListSysField(string sysFieldID, ref StringBuilder sbHeaderHtml, ref StringBuilder sbItemHtml, ref StringBuilder sbListWidth, ref StringBuilder sbListItemOrder, string order)
        {
            string            configPath;       // 配置文件路径
            string            xpath;
            XPathNodeIterator navNodeXPath;     // 字段配置根节点指针

            XPathNodeIterator currentNav;       // 临时指针

            configPath   = AppDomain.CurrentDomain.BaseDirectory + Utils.GetResourcesValue("Model", "SysFieldPath");
            xpath        = "/config";
            navNodeXPath = ModelManage.GetNodeIterator(configPath, xpath);
            navNodeXPath.MoveNext();

            currentNav = navNodeXPath.Current.Select("field[@id=" + sysFieldID + "]");
            // 节点存在
            if (currentNav != null && currentNav.Count > 0)
            {
                string itemHeader;  // 列表标题
                string width;       // 列显示宽
                string title;       // 列显示标题

                string[] fieldName; // 字段名


                currentNav.MoveNext();
                try
                {
                    title     = currentNav.Current.GetAttribute("title", "");
                    width     = currentNav.Current.SelectSingleNode("list").GetAttribute("width", "");
                    fieldName = currentNav.Current.SelectSingleNode("name").Value.Split(new char[] { '|' });
                    DataRow[] currentDR = dtField.Select("Name='" + fieldName[0] + "'");

                    // 配置节点只有一个字段,时列表表题引用字段表中的标题
                    if (fieldName.Length < 2)
                    {
                        if (currentDR.Length > 0 && !string.IsNullOrEmpty(currentDR[0]["FieldAlias"].ToString()))
                        {
                            title = currentDR[0]["FieldAlias"].ToString();
                        }
                    }

                    if (!string.IsNullOrEmpty(currentDR[0]["ListWidth"].ToString()))  // 优选采用页面配置的值

                    {
                        width = currentDR[0]["ListWidth"].ToString();
                    }
                }
                catch
                {
                    return;
                }


                // 列表标题
                if (width.Contains("%"))
                {
                    itemHeader = "<li  style=\"width:" + width + "; ";
                }
                else
                {
                    itemHeader = "<li  style=\"width:" + width + "px; ";
                }
                sbHeaderHtml.Append(itemHeader + "\">");
                sbHeaderHtml.Append(title);
                sbHeaderHtml.Append("</li>");

                // 列表项

                sbItemHtml.Append(itemHeader + this.listHeight + "\">" + "</li>");

                // 列表列宽设置
                sbListWidth.Append("<li>" + title + ":<input type=\"text\"  value=\"" + width + "\" name=\"HQB_ListWidth_1_" + sysFieldID + "\" /></li>");

                // 列表列顺序设置

                sbListItemOrder.Append("<li>" + title + ":<input type=\"text\"  value=\"" + order + "\" name=\"HQB_ListOrders_1_" + sysFieldID + "\" /></li>");
            }
        }
コード例 #13
0
        protected void SetIsEnable(object sender, CommandEventArgs e)
        {
            KingTop.BLL.Content.ModelManage model;
            string tranType;
            string returnMsg;

            string[] arrArg;        // arrArg[0]  记录ID  arrArg[1] 记录值
            int      isEnable;
            bool     isValidate;
            string   opName;        // 操作名称,用于记录日志

            isValidate = IsHaveRightByOperCode("Edit");

            if (isValidate)
            {
                model    = new KingTop.BLL.Content.ModelManage();
                arrArg   = e.CommandArgument.ToString().Split(new char[] { '|' });
                tranType = e.CommandName;
                isEnable = 0;

                switch (e.CommandName)
                {
                case "STATE":
                    opName = "状态";
                    break;

                case "HTML":
                    opName = "是否生成HTML";
                    break;

                default:
                    opName = string.Empty;
                    break;
                }

                if (arrArg.Length > 1)
                {
                    if (arrArg[1] == "False" || arrArg[1] == "0")
                    {
                        isEnable = 1;
                    }

                    returnMsg = model.ModelManageSet(tranType, isEnable.ToString(), arrArg[0]);

                    if (returnMsg == "1")
                    {
                        WriteLog("设置模型 " + LogTitle + opName + arrArg[1].ToString() + " => " + isEnable.ToString() + "成功", null, 2);
                    }
                    else
                    {
                        WriteLog("设置模型 " + LogTitle + opName + arrArg[1].ToString() + " => " + isEnable.ToString() + "失败", returnMsg, 3);
                    }

                    PageInit();
                }
            }
            else
            {
                jsMessage += "alert({msg:\"对不起,您没有修改模型属性的操作权限,请与管理员联系!\",title:\"操作提示\"});";
            }
        }
コード例 #14
0
        public void ModelManage_Del(object sender, CommandEventArgs e)
        {
            string id;
            string tranType;    // 事务类型
            string returnMsg;   // 事务返回信息

            KingTop.BLL.Content.ModelManage model;
            bool isValidate;

            isValidate = IsHaveRightByOperCode("Delete");

            if (isValidate)
            {
                if (IsPostBack)
                {
                    id = e.CommandArgument.ToString();

                    if (e.CommandName == "del")
                    {
                        tranType = "DELONE";
                    }
                    else if (string.Equals(e.CommandName, "deldp"))
                    {
                        string tableName;

                        tranType  = "DELDP";
                        tableName = ((Button)sender).ToolTip;
                        tableName = tableName.Replace("K_U_", "");
                        File.Delete(Server.MapPath(tableName + "list.aspx"));       // 删除生成的列表文件
                        File.Delete(Server.MapPath(tableName + "edit.aspx"));       // 删除生成的编辑文件
                        File.Delete(Server.MapPath(tableName + "view.aspx"));       // 删除生成的编辑文件
                    }
                    else if (string.Equals(e.CommandName, "revert"))
                    {
                        tranType = "REVERT";
                    }
                    else
                    {
                        tranType = "DELONE";
                    }

                    returnMsg = "";
                    model     = new KingTop.BLL.Content.ModelManage();
                    returnMsg = model.ModelManageSet(tranType, null, id);

                    if (returnMsg == "1")
                    {
                        WriteLog("删除模型 " + LogTitle + " 至回收站成功", string.Empty, 2);
                    }
                    else
                    {
                        WriteLog("删除模型 " + LogTitle + " 至回收站失败", returnMsg, 3);
                    }

                    PageInit();
                }
            }
            else
            {
                jsMessage += "alertClose({msg:\"对不起,您没有删除模型的操作权限,请与管理员联系!\",title:\"操作提示\"});";
            }
        }