public ActionResult UpdateMODULE(MODULE obj) { if (ModelState.IsValid) { obj.DESCRIPTION = obj.DESCRIPTION.Trim(); var checkname = _IMODULEService.Query.FirstOrDefault(x => x.DESCRIPTION.ToUpper() == obj.DESCRIPTION.ToUpper()); if (checkname == null) { try { _IMODULEService.Update(obj); _IMODULEService.CommitChanges(); _iLogSystemService.CreateNew(HttpContext.User.Identity.Name, "Cập nhật Nhóm Module ", "Thực hiện chức năng cập nhật Module", Helper.GetIPAddress.GetVisitorIPAddress(), HttpContext.Request.Browser.Browser); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Tên đã tồn tại, xin chọn tên khác!"; } } else { ViewData["EditError"] = "Bạn phải nhập đầy đủ thông tin!"; } return(PartialView("MODULEPartial", GetAllMODULE())); }
private void ModuleChanged(object sender, MODULE e) { if (e == MODULE.MAINMENU_DEBUG) { Refresh(); } }
private static List <MODULE> DoQuery(string sql_str) { List <MODULE> rtn = new List <MODULE>(); try { DBHelper DBHelper_SqlServer = new DBLink(); using (IDataReader dr = DBHelper_SqlServer.ExecuteReader(sql_str)) { while (dr.Read()) { var p = new MODULE(); p.ID = DBHelper_SqlServer.GetDataValue <string>(dr, "ID"); p.MODULE_NAME = DBHelper_SqlServer.GetDataValue <string>(dr, "MODULE_NAME"); p.MODULE_DESCRIBE = DBHelper_SqlServer.GetDataValue <string>(dr, "MODULE_DESCRIBE"); p.TAGNAME = DBHelper_SqlServer.GetDataValue <string>(dr, "TAGNAME"); p.STATUS = DBHelper_SqlServer.GetDataValue <string>(dr, "STATUS"); rtn.Add(p); } } } catch { } return(rtn); }
private void OnPaletteChanged(object sender, EventArgs e) { // Update buttons to reflect the new palette setting MODULE function = new MODULE(); UpdateRadioButtons(); function.set_theme_name(false, kryptonManager.GlobalPaletteMode.ToString()); }
public static Module Get(MODULE module) { try { return(_modules[module]); } catch (Exception) { throw new ModuleNotFoundException($"Module \"{module}\" not found."); } }
private void Form2_Load(object sender, EventArgs e) { MODULE function = new MODULE(); // Set correct initial radio button setting kryptonManager.GlobalPaletteMode = function.PalletMode(function.set_theme_name(true, "")); UpdateRadioButtons(); // Hook into changes in the global palette KryptonManager.GlobalPaletteChanged += new EventHandler(OnPaletteChanged); }
public static Module Get(int id) { try { MODULE module = (MODULE)id; return(_modules[module]); } catch (Exception) { throw new ModuleNotFoundException($"Module with id {id} not found."); } }
public ModuleStream(PROJECTINFORMATION ProjectInformation, MODULE module, XlBinaryReader Data) { this.ProjectInformation = ProjectInformation; this.PerformanceCache = Data.ReadBytes(module.OffsetRecord.TextOffset); Byte[] rest = Data.GetUnreadData(); var reader = new XlBinaryReader(ref rest); var container = new CompressedContainer(reader); var buffer = new DecompressedBuffer(); container.Decompress(buffer); this.UncompressedSourceCode = buffer.GetData(); }
public ActionResult DeleteMODULE(MODULE obj) { if (CheckForDeleteMODULE(obj.MODULEID)) { _IMODULEService.Delete(obj); _IMODULEService.CommitChanges(); _iLogSystemService.CreateNew(HttpContext.User.Identity.Name, "Xóa Nhóm Module ", "Thực hiện chức năng xóa Module", Helper.GetIPAddress.GetVisitorIPAddress(), HttpContext.Request.Browser.Browser); } else { ViewData["EditError"] = "Không thể xóa vì có nhóm chức năng trong Module này!"; } return(PartialView("MODULEPartial", GetAllMODULE())); }
public MODULE MergeModulesList(Dictionary <string, MODULE> modules) { MODULE baseModule = null; foreach (var module in modules.Values) { if (baseModule == null) { baseModule = module; } else { MergeModules(ref baseModule, module); } } return(baseModule); }
public void Add(Module module) { MODULE entity = new MODULE(); entity.MODULE_ID = module.Id; entity.MODULE_NOM = module.Nom; entity.MODULE_TYPE = module.Type; entity.MODULE_MARGE_COMMERCIAL = module.MargeCommercial; entity.MODULE_MARGE_ENTREPRISE = module.MargeEntreprise; // temp entity.PERSONNEL_ID = 0; using (var db = new maderaEntities()) { db.MODULE.Add(entity); db.SaveChanges(); } }
public void Add(MODULE module, string SourceCode) { string moduleName = module.NameRecord.GetModuleNameAsString(); string streamName = moduleName; if (this._ModuleStreams.ContainsKey(streamName)) { throw new ArgumentException(String.Format("Already contains a module stream named {0}", streamName), "moduleStream"); } var stream = new ModuleStream(this.DirStream.InformationRecord, module, SourceCode); throw new NotImplementedException(); /* * this._ModuleStreams.Add(streamName, moduleStream); * ModuleStreamAdded(streamName, moduleStream);*/ }
/// <summary> /// module添加的方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void bt_moduleadd_Click(object sender, EventArgs e) { MODULE mymodule = new MODULE(); mymodule.MODULE_NAME = this.tb_modulename.Text; mymodule.MODULE_DESCRIPTION = this.tb_moduledescription.Text; if (this.rab_genno.Checked == true) { mymodule.MODULE_FATHERID = Convert.ToInt16(this.drpl_gen.SelectedValue); } else { mymodule.MODULE_FATHERID = 0; } mymodule.MODULE_URL = this.tb_moduleurl.Text; mymodule.Add(); Response.Write(MessageBox.Show("添加成功!")); }
internal ModuleStream(PROJECTINFORMATION ProjectInformation, MODULE module, string SourceCode) { this.ProjectInformation = ProjectInformation; this.PerformanceCache = new Byte[] { }; SetUncompressetSourceCode(SourceCode, ProjectInformation.CodePageRecord); }
public void MergeModules(ref MODULE destination, MODULE source) { #region OTHER_ELEMENTS foreach (var obj in source.elements) { try { if (obj.GetType() == typeof(A2ML) && !options.ElementToIgnoreWhenMerging.HasFlag(Options.ElementTypes.A2ML)) { var list = destination.elements.FindAll(x => x.GetType() == typeof(A2ML)); if (list != null && list.Count > 1) { if (options.MergeConflict == Options.MergeConflictType.UseFromFirstModuleAndWarn) { Console.Error.WriteLine( "Warning: A2ML found '{0}' and in {1}. Ignoring the version from {1}.", destination.location.FileName, source.location.FileName); } if (options.MergeConflict == Options.MergeConflictType.AbortWithError) { throw new ErrorException(ErrorException.ErrorCodes.MergeError, string.Format("Error: A2ML found '{0}' and in {1}.", destination.location.FileName, source.location.FileName)); } } else { destination.elements.Add(obj); } } else if (obj.GetType() == typeof(IF_DATA) && !options.ElementToIgnoreWhenMerging.HasFlag(Options.ElementTypes.IF_DATA)) { destination.elements.Add(obj); } else if (obj.GetType() == typeof(MOD_COMMON) && !options.ElementToIgnoreWhenMerging.HasFlag(Options.ElementTypes.MOD_COMMON)) { var list = destination.elements.FindAll(x => x.GetType() == typeof(MOD_COMMON)); if (list != null && list.Count > 1) { if (options.MergeConflict == Options.MergeConflictType.UseFromFirstModuleAndWarn) { Console.Error.WriteLine( "Warning: MOD_COMMON found '{0}' and in {1}. Ignoring the version from {1}.", destination.location.FileName, source.location.FileName); } if (options.MergeConflict == Options.MergeConflictType.AbortWithError) { throw new ErrorException(ErrorException.ErrorCodes.MergeError, string.Format("Error: MOD_COMMON found '{0}' and in {1}.", destination.location.FileName, source.location.FileName)); } } else { destination.elements.Add(obj); } } else if (obj.GetType() == typeof(MOD_PAR) && !options.ElementToIgnoreWhenMerging.HasFlag(Options.ElementTypes.MOD_PAR)) { var list = destination.elements.FindAll(x => x.GetType() == typeof(MOD_PAR)); if (list != null && list.Count > 1) { if (options.MergeConflict == Options.MergeConflictType.UseFromFirstModuleAndWarn) { Console.Error.WriteLine( "Warning: MOD_PAR found '{0}' and in {1}. Ignoring the version from {1}.", destination.location.FileName, source.location.FileName); } if (options.MergeConflict == Options.MergeConflictType.AbortWithError) { throw new ErrorException(ErrorException.ErrorCodes.MergeError, string.Format("Error: MOD_PAR found '{0}' and in {1}.", destination.location.FileName, source.location.FileName)); } } else { destination.elements.Add(obj); } } else if (obj.GetType() == typeof(VARIANT_CODING) && !options.ElementToIgnoreWhenMerging.HasFlag(Options.ElementTypes.VARIANT_CODING)) { var list = destination.elements.FindAll(x => x.GetType() == typeof(VARIANT_CODING)); if (list != null && list.Count > 1) { if (options.MergeConflict == Options.MergeConflictType.UseFromFirstModuleAndWarn) { Console.Error.WriteLine( "Warning: VARIANT_CODING found '{0}' and in {1}. Ignoring the version from {1}.", destination.location.FileName, source.location.FileName); } if (options.MergeConflict == Options.MergeConflictType.AbortWithError) { throw new ErrorException(ErrorException.ErrorCodes.MergeError, string.Format("Error: VARIANT_CODING found '{0}' and in {1}.", destination.location.FileName, source.location.FileName)); } } else { destination.elements.Add(obj); } } else { Console.Error.WriteLine("Warning: Unhandled element type found '{0}' in {1}.", obj.GetType(), source.location.FileName); destination.elements.Add(obj); } } catch (ValidationErrorException e) { if (options.MergeConflict == Options.MergeConflictType.UseFromFirstModuleAndWarn) { Console.Error.WriteLine(e.Message); } if (options.MergeConflict == Options.MergeConflictType.AbortWithError) { throw new ErrorException(ErrorException.ErrorCodes.MergeError, e.Message); } } } #endregion #region AXIS_PTS_MEASUREMENT_CHARACTERISTIC foreach (var obj in source.AxisPtsCharacteristicMeasurement.Values) { try { if (obj.GetType() == typeof(AXIS_PTS) && !options.ElementToIgnoreWhenMerging.HasFlag(Options.ElementTypes.AXIS_PTS)) { destination.AddElement(obj as AXIS_PTS); } if (obj.GetType() == typeof(MEASUREMENT) && !options.ElementToIgnoreWhenMerging.HasFlag(Options.ElementTypes.MEASUREMENT)) { destination.AddElement(obj as MEASUREMENT); } if (obj.GetType() == typeof(CHARACTERISTIC) && !options.ElementToIgnoreWhenMerging.HasFlag(Options.ElementTypes.CHARACTERISTIC)) { destination.AddElement(obj as CHARACTERISTIC); } } catch (ValidationErrorException e) { if (options.MergeConflict == Options.MergeConflictType.UseFromFirstModuleAndWarn) { Console.Error.WriteLine(e.Message); } if (options.MergeConflict == Options.MergeConflictType.AbortWithError) { throw new ErrorException(ErrorException.ErrorCodes.MergeError, e.Message); } } } #endregion #region COMPU_TAB_COMPU_VTAB_COMPU_VTAB_RANGE foreach (var obj in source.CompuTabCompuVtabCompuVtabRanges.Values) { try { if (obj.GetType() == typeof(COMPU_TAB) && !options.ElementToIgnoreWhenMerging.HasFlag(Options.ElementTypes.COMPU_TAB)) { destination.AddElement(obj as COMPU_TAB); } if (obj.GetType() == typeof(COMPU_VTAB) && !options.ElementToIgnoreWhenMerging.HasFlag(Options.ElementTypes.COMPU_VTAB)) { destination.AddElement(obj as COMPU_VTAB); } if (obj.GetType() == typeof(COMPU_VTAB_RANGE) && !options.ElementToIgnoreWhenMerging.HasFlag(Options.ElementTypes.COMPU_VTAB_RANGE)) { destination.AddElement(obj as COMPU_VTAB_RANGE); } } catch (ValidationErrorException e) { if (options.MergeConflict == Options.MergeConflictType.UseFromFirstModuleAndWarn) { Console.Error.WriteLine(e.Message); } if (options.MergeConflict == Options.MergeConflictType.AbortWithError) { throw new ErrorException(ErrorException.ErrorCodes.MergeError, e.Message); } } } #endregion #region COMPU_METHOD if (!options.ElementToIgnoreWhenMerging.HasFlag(Options.ElementTypes.COMPU_METHOD)) { foreach (var obj in source.CompuMethods.Values) { try { destination.AddElement(obj); } catch (ValidationErrorException e) { if (options.MergeConflict == Options.MergeConflictType.UseFromFirstModuleAndWarn) { Console.Error.WriteLine(e.Message); } if (options.MergeConflict == Options.MergeConflictType.AbortWithError) { throw new ErrorException(ErrorException.ErrorCodes.MergeError, e.Message); } } } } #endregion #region FRAME if (!options.ElementToIgnoreWhenMerging.HasFlag(Options.ElementTypes.FRAME)) { foreach (var obj in source.Frames.Values) { try { destination.AddElement(obj); } catch (ValidationErrorException e) { if (options.MergeConflict == Options.MergeConflictType.UseFromFirstModuleAndWarn) { Console.Error.WriteLine(e.Message); } if (options.MergeConflict == Options.MergeConflictType.AbortWithError) { throw new ErrorException(ErrorException.ErrorCodes.MergeError, e.Message); } } } } #endregion #region FUNCTION if (!options.ElementToIgnoreWhenMerging.HasFlag(Options.ElementTypes.FUNCTION)) { foreach (var obj in source.Functions.Values) { try { destination.AddElement(obj); } catch (ValidationErrorException e) { if (options.MergeConflict == Options.MergeConflictType.UseFromFirstModuleAndWarn) { Console.Error.WriteLine(e.Message); } if (options.MergeConflict == Options.MergeConflictType.AbortWithError) { throw new ErrorException(ErrorException.ErrorCodes.MergeError, e.Message); } } } } #endregion #region GROUP if (!options.ElementToIgnoreWhenMerging.HasFlag(Options.ElementTypes.GROUP)) { foreach (var obj in source.Groups.Values) { try { destination.AddElement(obj); } catch (ValidationErrorException e) { if (options.MergeConflict == Options.MergeConflictType.UseFromFirstModuleAndWarn) { Console.Error.WriteLine(e.Message); } if (options.MergeConflict == Options.MergeConflictType.AbortWithError) { throw new ErrorException(ErrorException.ErrorCodes.MergeError, e.Message); } } } } #endregion #region RECORD_LAYOUT if (!options.ElementToIgnoreWhenMerging.HasFlag(Options.ElementTypes.RECORD_LAYOUT)) { foreach (var obj in source.Record_layouts.Values) { try { destination.AddElement(obj); } catch (ValidationErrorException e) { if (options.MergeConflict == Options.MergeConflictType.UseFromFirstModuleAndWarn) { Console.Error.WriteLine(e.Message); } if (options.MergeConflict == Options.MergeConflictType.AbortWithError) { throw new ErrorException(ErrorException.ErrorCodes.MergeError, e.Message); } } } } #endregion #region UNIT if (!options.ElementToIgnoreWhenMerging.HasFlag(Options.ElementTypes.UNIT)) { foreach (var obj in source.Units.Values) { try { destination.AddElement(obj); } catch (ValidationErrorException e) { if (options.MergeConflict == Options.MergeConflictType.UseFromFirstModuleAndWarn) { Console.Error.WriteLine(e.Message); } if (options.MergeConflict == Options.MergeConflictType.AbortWithError) { throw new ErrorException(ErrorException.ErrorCodes.MergeError, e.Message); } } } } #endregion #region USER_RIGHTS if (!options.ElementToIgnoreWhenMerging.HasFlag(Options.ElementTypes.USER_RIGHTS)) { foreach (var obj in source.User_rights.Values) { try { destination.AddElement(obj); } catch (ValidationErrorException e) { if (options.MergeConflict == Options.MergeConflictType.UseFromFirstModuleAndWarn) { Console.Error.WriteLine(e.Message); } if (options.MergeConflict == Options.MergeConflictType.AbortWithError) { throw new ErrorException(ErrorException.ErrorCodes.MergeError, e.Message); } } } } #endregion }
/// <summary> /// Removes empty <see cref="FUNCTION"/>s and <see cref="GROUP"/>s. Does also remove not referenced <see cref="COMPU_METHOD"/>s, <see cref="COMPU_TAB"/>s, /// <see cref="COMPU_VTAB"/>s, <see cref="COMPU_VTAB_RANGE"/>s and <see cref="UNIT"/>s /// </summary> /// <param name="module">Module to purge in.</param> /// <param name="options">Common options</param> static public void purgeEmptyOrNotReferencedElements(ref MODULE module, Options options) { { List <FUNCTION> functionToDelete = new List <FUNCTION>(); List <string> functionsNotToDelete = new List <string>(); foreach (var function in module.Functions.Values) { bool doDelete = true; if (function.def_characteristic != null && function.def_characteristic.def_characteristics.Count > 0) { doDelete = false; } if (function.ref_characteristic != null && function.ref_characteristic.reference.Count > 0) { doDelete = false; } if (function.in_measurement != null && function.in_measurement.measurements.Count > 0) { doDelete = false; } if (function.loc_measurement != null && function.loc_measurement.measurements.Count > 0) { doDelete = false; } if (function.out_measurement != null && function.out_measurement.measurements.Count > 0) { doDelete = false; } if (!doDelete) { // Not empty, store it so it is not deleted in next part. functionsNotToDelete.Add(function.Name); } if (function.sub_function != null && function.sub_function.sub_functions.Count > 0) { // There is subfunctions. doDelete = false; } if (doDelete) { functionToDelete.Add(function); } } foreach (var function in functionToDelete) { module.Functions.Remove(function.Name); } // Search for functions refered in subfunctions, remove not existing functions from subfunctions. Delete function if subfunctions is empty. Dictionary <string, FUNCTION> Functions = module.Functions; functionToDelete.Clear(); foreach (var function in module.Functions.Values) { bool doDelete = true; List <String> sub_functionToDelete = new List <String>(); if (function.sub_function != null) { foreach (var obj in function.sub_function.sub_functions.Where(x => !Functions.Keys.Contains(x))) { sub_functionToDelete.Add(obj); } } foreach (var obj in sub_functionToDelete) { function.sub_function.sub_functions.Remove(obj); } if (function.sub_function != null && function.sub_function.sub_functions.Count > 0) { doDelete = false; } if (doDelete) { functionToDelete.Add(function); } } foreach (var obj in functionToDelete) { if (!functionsNotToDelete.Contains(obj.Name)) { module.Functions.Remove(obj.Name); } } } { List <GROUP> groupsToDelete = new List <GROUP>(); List <string> groupsNotToDelete = new List <string>(); foreach (var group in module.Groups.Values) { bool doDelete = true; if (group.ref_characteristic != null && group.ref_characteristic.reference.Count > 0) { doDelete = false; } if (group.ref_measurement != null && group.ref_measurement.reference.Count > 0) { doDelete = false; } if (!doDelete) { // Not empty, store it so it is not deleted in next part. groupsNotToDelete.Add(group.Name); } if (group.sub_group != null && group.sub_group.groups.Count > 0) { doDelete = false; } if (doDelete) { groupsToDelete.Add(group); } } foreach (var function in groupsToDelete) { module.Functions.Remove(function.Name); } // Search for Groups refered in subGroups, remove not existing functions from subGroups. Delete group if subGroups is empty. Dictionary <string, GROUP> Groups = module.Groups; groupsToDelete.Clear(); foreach (var group in module.Groups.Values) { bool doDelete = true; List <String> sub_functionToDelete = new List <String>(); if (group.sub_group != null) { foreach (var obj in group.sub_group.groups.Where(x => !Groups.Keys.Contains(x))) { sub_functionToDelete.Add(obj); } } foreach (var obj in sub_functionToDelete) { group.sub_group.groups.Remove(obj); } if (group.sub_group != null && group.sub_group.groups.Count > 0) { doDelete = false; } if (doDelete) { groupsToDelete.Add(group); } } foreach (var obj in groupsToDelete) { if (!groupsNotToDelete.Contains(obj.Name)) { module.Groups.Remove(obj.Name); } } } { List <String> referedCompuMethods = new List <String>(); List <String> referedRecord_layouts = new List <String>(); List <String> referedUnits = new List <String>(); foreach (var obj in module.AxisPtsCharacteristicMeasurement.Values) { if (obj.GetType() == typeof(CHARACTERISTIC)) { var tmp = obj as CHARACTERISTIC; if (tmp.Conversion != "NO_COMPU_METHOD") { referedCompuMethods.Add(tmp.Conversion); } referedRecord_layouts.Add(tmp.Deposit); } if (obj.GetType() == typeof(AXIS_PTS)) { var tmp = obj as AXIS_PTS; if (tmp.Conversion != "NO_COMPU_METHOD") { referedCompuMethods.Add(tmp.Conversion); } referedRecord_layouts.Add(tmp.Deposit); } if (obj.GetType() == typeof(MEASUREMENT)) { var tmp = obj as MEASUREMENT; if (tmp.Conversion != "NO_COMPU_METHOD") { referedCompuMethods.Add(tmp.Conversion); } } } { List <String> objsToDelete = new List <String>(); foreach (var obj in module.CompuMethods.Keys.Where(x => !referedCompuMethods.Contains(x))) { objsToDelete.Add(obj); } foreach (var obj in objsToDelete) { module.CompuMethods.Remove(obj); } } { List <String> objsToDelete = new List <String>(); foreach (var obj in module.Record_layouts.Keys.Where(x => !referedRecord_layouts.Contains(x))) { objsToDelete.Add(obj); } foreach (var obj in objsToDelete) { module.Record_layouts.Remove(obj); } } List <String> referedCompu_tabs = new List <String>(); foreach (var obj in module.CompuMethods.Values) { if (obj.ref_unit != null && obj.ref_unit.Count() > 0) { referedUnits.Add(obj.ref_unit); } if (obj.compu_tab_ref != null && obj.compu_tab_ref.Count() > 0) { referedCompu_tabs.Add(obj.compu_tab_ref); } } { List <String> objsToDelete = new List <String>(); foreach (var obj in module.CompuTabCompuVtabCompuVtabRanges.Keys.Where(x => !referedCompu_tabs.Contains(x))) { objsToDelete.Add(obj); } foreach (var obj in objsToDelete) { module.CompuTabCompuVtabCompuVtabRanges.Remove(obj); } } { List <String> objsToDelete = new List <String>(); foreach (var obj in module.Units.Keys.Where(x => !referedUnits.Contains(x))) { objsToDelete.Add(obj); } foreach (var obj in objsToDelete) { module.Units.Remove(obj); } } } }
/// <summary> /// Search base elements (elements that is handled by the <see cref="MODULE"/>) and delete references to named <see cref="CHARACTERISTIC"/>, <see cref="MEASUREMENT"/> or <see cref="AXIS_PTS"/>. /// </summary> /// <param name="module">Module to delete references in.</param> /// <param name="name">Name to search for.</param> /// <returns>List of base elements that contains references to the named <see cref="CHARACTERISTIC"/>.</returns> static void deleteReferencesToCharacteristicMeasurementAxis_pts(ref MODULE module, List <String> name) { foreach (var function in module.Functions.Values) { if (function.def_characteristic != null) { List <String> objToDelete = new List <String>(); foreach (var obj in function.def_characteristic.def_characteristics.Where(x => name.Contains(x))) { objToDelete.Add(obj); } foreach (var obj in objToDelete) { function.def_characteristic.def_characteristics.Remove(obj); } } if (function.ref_characteristic != null) { List <String> objToDelete = new List <String>(); foreach (var obj in function.ref_characteristic.reference.Where(x => name.Contains(x))) { objToDelete.Add(obj); } foreach (var obj in objToDelete) { function.ref_characteristic.reference.Remove(obj); } } if (function.in_measurement != null) { List <String> objToDelete = new List <String>(); foreach (var obj in function.in_measurement.measurements.Where(x => name.Contains(x))) { objToDelete.Add(obj); } foreach (var obj in objToDelete) { function.in_measurement.measurements.Remove(obj); } } if (function.loc_measurement != null) { List <String> objToDelete = new List <String>(); foreach (var obj in function.loc_measurement.measurements.Where(x => name.Contains(x))) { objToDelete.Add(obj); } foreach (var obj in objToDelete) { function.loc_measurement.measurements.Remove(obj); } } if (function.out_measurement != null) { List <String> objToDelete = new List <String>(); foreach (var obj in function.out_measurement.measurements.Where(x => name.Contains(x))) { objToDelete.Add(obj); } foreach (var obj in objToDelete) { function.out_measurement.measurements.Remove(obj); } } } foreach (var group in module.Groups.Values) { if (group.ref_characteristic != null) { List <String> objToDelete = new List <String>(); foreach (var obj in group.ref_characteristic.reference.Where(x => name.Contains(x))) { objToDelete.Add(obj); } foreach (var obj in objToDelete) { group.ref_characteristic.reference.Remove(obj); } } if (group.ref_measurement != null) { List <String> objToDelete = new List <String>(); foreach (var obj in group.ref_measurement.reference.Where(x => name.Contains(x))) { objToDelete.Add(obj); } foreach (var obj in objToDelete) { group.ref_measurement.reference.Remove(obj); } } } }
public static bool InsertNew(MODULE t_new) { try { MODULE tt = t_new; StringBuilder sb = new StringBuilder(); sb.Append(" Insert into MODULE ( "); sb.Append("ID, "); sb.Append("MODULE_NAME, "); sb.Append("MODULE_DESCRIBE, "); sb.Append("TAGNAME, "); sb.Append("STATUS )"); sb.Append(" values ( "); sb.Append("@ID,"); sb.Append("@MODULE_NAME,"); sb.Append("@MODULE_DESCRIBE,"); sb.Append("@TAGNAME,"); sb.Append(" @STATUS )"); DbCommand cmd = new SqlCommand(); cmd.CommandText = sb.ToString(); cmd.CommandType = CommandType.Text; cmd.Parameters.Add(new SqlParameter("@ID", DbType.String) { Value = tt.ID }); cmd.Parameters.Add(new SqlParameter("@MODULE_NAME", DbType.String) { Value = tt.MODULE_NAME }); cmd.Parameters.Add(new SqlParameter("@MODULE_DESCRIBE", DbType.String) { Value = tt.MODULE_DESCRIBE }); cmd.Parameters.Add(new SqlParameter("@TAGNAME", DbType.String) { Value = tt.TAGNAME }); cmd.Parameters.Add(new SqlParameter("@STATUS", DbType.String) { Value = tt.STATUS }); foreach (SqlParameter p in cmd.Parameters) { p.IsNullable = true; if (p.Value == null) { p.Value = DBNull.Value; } } DBHelper DBHelper_SqlServer = new DBLink(); int val = DBHelper_SqlServer.ExecuteNonQuery(cmd); if (val > 0) { return(true); } else { return(false); } } catch { return(false); } }
public void Validate(IErrorReporter errorReporter, MODULE module) { ValidateIdentifier(Name, errorReporter); if (conversionType == ConversionType.FORM) { if (formula != null) { formula.Validate(errorReporter, module); } else { reportErrorOrWarning( "COMPU_METHOD with ConversionType FORM requires a FORMULA definition but no FORMULA where defined", false, errorReporter); } } else if (conversionType == ConversionType.LINEAR) { if (coeffs_linear == null) { reportErrorOrWarning( "COMPU_METHOD with ConversionType LINEAR requires a COEFFS_LINEAR definition but no COEFFS_LINEAR where defined", false, errorReporter); } } else if (conversionType == ConversionType.RAT_FUNC) { if (coeffs == null) { reportErrorOrWarning( "COMPU_METHOD with ConversionType RAT_FUNC requires a COEFFS definition but no COEFFS where defined", false, errorReporter); } } else if (conversionType == ConversionType.TAB_INTP || conversionType == ConversionType.TAB_NOINTP || conversionType == ConversionType.TAB_VERB) { if (compu_tab_ref == null) { reportErrorOrWarning( string.Format( "COMPU_METHOD with conversionType {0} requires a COMPU_TAB_REF definition but no COMPU_TAB_REF where defined", ConversionType.TAB_VERB.ToString()), false, errorReporter); } else { Asap2Base tab; if (module.CompuTabCompuVtabCompuVtabRanges.TryGetValue(compu_tab_ref, out tab)) { if (conversionType == ConversionType.TAB_INTP || conversionType == ConversionType.TAB_NOINTP) { if (tab.GetType() == typeof(COMPU_TAB)) { var tmp = tab as COMPU_TAB; if (tmp.conversionType != conversionType) { tmp.reportErrorOrWarning( string.Format("ConversionType '{0}' is not the expeced ConversionType '{1}'", tmp.conversionType, conversionType), false, errorReporter); } } else { reportErrorOrWarning( string.Format("Reference '{0}' in COMPU_TAB_REF is not of type COMPU_TAB", compu_tab_ref), false, errorReporter); } } else { if (tab.GetType() == typeof(COMPU_VTAB)) { var tmp = tab as COMPU_VTAB; if (tmp.conversionType != conversionType) { tmp.reportErrorOrWarning( string.Format("ConversionType '{0}' is not the expeced ConversionType '{1}'", tmp.conversionType, conversionType), false, errorReporter); } } else if (tab.GetType() != typeof(COMPU_VTAB_RANGE)) { reportErrorOrWarning( string.Format( "Reference '{0}' in COMPU_TAB_REF is not of type COMPU_VTAB or COMPU_VTAB_RANGE", compu_tab_ref), false, errorReporter); } } } else { reportErrorOrWarning( string.Format("Referenced COMPU_TAB '{0}' in COMPU_TAB_REF not found", compu_tab_ref), false, errorReporter); } } } if (ref_unit != null && ref_unit != "") { /* Validate that refered UNIT exists */ if (!module.Units.ContainsKey(ref_unit)) { reportErrorOrWarning(string.Format("Referenced UNIT '{0}' in REF_UNIT not found", ref_unit), false, errorReporter); } if (Unit != "") { reportErrorOrWarning("Both Unit and REF_UNIT is specified, value from REF_UNIT will be used", false, errorReporter, true); } } if (status_string_ref != null && status_string_ref != "") { Asap2Base tab; if (module.CompuTabCompuVtabCompuVtabRanges.TryGetValue(status_string_ref, out tab)) { if (tab.GetType() == typeof(COMPU_VTAB)) { var tmp = tab as COMPU_VTAB; if (tmp.conversionType != conversionType) { tmp.reportErrorOrWarning( string.Format("ConversionType '{0}' is not the expected ConversionType '{1}'", tmp.conversionType, ConversionType.TAB_VERB), false, errorReporter); } } else if (tab.GetType() != typeof(COMPU_VTAB_RANGE)) { reportErrorOrWarning( string.Format( "Reference '{0}' in STATUS_STRING_REF is not of type COMPU_VTAB or COMPU_VTAB_RANGE", status_string_ref), false, errorReporter); } } else { reportErrorOrWarning( string.Format("Referenced COMPU_VTAB or COMPU_VTAB_RANGE '{0}' in STATUS_STRING_REF not found", status_string_ref), false, errorReporter); } } }
public bool MODULE_InsertOne(MODULE t_one) { return(SQL_Da_MODULE.InsertNew(t_one)); }
public bool MODULE_UpdateOne(MODULE t_one) { return(SQL_Da_MODULE.UpdateOne(t_one)); }
public static async void Update(GameTime gameTime) { if (lastModule != module) { GC.Collect(); GC.WaitForPendingFinalizers(); lastModule = module; } module = Memory.module; #if DEBUG if (Input2.DelayedButton(FF8TextTagKey.Reset) || Input2.DelayedButton(FF8TextTagKey.Cancel)) { if (Memory.module != MODULE.MAINMENU_DEBUG && Memory.module != MODULE.BATTLE_DEBUG) { Memory.module = MODULE.MAINMENU_DEBUG; InputMouse.Mode = MouseLockMode.Screen; } } #endif switch (module) { //doesn't need memory case MODULE.OVERTURE_DEBUG: case MODULE.MOVIETEST: break; default: //requires memory to be loaded. if ((Memory.InitTask != null) && (Memory.InitTask.IsCompleted == false || Memory.InitTask.Status == TaskStatus.Running || Memory.InitTask.Status == TaskStatus.WaitingToRun || Memory.InitTask.Status == TaskStatus.WaitingForActivation)) { //task is still running loading assets blank screen and wait. Memory.SuppressDraw = true; await Memory.InitTask; //fade in doesn't happen because time was set before the await. //ending here causes update to be run again with new time return; } break; } switch (module) { case MODULE.BATTLE: module_battle.Update(); break; case MODULE.BATTLE_DEBUG: Module_battle_debug.Update(); break; case MODULE.MOVIETEST: Module_movie_test.Update(); break; case MODULE.FIELD_DEBUG: Module_field_debug.Update(); break; case MODULE.OVERTURE_DEBUG: Module_overture_debug.Update(); break; case MODULE.MAINMENU_DEBUG: Module_main_menu_debug.Update(); break; case MODULE.WORLD_DEBUG: Module_world_debug.Update(gameTime); break; case MODULE.FACE_TEST: Module_face_test.Update(); break; case MODULE.ICON_TEST: Module_icon_test.Update(); break; case MODULE.CARD_TEST: Module_card_test.Update(); break; } }
/// <summary> /// Removes all elements of the types specified by the parameter <paramref name="elementsToDelete"/>. /// </summary> /// <param name="module">Asap2 <see cref="MODULE"/> to delete elements from.</param> /// <param name="elementsToDelete">Element types to remove</param> /// <param name="options">Common options</param> /// <param name="moduleName">Name of module to remove elements from. If not specified the first module is used.</param> static public void RemoveAllElements(ref MODULE module, Options.ElementTypes elementsToDelete, Options options) { { List <String> deletedNames = new List <string>(); if (elementsToDelete.HasFlag(Options.ElementTypes.CHARACTERISTIC)) { List <CHARACTERISTIC> characteristicsToDelete = new List <CHARACTERISTIC>(); elementsToDelete &= ~(Options.ElementTypes.CHARACTERISTIC); foreach (var obj in module.AxisPtsCharacteristicMeasurement.Where(x => x.Value.GetType() == typeof(CHARACTERISTIC))) { characteristicsToDelete.Add(obj.Value as CHARACTERISTIC); } foreach (var obj in characteristicsToDelete) { module.AxisPtsCharacteristicMeasurement.Remove(obj.Name); deletedNames.Add(obj.Name); } } if (elementsToDelete.HasFlag(Options.ElementTypes.MEASUREMENT)) { List <MEASUREMENT> measurementsToDelete = new List <MEASUREMENT>(); elementsToDelete &= ~(Options.ElementTypes.MEASUREMENT); foreach (var obj in module.AxisPtsCharacteristicMeasurement.Where(x => x.Value.GetType() == typeof(MEASUREMENT))) { measurementsToDelete.Add(obj.Value as MEASUREMENT); } foreach (var obj in measurementsToDelete) { module.AxisPtsCharacteristicMeasurement.Remove(obj.Name); deletedNames.Add(obj.Name); } } if (elementsToDelete.HasFlag(Options.ElementTypes.AXIS_PTS)) { List <AXIS_PTS> axis_ptsToDelete = new List <AXIS_PTS>(); elementsToDelete &= ~(Options.ElementTypes.AXIS_PTS); foreach (var obj in module.AxisPtsCharacteristicMeasurement.Where(x => x.Value.GetType() == typeof(AXIS_PTS))) { axis_ptsToDelete.Add(obj.Value as AXIS_PTS); } foreach (var obj in axis_ptsToDelete) { module.AxisPtsCharacteristicMeasurement.Remove(obj.Name); deletedNames.Add(obj.Name); } } deleteReferencesToCharacteristicMeasurementAxis_pts(ref module, deletedNames); } if (elementsToDelete.HasFlag(Options.ElementTypes.FRAME)) { elementsToDelete &= ~(Options.ElementTypes.FRAME); module.Frames.Clear(); } if (elementsToDelete.HasFlag(Options.ElementTypes.GROUP)) { elementsToDelete &= ~(Options.ElementTypes.GROUP); module.Groups.Clear(); } if (elementsToDelete.HasFlag(Options.ElementTypes.UNIT)) { elementsToDelete &= ~(Options.ElementTypes.UNIT); module.Units.Clear(); } if (elementsToDelete.HasFlag(Options.ElementTypes.USER_RIGHTS)) { elementsToDelete &= ~(Options.ElementTypes.USER_RIGHTS); module.User_rights.Clear(); } if (elementsToDelete.HasFlag(Options.ElementTypes.A2ML)) { List <Asap2Base> objToDelete = new List <Asap2Base>(); elementsToDelete &= ~(Options.ElementTypes.A2ML); foreach (var obj in module.elements.Where(x => x.GetType() == typeof(A2ML))) { objToDelete.Add(obj); } foreach (var obj in objToDelete) { module.elements.Remove(obj); } } if (elementsToDelete.HasFlag(Options.ElementTypes.IF_DATA)) { List <Asap2Base> objToDelete = new List <Asap2Base>(); elementsToDelete &= ~(Options.ElementTypes.IF_DATA); foreach (var obj in module.elements.Where(x => x.GetType() == typeof(IF_DATA))) { objToDelete.Add(obj); } foreach (var obj in objToDelete) { module.elements.Remove(obj); } } if (elementsToDelete.HasFlag(Options.ElementTypes.MOD_COMMON)) { List <Asap2Base> objToDelete = new List <Asap2Base>(); elementsToDelete &= ~(Options.ElementTypes.MOD_COMMON); foreach (var obj in module.elements.Where(x => x.GetType() == typeof(MOD_COMMON))) { objToDelete.Add(obj); } foreach (var obj in objToDelete) { module.elements.Remove(obj); } } if (elementsToDelete.HasFlag(Options.ElementTypes.MOD_PAR)) { List <Asap2Base> objToDelete = new List <Asap2Base>(); elementsToDelete &= ~(Options.ElementTypes.MOD_PAR); foreach (var obj in module.elements.Where(x => x.GetType() == typeof(MOD_PAR))) { objToDelete.Add(obj); } foreach (var obj in objToDelete) { module.elements.Remove(obj); } } if (elementsToDelete.HasFlag(Options.ElementTypes.VARIANT_CODING)) { List <Asap2Base> objToDelete = new List <Asap2Base>(); elementsToDelete &= ~(Options.ElementTypes.VARIANT_CODING); foreach (var obj in module.elements.Where(x => x.GetType() == typeof(VARIANT_CODING))) { objToDelete.Add(obj); } foreach (var obj in objToDelete) { module.elements.Remove(obj); } } if (elementsToDelete != Options.ElementTypes.NONE) { throw new ErrorException(ErrorException.ErrorCodes.ParameterError, String.Format("Specified elemenents to delete is not supported to delete '{0}'", elementsToDelete)); } }
/// <summary> /// 获取同级菜单 /// </summary> /// <returns></returns> public string GetMenuItem(string loginKey, ref ErrorInfo err, int parentid, string statu, UrlHelper url) { try { using (DBEntities db = new DBEntities()) { List <MODULE> pt = null; ProInterface.IModule ems = new ProServer.Service(); string whereLamba = "a=>a.PARENT_ID==null"; var menu = ""; if (parentid == 0) { pt = ems.SysModuleWhere(loginKey, ref err, 1, 100, whereLamba, "SHOW_ORDER", "asc").Where(k => k.IS_HIDE == 0).ToList(); menu += "{\"id\": \"0\", \"text\": \"主菜单\",\"attributes\":\"\"},"; } else { var first = ems.SysModuleWhere(loginKey, ref err, 1, 100, "k=>k.ID==" + parentid, "SHOW_ORDER", "asc").Where(k => k.IS_HIDE == 0).ToList()[0]; // var first = db.YL_MODULE.SingleOrDefault(k => k.ID == parentid); MODULE ml = null; if (statu == "Next") { whereLamba = "a=>a.PARENT_ID.Value==" + parentid; pt = ems.SysModuleWhere(loginKey, ref err, 1, 100, whereLamba, "SHOW_ORDER", "asc").Where(k => k.IS_HIDE == 0).ToList(); ml = first; } else if (statu == "Pre") { if (first.PARENT_ID == null) { whereLamba = "a=>a.PARENT_ID==null"; pt = ems.SysModuleWhere(loginKey, ref err, 1, 100, whereLamba, "SHOW_ORDER", "asc").Where(k => k.IS_HIDE == 0).ToList(); } else { whereLamba = "a=>a.PARENT_ID.Value==" + first.PARENT_ID; pt = ems.SysModuleWhere(loginKey, ref err, 1, 100, whereLamba, "SHOW_ORDER", "asc").Where(k => k.IS_HIDE == 0).ToList(); } string tj = first.PARENT_ID == null ? "k=>k.ID==0" : "k=>k.ID==" + first.PARENT_ID; var qu = ems.SysModuleWhere(loginKey, ref err, 1, 100, tj, "SHOW_ORDER", "asc").Where(k => k.IS_HIDE == 0).ToList(); //var qu = db.YL_MODULE.Where(k => k.ID == first.PARENT_ID).ToList(); if (qu.Count > 0) { ml = qu[0]; } else { ml = new MODULE(); ml.NAME = "主菜单"; ml.ID = 0; } } if (ml.LOCATION.IsNullOrEmpty() == false) { ml.LOCATION = url.Content(ml.LOCATION); } menu += "{\"id\": \"" + ml.ID + "\", \"text\": \"" + ml.NAME + "\",\"attributes\":\"" + ml.LOCATION + "\"},"; } if (pt.Count > 0) { foreach (var p in pt) { if (p.LOCATION.IsNullOrEmpty() == false) { p.LOCATION = url.Content(p.LOCATION); } menu += "{\"id\": \"" + p.ID + "\", \"text\": \"" + p.NAME + "\",\"attributes\":\"" + p.LOCATION + "\"},"; } } menu = menu.Length > 0 ? menu.Substring(0, menu.Length - 1) : ""; return("[" + menu + "]"); } } catch { return(""); } }
protected void Page_Load(object sender, EventArgs e) { #region 获取当前权限表 ROLE myrole = new ROLE(); myrole.ROLEID = Convert.ToInt16(Session["roleid"].ToString()); myrole.GetModel(myrole.ROLEID); //获取整个表,里面包含当前所有权限的moduleid DataSet ds = new DataSet(); Authority myauthority = new Authority(); ds = myauthority.GetList("RoleID=" + myrole.ROLEID + ""); #endregion #region 父节点添加 //建立int来防止fathermoduleid相同来判断并且只建立一个fathernode int fathermoduleid = 100; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { MODULE mymodule = new MODULE(); //设立查询的moduleid mymodule.MODULEID = Convert.ToInt16(ds.Tables[0].Rows[i].ItemArray[2]); //获取实例module mymodule.GetModel(mymodule.MODULEID); //查询父节点 //获取父节点编号 int Ofathernodeid = Convert.ToInt16(mymodule.MODULE_FATHERID); //查询所有父节点的模块 MODULE fathermodule = new MODULE(); fathermodule.MODULEID = Ofathernodeid; fathermodule.GetModel(fathermodule.MODULEID); //查询结果中有重复取消在循环中进行判断,将重复的不执行 if (fathermoduleid != fathermodule.MODULEID) { //将当前查询到的父节点的id负值给Ofathernodeid fathermoduleid = fathermodule.MODULEID; //实例化本父节点 TreeNode FatherNode = new TreeNode(fathermodule.MODULE_NAME, fathermodule.MODULEID.ToString(), "", fathermodule.MODULE_URL, "_blank"); this.Tree_left.Nodes.Add(FatherNode); } } #endregion #region 子节点添加 for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { MODULE mymodule = new MODULE(); //设立查询的moduleid mymodule.MODULEID = Convert.ToInt16(ds.Tables[0].Rows[i].ItemArray[2]); //获取实例module mymodule.GetModel(mymodule.MODULEID); //实例化本子节点 if (mymodule.MODULE_FATHERID != 0) { //建立子节点 TreeNode Childnode = new TreeNode(mymodule.MODULE_NAME, mymodule.MODULEID.ToString().Trim(), "", mymodule.MODULE_URL, "_blank"); //this.Tree_left.Nodes.Add(Childnode); //遍历所有treenode查询出需要的treenode foreach (TreeNode myfathernode in Tree_left.Nodes) { MODULE mymodule1 = new MODULE(); mymodule1.MODULEID = Convert.ToInt16(myfathernode.Value); mymodule1.GetModel(mymodule1.MODULEID); if (Convert.ToInt16(mymodule1.MODULE_FATHERID) == 0 && mymodule.MODULE_FATHERID == mymodule1.MODULEID) { myfathernode.ChildNodes.Add(Childnode); } } } } #endregion }