void oprBar_Click(object sender, EventArgs e) { ICatalog c = _catalogs[(sender as ToolStripButton).Tag.ToString()]; SubProductCatalogDef catalogDef = c.Definition as SubProductCatalogDef; string filter = catalogDef.Filter; using (OpenFileDialog dlg = new OpenFileDialog()) { dlg.Filter = filter; dlg.Multiselect = true; dlg.InitialDirectory = MifEnvironment.GetWorkspaceDir(); if (dlg.ShowDialog() == DialogResult.OK) { string[] fnames = dlg.FileNames; if (fnames == null || fnames.Length == 0) { return; } foreach (string f in fnames) { c.AddItem(new CatalogItem(f, catalogDef, null)); } } } }
protected void AddFileToUI_tmp(string dateDir, string fname) { SubProductCatalogDef def = _definition as SubProductCatalogDef; CatalogItem it = new CatalogItem(fname, def); ListViewDataItem lvItem = new ListViewDataItem(); lvItem.Text = fname; Dictionary <string, object> colValues = new Dictionary <string, object>(); foreach (CatalogAttriteDef att in def.AttributeDefs) { string v = it.Info.GetPropertyValue(att.Identify); if (!colValues.ContainsKey(att.Identify)) { colValues.Add(att.Identify, v); } else { colValues[att.Identify] = v; } } if (colValues.ContainsKey("FileName")) { colValues["FileName"] = Path.GetFileName(fname); } if (colValues.ContainsKey("OrbitDateTime") && (colValues["OrbitDateTime"] == null || colValues["OrbitDateTime"].ToString() == string.Empty)) { colValues["OrbitDateTime"] = dateDir; } if (colValues.ContainsKey("CatalogItemCN") && it.Info.Properties["CycFlagCN"].ToString() != "\\") { colValues["CatalogItemCN"] = it.Info.Properties["CycFlagCN"]; } _listView.Items.Add(new ItemInfoListViewDataItem(colValues.Values.ToArray(), fname)); }
private void LoadSubProductItems() { string wkddir = MifEnvironment.GetWorkspaceDir(); string catalogDir = Path.Combine(wkddir, _wks.Definition.Identify); if (!Directory.Exists(catalogDir)) { return; } string[] dateFolders = Directory.GetDirectories(catalogDir); dateFolders = FilterByDate(dateFolders); string dir; SubProductCatalogDef def = _definition as SubProductCatalogDef; foreach (string dateDir in dateFolders) { string date = (new DirectoryInfo(dateDir)).Name; dir = Path.Combine(dateDir, def.Folder); if (!Directory.Exists(dir)) { continue; } string[] fnames = GetFiles(dir, def.Identify, def.Pattern, true); if (fnames != null && fnames.Length > 0) { foreach (string f in fnames) { AddFileToUI(date, f); } } } }
/// <summary> /// 加载指定日期目录下的产品待入库文件 /// \Workspace\{PrdIdentify}\yyyy-MM-dd\... /// </summary> /// <param name="dt"></param> private void LoadTheDayExtractResult(DateTime dt) { _catalogNodes.Clear(); _treeView.Nodes.Clear(); string dir = Path.Combine(MifEnvironment.GetWorkspaceDir(), _wDef.Identify); string data = dt.ToString("yyyy-MM-dd"); string prdRootDir = Path.Combine(dir, data); RadTreeNode rootNode = new RadTreeNode(data); rootNode.Font = _font; _treeView.Nodes.Add(rootNode); if (Directory.Exists(prdRootDir)) { foreach (CatalogDef catalogDef in _wDef.CatalogDefs) { if (catalogDef is SubProductCatalogDef)//子产品目录 { SubProductCatalogDef subProductdef = catalogDef as SubProductCatalogDef; string subProductDir = Path.Combine(prdRootDir, subProductdef.Folder); RadTreeNode subProductNode = new RadTreeNode(subProductdef.Text); subProductNode.Tag = subProductdef; subProductNode.ToolTipText = subProductDir; subProductNode.Font = _font; subProductNode.Image = GetImge("Open"); rootNode.Nodes.Add(subProductNode); string[] files = GetFiles(subProductDir, subProductdef.Identify, subProductdef.Pattern, false); if (files != null && files.Length > 0) { foreach (string file in files) { ICatalogItem ca = new CatalogItem(file, subProductdef); if (!_showHasToDb && ca.Info.GetPropertyValue(ToDBInfoKey) == ToDBInfoValue)//是否标记为已入库 { continue; } RadTreeNode fileNode = new RadTreeNode(GetCatalogCN(file)); fileNode.Tag = file; fileNode.ToolTipText = Path.GetFileName(file); fileNode.Image = GetImge(Path.GetExtension(file).ToUpper()); fileNode.CheckType = CheckType.CheckBox; fileNode.Checked = true; subProductNode.Nodes.Add(fileNode); } } } } } else { rootNode.Nodes.Add(new RadTreeNode("当期日期下没有产品生成")); } rootNode.ExpandAll(); }
private ICatalogItem CreateFileInfo(string fname) { ICatalogItem ca = GetFileInfo(fname); if (ca != null) { return(ca); } SubProductCatalogDef subProductCatalogDef = GetSubProCatalogDef(fname, _wDef.CatalogDefs); if (subProductCatalogDef == null) { return(null); } ca = new CatalogItem(fname, subProductCatalogDef); return(ca); }
private Control GetSubProductCatalogUI(SubProductCatalogDef catalog) { RadListView lv = new RadListView(); lv.Tag = catalog; lv.AllowEdit = false; lv.Font = this.Font; lv.ViewType = ListViewType.DetailsView; lv.FullRowSelect = true; lv.ShowGroups = true; lv.EnableSorting = true; lv.EnableColumnSort = true; lv.ItemMouseDoubleClick += _listViewItemDoubleClicked; lv.MultiSelect = true; foreach (CatalogAttriteDef att in catalog.AttributeDefs) { lv.Columns.Add(att.Text); lv.Columns[lv.Columns.Count - 1].Visible = att.Visible; } return(lv); }
public ICatalogItem[] GetCheckedItem() { if (_treeView.CheckedNodes == null) { return(null); } List <ICatalogItem> checks = new List <ICatalogItem>(); for (int i = 0; i < _treeView.CheckedNodes.Count; i++) { RadTreeNode fileNode = _treeView.CheckedNodes[i]; string fname = fileNode.Tag != null?fileNode.Tag.ToString() : null; if (string.IsNullOrEmpty(fname)) { return(null); } SubProductCatalogDef subProductCatalogDef = fileNode.Parent.Tag as SubProductCatalogDef; ICatalogItem ca = new CatalogItem(fname, subProductCatalogDef); checks.Add(ca); } return(checks.ToArray()); }
public ICatalog GetCatalogByIdentify(string identify) { if (_catalogs == null || _catalogs.Count == 0 || string.IsNullOrEmpty(identify)) { return(null); } foreach (ICatalog cit in _catalogs.Values) { if (cit.Definition == null) { continue; } SubProductCatalogDef c = cit.Definition as SubProductCatalogDef; if (c == null) { continue; } if (c.Identify.Contains(identify)) { return(cit); } } return(null); }