private void validateEAElement(Object eaObject, SQLRepository repository, Boolean singleRulecheck) { SQLElement element = eaObject as SQLElement; //only do rules for Element, Attributes and Methods if (singleRulecheck) { foreach (SQLAttribute actAttribute in element.Attributes) { RuleControl.deleteRuleResults(EA.ObjectType.otAttribute, actAttribute.AttributeID); RuleControl.doRules(actAttribute, repository); } foreach (SQLMethod actMethod in element.Methods) { RuleControl.deleteRuleResults(EA.ObjectType.otMethod, actMethod.MethodID); RuleControl.doRules(actMethod, repository); } RuleControl.deleteRuleResults(EA.ObjectType.otElement, element.ElementID); RuleControl.doRules(element, repository); } else { List <SQLElement> listOfElements = new List <SQLElement>(); List <SQLConnector> listOfConnectors = new List <SQLConnector>(); List <SQLAttribute> listOfAttributes = new List <SQLAttribute>(); List <SQLMethod> listofMethods = new List <SQLMethod>(); List <SQLParameter> listofParameters = new List <SQLParameter>(); List <SQLPackage> listOfPackages = new List <SQLPackage>(); addElementChildFeatures(listOfElements, listOfConnectors, listOfAttributes, listofMethods, listofParameters, element); doRulesForFeatures(repository, listOfElements, listOfConnectors, listOfAttributes, listofMethods, listofParameters, listOfPackages); } }
public void CreatPassiveSPScript(XCollection <SQLOutboundChanel> channelSet) { string interfaceName = Program.DeviceMgt.DeviceDirInfor.Header.Name; string fnameInstall = Application.StartupPath + "\\" + RuleScript.InstallSP.FileName; string fnameUninstall = Application.StartupPath + "\\" + RuleScript.UninstallSP.FileName; //Install //using (StreamWriter sw = File.CreateText(fnameInstall)) // 20110706 OSQL & SQLMgmtStudio only support ASCII and UNICODE { StringBuilder sb = new StringBuilder(); sb.AppendLine(GWDataDB.GetUseDataBaseSql()); foreach (SQLOutboundChanel channel in channelSet) { sb.AppendLine(channel.SPStatement); } //sw.Write(sb.ToString()); File.WriteAllText(fnameInstall, sb.ToString(), Encoding.Unicode); } //UnInstall using (StreamWriter sw = File.CreateText(fnameUninstall)) { StringBuilder sb = new StringBuilder(); sb.AppendLine(GWDataDB.GetUseDataBaseSql()); foreach (SQLOutboundChanel channel in channelSet) { string strSql = RuleControl.GetOutboundSPUninstall(interfaceName, channel.Rule); sb.AppendLine(strSql); } sw.Write(sb.ToString()); } }
private void CreateSPScript() { string dbName = this.textBoxRISDBName.Text.Trim(); string interfaceName = this.textBoxTP.Text.Trim(); string fnameInstall = Application.StartupPath + "\\" + RuleScript.InstallSP.FileName; string fnameUninstall = Application.StartupPath + "\\" + RuleScript.UninstallSP.FileName; using (StreamWriter sw = File.CreateText(fnameInstall)) { StringBuilder sb = new StringBuilder(); foreach (SQLOutboundChanel chn in SQLOutAdapterConfigMgt.SQLOutAdapterConfig.OutboundChanels) { InsertDataId(chn); string strSql = RuleControl.GetOutboundSP(interfaceName, chn.Rule); strSql = strSql.Replace("USE GWDataDB", ""); sb.AppendLine(strSql); } sw.Write("USE " + dbName + "\r\n" + sb.ToString()); } using (StreamWriter sw = File.CreateText(fnameUninstall)) { StringBuilder sb = new StringBuilder(); foreach (SQLOutboundChanel chn in SQLOutAdapterConfigMgt.SQLOutAdapterConfig.OutboundChanels) { string strSql = RuleControl.GetOutboundSPUninstall(interfaceName, chn.Rule); strSql = strSql.Replace("USE GWDataDB", ""); sb.AppendLine(strSql); } sw.Write("USE " + dbName + "\r\n" + sb.ToString()); } }
private void CreateTableScript() { string interfaceName = Program.DeviceMgt.DeviceDirInfor.Header.Name; string fnameInstall = Application.StartupPath + "\\" + RuleScript.InstallTable.FileName; string fnameUninstall = Application.StartupPath + "\\" + RuleScript.UninstallTable.FileName; Program.Log.Write("Creating install table script..."); using (StreamWriter sw = File.CreateText(fnameInstall)) { //US29442 #region //Program.ServiceMgt.Config.GarbageCollection.MaxRecordCountLimitation = 500; #endregion string strSql = RuleControl.GetCreateTableSQL(interfaceName, Program.ServiceMgt.Config.GarbageCollection); sw.Write(strSql); } Program.Log.Write("Create install table script succeeded. " + fnameInstall); Program.Log.Write("Creating uninstall table script..."); using (StreamWriter sw = File.CreateText(fnameUninstall)) { string strSql = RuleControl.GetDropTableSQL(interfaceName); sw.Write(strSql); } Program.Log.Write("Create uninstall table script succeeded. " + fnameUninstall); }
public bool SetProcessFlag(string interfaceName, string[] guidList) { if (guidList == null || interfaceName == null) { return(false); } if (interfaceName.Length < 1) { Program.Log.Write(LogType.Warning, "Adapter interface name is a empty string."); return(false); } if (guidList.Length < 1) { Program.Log.Write(LogType.Warning, "Nothing in the GUID List."); return(true); } string strSql = RuleControl.GetSetProcessFlagSQL(interfaceName, guidList); bool result = false; //SafeDBConnection cn = SafeDBConnection.Instance; OleDbConnection cnn = new OleDbConnection(Program.ConfigMgt.Config.DataDBConnection); try { //OleDbCommand cmd = new OleDbCommand(strSql,cn.Connection); OleDbCommand cmd = new OleDbCommand(strSql, cnn); cmd.CommandType = CommandType.Text; //cn.Open(); cnn.Open(); int count = cmd.ExecuteNonQuery(); //cn.Close(); cnn.Close(); Program.Log.Write("Update process flag success. Interface Name: " + interfaceName + ", Number of rows affected: " + count.ToString()); result = true; } catch (Exception err) { Program.Log.Write(LogType.Warning, "Update process flag failed."); DumpDataBaseError(err, strSql); } finally { //if (!result) cn.Close(); if (!result) { cnn.Close(); } } return(result); }
private void CreateInboundSPScript(IInboundRule[] ruleList) { string interfaceName = Program.DeviceMgt.DeviceDirInfor.Header.Name; string fnameInstall = Application.StartupPath + "\\" + RuleScript.InstallSP.FileName; string fnameUninstall = Application.StartupPath + "\\" + RuleScript.UninstallSP.FileName; Program.Log.Write("Creating install storage procedure script..."); //using (StreamWriter sw = File.CreateText(fnameInstall)) // 20110706 OSQL & SQLMgmtStudio only support ASCII and UNICODE { StringBuilder sb = new StringBuilder(); sb.AppendLine(GWDataDB.GetUseDataBaseSql()); foreach (IInboundRule rule in ruleList) { string strSql = RuleControl.GetInboundSP(interfaceName, rule); sb.AppendLine(strSql); IRuleSupplier supplier = rule as IRuleSupplier; if (supplier != null) { string strSqlSupplied = supplier.GetInstallDBScript(); if (strSqlSupplied != null) { sb.AppendLine(strSqlSupplied); } } } //sw.Write(sb.ToString()); File.WriteAllText(fnameInstall, sb.ToString(), Encoding.Unicode); } Program.Log.Write("Create install storage procedure script succeeded. " + fnameInstall); Program.Log.Write("Creating uninstall storage procedure script..."); using (StreamWriter sw = File.CreateText(fnameUninstall)) { StringBuilder sb = new StringBuilder(); sb.AppendLine(GWDataDB.GetUseDataBaseSql()); foreach (IInboundRule rule in ruleList) { string strSql = RuleControl.GetInboundSPUninstall(interfaceName, rule); sb.AppendLine(strSql); IRuleSupplier supplier = rule as IRuleSupplier; if (supplier != null) { string strSqlSupplied = supplier.GetUninstallDBScript(); if (strSqlSupplied != null) { sb.AppendLine(strSqlSupplied); } } } sw.Write(sb.ToString()); } Program.Log.Write("Create uninstall storage procedure script succeeded. " + fnameUninstall); }
private void startValidation(EA.ObjectType ot, Object eaObject, SQLRepository repository, Boolean singleRulecheck, Boolean validateAll) { this.fullValidation = validateAll; this.singleRuleCheck = singleRulecheck; switch (ot) { //do rules for elements and their attributes/methods case EA.ObjectType.otElement: validateEAElement(eaObject, repository, singleRulecheck); break; //do rules for connectors case EA.ObjectType.otConnector: SQLConnector connector = eaObject as SQLConnector; RuleControl.deleteRuleResults(EA.ObjectType.otConnector, connector.ConnectorID); RuleControl.doRules(connector, repository); break; //do rules for attributes case EA.ObjectType.otAttribute: SQLAttribute attribute = eaObject as SQLAttribute; RuleControl.deleteRuleResults(EA.ObjectType.otAttribute, attribute.AttributeID); RuleControl.doRules(attribute, repository); break; //do rules for methods case EA.ObjectType.otMethod: SQLMethod method = eaObject as SQLMethod; RuleControl.deleteRuleResults(EA.ObjectType.otMethod, method.MethodID); RuleControl.doRules(method, repository); break; //do rules for packages case EA.ObjectType.otPackage: validatePackage(eaObject, repository, singleRulecheck, validateAll); break; case EA.ObjectType.otDiagram: SQLDiagram diagram = eaObject as SQLDiagram; RuleControl.deleteRuleResults(EA.ObjectType.otDiagram, diagram.DiagramID); RuleControl.doRules(diagram, repository); break; } if (DoGlobalRules) { RuleControl.doGlobalRules(repository); } endValidation(repository); }
public void Save() { if (IsChanged) { channel.SPStatement = txtSPStatement.Text; } else { channel.SPStatement = RuleControl.GetOutboundSP(interfaceName, channel.Rule); } }
public void resetConsistencyModule(EA.Repository repository) { consistencyProgressbar = null; RuleControl.clearRuleResults(); SQLRepository sqlRep = new SQLRepository(repository, false); foreach (NewErrorOutput rEo in RuleErrorOutputControls) { rEo.clearOutput(); rEo.setClassMembers(new SQLRepository(repository, false), this.RuleControl); } }
private void SaveRule() { Boolean typeChoose = false; RuleFile ruleAux = null; if (rbtDate.IsChecked.HasValue && rbtDate.IsChecked.Value) { ruleAux = new RuleFileDate(); ruleAux.RuleType = (int)RuleFile.TypeFileRule.Date; ruleAux.ImagePath = @"/images/icon_ruleFileDate.png"; typeChoose = true; } else if (rbtExtension.IsChecked.HasValue && rbtExtension.IsChecked.Value) { ruleAux = new RuleFileExtension(); ruleAux.RuleType = (int)RuleFile.TypeFileRule.Extension; ruleAux.ImagePath = @"/images/icon_ruleFileExtension.png"; typeChoose = true; } else if (rbtName.IsChecked.HasValue && rbtName.IsChecked.Value) { ruleAux = new RuleFileName(); ruleAux.RuleType = (int)RuleFile.TypeFileRule.FileName; ruleAux.ImagePath = @"/images/icon_ruleFileName.png"; typeChoose = true; } if (!typeChoose) { MessageBox.Show("Necesita especificar el tipo de la regla"); return; } RuleControl rControl = (RuleControl)pnlExtensionControl.Children[0]; rule = rControl.GetRule(); rule.RuleType = ruleAux.RuleType; rule.ImagePath = ruleAux.ImagePath; rule.Name = txtName.Text; this.Close(); }
private void CreateLookupTableScript(LookupTable[] tableList) { if (tableList == null) { Program.Log.Write(LogType.Warning, "LookupTable array is NULL, do not create any private look up table."); return; } string installTable = Application.StartupPath + "\\" + RuleScript.InstallLUT.FileName; string uninstallTable = Application.StartupPath + "\\" + RuleScript.UninstallLUT.FileName; Program.Log.Write("Creating install private look up table script..."); //using (StreamWriter sw = File.CreateText(installTable)) // 20110706 OSQL & SQLMgmtStudio only support ASCII and UNICODE { StringBuilder sb = new StringBuilder(); sb.AppendLine(GWDataDB.GetUseDataBaseSql()); foreach (LookupTable table in tableList) { string strSql = RuleControl.GetCreateLUTSQL(table); sb.AppendLine(strSql); } //sw.Write(sb.ToString()); File.WriteAllText(installTable, sb.ToString(), Encoding.Unicode); } Program.Log.Write("Create install private look up table script succeeded. " + installTable); Program.Log.Write("Creating uninstall private look up table script..."); using (StreamWriter sw = File.CreateText(uninstallTable)) { StringBuilder sb = new StringBuilder(); sb.AppendLine(GWDataDB.GetUseDataBaseSql()); foreach (LookupTable table in tableList) { string strSql = RuleControl.GetDropLUTSQL(table); sb.AppendLine(strSql); } sw.Write(sb.ToString()); } Program.Log.Write("Create uninstall private look up table script succeeded. " + uninstallTable); }
private void LoadDefaultInboundSP() { channelSet.Clear(); string interfaceName = Program.DeviceMgt.DeviceDirInfor.Header.Name; //Patient Table SQLInboundChanel chnPatient = channelSet.Add(new SQLInboundChanel()); chnPatient.Rule.RuleID = GWDataDBTable.Patient.ToString(); chnPatient.SPName = "sp_" + interfaceName + "_" + GWDataDBTable.Patient.ToString(); LoadTableParameter(chnPatient, GWDataDBTable.Index, interfaceName); LoadTableParameter(chnPatient, GWDataDBTable.Patient, interfaceName); chnPatient.SPStatement = RuleControl.GetInboundSP(interfaceName, chnPatient.Rule, false); //Order Table SQLInboundChanel chnOrder = channelSet.Add(new SQLInboundChanel()); chnOrder.Rule.RuleID = GWDataDBTable.Order.ToString(); chnOrder.SPName = "sp_" + interfaceName + "_" + GWDataDBTable.Order.ToString(); LoadTableParameter(chnOrder, GWDataDBTable.Index, interfaceName); LoadTableParameter(chnOrder, GWDataDBTable.Patient, interfaceName); LoadTableParameter(chnOrder, GWDataDBTable.Order, interfaceName); chnOrder.SPStatement = RuleControl.GetInboundSP(interfaceName, chnOrder.Rule, false); //Report Table SQLInboundChanel chnReport = channelSet.Add(new SQLInboundChanel()); chnReport.Rule.RuleID = GWDataDBTable.Report.ToString(); chnReport.SPName = "sp_" + interfaceName + "_" + GWDataDBTable.Report.ToString(); LoadTableParameter(chnReport, GWDataDBTable.Index, interfaceName); LoadTableParameter(chnReport, GWDataDBTable.Patient, interfaceName); LoadTableParameter(chnReport, GWDataDBTable.Order, interfaceName); LoadTableParameter(chnReport, GWDataDBTable.Report, interfaceName); chnReport.SPStatement = RuleControl.GetInboundSP(interfaceName, chnReport.Rule, false); }
private void CreateTableScript() { string dbName = this.textBoxRISDBName.Text.Trim(); string interfaceName = this.textBoxTP.Text.Trim(); string fnameInstall = Application.StartupPath + "\\" + RuleScript.InstallTable.FileName; string fnameUninstall = Application.StartupPath + "\\" + RuleScript.UninstallTable.FileName; GarbageRule gcRule = null; string serviceCfgFile = Application.StartupPath + "\\" + ConfigHelper.ServiceDefaultFileName; AdapterServiceCfgMgt mgt = new AdapterServiceCfgMgt(serviceCfgFile); if (mgt.Load()) { gcRule = mgt.Config.GarbageCollection; //US29442 #region //gcRule.MaxRecordCountLimitation = 500; #endregion } else { MessageBox.Show(this, "Cannot open file : " + serviceCfgFile + "\r\n" + mgt.LastErrorInfor, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } using (StreamWriter sw = File.CreateText(fnameInstall)) { string strSql = RuleControl.GetCreateTableSQL(interfaceName, gcRule); strSql = strSql.Replace("USE GWDataDB", "USE " + dbName); sw.Write(strSql); } using (StreamWriter sw = File.CreateText(fnameUninstall)) { string strSql = RuleControl.GetDropTableSQL(interfaceName); strSql = strSql.Replace("USE GWDataDB", "USE " + dbName); sw.Write(strSql); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { txtName.Text = rule.Name; switch ((RuleFile.TypeFileRule)rule.RuleType) { case RuleFile.TypeFileRule.Date: rbtDate.IsChecked = true; break; case RuleFile.TypeFileRule.Extension: rbtExtension.IsChecked = true; break; case RuleFile.TypeFileRule.FileName: rbtName.IsChecked = true; break; } RuleControl rControl = (RuleControl)pnlExtensionControl.Children[0]; rControl.SetRule(rule); }
public static string GetPrivateLutName() { return("lut_p_" + RuleControl.GetRandomNumber()); }
public void initializeRules() { RuleControl.registerRules(); }
//private void ProcessGarbageCollection() //{ // //if (!Program.ConfigMgt.Config.GarbageCollection.Enable) // //{ // // Program.Log.Write(LogType.Warning, "Skip garbage collection."); // // return; // //} // int result = -1; // SafeDBConnection cn = SafeDBConnection.Instance; // //OleDbConnection cn = null; // //if (!LockDatabase()) // //{ // // Program.Log.Write(LogType.Warning, "Cannot access database without mutex."); // // return; // //} // //#region critical resource // try // { // //cn = new OleDbConnection(); // //cn.ConnectionString = Program.ConfigMgt.Config.DataDBConnection; // string spName = RuleControl.GetCreateGarbageCollectionSPName(_interfaceName); // OleDbCommand cmd = new OleDbCommand(spName, cn.Connection); // cmd.CommandTimeout = Program.ConfigMgt.Config.GarbageCollection.SqlCommandTimeOutInSecond; // cmd.CommandType = System.Data.CommandType.StoredProcedure; // OleDbParameter paramProcessFlag = new OleDbParameter(); // paramProcessFlag.Direction = ParameterDirection.Input; // paramProcessFlag.ParameterName = "@ProcessFlag"; // paramProcessFlag.OleDbType = OleDbType.VarWChar; // cmd.Parameters.Add(paramProcessFlag); // if (Program.ConfigMgt.Config.GarbageCollection.CheckProcessFlag) // { // paramProcessFlag.Value = RuleControl.ProcessFlagValueForProcessed; // Program.Log.Write("Check process flag."); // } // else // { // paramProcessFlag.Value = DBNull.Value; // Program.Log.Write("Do not check process flag."); // } // OleDbParameter paramFromTime = new OleDbParameter(); // paramFromTime.Direction = ParameterDirection.Input; // paramFromTime.ParameterName = "@FromDateTime"; // paramFromTime.OleDbType = OleDbType.DBTimeStamp; // paramFromTime.Value = DBNull.Value; // cmd.Parameters.Add(paramFromTime); // OleDbParameter paramToTime = new OleDbParameter(); // paramToTime.Direction = ParameterDirection.Input; // paramToTime.ParameterName = "@ToDateTime"; // paramToTime.OleDbType = OleDbType.DBTimeStamp; // cmd.Parameters.Add(paramToTime); // if (Program.ConfigMgt.Config.GarbageCollection.CheckExpireTime) // { // DateTime dtNow = DateTime.Now; // DateTime dtExpire = dtNow.Subtract(Program.ConfigMgt.Config.GarbageCollection.ExpireTime); // Program.Log.Write("Check expire time: " + dtExpire.ToShortDateString() + " " + dtExpire.ToLongTimeString()); // paramToTime.Value = dtExpire; // } // else // { // paramToTime.Value = DBNull.Value; // Program.Log.Write("Do not check expire time."); // } // OleDbParameter paramResult = new OleDbParameter(); // paramResult.Direction = ParameterDirection.Output; // paramResult.ParameterName = "@result"; // paramResult.OleDbType = OleDbType.Integer; // cmd.Parameters.Add(paramResult); // cn.Open(); // result = cmd.ExecuteNonQuery(); // cn.Close(); // Program.Log.Write("Process garbage collection success. Result value: " + paramResult.Value + ", number of rows: " + result.ToString()); // } // catch (Exception err) // { // Program.Log.Write(LogType.Warning, "Process garbage collection failed."); // DumpDataBaseError(err, ""); // } // finally // { // if (cn != null) cn.Close(); // } // //#endregion // //ReleaseDatabase(); //} #endregion private void ProcessGarbageCollection2() { bool result = false; //SafeDBConnection cn = SafeDBConnection.Instance; OleDbConnection cnn = new OleDbConnection(Program.ConfigMgt.Config.DataDBConnection); try { string spName = RuleControl.GetCreateGarbageCollectionSPName(_interfaceName); //OleDbCommand cmd = new OleDbCommand(spName, cn.Connection); OleDbCommand cmd = new OleDbCommand(spName, cnn); cmd.CommandTimeout = Program.ConfigMgt.Config.GarbageCollection.SqlCommandTimeOutInSecond; cmd.CommandType = System.Data.CommandType.StoredProcedure; OleDbParameter paramToTime = new OleDbParameter(); paramToTime.Direction = ParameterDirection.Input; paramToTime.ParameterName = "@ToDateTime"; paramToTime.OleDbType = OleDbType.DBTimeStamp; cmd.Parameters.Add(paramToTime); if (Program.ConfigMgt.Config.GarbageCollection.CheckExpireTime) { DateTime dtNow = DateTime.Now; DateTime dtExpire = dtNow.Subtract(Program.ConfigMgt.Config.GarbageCollection.ExpireTime); Program.Log.Write("Check expire time: " + dtExpire.ToShortDateString() + " " + dtExpire.ToLongTimeString()); paramToTime.Value = dtExpire; } else { paramToTime.Value = DBNull.Value; Program.Log.Write("Do not check expire time."); } OleDbParameter paramResult = new OleDbParameter(); paramResult.Direction = ParameterDirection.Output; paramResult.ParameterName = "@result"; paramResult.OleDbType = OleDbType.Integer; cmd.Parameters.Add(paramResult); //cn.Open(); cnn.Open(); cmd.ExecuteNonQuery(); //cn.Close(); cnn.Close(); cnn.Dispose(); result = true; Program.Log.Write("Process garbage collection success. result: " + result.ToString() + ", number of rows: " + paramResult.Value); } catch (Exception err) { Program.Log.Write(LogType.Warning, "Process garbage collection failed."); DumpDataBaseError(err, ""); } finally { //if (!result) cn.Close(); if (!result) { cnn.Close(); } cnn.Dispose(); } }
public RuleBase() { _ruleID = RuleControl.GetRandomNumber(); }
private void doRulesForFeatures(SQLRepository repository, List <SQLElement> listOfElements, List <SQLConnector> listOfConnectors, List <SQLAttribute> listOfAttributes, List <SQLMethod> listofMethods, List <SQLParameter> listofParameters, List <SQLPackage> listOfPackages) { List <SQLElement> toDelete = new List <SQLElement>(); foreach (SQLElement elem in listOfElements) { if (elem.Type == "Constraint") { toDelete.Add(elem); } } foreach (SQLElement del in toDelete) { listOfElements.Remove(del); } String result = repository.SQLQuery("select a.* from t_object a, t_package b, t_diagramobjects c where a.Object_Type = 'Constraint' AND a.Package_ID = b.Package_ID and b.Name = 'Rules' AND c.Object_ID = a.Object_ID"); //String result = repository.SQLQuery("select * from t_object where Object_Type = 'Constraint' AND Diagram_ID <> 0"); foreach (String row in EAUtil.getXMLNodeContentFromSQLQueryString(result, "Row")) { if (row != "") { listOfElements.Add(new SQLElement(repository, row)); } } consistencyProgressbar.invokeProgressBarSetBarSize(6); consistencyProgressbar.invokeProgressBarAndPerformNext(EA.ObjectType.otElement); foreach (SQLElement element in listOfElements) { if (Canceled) { return; } RuleControl.deleteRuleResults(EA.ObjectType.otElement, element.ElementID); RuleControl.doRules(element, repository); } consistencyProgressbar.invokeProgressBarAndPerformNext(EA.ObjectType.otConnector); foreach (SQLConnector connector in listOfConnectors) { if (Canceled) { return; } RuleControl.deleteRuleResults(EA.ObjectType.otConnector, connector.ConnectorID); RuleControl.doRules(connector, repository); } consistencyProgressbar.invokeProgressBarAndPerformNext(EA.ObjectType.otMethod); foreach (SQLMethod method in listofMethods) { if (Canceled) { return; } RuleControl.deleteRuleResults(EA.ObjectType.otMethod, method.MethodID); RuleControl.doRules(method, repository); } consistencyProgressbar.invokeProgressBarAndPerformNext(EA.ObjectType.otParameter); foreach (SQLParameter parameter in listofParameters) { } consistencyProgressbar.invokeProgressBarAndPerformNext(EA.ObjectType.otAttribute); foreach (SQLAttribute attribute in listOfAttributes) { if (Canceled) { return; } RuleControl.deleteRuleResults(EA.ObjectType.otAttribute, attribute.AttributeID); RuleControl.doRules(attribute, repository); } consistencyProgressbar.invokeProgressBarAndPerformNext(EA.ObjectType.otPackage); foreach (SQLPackage actpackage in listOfPackages) { if (Canceled) { return; } RuleControl.deleteRuleResults(EA.ObjectType.otPackage, actpackage.PackageID); RuleControl.doRules(actpackage, repository); } }
public void CreatStatement() { txtSPStatement.Text = RuleControl.GetOutboundSP(interfaceName, channel.Rule); lblIsChanged.Visible = false; }
private void validatePackage(Object eaObject, SQLRepository repository, Boolean singleRulecheck, Boolean validateAll) { SQLPackage package = eaObject as SQLPackage; //if a full rulecheck should be done if (!singleRulecheck) { List <SQLPackage> packagesToValidate = new List <SQLPackage>(); //if package is a simple package check all elements within the package if (!validateAll) { SQLPackage modelPackage = package; //root node is selected if (modelPackage.ParentID == 0) { foreach (SQLPackage pkg in modelPackage.Packages) { SQLTaggedValue validated = EAEcoreAddin.Util.EAUtil.findTaggedValue(pkg, MetamodelHelper.MoflonValidatedTaggedValueName); if (validated == null || validated.Value != "true") { packagesToValidate.Add(pkg); } } } //simple package is selected else { if (modelPackage.IsModel) { SQLTaggedValue validated = EAEcoreAddin.Util.EAUtil.findTaggedValue(modelPackage, MetamodelHelper.MoflonValidatedTaggedValueName); if (validated == null || validated.Value != "true") { packagesToValidate.Add(modelPackage); } } else { packagesToValidate.Add(modelPackage); } } } else { foreach (SQLPackage root in repository.Models) { foreach (SQLPackage model in root.Packages) { SQLTaggedValue validated = EAEcoreAddin.Util.EAUtil.findTaggedValue(model, MetamodelHelper.MoflonValidatedTaggedValueName); if (validated == null || !validated.Value.ToLower().Contains("true") || validated.Value == EPackageHelper.DEFAULT_VALUE_PLACEHOLDER) { packagesToValidate.Add(model); } } } } doRulesForPackages(packagesToValidate, repository); } //single rulecheck for package else { RuleControl.deleteRuleResults(EA.ObjectType.otPackage, package.PackageID); RuleControl.doRules(package, repository); } }
private void QueryDataToFile() { if (OnDataRequest == null || OnDataDischarge == null) { return; } ThirdDBConnection cfg = SQLOutAdapterConfigMgt.SQLOutAdapterConfig.ThirdPartyInteractConfig.ConnectionParameter; foreach (SQLOutboundChanel ch in SQLOutAdapterConfigMgt.SQLOutAdapterConfig.OutboundChanels) { try { if (!ch.Enable) { continue; } if (ch.OperationType != ThrPartyDBOperationType.Table) { continue; } DataSet dsResult = OnDataRequest((IOutboundRule)ch.Rule, null); int count = PrepareQueryResult(dsResult); if (count < 1) { continue; } // generate file name string fn = RuleControl.GetRandomNumber(); string dataFileFolder = ConfigHelper.GetFullPath(cfg.FileFolder); string csvFileName = string.Format("{0}{1}", fn, cfg.FileNameExtension); string tmpFileName = string.Format("{0}{1}", fn, cfg.TempFileNameExtensin); // create CSV file List <string> idList = new List <string>(); if (!CreateDataFile(ch, tmpFileName)) { continue; } if (!InsertDataFile(ch, tmpFileName, dsResult, idList, count)) { continue; } Program.Log.Write("Creating data file: " + csvFileName); File.Move(Path.Combine(dataFileFolder, tmpFileName), Path.Combine(dataFileFolder, csvFileName)); // delete INI file if (!cfg.KeepSchemaFile) { string schameFilePath = Path.Combine(dataFileFolder, cfg.SchemaFileName); Program.Log.Write("Deleting schema file: " + schameFilePath); File.Delete(schameFilePath); } // create IDX file if (cfg.WriteIndexFile) { string indexFileName = string.Format("{0}.idx", fn); string indexFileFolder = ConfigHelper.GetFullPath(cfg.IndexFileFolder); string indexFilePath = Path.Combine(indexFileFolder, indexFileName); Program.Log.Write("Creating index file: " + indexFilePath); if (!Directory.Exists(indexFileFolder)) { Directory.CreateDirectory(indexFileFolder); } using (StreamWriter sw = File.CreateText(indexFilePath)) { } } OnDataDischarge(idList.ToArray()); } catch (Exception err) { Program.Log.Write(err); } } }
public static bool LoadDefaultPassiveChannels(XCollection <SQLOutboundChanel> chs, string Prefix, string interfaceName) { //XCollection<SQLOutboundChanel> chs = new XCollection<SQLOutboundChanel>(); chs.Clear(); SQLOutboundChanel ch; int iFieldID = 0; SQLOutQueryResultItem ri; #region CH_Patient ch = new SQLOutboundChanel(); ch.ChannelName = "CH_PATITENT"; ch.SPName = Prefix + GWDataDBTable.Patient.ToString(); ch.OperationType = ThrPartyDBOperationType.StorageProcedure; ch.Modified = false; #region Criteria SQLOutQueryCriteriaItem ci = new SQLOutQueryCriteriaItem(); ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet; ci.GWDataDBField = GWDataDBField.i_EventType; ci.Operator = QueryCriteriaOperator.Equal; ci.Type = QueryCriteriaType.Or; ci.SourceField = ci.GWDataDBField.GetFullFieldName(); ci.TargetField = ci.GWDataDBField.GetFullFieldName(); ci.Translating.Type = TranslatingType.FixValue; ci.Translating.ConstValue = "00"; ch.Rule.QueryCriteria.MappingList.Add(ci); ci = new SQLOutQueryCriteriaItem(); ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet; ci.GWDataDBField = GWDataDBField.i_EventType; ci.Operator = QueryCriteriaOperator.Equal; ci.Type = QueryCriteriaType.Or; ci.SourceField = ci.GWDataDBField.GetFullFieldName(); ci.TargetField = ci.GWDataDBField.GetFullFieldName(); ci.Translating.Type = TranslatingType.FixValue; ci.Translating.ConstValue = "01"; ch.Rule.QueryCriteria.MappingList.Add(ci); ci = new SQLOutQueryCriteriaItem(); ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet; ci.GWDataDBField = GWDataDBField.i_EventType; ci.Operator = QueryCriteriaOperator.Equal; ci.Type = QueryCriteriaType.Or; ci.SourceField = ci.GWDataDBField.GetFullFieldName(); ci.TargetField = ci.GWDataDBField.GetFullFieldName(); ci.Translating.Type = TranslatingType.FixValue; ci.Translating.ConstValue = "02"; ch.Rule.QueryCriteria.MappingList.Add(ci); ci = new SQLOutQueryCriteriaItem(); ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet; ci.GWDataDBField = GWDataDBField.i_EventType; ci.Operator = QueryCriteriaOperator.Equal; ci.Type = QueryCriteriaType.Or; ci.SourceField = ci.GWDataDBField.GetFullFieldName(); ci.TargetField = ci.GWDataDBField.GetFullFieldName(); ci.Translating.Type = TranslatingType.FixValue; ci.Translating.ConstValue = "03"; ch.Rule.QueryCriteria.MappingList.Add(ci); #endregion #region Result iFieldID = 0; foreach (GWDataDBField f in GWDataDBField.GetFields(GWDataDBTable.Index)) { // Third party application need to use this ID to update process flag //if (f.GetFullFieldName() == GWDataDBField.i_IndexGuid.GetFullFieldName()) continue; if (f.GetFullFieldName() == GWDataDBField.i_DataDateTime.GetFullFieldName()) { continue; } if (f.GetFullFieldName() == GWDataDBField.i_PROCESS_FLAG.GetFullFieldName()) { continue; } ri = new SQLOutQueryResultItem(); ri.GWDataDBField = f; ri.SourceField = f.FieldName.ToUpper(); ri.TargetField = f.GetFullFieldName().Replace(".", "_").ToUpper(); ri.ThirdPartyDBPatamter.FieldName = f.GetFullFieldName().Replace(".", "_").ToUpper(); ri.ThirdPartyDBPatamter.FieldID = ++iFieldID; ri.Translating.Type = TranslatingType.None; ri.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar; ri.Translating.Type = TranslatingType.None; ch.Rule.QueryResult.MappingList.Add(ri); } foreach (GWDataDBField f in GWDataDBField.GetFields(GWDataDBTable.Patient)) { if (f.GetFullFieldName() == GWDataDBField.p_DATA_ID.GetFullFieldName()) { continue; } if (f.GetFullFieldName() == GWDataDBField.p_DATA_DT.GetFullFieldName()) { continue; } ri = new SQLOutQueryResultItem(); ri.GWDataDBField = f; ri.SourceField = f.FieldName.ToUpper(); ri.TargetField = f.GetFullFieldName().Replace(".", "_").ToUpper(); ri.ThirdPartyDBPatamter.FieldName = f.GetFullFieldName().Replace(".", "_").ToUpper(); ri.ThirdPartyDBPatamter.FieldID = ++iFieldID; ri.Translating.Type = TranslatingType.None; ri.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar; ri.Translating.Type = TranslatingType.None; ch.Rule.QueryResult.MappingList.Add(ri); } chs.Add(ch); #endregion ch.Rule.RuleID = GWDataDBTable.Patient.ToString(); ch.SPStatement = RuleControl.GetOutboundSP(interfaceName, ch.Rule); #endregion #region CH_Order ch = new SQLOutboundChanel(); ch.ChannelName = "CH_ORDER"; ch.SPName = Prefix + GWDataDBTable.Order.ToString(); ch.OperationType = ThrPartyDBOperationType.StorageProcedure; ch.Modified = false; #region Criteria ci = new SQLOutQueryCriteriaItem(); ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet; ci.GWDataDBField = GWDataDBField.i_EventType; ci.Operator = QueryCriteriaOperator.Equal; ci.Type = QueryCriteriaType.Or; ci.SourceField = ci.GWDataDBField.GetFullFieldName(); ci.TargetField = ci.GWDataDBField.GetFullFieldName(); ci.Translating.Type = TranslatingType.FixValue; ci.Translating.ConstValue = "10"; ch.Rule.QueryCriteria.MappingList.Add(ci); ci = new SQLOutQueryCriteriaItem(); ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet; ci.GWDataDBField = GWDataDBField.i_EventType; ci.Operator = QueryCriteriaOperator.Equal; ci.Type = QueryCriteriaType.Or; ci.SourceField = ci.GWDataDBField.GetFullFieldName(); ci.TargetField = ci.GWDataDBField.GetFullFieldName(); ci.Translating.Type = TranslatingType.FixValue; ci.Translating.ConstValue = "11"; ch.Rule.QueryCriteria.MappingList.Add(ci); ci = new SQLOutQueryCriteriaItem(); ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet; ci.GWDataDBField = GWDataDBField.i_EventType; ci.Operator = QueryCriteriaOperator.Equal; ci.Type = QueryCriteriaType.Or; ci.SourceField = ci.GWDataDBField.GetFullFieldName(); ci.TargetField = ci.GWDataDBField.GetFullFieldName(); ci.Translating.Type = TranslatingType.FixValue; ci.Translating.ConstValue = "12"; ch.Rule.QueryCriteria.MappingList.Add(ci); ci = new SQLOutQueryCriteriaItem(); ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet; ci.GWDataDBField = GWDataDBField.i_EventType; ci.Operator = QueryCriteriaOperator.Equal; ci.Type = QueryCriteriaType.Or; ci.SourceField = ci.GWDataDBField.GetFullFieldName(); ci.TargetField = ci.GWDataDBField.GetFullFieldName(); ci.Translating.Type = TranslatingType.FixValue; ci.Translating.ConstValue = "13"; ch.Rule.QueryCriteria.MappingList.Add(ci); #endregion #region Result iFieldID = 0; foreach (GWDataDBField f in GWDataDBField.GetFields(GWDataDBTable.Index)) { // Third party application need to use this ID to update process flag //if (f.GetFullFieldName() == GWDataDBField.i_IndexGuid.GetFullFieldName()) continue; if (f.GetFullFieldName() == GWDataDBField.i_DataDateTime.GetFullFieldName()) { continue; } if (f.GetFullFieldName() == GWDataDBField.i_PROCESS_FLAG.GetFullFieldName()) { continue; } ri = new SQLOutQueryResultItem(); ri.GWDataDBField = f; ri.SourceField = f.FieldName.ToUpper(); ri.TargetField = f.GetFullFieldName().Replace(".", "_").ToUpper(); ri.ThirdPartyDBPatamter.FieldName = f.GetFullFieldName().Replace(".", "_").ToUpper(); ri.ThirdPartyDBPatamter.FieldID = ++iFieldID; ri.Translating.Type = TranslatingType.None; ri.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar; ch.Rule.QueryResult.MappingList.Add(ri); } foreach (GWDataDBField f in GWDataDBField.GetFields(GWDataDBTable.Patient)) { if (f.GetFullFieldName() == GWDataDBField.p_DATA_ID.GetFullFieldName()) { continue; } if (f.GetFullFieldName() == GWDataDBField.p_DATA_DT.GetFullFieldName()) { continue; } ri = new SQLOutQueryResultItem(); ri.GWDataDBField = f; ri.SourceField = f.FieldName.ToUpper(); ri.TargetField = f.GetFullFieldName().Replace(".", "_").ToUpper(); ri.ThirdPartyDBPatamter.FieldName = f.GetFullFieldName().Replace(".", "_").ToUpper(); ri.ThirdPartyDBPatamter.FieldID = ++iFieldID; ri.Translating.Type = TranslatingType.None; ri.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar; ch.Rule.QueryResult.MappingList.Add(ri); } foreach (GWDataDBField f in GWDataDBField.GetFields(GWDataDBTable.Order)) { if (f.GetFullFieldName() == GWDataDBField.o_DATA_ID.GetFullFieldName()) { continue; } if (f.GetFullFieldName() == GWDataDBField.o_DATA_DT.GetFullFieldName()) { continue; } ri = new SQLOutQueryResultItem(); ri.GWDataDBField = f; ri.SourceField = f.FieldName.ToUpper(); ri.TargetField = f.GetFullFieldName().Replace(".", "_").ToUpper(); ri.ThirdPartyDBPatamter.FieldName = f.GetFullFieldName().Replace(".", "_").ToUpper(); ri.ThirdPartyDBPatamter.FieldID = ++iFieldID; ri.Translating.Type = TranslatingType.None; ri.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar; ch.Rule.QueryResult.MappingList.Add(ri); } chs.Add(ch); #endregion ch.Rule.RuleID = GWDataDBTable.Order.ToString(); ch.SPStatement = RuleControl.GetOutboundSP(interfaceName, ch.Rule); #endregion #region CH_Report ch = new SQLOutboundChanel(); ch.ChannelName = "CH_REPORT"; ch.SPName = Prefix + GWDataDBTable.Report.ToString(); ch.OperationType = ThrPartyDBOperationType.StorageProcedure; ch.Modified = false; #region Criteria ci = new SQLOutQueryCriteriaItem(); ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet; ci.GWDataDBField = GWDataDBField.i_EventType; ci.Operator = QueryCriteriaOperator.Equal; ci.Type = QueryCriteriaType.Or; ci.SourceField = ci.GWDataDBField.GetFullFieldName(); ci.TargetField = ci.GWDataDBField.GetFullFieldName(); ci.Translating.Type = TranslatingType.FixValue; ci.Translating.ConstValue = "30"; ch.Rule.QueryCriteria.MappingList.Add(ci); ci = new SQLOutQueryCriteriaItem(); ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet; ci.GWDataDBField = GWDataDBField.i_EventType; ci.Operator = QueryCriteriaOperator.Equal; ci.Type = QueryCriteriaType.Or; ci.SourceField = ci.GWDataDBField.GetFullFieldName(); ci.TargetField = ci.GWDataDBField.GetFullFieldName(); ci.Translating.Type = TranslatingType.FixValue; ci.Translating.ConstValue = "31"; ch.Rule.QueryCriteria.MappingList.Add(ci); ci = new SQLOutQueryCriteriaItem(); ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet; ci.GWDataDBField = GWDataDBField.i_EventType; ci.Operator = QueryCriteriaOperator.Equal; ci.Type = QueryCriteriaType.Or; ci.SourceField = ci.GWDataDBField.GetFullFieldName(); ci.TargetField = ci.GWDataDBField.GetFullFieldName(); ci.Translating.Type = TranslatingType.FixValue; ci.Translating.ConstValue = "32"; ch.Rule.QueryCriteria.MappingList.Add(ci); ci = new SQLOutQueryCriteriaItem(); ch.Rule.QueryCriteria.Type = QueryCriteriaRuleType.DataSet; ci.GWDataDBField = GWDataDBField.i_EventType; ci.Operator = QueryCriteriaOperator.Equal; ci.Type = QueryCriteriaType.Or; ci.SourceField = ci.GWDataDBField.GetFullFieldName(); ci.TargetField = ci.GWDataDBField.GetFullFieldName(); ci.Translating.Type = TranslatingType.FixValue; ci.Translating.ConstValue = "33"; ch.Rule.QueryCriteria.MappingList.Add(ci); #endregion #region Result iFieldID = 0; foreach (GWDataDBField f in GWDataDBField.GetFields(GWDataDBTable.Index)) { // Third party application need to use this ID to update process flag //if (f.GetFullFieldName() == GWDataDBField.i_IndexGuid.GetFullFieldName()) continue; if (f.GetFullFieldName() == GWDataDBField.i_DataDateTime.GetFullFieldName()) { continue; } if (f.GetFullFieldName() == GWDataDBField.i_PROCESS_FLAG.GetFullFieldName()) { continue; } ri = new SQLOutQueryResultItem(); ri.GWDataDBField = f; ri.SourceField = f.FieldName.ToUpper(); ri.TargetField = f.GetFullFieldName().Replace(".", "_").ToUpper(); ri.ThirdPartyDBPatamter.FieldName = f.GetFullFieldName().Replace(".", "_").ToUpper(); ri.ThirdPartyDBPatamter.FieldID = ++iFieldID; ri.Translating.Type = TranslatingType.None; ri.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar; ch.Rule.QueryResult.MappingList.Add(ri); } foreach (GWDataDBField f in GWDataDBField.GetFields(GWDataDBTable.Patient)) { if (f.GetFullFieldName() == GWDataDBField.p_DATA_ID.GetFullFieldName()) { continue; } if (f.GetFullFieldName() == GWDataDBField.p_DATA_DT.GetFullFieldName()) { continue; } ri = new SQLOutQueryResultItem(); ri.GWDataDBField = f; ri.SourceField = f.FieldName.ToUpper(); ri.TargetField = f.GetFullFieldName().Replace(".", "_").ToUpper(); ri.ThirdPartyDBPatamter.FieldName = f.GetFullFieldName().Replace(".", "_").ToUpper(); ri.ThirdPartyDBPatamter.FieldID = ++iFieldID; ri.Translating.Type = TranslatingType.None; ri.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar; ch.Rule.QueryResult.MappingList.Add(ri); } foreach (GWDataDBField f in GWDataDBField.GetFields(GWDataDBTable.Order)) { if (f.GetFullFieldName() == GWDataDBField.o_DATA_ID.GetFullFieldName()) { continue; } if (f.GetFullFieldName() == GWDataDBField.o_DATA_DT.GetFullFieldName()) { continue; } ri = new SQLOutQueryResultItem(); ri.GWDataDBField = f; ri.SourceField = f.FieldName.ToUpper(); ri.TargetField = f.GetFullFieldName().Replace(".", "_").ToUpper(); ri.ThirdPartyDBPatamter.FieldName = f.GetFullFieldName().Replace(".", "_").ToUpper(); ri.ThirdPartyDBPatamter.FieldID = ++iFieldID; ri.Translating.Type = TranslatingType.None; ri.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar; ch.Rule.QueryResult.MappingList.Add(ri); } foreach (GWDataDBField f in GWDataDBField.GetFields(GWDataDBTable.Report)) { if (f.GetFullFieldName() == GWDataDBField.r_DATA_ID.GetFullFieldName()) { continue; } if (f.GetFullFieldName() == GWDataDBField.r_DATA_DT.GetFullFieldName()) { continue; } ri = new SQLOutQueryResultItem(); ri.GWDataDBField = f; ri.SourceField = f.FieldName.ToUpper(); ri.TargetField = f.GetFullFieldName().Replace(".", "_").ToUpper(); ri.ThirdPartyDBPatamter.FieldName = f.GetFullFieldName().Replace(".", "_").ToUpper(); ri.ThirdPartyDBPatamter.FieldID = ++iFieldID; ri.Translating.Type = TranslatingType.None; ri.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar; ch.Rule.QueryResult.MappingList.Add(ri); } chs.Add(ch); #endregion ch.Rule.RuleID = GWDataDBTable.Report.ToString(); ch.SPStatement = RuleControl.GetOutboundSP(interfaceName, ch.Rule); #endregion return(true); }
static void Main() { MessageBox.Show(RuleControl.ParseConstValue("")); MessageBox.Show(RuleControl.ParseConstValue("asdfaf")); MessageBox.Show(RuleControl.ParseConstValue("a''sdf'af")); MessageBox.Show(RuleControl.ParseConstValue("{SQ")); MessageBox.Show(RuleControl.ParseConstValue("{SQLasdfasdfaf")); MessageBox.Show(RuleControl.ParseConstValue("SQL}asdfasdfaf")); MessageBox.Show(RuleControl.ParseConstValue("{SQL}asdfasdfaf")); MessageBox.Show(RuleControl.ParseConstValue("{SQL}asdfa'af")); MessageBox.Show(RuleControl.ParseConstValue(@"\{SQL}asdfasdfaf")); MessageBox.Show(RuleControl.ParseConstValue(@"\\{SQL}asdfasdfaf")); MessageBox.Show(RuleControl.ParseConstValue(@"\{SQL}")); MessageBox.Show(RuleControl.ParseConstValue(@"{SQL}")); //Form frm = new Form(); //TextBox b = new TextBox(); //b.Multiline = true; //b.Dock = DockStyle.Fill; //frm.Controls.Add(b); //frm.ShowDialog(); //MessageBox.Show(string.Format(b.Text, 1, 2)); //return; //MessageBox.Show("wait a minute."); //DLogMgt.OnError += new EventHandler(DLogMgt_OnError); //DLogMgt.OnLog += new DLogHandler(DLogMgt_OnLog); //DElement e1 = new DElement(0x0010, 0x0010, DVR.PN, "Bill^Gates"); //MessageBox.Show(e1.Value); //DElement e2 = new DElement(0x0007, 0x0007, DVR.LO, "Hello world ÖíÍ·"); //MessageBox.Show(e2.Value); ////DHelper.CharacterSetName = "ISO 2022 IR 13"; ////DHelper.CharacterSetName = "ISO 2022 IR 87"; //DElementList eleList = DElementList.OpenFile(@"D:\Standard\DICOM\DicomFile_Japan\SCSH31.dcm"); ////DElementList eleList = DElementList.OpenFile(@"D:\Standard\DICOM\DicomFile_Japan\SCSH32.dcm"); ////DElementList eleList = DElementList.OpenFile(@"D:\Standard\DICOM\DicomFile\001.dcm"); //DElement eleCS = eleList.GetElement(0x00080005); //if (eleCS != null) //{ // MessageBox.Show(eleCS.Value); // //eleCS.Value = DHelper.CharacterSetName; // //MessageBox.Show(eleCS.Value); //} //DElement elePN = eleList.GetElement(0x00100010); //MessageBox.Show(elePN.Value); //using (StreamWriter sw = File.CreateText("File.txt")) //{ // sw.Write(eleList.ToXMLString()); //} //return; //MessageBox.Show(((int)' ').ToString()); //return; XmlDocument doc = new XmlDocument(); doc.Load(@"../../XMLBlank\test.xml"); XmlNode nodeR = doc.GetElementsByTagName("r")[0]; XmlNode nodeA = nodeR.ChildNodes[0]; XmlNode nodeB = nodeR.ChildNodes[1]; XmlNode nodeC = nodeR.ChildNodes[2]; XmlNode nodeD = nodeR.ChildNodes[3]; MessageBox.Show("a:" + nodeA.InnerText + ";\r\n" + "b:" + nodeB.InnerText + ";\r\n" + "c:" + nodeC.InnerText + ";\r\n" + "d:" + nodeD.InnerText + ";\r\n"); XPathDocument myXPathDoc = new XPathDocument(@"../../XMLBlank\test.xml"); using (XmlTextWriter myWriter = new XmlTextWriter(@"../../XMLBlank\result" + DateTime.Now.Ticks + ".xml", null)) { XslCompiledTransform myXslTrans = new XslCompiledTransform(); myXslTrans.Load(@"../../XMLBlank\transfrom.xsl"); myXslTrans.Transform(myXPathDoc, null, myWriter); } //return; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FormMain()); }