/// <summary> /// 页面入口方法,以文件路径 /// </summary> /// <param name="mHtmlpPath">somepage.html文件路径</param> /// <param name="mPageName">页面名称,如: somepage </param> /// <param name="mDeep">嵌套深度</param> /// <param name="config">配置信息</param> /// <param name="justGetTagList">是否仅获取页面内标签列表</param> internal BasePage(string mHtmlpPath, string mPageName, int mDeep, TagConfig config, bool justGetTagList) { config.Init(); this.JustGetTagList = justGetTagList; this.Config = config; this.Extends = config.DefaultBase; this.SubpageExtends = config.DefaultUCBase; this.Deep = mDeep + 1; this.PageName = mPageName; if (Deep > config.MAXD_EEP) { this.Msg += string.Format("{0}-镶套层数达到{1}层,为防止循环套用已停止解析。<br />", this.PageName, config.MAXD_EEP); return; } if (justGetTagList) //仅获取标签列表是,直接传入要解析的文件物理路径 { this.HtmlpPath = mPageName; try { Html = File.ReadAllText(HtmlpPath); } catch (Exception e) { Msg += string.Format("无法打开文件:{0}。 {1}", HtmlpPath, e.Message); } } else// 设置文件路径 { this.HtmlpPath = string.IsNullOrEmpty(mHtmlpPath) ? config.PagePath : mHtmlpPath; ReadFile(); } GetTegs(); }
public static List <TagConfig> getTagConfigList(string webpageName) { SqlConnection conn = ConnectionBuilder.getConnection(); string sql = "SELECT * FROM Tag_Config WHERE webpage = @param1"; SqlCommand sqlCom = new SqlCommand(sql, conn); sqlCom.Parameters.AddWithValue("@param1", webpageName); conn.Open(); List <TagConfig> list = new List <TagConfig>(); using (SqlDataReader reader = sqlCom.ExecuteReader()) { while (reader.Read()) { TagConfig tc = new TagConfig(); tc.Id = (int)reader["id"]; tc.Tag_id = reader["tag_id"].ToString(); tc.Webpage = reader["webpage"].ToString(); tc.Tag_name = reader["tag_name"].ToString(); list.Add(tc); } } conn.Close(); return(list); }
//删除block private void toolBlockDel_Click(object sender, EventArgs e) { if (MessageBox.Show("是否删除", "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { if (!TagConfig.DelBlock(treeTags.SelectedNode.Text)) { MessageBox.Show("删除失败,不在在节点"); } else { //成功删除后刷新 treeTags.Nodes.Clear(); //加载treeview XElement doc = XElement.Load(TagConfig.Path);//将加载完成的XML文件显示在TreeView控件中 RecursionTreeControl(doc, treeTags.Nodes); dataGridTags.Rows.Clear(); treeTags.ExpandAll();//展开TreeView控件中的所有项 groupName = ""; blockName = "";; lblGroup.Text = groupName; lblBlock.Text = blockName; } } }
/// <summary> /// block名称修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolBlockNameEdit_Click(object sender, EventArgs e) { //定义块新增控制的委托 Func <string, bool> editBlock = (newblockName) => { string blockName = treeTags.SelectedNode.Text; string groupName = treeTags.SelectedNode.Parent.Text; if (TagConfig.EditBlock(groupName, blockName, newblockName)) { return(true); } else { return(false); } }; ControlBlock ab = new ControlBlock(editBlock, treeTags.SelectedNode.Text); if (ab.ShowDialog() == DialogResult.OK) { //清空后并重新加载 treeTags.Nodes.Clear(); XElement doc = XElement.Load(TagConfig.Path); //将加载完成的XML文件显示在TreeView控件中 RecursionTreeControl(doc, treeTags.Nodes); treeTags.ExpandAll(); //展开TreeView控件中的所有项 lblBlock.Text = ab.NewBlockName; } }
public static IDictionary <string, Tag> BuildDictionary(TagConfig config) { IDictionary <string, Tag> tags = new Dictionary <string, Tag>(); foreach (IList <object> row in config.Query.Data) { try { IList <string> tag = row.Select(r => r.ToString()).ToList(); string name = ParseHelper.SafeStringParse(tag, config.Name, "Name", false); if (string.IsNullOrEmpty(name)) { continue; } if (!tags.TryAdd(name, new Tag(config, tag))) { throw new NonUniqueObjectNameException("tag"); } } catch (Exception ex) { throw new TagProcessingException((row.ElementAtOrDefault(config.Name) ?? string.Empty).ToString(), ex); } } return(tags); }
//新增block private void toolBlockAdd_Click(object sender, EventArgs e) { //定义块新增控制的委托 Func <string, bool> addBlock = (blockName) => { if (TagConfig.CreateBlock(treeTags.SelectedNode.Text, blockName)) { return(true); } else { return(false); } }; ControlBlock ab = new ControlBlock(addBlock); if (ab.ShowDialog() == DialogResult.OK) { //清空后并重新加载 treeTags.Nodes.Clear(); XElement doc = XElement.Load(TagConfig.Path); //将加载完成的XML文件显示在TreeView控件中 RecursionTreeControl(doc, treeTags.Nodes); treeTags.ExpandAll(); //展开TreeView控件中的所有项 } }
/// <summary> /// 连接opc /// </summary> /// <param name="client"></param> private bool ConnectOpc(IOpcClient client) { try { if (client.Connect().Result) { //创建组及绑定组内的tags client.CreateGroup("GroupTrigger") .SetUpdateRate(groupTriggerUpdateRate) .AddItems(TagConfig.QueryTagsByGroupName <Tag>("GroupTrigger")) .ValueChangedHandle = TagValueChanged; client.CreateGroup("GroupData") .SetUpdateRate(groupDataUpdateRate) .AddItems(TagConfig.QueryTagsByGroupName <Tag>("GroupData")) .AddQueue(100) .ValueChangedHandle = TagValueChanged; OpcServerRefreshUI(client); return(true); } else { OpcServerRefreshUI(client); return(false); } } catch (Exception) { throw; } }
/// <summary> /// Constructor. /// </summary> public Tag(TagConfig config, IList <string> data) { this.Name = ParseHelper.SafeStringParse(data, config.Name, "Name", true); this.SpriteURL = ParseHelper.SafeURLParse(data, config.SpriteURL, "Sprite URL", false); this.ShowOnUnit = (ParseHelper.SafeStringParse(data, config.ShowOnUnit, "Show On Unit", false) == "Yes" && !string.IsNullOrEmpty(this.SpriteURL)); this.UnitAura = ParseHelper.SafeHexParse(data, config.UnitAura, "Unit Aura", false); }
private bool GetTagUpdateRequiresAdmin(ulong serverId) { // assume if the record doesn't exist in the DB that we do not need admin permission TagConfig config = _floofDb.TagConfigs.AsQueryable() .FirstOrDefault(config => config.ServerId == serverId); return(config == null ? false : config.TagUpdateRequiresAdmin); }
/// <summary> /// 取得學生類別設定完整名稱 /// </summary> /// <returns></returns> public static List <string> GetStudTypeConfigFullNameList() { List <string> retVal = new List <string>(); // 取得學生設定標籤內的類別名稱 List <TagConfigRecord> studTagConf = TagConfig.SelectByCategory(TagCategory.Student); retVal = (from tag in studTagConf orderby tag.FullName ascending select tag.FullName).ToList(); return(retVal); }
/// <summary> /// Lấy ra danh sách modul từ TagConfig /// </summary> private void LoadModul() { ddlModul.Items.Clear(); TagConfig tcfg = new TagConfig(); for (int i = 0; i < tcfg.Text.Length; i++) { ddlModul.Items.Add(new ListItem(tcfg.Text[i], tcfg.Values[i])); } }
/// <summary> /// 重载dataGridTags的Tag定义 /// </summary> /// <param name="groupName"></param> /// <param name="blockName"></param> private void QueryTags(string groupName, string blockName) { //显示block中的tag点明细 List <Tag> tags = TagConfig.QueryTagsByBlockName <Tag>(groupName, blockName); List <GridTag> list = tags.Select(p => new GridTag { TagName = p.TagName, OpcTagName = p.OpcTagName, TimeStamps = p.TimeStamps, Qualities = p.Qualities, Value = p.Value, Message = p.Message }).ToList(); dataGridTags.DataSource = new BindingList <GridTag>(list); }
static void _bgLLoadUDT_DoWork(object sender, DoWorkEventArgs e) { UDTTransfer.CreateUDTTable(); #region 自訂驗證規則 FactoryProvider.FieldFactory.Add(new FieldValidatorFactory()); #endregion #region 加入自動加入班級類別 List <string> nameList = new List <string> (); nameList.Add("普通班"); nameList.Add("體育班"); nameList.Add("美術班"); nameList.Add("音樂班"); nameList.Add("舞蹈班"); nameList.Add("資優班"); nameList.Add("資源班"); nameList.Add("特教班"); nameList.Add("技藝專班"); nameList.Add("機構式非學校自學班"); // 取得班級分類 List <TagConfigRecord> TagRecList = TagConfig.SelectByCategory(TagCategory.Class); List <TagConfigRecord> AddTagRecList = new List <TagConfigRecord>(); List <string> hasNameList = new List <string>(); foreach (TagConfigRecord rec in TagRecList) { if (rec.Prefix == "班級分類") { hasNameList.Add(rec.Name); } } // 檢查是否新增 foreach (string name in nameList) { if (!hasNameList.Contains(name)) { TagConfigRecord rec = new TagConfigRecord(); rec.Name = name; rec.Prefix = "班級分類"; rec.Category = "Class"; AddTagRecList.Add(rec); } } if (AddTagRecList.Count > 0) { TagConfig.Insert(AddTagRecList); } #endregion }
/// <summary> /// 构造函数 /// </summary> /// <param name="mText">经过处理的标签文本(去除空格 \s*、br/hr替换)</param> /// <param name="mOrigin">原始标签文本</param> /// <param name="mDeep">嵌套深度</param> /// <param name="config">配置</param> /// <param name="no_">标签的递增编码</param> protected BaseTag(string mText, string mOrigin, int mDeep, TagConfig config, int no_) { this.Config = config; this.Deep = mDeep; this.Text = mText; this.Origin = mOrigin; this.NO_ = no_; this.TagName = string.Concat(this.GetType().Name, "_", this.Text.Length, TagHelper.RandomNext(999), "_", (this.NO_ + 1)); this.PlaceHolderName = string.Concat("#", this.TagName, "#"); this.In_Pairs = this.Text.LastIndexOf('/') != this.Text.Length - 2; this.Discover(); }
public CourseCodeTagHelper() { // 檢查課程Tag是否存在,如果不存在加入 if (GetCourseCodeTagID() == "") { // 使用 K12 Tag 新增 TagConfigRecord rec = new TagConfigRecord(); rec.Name = "課程"; rec.Prefix = "課程計畫"; CourseCodeTagID = TagConfig.Insert(rec); } }
private void GetListTagModul() { TagConfig tagcfg = new TagConfig(); ddlTagModul.Items.Clear(); for (int i = 0; i < tagcfg.Values.Length; i++) { ddlTagModul.Items.Add(new ListItem(tagcfg.Text[i], tagcfg.Values[i])); } if (Modul.Length > 0) { ddlTagModul.SelectedValue = Modul; } }
// Use this for initialization void Start() { TagConfig config = new TagConfig(); config.TagDetailConfig = new TagDetailConfig(); config.TagDetailConfig.CameraItemConfig = new CameraParameterConfig(); config.TagDetailConfig.CameraItemConfig.Margin = "12,34,0,0"; string json = JsonConvert.SerializeObject(config); print(json); TagConfig config2 = JsonConvert.DeserializeObject <TagConfig>(json); print(config2.TagDetailConfig.CameraItemConfig.ExtraConfigContent); print(config2.TagDetailConfig.CameraItemConfig.Margin); }
/// <summary> /// 页面入口方法,以html文本 /// </summary> /// <param name="style">html文本</param> /// <param name="mDeep">嵌套深度</param> /// <param name="config">配置信息</param> /// <param name="fakeName">虚拟的页面名称</param> internal BasePage(string style, int mDeep, TagConfig config, string fakeName) { this.Config = config; this.Extends = config.DefaultBase; this.SubpageExtends = config.DefaultUCBase; this.Deep = mDeep + 1; this.PageName = fakeName; this.Html = style; if (Deep > config.MAXD_EEP) { this.Msg += string.Format("{0}-镶套层数达到{1}层,为防止循环套用已停止解析。<br />", this.PageName, config.MAXD_EEP); return; } GetTegs(); }
//校验重复性 private void btnCheckRepeat_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in dataGridTags.Rows) { //Xml文件中在在此名称,修改dataGridTags的显示背景色 if (TagConfig.ExistTag(row.Cells["TagName"].Value.ToString())) { row.DefaultCellStyle.BackColor = Color.Yellow; } else { row.DefaultCellStyle.BackColor = Color.White; } } }
//删除tag private void toolTagDel_Click(object sender, EventArgs e) { BindingList <GridTag> list = (BindingList <GridTag>)dataGridTags.DataSource; foreach (DataGridViewRow row in dataGridTags.SelectedRows) { string tagName = dataGridTags.Rows[row.Index].Cells["TagName"].Value.ToString(); Tag tag = new Tag() { TagName = tagName }; if (TagConfig.DelTag(groupName, blockName, tag)) { list.RemoveAt(row.Index); } } isdDtaGridTagsChanged = true; }
public async Task RequireAdmin([Summary("True/False")] string requireAdmin = "") { TagConfig config = await _floofDb.TagConfigs.AsQueryable() .Where(config => config.ServerId == Context.Guild.Id).FirstOrDefaultAsync(); bool parsedRequireAdmin; if (!bool.TryParse(requireAdmin, out parsedRequireAdmin)) { await SendEmbed(CreateDescriptionEmbed($"Usage: `.tag requireadmin True/False`")); return; } try { if (config == null) { await _floofDb.TagConfigs.AddAsync(new TagConfig { ServerId = Context.Guild.Id, TagUpdateRequiresAdmin = parsedRequireAdmin, }); } else { config.TagUpdateRequiresAdmin = parsedRequireAdmin; } await _floofDb.SaveChangesAsync(); string message = "Adding/removing tags now " + (parsedRequireAdmin ? "requires" : "does not require") + " admin permission."; await Context.Channel.SendMessageAsync(message); } catch (DbUpdateException e) { string message = "Error when configuring permissions for adding/removing tags."; await Context.Channel.SendMessageAsync(message); Log.Error(message + Environment.NewLine + e); } }
//新增tag private void toolTagAdd_Click(object sender, EventArgs e) { chkRefresh.Checked = false; //设置当前选中的节点信息 groupName = treeTags.SelectedNode.Parent.Text; blockName = treeTags.SelectedNode.Text; lblGroup.Text = groupName; lblBlock.Text = blockName; AddTags at = new AddTags(client, groupName, blockName); if (at.ShowDialog() == DialogResult.OK) { //显示block中的tag点明细 List <Tag> tags = TagConfig.QueryTagsByBlockName <Tag>(groupName, blockName); List <GridTag> list = tags.Select(p => new GridTag { TagName = p.TagName, OpcTagName = p.OpcTagName, TimeStamps = p.TimeStamps, Qualities = p.Qualities, Value = p.Value, Message = p.Message }).ToList(); dataGridTags.DataSource = new BindingList <GridTag>(list); isdDtaGridTagsChanged = true; } }
/// <summary> /// 连接opc /// </summary> /// <param name="client"></param> private bool ConnectOpc(IOpcClient client) { if (client.Connect().Result == true) { client.RemoveGroupsAll(); //创建组及绑定组内的tags client.CreateGroup("GroupTrigger") .SetUpdateRate(groupTriggerUpdateRate) .AddItems(TagConfig.QueryTagsByGroupName <Tag>("GroupTrigger")) .ValueChangedHandle = TagValueChanged; client.CreateGroup("GroupData") .SetUpdateRate(groupDataUpdateRate) .AddItems(TagConfig.QueryTagsByGroupName <Tag>("GroupData")) .AddQueue(tagsQueueNum); OpcServerRefreshUI(client); return(true); } else { OpcServerRefreshUI(client); return(false); } }
//保存提交的数据 private void btnSave_Click(object sender, EventArgs e) { if (dataGridTags.Rows.Count == 0) { MessageBox.Show("不存在需要提交的数据集!"); return; } List <Tag> tags = new List <Tag>(); foreach (DataGridViewRow row in dataGridTags.Rows) { Tag tag = new Tag() { TagName = row.Cells["TagName"].Value.ToString(), OpcTagName = row.Cells["OpcTagName"].Value.ToString() }; tags.Add(tag); } if (TagConfig.CreateTag(groupName, blockName, tags)) { this.DialogResult = DialogResult.OK; //this.Close(); this.Dispose(); } }
public IfGroupTag(string mtext, int Deep, TagConfig config, int no_) : base(mtext, mtext, Deep, config, no_) { }
public SubListPage(string mHtmlpPath, string mPageName, int mDeep, TagConfig config) : base(mHtmlpPath, mPageName, mDeep, config) { }
public CMDTag(string mtext, string mOrigin, int Deep, TagConfig config, int no_) : base(mtext, mOrigin, Deep, config, no_) { }
public StaticTag(string mtext, string mOrigin, int Deep, string mParPageName, TagConfig config, int no_) : base(mtext, mOrigin, Deep, config, no_) { this.ParPageName = mParPageName; }
protected StyleAbleTag(string mtext, string origin, int mdeep, TagConfig config, int no_) : base(mtext, origin, mdeep, config, no_) { }
public static void main() { FISCA.Presentation.RibbonBarItem item1 = FISCA.Presentation.MotherForm.RibbonBarItems["教務作業", "資料統計"]; item1["報表"].Image = Properties.Resources.Report; item1["報表"].Size = FISCA.Presentation.RibbonBarButton.MenuButtonSize.Large; item1["報表"]["新生入學方式統計表"].Enable = Permissions.新生入學方式統計表權限; item1["報表"]["新生入學方式統計表"].Click += delegate { Form2 form = new Form2(); form.ShowDialog(); }; //權限設定 Catalog permission = RoleAclSource.Instance["教務作業"]["功能按鈕"]; permission.Add(new RibbonFeature(Permissions.新生入學方式統計表, "新生入學方式統計表")); //2017/2/8 穎驊註解,原本因應公務統計報表 "新生入學方式統計報表"項目 而新增提供的預設類別項目, //為了防止 所有使用本類別模組的學校(包含 沒有使用公務統計報表模組的學校) 一併被提供到預設定類別項目 //將下面的CODE 自MOD_Tagging模組 Tagging 專案 其 Program 移轉過來 //如此一來就只有 使用公務統計報表模組的學校會被新增類別項目 #region 加入預設的入學方式、入學身分、原住民類別 List <string> EnterSchoolWays = new List <string>(); List <string> EnterSchoolIdentities = new List <string>(); List <string> aboList = new List <string>(); List <string> aboList2 = new List <string>(); //九種入學方式 EnterSchoolWays.Add("免試入學--校內直升"); EnterSchoolWays.Add("免試入學--就學區免試(含共同就學區)"); EnterSchoolWays.Add("免試入學--技優甄審"); EnterSchoolWays.Add("免試入學--免試獨招"); EnterSchoolWays.Add("免試入學--其他"); EnterSchoolWays.Add("特色招生--考試分發"); EnterSchoolWays.Add("特色招生--甄選入學"); EnterSchoolWays.Add("適性輔導安置(十二年安置)"); EnterSchoolWays.Add("其他"); //四種入學身分 EnterSchoolIdentities.Add("一般生(非外加錄取)"); EnterSchoolIdentities.Add("外加錄取--原住民生"); EnterSchoolIdentities.Add("外加錄取--身心障礙生"); EnterSchoolIdentities.Add("外加錄取--其他"); //十七種 原住民身分 aboList.Add("阿美族"); aboList.Add("泰雅族"); aboList.Add("排灣族"); aboList.Add("布農族"); aboList.Add("卑南族"); aboList.Add("鄒(曹)族"); aboList.Add("魯凱族"); aboList.Add("賽夏族"); aboList.Add("雅美族或達悟族"); aboList.Add("卲族"); aboList.Add("噶瑪蘭族"); aboList.Add("太魯閣族(含 德魯固族)"); aboList.Add("撒奇萊雅族"); aboList.Add("賽德克族"); aboList.Add("拉阿魯哇族"); aboList.Add("卡那卡那富族"); aboList.Add("其他"); aboList2.Add("阿美族"); aboList2.Add("泰雅族"); aboList2.Add("排灣族"); aboList2.Add("布農族"); aboList2.Add("卑南族"); aboList2.Add("鄒(曹)族"); aboList2.Add("魯凱族"); aboList2.Add("賽夏族"); aboList2.Add("雅美族或達悟族"); aboList2.Add("卲族"); aboList2.Add("噶瑪蘭族"); aboList2.Add("太魯閣族(含 德魯固族)"); aboList2.Add("撒奇萊雅族"); aboList2.Add("賽德克族"); aboList2.Add("拉阿魯哇族"); aboList2.Add("卡那卡那富族"); aboList2.Add("其他"); // 若學校本來自己就有"原住民" Tag ,則以加入他的原住民項目 為主,幫他補齊。 bool Tag_Prefix原校內為原住民 = false; //排除已加入的名單,避免重覆insert會爆掉 foreach (TagConfigRecord each in TagConfig.SelectAll()) { if (each.Prefix == "入學方式") { if (EnterSchoolWays.Contains(each.Name)) { EnterSchoolWays.Remove(each.Name); } } if (each.Prefix == "入學身分") { if (EnterSchoolIdentities.Contains(each.Name)) { EnterSchoolIdentities.Remove(each.Name); } } if (each.Prefix == "原住民") { if (aboList.Contains(each.Name)) { aboList.Remove(each.Name); } Tag_Prefix原校內為原住民 = true; } if (each.Prefix == "原住民族別") { if (aboList.Contains(each.Name)) { aboList2.Remove(each.Name); } } } // 加入 入學方式 Tag foreach (string aboRaceName in EnterSchoolWays) { TagConfigRecord _current_tag; _current_tag = new TagConfigRecord(); _current_tag.Category = TagCategory.Student.ToString(); _current_tag.Prefix = "入學方式"; _current_tag.Name = aboRaceName; _current_tag.Color = System.Drawing.Color.White; TagConfig.Insert(_current_tag); } // 加入 入學身分 Tag foreach (string aboRaceName in EnterSchoolIdentities) { TagConfigRecord _current_tag; _current_tag = new TagConfigRecord(); _current_tag.Category = TagCategory.Student.ToString(); _current_tag.Prefix = "入學身分"; _current_tag.Name = aboRaceName; _current_tag.Color = System.Drawing.Color.White; TagConfig.Insert(_current_tag); } //加入 原住民Tag if (Tag_Prefix原校內為原住民) { foreach (string aboRaceName in aboList) { TagConfigRecord _current_tag; _current_tag = new TagConfigRecord(); _current_tag.Category = TagCategory.Student.ToString(); _current_tag.Prefix = "原住民"; _current_tag.Name = aboRaceName; _current_tag.Color = System.Drawing.Color.White; TagConfig.Insert(_current_tag); } } else { foreach (string aboRaceName in aboList2) { TagConfigRecord _current_tag; _current_tag = new TagConfigRecord(); _current_tag.Category = TagCategory.Student.ToString(); _current_tag.Prefix = "原住民族別"; _current_tag.Name = aboRaceName; _current_tag.Color = System.Drawing.Color.White; TagConfig.Insert(_current_tag); } } #endregion }