Beispiel #1
0
        private static string ItemTemplateFilePath(CommonModelInfo commonModelInfo)
        {
            string defaultTemplateFile = "";

            if (!string.IsNullOrEmpty(commonModelInfo.TemplateFile))
            {
                return(commonModelInfo.TemplateFile);
            }
            NodesModelTemplateRelationShipInfo nodesModelTemplateRelationShip = ModelManager.GetNodesModelTemplateRelationShip(commonModelInfo.NodeId, commonModelInfo.ModelId);

            if (!nodesModelTemplateRelationShip.IsNull)
            {
                if (!string.IsNullOrEmpty(nodesModelTemplateRelationShip.DefaultTemplateFile))
                {
                    defaultTemplateFile = nodesModelTemplateRelationShip.DefaultTemplateFile;
                }
                return(defaultTemplateFile);
            }
            ModelInfo modelInfoById = ModelManager.GetModelInfoById(commonModelInfo.ModelId);

            if (!string.IsNullOrEmpty(modelInfoById.DefaultTemplateFile))
            {
                defaultTemplateFile = modelInfoById.DefaultTemplateFile;
            }
            return(defaultTemplateFile);
        }
        private IList <NodesModelTemplateRelationShipInfo> GetDataFromRepeater()
        {
            IList <NodesModelTemplateRelationShipInfo> list = new List <NodesModelTemplateRelationShipInfo>();

            foreach (RepeaterItem item in this.RepContentModelTemplate.Items)
            {
                if ((item.ItemType == ListItemType.Item) || (item.ItemType == ListItemType.AlternatingItem))
                {
                    string text = ((TextBox)item.FindControl("FileCTemplate")).Text;
                    if (((CheckBox)item.FindControl("ChkModel")).Checked && !string.IsNullOrEmpty(text))
                    {
                        NodesModelTemplateRelationShipInfo info = new NodesModelTemplateRelationShipInfo();
                        info.ModelId             = DataConverter.CLng(((HiddenField)item.FindControl("HdnModelId")).Value);
                        info.DefaultTemplateFile = text;
                        list.Add(info);
                    }
                }
            }
            foreach (RepeaterItem item2 in this.RepShopModelTemplate.Items)
            {
                if ((item2.ItemType == ListItemType.Item) || (item2.ItemType == ListItemType.AlternatingItem))
                {
                    string str2 = ((TextBox)item2.FindControl("FileCTemplate")).Text;
                    if (((CheckBox)item2.FindControl("ChkModel")).Checked && !string.IsNullOrEmpty(str2))
                    {
                        NodesModelTemplateRelationShipInfo info2 = new NodesModelTemplateRelationShipInfo();
                        info2.ModelId             = DataConverter.CLng(((HiddenField)item2.FindControl("HdnModelId")).Value);
                        info2.DefaultTemplateFile = str2;
                        list.Add(info2);
                    }
                }
            }
            return(list);
        }
Beispiel #3
0
        public static bool AddNodesModelTemplateRelationShip(NodesModelTemplateRelationShipInfo info)
        {
            bool flag = true;

            if ((!string.IsNullOrEmpty(info.DefaultTemplateFile) && (info.NodeId > 0)) && (info.ModelId > 0))
            {
                info.DefaultTemplateFile = info.DefaultTemplateFile;
                flag = dal.AddNodesModelTemplateRelationShip(info);
            }
            return(flag);
        }
Beispiel #4
0
        public bool AddNodesModelTemplateRelationShip(NodesModelTemplateRelationShipInfo info)
        {
            Parameters cmdParams = new Parameters();

            cmdParams.AddInParameter("@NodeId", DbType.Int32, info.NodeId);
            cmdParams.AddInParameter("@ModelId", DbType.Int32, info.ModelId);
            cmdParams.AddInParameter("@DefaultTemplateFile", DbType.String, info.DefaultTemplateFile);
            string strSql = "INSERT INTO PE_Nodes_Model_Template(NodeId, ModelId, DefaultTemplateFile) VALUES (@NodeId, @ModelId, @DefaultTemplateFile)";

            return(DBHelper.ExecuteSql(strSql, cmdParams));
        }
Beispiel #5
0
        public bool ExistsNodesModelTemplateRelationShip(NodesModelTemplateRelationShipInfo info)
        {
            Parameters cmdParams = new Parameters();

            cmdParams.AddInParameter("@NodeId", DbType.Int32, info.NodeId);
            cmdParams.AddInParameter("@ModelId", DbType.Int32, info.ModelId);
            cmdParams.AddInParameter("@DefaultTemplateFile", DbType.String, info.DefaultTemplateFile);
            string strSql = "SELECT COUNT(*) FROM PE_Nodes_Model_Template WHERE NodeId = @NodeId AND ModelId = @ModelId AND DefaultTemplateFile = @DefaultTemplateFile";

            return(DBHelper.ExistsSql(strSql, cmdParams));
        }
Beispiel #6
0
        protected string ItemTemplateFilePath()
        {
            if (!string.IsNullOrEmpty(this.m_ItemInfo.TemplateFile))
            {
                return(this.m_ItemInfo.TemplateFile);
            }
            NodesModelTemplateRelationShipInfo nodesModelTemplateRelationShip = ModelManager.GetNodesModelTemplateRelationShip(this.m_NodeInfo.NodeId, this.m_ModelInfo.ModelId);

            if (!nodesModelTemplateRelationShip.IsNull && !string.IsNullOrEmpty(nodesModelTemplateRelationShip.DefaultTemplateFile))
            {
                return(nodesModelTemplateRelationShip.DefaultTemplateFile);
            }
            if (!string.IsNullOrEmpty(this.m_ModelInfo.DefaultTemplateFile))
            {
                return(this.m_ModelInfo.DefaultTemplateFile);
            }
            return("");
        }
Beispiel #7
0
        public NodesModelTemplateRelationShipInfo GetNodesModelTemplateRelationShip(int nodeId, int modelId)
        {
            NodesModelTemplateRelationShipInfo info = new NodesModelTemplateRelationShipInfo();
            string     strSql    = "SELECT * FROM PE_Nodes_Model_Template WHERE NodeId = @NodeId AND ModelId = @ModelId";
            Parameters cmdParams = new Parameters();

            cmdParams.AddInParameter("@NodeId", DbType.Int32, nodeId);
            cmdParams.AddInParameter("@ModelId", DbType.Int32, modelId);
            using (NullableDataReader reader = DBHelper.ExecuteReaderSql(strSql, cmdParams))
            {
                if (reader.Read())
                {
                    info.NodeId              = reader.GetInt32("NodeId");
                    info.ModelId             = reader.GetInt32("ModelId");
                    info.DefaultTemplateFile = reader.GetString("DefaultTemplateFile");
                    return(info);
                }
                return(new NodesModelTemplateRelationShipInfo(true));
            }
        }
Beispiel #8
0
        public IList <NodesModelTemplateRelationShipInfo> GetNodesModelTemplateList(int nodeId)
        {
            IList <NodesModelTemplateRelationShipInfo> list = new List <NodesModelTemplateRelationShipInfo>();
            string     strSql    = "SELECT * FROM PE_Nodes_Model_Template WHERE NodeId = @NodeId";
            Parameters cmdParams = new Parameters();

            cmdParams.AddInParameter("@NodeId", DbType.Int32, nodeId);
            using (NullableDataReader reader = DBHelper.ExecuteReaderSql(strSql, cmdParams))
            {
                while (reader.Read())
                {
                    NodesModelTemplateRelationShipInfo item = new NodesModelTemplateRelationShipInfo();
                    item.NodeId              = reader.GetInt32("NodeId");
                    item.ModelId             = reader.GetInt32("ModelId");
                    item.DefaultTemplateFile = reader.GetString("DefaultTemplateFile");
                    list.Add(item);
                }
            }
            return(list);
        }
Beispiel #9
0
 public static bool ExistsNodesModelTemplateRelationShip(NodesModelTemplateRelationShipInfo info)
 {
     return(dal.ExistsNodesModelTemplateRelationShip(info));
 }