private void InvalidText_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { TextBlock img = (TextBlock)sender; DataScript info = img.Tag as DataScript; DataScriptDAL.updateInvalid(info.FID, info.Invalid == 0 ? 1 : 0); dataSource = DataScriptDAL.getList(); bindData(); }
private string scriptCode2Fid(string code) { string result = ""; var item = DataScriptDAL.getList().LastOrDefault(it => it.MidsScriptCode == code); if (item != null) { result = item.FID; } return(result); }
private void delButton_Click(object sender, RoutedEventArgs e) { string error = ""; foreach (DataScript item in dataGrid.SelectedItems) { if (item.CreatedBy != MainWindow.UserID) { error += string.Format("解析器[{0}],是别人创建的,无法删除\r\n", item.DisplayName); continue; } if (item.Release == "02") { error += string.Format("解析器[{0}],已发布,无法删除\r\n", item.DisplayName); continue; } List <string> allMaps = DataScriptDAL.getMapColName(item.TableName); var currMaps = DataScriptMapDAL.getList(item.FID); var struceures = TableDAL.getTableStructure(item.TableName); foreach (var cm in currMaps) { if (allMaps.Count(it => it == cm.TableColName) > 1) { // 多个并用 continue; } var s = struceures.FirstOrDefault(it => it.ColumnName == cm.TableColName); if (s != null && s.IsKey) { // 主键不能删 continue; } TableDAL.dropColumn(item.TableName, cm.TableColName); } DataScriptDAL.Delete(item.FID); DataScriptRuleDAL.Delete(item.FID); DataScriptMapDAL.delAll(item.FID); } if (!string.IsNullOrEmpty(error)) { MessageBox.Show(error); } dataGrid.DataContext = DataScriptDAL.getList(); }
void DataScriptList_Loaded(object sender, RoutedEventArgs e) { if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this)) { dataSource = DataScriptDAL.getList(); dataGrid.DataContext = dataSource; FileType.SelectedIndex = 0; FileType.SelectionChanged += FileType_SelectionChanged; MidsScriptCode.TextChanged += MidsScriptCode_TextChanged; MidsScriptName.TextChanged += MidsScriptName_TextChanged; IndexKey.TextChanged += IndexKey_TextChanged; } }
void DataScriptInfo_Loaded(object sender, RoutedEventArgs e) { string[] tablelist = System.Configuration.ConfigurationManager.AppSettings["tables"].Split(new char[] { ',' }); string[] descs = System.Configuration.ConfigurationManager.AppSettings["tabledescs"].Split(new char[] { ',' }); // 所有Script的列表,用于计算版本号 scripts = DataScriptDAL.getList(); var objTableList = ObjtableInfoDAL.getList(); foreach (var objTable in objTableList) { tables.Add(new TableInfo() { TableDesc = string.Format("{0}({1})", objTable.ObjectTableName, objTable.ObjectTableCode), TableName = objTable.ObjectTableCode }); } projectList = WebHelper.listProject(MainWindow.UserName); ProjectCode.ItemsSource = projectList; ProjectCode.DisplayMemberPath = "ProjectName"; ProjectCode.SelectedValuePath = "ProjectCode"; ProjectCode.KeyUp += ProjectCode_KeyUp; if (projectList.Count > 0) { ProjectCode.SelectedIndex = 0; } ScriptType.SelectedIndex = 0; if (string.IsNullOrEmpty(FID)) { // new row MidsScriptCode.Text = ""; getScriptCode(); } else { nextButton.IsEnabled = false; nextButton.Visibility = System.Windows.Visibility.Collapsed; // edit row showData(); } }
private void getScriptCode() { if (TaskNameList.SelectedIndex == 0) { MidsScriptName.Text = ""; var list = DataScriptDAL.getList(); var projectCode = ProjectCode.SelectedValue.ToString(); for (int i = 0; i < 100; i++) { string scriptcode = string.Format("{0}{1}{2}", projectCode, DateTime.Now.Year, i.ToString("000")); if (list.FirstOrDefault(it => it.MidsScriptCode == scriptcode) == null) { MidsScriptCode.Text = scriptcode; break; } } getScriptName(); } }
void ImportFileSelecte_Loaded(object sender, RoutedEventArgs e) { if (ScriptName.Items == null || ScriptName.Items.Count == 0) { var dsList = DataScriptDAL.getList(); ScriptName.Items.Clear(); foreach (var item in dsList) { ScriptName.Items.Add(item); } ScriptName.SelectedIndex = 0; if (!String.IsNullOrEmpty(TaskCenter.ScriptID)) { var script = dsList.FirstOrDefault(it => it.FID == TaskCenter.ScriptID); if (script != null) { ScriptName.SelectedIndex = dsList.IndexOf(script); switch (script.FileType) { case "txt": FileType.SelectedIndex = 0; break; case "dat": FileType.SelectedIndex = 2; break; default: FileType.SelectedIndex = 1; break; } } } } }