public async Task <IActionResult> Edit(int id, [Bind("TypeId,TypeName,Status,CreateBy,CreateDate,UpdateBy,UpdateDate")] MasterTypes masterTypes) { if (id != masterTypes.TypeId) { return(NotFound()); } if (ModelState.IsValid) { try { int userId = int.Parse(masterTypes.UpdateBy); masterTypes.UpdateBy = _context.Users.SingleOrDefault(p => p.UserId == userId).UserName; masterTypes.UpdateDate = DateTime.Now; _context.Update(masterTypes); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MasterTypesExists(masterTypes.TypeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(RedirectToAction(nameof(Index))); }
public RCBConfiguration(MasterTypes mType, int mNo, int iNo) { string strRoutineName = "RCBConfiguration: RCBConfiguration"; try { masterType = mType; masterNo = mNo; IEDNo = iNo; report = null; config = null; ucrcb.btnDoneClick += new System.EventHandler(this.btnDone_Click); ucrcb.btnCancelClick += new System.EventHandler(this.btnCancel_Click); ucrcb.lvAIlistDoubleClick += new System.EventHandler(this.lvAIlist_DoubleClick); ucrcb.ucRCBListLoad += new System.EventHandler(this.ucRCBList_Load); ucrcb.comboBox1KeyUp += new System.Windows.Forms.KeyEventHandler(this.comboBox1_KeyUp); ucrcb.ChkListTriOptn.Click += new System.EventHandler(this.checkedListBox1_Click); addListHeaders(); fillOptions(); DTRCBTriggeredItems.Columns.Add("RCBAddress", typeof(string)); DTRCBTriggeredItems.Columns.Add("TriggeredItems", typeof(string)); } catch (Exception ex) { MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public DO(string doName, List <KeyValuePair <string, string> > doData, TreeNode tn, MasterTypes mType, int mNo, int iNo) { masterType = mType; masterNo = mNo; IEDNo = iNo; SetSupportedAttributes(); SetSupportedResponseTypes(); SetSupportedControlTypes(); try { donType = (doType)Enum.Parse(typeof(doType), doName); } catch (System.ArgumentException) { } if (doData != null && doData.Count > 0) { foreach (KeyValuePair <string, string> dokp in doData) { try { if (this.GetType().GetProperty(dokp.Key) != null) //Ajay: 02/07/2018 { this.GetType().GetProperty(dokp.Key).SetValue(this, dokp.Value); } } catch (System.NullReferenceException) { } } } }
public RCB(string aiName, List <KeyValuePair <string, string> > aiData, TreeNode tn, MasterTypes mType, int mNo, int iNo) { masterType = mType; masterNo = mNo; IEDNo = iNo; SetSupportedRCBAttributes(); try { ainType = (RcbType)Enum.Parse(typeof(RcbType), aiName); } catch (System.ArgumentException) { Utils.WriteLine(VerboseLevel.WARNING, "Enum argument {0} not supported!!!", aiName); } //Parse n store values... if (aiData != null && aiData.Count > 0) { foreach (KeyValuePair <string, string> aikp in aiData) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", aikp.Key, aikp.Value); try { if (this.GetType().GetProperty(aikp.Key) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(aikp.Key).SetValue(this, aikp.Value); } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", aikp.Key, aikp.Value); } } Utils.Write(VerboseLevel.DEBUG, "\n"); } }
public static List <string> getDataTypes(MasterTypes masterType) { if (masterType == MasterTypes.IEC103) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC103_EN_DataType")); } else if (masterType == MasterTypes.ADR) { return(Utils.getOpenProPlusHandle().getDataTypeValues("ADR_EN_DataType")); } else if (masterType == MasterTypes.MODBUS) { return(Utils.getOpenProPlusHandle().getDataTypeValues("MODBUS_EN_DataType")); } else if (masterType == MasterTypes.Virtual) { return(Utils.getOpenProPlusHandle().getDataTypeValues("Virtual_EN_DataType")); } //Namarta:7/72017 else if (masterType == MasterTypes.IEC101) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC101_EN_DataType")); } //else if (masterType == MasterTypes.IEC61850Client) // return Utils.getOpenProPlusHandle().getDataTypeValues("IEC61850_EN_DataType"); else { return(new List <string>()); } }
public static List <string> getDataTypes(MasterTypes masterType) { if (masterType == MasterTypes.IEC103) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC103_AI_DataType")); } else if (masterType == MasterTypes.ADR) { return(Utils.getOpenProPlusHandle().getDataTypeValues("ADR_AI_DataType")); } else if (masterType == MasterTypes.MODBUS) { return(Utils.getOpenProPlusHandle().getDataTypeValues("MODBUS_AI_DataType")); } else if (masterType == MasterTypes.Virtual) { return(Utils.getOpenProPlusHandle().getDataTypeValues("Virtual_AI_DataType")); } else if (masterType == MasterTypes.IEC101) //Namrata:7/7/2017 { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC101_AI_DataType")); } else if (masterType == MasterTypes.IEC104) //Namrata:22/05/2018 { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC104_AI_DataType")); } else { return(new List <string>()); } }
static bool DecryptMaster(FileInfo inputFile, byte[] decrypted) { var typeName = inputFile.Name.Replace(".msgpack.enc", ""); var targetType = MasterTypes.GetDeserializeType(typeName); var options = MessagePackSerializerOptions.Standard.WithCompression(MessagePackCompression.Lz4Block); if (targetType == null) { Console.WriteLine($"Not supported master {typeName}."); File.WriteAllText( inputFile.FullName.Replace(".msgpack.enc", ".json"), MessagePackSerializer.ConvertToJson(decrypted, options) ); } else { var result = MessagePackSerializer.Deserialize(targetType, decrypted, options); File.WriteAllText( inputFile.FullName.Replace(".msgpack.enc", ".json"), DumpToJson(result) ); } return(true); }
public static List <string> getResponseTypes(MasterTypes masterType) { if (masterType == MasterTypes.IEC103) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC103_DI_ResponseType")); } else if (masterType == MasterTypes.ADR) { return(Utils.getOpenProPlusHandle().getDataTypeValues("ADR_DI_ResponseType")); } else if (masterType == MasterTypes.MODBUS) { return(Utils.getOpenProPlusHandle().getDataTypeValues("MODBUS_DI_ResponseType")); } else if (masterType == MasterTypes.Virtual) { return(Utils.getOpenProPlusHandle().getDataTypeValues("Virtual_DI_ResponseType")); } //Namarta:07/07/2017 else if (masterType == MasterTypes.IEC101) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC101_DI_ResponseType")); } //else if (masterType == MasterTypes.IEC61850Client) // return Utils.getOpenProPlusHandle().getDataTypeValues("IEC61850_DI_ResponseType"); else { return(null); } }
public RCB(XmlNode aiNode, MasterTypes mType, int mNo, int iNo, bool imported) { string strRoutineName = "AI"; try { masterType = mType; masterNo = mNo; IEDNo = iNo; SetSupportedRCBAttributes(); //Parse n store values... Utils.WriteLine(VerboseLevel.DEBUG, "aiNode name: '{0}'", aiNode.Name); if (aiNode.Attributes != null) { //First set the root element value... try { ainType = (RcbType)Enum.Parse(typeof(RcbType), aiNode.Name); } catch (System.ArgumentException) { Utils.WriteLine(VerboseLevel.WARNING, "Enum argument {0} not supported!!!", aiNode.Name); } foreach (XmlAttribute item in aiNode.Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", item.Name, item.Value); try { if (this.GetType().GetProperty(item.Name) != null) //Ajay: 10/08/2018 { this.GetType().GetProperty(item.Name).SetValue(this, item.Value); } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", item.Name, item.Value); } } Utils.Write(VerboseLevel.DEBUG, "\n"); } else if (aiNode.NodeType == XmlNodeType.Comment) { isNodeComment = true; comment = aiNode.Value; } if (imported)//Generate a new unique id... { } } catch (Exception Ex) { MessageBox.Show(strRoutineName + ": " + "Error: " + Ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void OpenMasterList(MasterTypes masterType) { if (CheckIsFormOpen("frmMasterList")) { return; } formToOpen = new frmMasterList(masterType); formToOpen.MdiParent = this; formToOpen.Show(); }
public static List <string> GetControlModels(MasterTypes masterType) { if (masterType == MasterTypes.IEC61850Client) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC61850_ControlModels")); } else { return(new List <string>()); } }
public LPFile(XmlNode LPFileNode, MasterTypes mType, int mNo, int iNo, bool imported) { string StrRoutineName = "LPFile"; try { masterType = mType; masterNo = mNo; IEDNo = iNo; SetSupportedAttributes(); if (LPFileNode.Attributes != null) { try { LpFilenType = (LPFileType)Enum.Parse(typeof(LPFileType), LPFileNode.Name); } catch (System.ArgumentException) { } if (masterType == MasterTypes.LoadProfile) { foreach (XmlAttribute item in LPFileNode.Attributes) { try { if (this.GetType().GetProperty(item.Name) != null) { this.GetType().GetProperty(item.Name).SetValue(this, item.Value); } } catch (System.NullReferenceException) { } } } } else if (LPFileNode.NodeType == XmlNodeType.Comment) { isNodeComment = true; comment = LPFileNode.Value; } if (imported) { //Ajay: 10/10/2018 Commented //this.LPFileNo = (Globals.LPFileNo + 1).ToString(); } } catch (Exception ex) { MessageBox.Show(StrRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static List <string> getDataTypes(MasterTypes masterType) { if (masterType == MasterTypes.MODBUS) { return(Utils.getOpenProPlusHandle().getDataTypeValues("MODBUS_DI_DataType")); } //Namrata: 31/10/2017 if (masterType == MasterTypes.Virtual) { return(Utils.getOpenProPlusHandle().getDataTypeValues("Virtual_DI_DataType")); } else { return(new List <string>()); } }
public async Task <IActionResult> Create([Bind("TypeId,TypeName,Status,CreateBy,CreateDate")] MasterTypes masterTypes) { int userId = int.Parse(masterTypes.CreateBy); masterTypes.CreateBy = _context.Users.SingleOrDefault(p => p.UserId == userId).UserName; masterTypes.CreateDate = DateTime.Now; if (ModelState.IsValid) { _context.Add(masterTypes); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(RedirectToAction(nameof(Index))); }
public static List <string> getControlTypes(MasterTypes masterType) { if (masterType == MasterTypes.IEC103) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC103_DO_ControlType")); } if (masterType == MasterTypes.ADR) { return(Utils.getOpenProPlusHandle().getDataTypeValues("ADR_DO_ControlType")); } else if (masterType == MasterTypes.MODBUS) { return(Utils.getOpenProPlusHandle().getDataTypeValues("MODBUS_DO_ControlType")); } else if (masterType == MasterTypes.Virtual) { return(Utils.getOpenProPlusHandle().getDataTypeValues("Virtual_DO_ControlType")); } //Namrata:7/7/2017 else if (masterType == MasterTypes.IEC101) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC101_DO_ControlType")); } //Namrata:22/05/2018 else if (masterType == MasterTypes.IEC104) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC101_DO_ControlType")); } else if (masterType == MasterTypes.IEC61850Client) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC61850_DO_ControlType")); } //Namrata:23/05/2018 else if (masterType == MasterTypes.SPORT) { //Ajay: 02/07/2018 //return Utils.getOpenProPlusHandle().getDataTypeValues("SPORTMaster_DO_ControlType"); return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC101_DO_ControlType")); } //Ajay: 31/07/2018 //else if (masterType == MasterTypes.LoadProfile) //return Utils.getOpenProPlusHandle().getDataTypeValues("LoadProfile_DO_ControlType"); else { return(new List <string>()); } }
public frmMastersListEdit(MasterTypes editMasterOf, long editRecordID) { masterType = editMasterOf; recordID = editRecordID; InitializeComponent(); switch (masterType) { case MasterTypes.States: loadRespectiveData = new LoadData(LoadState); saveRespectiveData = new SaveData(SaveState); break; case MasterTypes.Cities: loadRespectiveData = new LoadData(LoadCity); saveRespectiveData = new SaveData(SaveCity); break; case MasterTypes.IdentityTypes: loadRespectiveData = new LoadData(LoadIdentityType); saveRespectiveData = new SaveData(SaveIdentityType); break; case MasterTypes.Relationships: loadRespectiveData = new LoadData(LoadRelationship); saveRespectiveData = new SaveData(SaveRelationship); break; case MasterTypes.Ranks: loadRespectiveData = new LoadData(LoadRank); saveRespectiveData = new SaveData(SaveRank); break; case MasterTypes.Units: loadRespectiveData = new LoadData(LoadUnit); saveRespectiveData = new SaveData(SaveUnit); break; case MasterTypes.QuarterTypes: loadRespectiveData = new LoadData(LoadQuarterType); saveRespectiveData = new SaveData(SaveQuarterType); break; default: break; } }
public DI(string diName, List <KeyValuePair <string, string> > diData, TreeNode tn, MasterTypes mType, int mNo, int iNo) { string strRoutineName = "DI"; try { masterType = mType; masterNo = mNo; IEDNo = iNo; SetSupportedAttributes(); SetSupportedResponseTypes(); //Namrata: 17/10/2017 SetSupportedDataTypes(); try { dinType = (diType)Enum.Parse(typeof(diType), diName); } catch (System.ArgumentException) { Utils.WriteLine(VerboseLevel.WARNING, "Enum argument {0} not supported!!!", diName); } if (diData != null && diData.Count > 0) { foreach (KeyValuePair <string, string> dikp in diData) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", dikp.Key, dikp.Value); try { if (this.GetType().GetProperty(dikp.Key) != null) //Ajay: 10/08/2018 { this.GetType().GetProperty(dikp.Key).SetValue(this, dikp.Value); } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "DI: Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", dikp.Key, dikp.Value); } } Utils.Write(VerboseLevel.DEBUG, "\n"); } } catch (Exception ex) { MessageBox.Show(strRoutineName + ": " + "Error:" + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//Ajay: 10/10/2018 Commented //public static List<string> getParamCode(MasterTypes masterType) //{ // if (masterType == MasterTypes.LoadProfile) // return Utils.getOpenProPlusHandle().getDataTypeValues("LoadProfile_LPFile_ParamCode"); // else // return new List<string>(); //} public LPFile(string LPFileName, List <KeyValuePair <string, string> > LpFileData, TreeNode tn, MasterTypes mType, int mNo, int iNo) { string strRoutineName = "DI"; try { masterType = mType; masterNo = mNo; IEDNo = iNo; SetSupportedAttributes(); try { LpFilenType = (LPFileType)Enum.Parse(typeof(LPFileType), LPFileName); } catch (System.ArgumentException) { Utils.WriteLine(VerboseLevel.WARNING, "Enum argument {0} not supported!!!", LPFileName); } if (LpFileData != null && LpFileData.Count > 0) { foreach (KeyValuePair <string, string> lpfilekp in LpFileData) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", lpfilekp.Key, lpfilekp.Value); try { if (this.GetType().GetProperty(lpfilekp.Key) != null) { this.GetType().GetProperty(lpfilekp.Key).SetValue(this, lpfilekp.Value); } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "LPFile: Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", lpfilekp.Key, lpfilekp.Value); } } Utils.Write(VerboseLevel.DEBUG, "\n"); } } catch (Exception ex) { MessageBox.Show(strRoutineName + ": " + "Error:" + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static List <string> getResponseTypes(MasterTypes masterType) { if (masterType == MasterTypes.IEC103) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC103_DI_ResponseType")); } else if (masterType == MasterTypes.ADR) { return(Utils.getOpenProPlusHandle().getDataTypeValues("ADR_DI_ResponseType")); } else if (masterType == MasterTypes.MODBUS) { return(Utils.getOpenProPlusHandle().getDataTypeValues("MODBUS_DI_ResponseType")); } else if (masterType == MasterTypes.Virtual) { return(Utils.getOpenProPlusHandle().getDataTypeValues("Virtual_DI_ResponseType")); } //Namrata:07/07/2017 else if (masterType == MasterTypes.IEC101) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC101_DI_ResponseType")); } //Namrata:22/05/2018 else if (masterType == MasterTypes.IEC104) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC101_DI_ResponseType")); } //Namrata:23/05/2018 else if (masterType == MasterTypes.SPORT) { return(Utils.getOpenProPlusHandle().getDataTypeValues("SportMaster_DI_ResponseType")); } //Ajay: 31/07/2018 //else if (masterType == MasterTypes.LoadProfile) // return Utils.getOpenProPlusHandle().getDataTypeValues("SportMaster_DI_ResponseType"); else { return(null); } }
public AI(string aiName, List <KeyValuePair <string, string> > aiData, TreeNode tn, MasterTypes mType, int mNo, int iNo) { string strRoutineName = "AI"; try { masterType = mType; masterNo = mNo; IEDNo = iNo; SetSupportedAttributes(); SetSupportedResponseTypes(); SetSupportedDataTypes(); try { ainType = (aiType)Enum.Parse(typeof(aiType), aiName); } catch (System.ArgumentException) { } if (aiData != null && aiData.Count > 0) //Parse n store values... { foreach (KeyValuePair <string, string> aikp in aiData) { try { if (this.GetType().GetProperty(aikp.Key) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(aikp.Key).SetValue(this, aikp.Value); } } catch (System.NullReferenceException) { } } } } catch (Exception ex) { MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public EN(string enName, List <KeyValuePair <string, string> > enData, TreeNode tn, MasterTypes mType, int mNo, int iNo) { masterType = mType; masterNo = mNo; IEDNo = iNo; SetSupportedAttributes(); //IMP: Call only after master types are set... SetSupportedResponseTypes(); //IMP: Call only after master types are set... SetSupportedDataTypes(); //IMP: Call only after master types are set... //First set the root element value... try { ennType = (enType)Enum.Parse(typeof(enType), enName); } catch (System.ArgumentException) { Utils.WriteLine(VerboseLevel.WARNING, "Enum argument {0} not supported!!!", enName); } //Parse n store values... if (enData != null && enData.Count > 0) { foreach (KeyValuePair <string, string> enkp in enData) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", enkp.Key, enkp.Value); try { if (this.GetType().GetProperty(enkp.Key) != null) //Ajay: 10/08/2018 { this.GetType().GetProperty(enkp.Key).SetValue(this, enkp.Value); } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", enkp.Key, enkp.Value); } } Utils.Write(VerboseLevel.DEBUG, "\n"); } }
public static List <string> getResponseTypes(MasterTypes masterType) { if (masterType == MasterTypes.IEC103) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC103_AO_ResponseType")); } else if (masterType == MasterTypes.ADR) { return(Utils.getOpenProPlusHandle().getDataTypeValues("ADR_AO_ResponseType")); } else if (masterType == MasterTypes.MODBUS) { return(Utils.getOpenProPlusHandle().getDataTypeValues("MODBUS_AO_ResponseType")); } else if (masterType == MasterTypes.Virtual) { return(Utils.getOpenProPlusHandle().getDataTypeValues("Virtual_AO_ResponseType")); } //Namrata:7/7/2017 else if (masterType == MasterTypes.IEC101) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC101_AO_ResponseType")); } //Namrata:22/05/2018 else if (masterType == MasterTypes.IEC104) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC101_AO_ResponseType")); } //Namrata:23/05/2018 else if (masterType == MasterTypes.SPORT) { return(Utils.getOpenProPlusHandle().getDataTypeValues("SportMaster_AO_ResponseType")); } else { return(new List <string>()); } }
static void EncryptMaster(FileInfo inputFile) { var typeName = inputFile.Name.Replace(".json", ""); var targetType = MasterTypes.GetDeserializeType(typeName); if (targetType == null) { Console.WriteLine($"Not supported master {typeName}."); return; } var options = MessagePackSerializerOptions.Standard.WithCompression(MessagePackCompression.Lz4Block); var result = JsonConvert.DeserializeObject( File.ReadAllText(inputFile.FullName), targetType, new TupleConverterIntInt <ChartLessonMaster>(), new TupleConverterIntEnum <ChartNoteCountMaster, ChartSectionType>() ); var output = MessagePackSerializer.Serialize(result, options); var encrypted = AssetDecryptor.Encrypt(output); File.WriteAllBytes(inputFile.FullName.Replace(".json", ".msgpack.enc"), encrypted); }
public DO(XmlNode doNode, MasterTypes mType, int mNo, int iNo, bool imported) { masterType = mType; masterNo = mNo; IEDNo = iNo; SetSupportedAttributes(); //IMP: Call only after master types are set... SetSupportedResponseTypes(); //IMP: Call only after master types are set... SetSupportedControlTypes(); //IMP: Call only after master types are set... //Parse n store values... Utils.WriteLine(VerboseLevel.DEBUG, "doNode name: '{0}'", doNode.Name); if (doNode.Attributes != null) { //First set the root element value... try { donType = (doType)Enum.Parse(typeof(doType), doNode.Name); } catch (System.ArgumentException) { Utils.WriteLine(VerboseLevel.WARNING, "Enum argument {0} not supported!!!", doNode.Name); } if (masterType == MasterTypes.ADR || masterType == MasterTypes.IEC101 || masterType == MasterTypes.IEC103 || masterType == MasterTypes.MODBUS || masterType == MasterTypes.Virtual) { foreach (XmlAttribute item in doNode.Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", item.Name, item.Value); try { if (this.GetType().GetProperty(item.Name) != null) //Ajay: 10/08/2018 { this.GetType().GetProperty(item.Name).SetValue(this, item.Value); } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", item.Name, item.Value); } } } //Namrata: 17/7/2017 if (masterType == MasterTypes.IEC61850Client) { if (doNode.Name == "DO") { foreach (XmlAttribute xmlattribute in doNode.Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", xmlattribute.Name, xmlattribute.Value); try { if (xmlattribute.Name == "ResponseType") { Iec61850DOResponseType = doNode.Attributes[1].Value; } else if (xmlattribute.Name == "Index") { Iec61850DOIndex = doNode.Attributes[2].Value; } else if (xmlattribute.Name == "FC") { fc = doNode.Attributes[3].Value; } else { if (this.GetType().GetProperty(xmlattribute.Name) != null) //Ajay: 10/08/2018 { this.GetType().GetProperty(xmlattribute.Name).SetValue(this, xmlattribute.Value); } } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "DI: Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", xmlattribute.Name, xmlattribute.Value); } } } } Utils.Write(VerboseLevel.DEBUG, "\n"); } else if (doNode.NodeType == XmlNodeType.Comment) { isNodeComment = true; comment = doNode.Value; } if (imported)//Generate a new unique id... { this.DONo = (Globals.DONo + 1).ToString(); //Commented as asked by Amol, 29/12/2k16: this.Index = (Globals.DOIndex + 1).ToString(); } }
public AO(XmlNode aiNode, MasterTypes mType, int mNo, int iNo, bool imported) { string strRoutineName = "AO"; try { masterType = mType; masterNo = mNo; IEDNo = iNo; SetSupportedAttributes(); SetSupportedResponseTypes(); SetSupportedDataTypes(); Utils.WriteLine(VerboseLevel.DEBUG, "aoNode name: '{0}'", aiNode.Name); if (aiNode.Attributes != null) { try { ainType = (aoType)Enum.Parse(typeof(aoType), aiNode.Name); } catch (System.ArgumentException) { Utils.WriteLine(VerboseLevel.WARNING, "Enum argument {0} not supported!!!", aiNode.Name); } if (masterType == MasterTypes.ADR || masterType == MasterTypes.IEC101 || masterType == MasterTypes.IEC103 || masterType == MasterTypes.MODBUS || masterType == MasterTypes.Virtual) { foreach (XmlAttribute item in aiNode.Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", item.Name, item.Value); try { if (this.GetType().GetProperty(item.Name) != null) //Ajay: 10/08/2018 { this.GetType().GetProperty(item.Name).SetValue(this, item.Value); } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", item.Name, item.Value); } } } //Namrata: 21/04/2018 // If master Type is IEC61850Client if (masterType == MasterTypes.IEC61850Client) { if (aiNode.Name == "AO") { foreach (XmlAttribute xmlattribute in aiNode.Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", xmlattribute.Name, xmlattribute.Value); try { if (xmlattribute.Name == "ResponseType") { Iec61850ResponseType = aiNode.Attributes[1].Value; } else if (xmlattribute.Name == "Index") { Iec61850Index = aiNode.Attributes[2].Value; } else if (xmlattribute.Name == "FC") { fc = aiNode.Attributes[3].Value; } else { if (this.GetType().GetProperty(xmlattribute.Name) != null) //Ajay: 10/08/2018 { this.GetType().GetProperty(xmlattribute.Name).SetValue(this, xmlattribute.Value); } } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "DI: Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", xmlattribute.Name, xmlattribute.Value); } } } } Utils.Write(VerboseLevel.DEBUG, "\n"); } else if (aiNode.NodeType == XmlNodeType.Comment) { isNodeComment = true; comment = aiNode.Value; } if (imported)//Generate a new unique id... { this.AONo = (Globals.AONo + 1).ToString(); if (masterType == MasterTypes.IEC103) { //Commented as asked by Amol, 29 / 12 / 2k16: //this.Index = (Globals.AIIndex + 1).ToString(); } else if (masterType == MasterTypes.ADR) { //Commented as asked by Amol, 29/12/2k16: this.Index = (Globals.AIIndex + 1).ToString(); } else if (masterType == MasterTypes.MODBUS) { //Commented as asked by Amol, 29 / 12 / 2k16: this.Index = (Globals.AIIndex + 1).ToString(); } } } catch (Exception Ex) { MessageBox.Show(strRoutineName + ": " + "Error: " + Ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public DI(XmlNode diNode, MasterTypes mType, int mNo, int iNo, bool imported) { string StrRoutineName = "DI"; try { masterType = mType; masterNo = mNo; IEDNo = iNo; SetSupportedAttributes(); SetSupportedResponseTypes(); SetSupportedDataTypes(); //Namrata:17/10/2017 if (diNode.Attributes != null) { try { dinType = (diType)Enum.Parse(typeof(diType), diNode.Name); } catch (System.ArgumentException) { } if (masterType == MasterTypes.ADR || masterType == MasterTypes.IEC101 || masterType == MasterTypes.IEC103 || masterType == MasterTypes.MODBUS || masterType == MasterTypes.Virtual || masterType == MasterTypes.IEC104 || masterType == MasterTypes.SPORT || masterType == MasterTypes.LoadProfile) //Ajay: 31/07/2018 LoadProfile added { foreach (XmlAttribute item in diNode.Attributes) { try { if (this.GetType().GetProperty(item.Name) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(item.Name).SetValue(this, item.Value); } } catch (System.NullReferenceException) { } } //Namrata: 17/7/2017 if (masterType == MasterTypes.ADR) { if (diNode.HasChildNodes) { if (diNode.ChildNodes[0].Name == "Event") { foreach (XmlAttribute xmlattribute in diNode.ChildNodes[0].Attributes) { try { if (this.GetType().GetProperty(xmlattribute.Name) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(xmlattribute.Name).SetValue(this, xmlattribute.Value); } } catch (System.NullReferenceException) { } } } } } } //Namrata: 17/7/2017 if (masterType == MasterTypes.IEC61850Client) { if (diNode.Name == "DI") { foreach (XmlAttribute xmlattribute in diNode.Attributes) { try { if (xmlattribute.Name == "ResponseType") { Iec61850DIResponseType = diNode.Attributes[1].Value; } else if (xmlattribute.Name == "Index") { Iec61850DIIndex = diNode.Attributes[2].Value; } else if (xmlattribute.Name == "FC") { fc = diNode.Attributes[3].Value; } else { if (this.GetType().GetProperty(xmlattribute.Name) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(xmlattribute.Name).SetValue(this, xmlattribute.Value); } } } catch (System.NullReferenceException) { } } } } } else if (diNode.NodeType == XmlNodeType.Comment) { isNodeComment = true; comment = diNode.Value; } if (imported) { this.DINo = (Globals.DINo + 1).ToString(); } } catch (Exception ex) { MessageBox.Show(StrRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public DO(XmlNode doNode, MasterTypes mType, int mNo, int iNo, bool imported) { masterType = mType; masterNo = mNo; IEDNo = iNo; SetSupportedAttributes(); SetSupportedResponseTypes(); SetSupportedControlTypes(); if (doNode.Attributes != null) { try { donType = (doType)Enum.Parse(typeof(doType), doNode.Name); } catch (System.ArgumentException) { } if (masterType == MasterTypes.ADR || masterType == MasterTypes.IEC103 || masterType == MasterTypes.MODBUS || masterType == MasterTypes.Virtual || masterType == MasterTypes.IEC104 || masterType == MasterTypes.SPORT || masterType == MasterTypes.LoadProfile) //Ajay: 31/07/2018 LoadProfile added { foreach (XmlAttribute item in doNode.Attributes) { try { if (this.GetType().GetProperty(item.Name) != null) { this.GetType().GetProperty(item.Name).SetValue(this, item.Value); } } catch (System.NullReferenceException) { } } } //Namrata: 08/05/2018 if (masterType == MasterTypes.IEC101) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(Utils.XMLFileName); XmlAttribute attrName = xmlDoc.CreateAttribute("Select"); attrName.Value = "ENABLE"; bool IsExist = false; arrAttributes.OfType <string>().ToList().ForEach(item => { if (!doNode.Attributes.OfType <XmlNode>().ToList().Select(x => x.Name).ToList().Contains(item)) { IsExist = true; } }); if (IsExist) { doNode.Attributes.SetNamedItem(attrName); } foreach (XmlAttribute item in doNode.Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", item.Name, item.Value); try { if (this.GetType().GetProperty(item.Name) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(item.Name).SetValue(this, item.Value); } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", item.Name, item.Value); } } } //Namrata: 17/7/2017 if (masterType == MasterTypes.IEC61850Client) { if (doNode.Name == "DO") { foreach (XmlAttribute xmlattribute in doNode.Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", xmlattribute.Name, xmlattribute.Value); try { if (xmlattribute.Name == "ResponseType") { //Ajay: 04/08/2018 Seq changed due to CModel added //Iec61850DOResponseType = doNode.Attributes[1].Value; Iec61850DOResponseType = doNode.Attributes["ResponseType"].Value; } else if (xmlattribute.Name == "Index") { //Ajay: 04/08/2018 Seq changed due to CModel added //Iec61850DOIndex = doNode.Attributes[2].Value; Iec61850DOIndex = doNode.Attributes["Index"].Value; } else if (xmlattribute.Name == "FC") { //Ajay: 04/08/2018 Seq changed due to CModel added //fc = doNode.Attributes[3].Value; fc = doNode.Attributes["FC"].Value; } else { if (this.GetType().GetProperty(xmlattribute.Name) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(xmlattribute.Name).SetValue(this, xmlattribute.Value); } } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "DI: Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", xmlattribute.Name, xmlattribute.Value); } } } } Utils.Write(VerboseLevel.DEBUG, "\n"); } else if (doNode.NodeType == XmlNodeType.Comment) { isNodeComment = true; comment = doNode.Value; } if (imported)//Generate a new unique id... { this.DONo = (Globals.DONo + 1).ToString(); //Commented as asked by Amol, 29/12/2k16: this.Index = (Globals.DOIndex + 1).ToString(); } }
public AO(XmlNode aiNode, MasterTypes mType, int mNo, int iNo, bool imported) { string strRoutineName = "AO"; try { masterType = mType; masterNo = mNo; IEDNo = iNo; SetSupportedAttributes(); SetSupportedResponseTypes(); SetSupportedDataTypes(); if (aiNode.Attributes != null) { try { ainType = (aoType)Enum.Parse(typeof(aoType), aiNode.Name); } catch (System.ArgumentException) { } if (masterType == MasterTypes.ADR || masterType == MasterTypes.IEC101 || masterType == MasterTypes.IEC103 || masterType == MasterTypes.MODBUS || masterType == MasterTypes.Virtual || masterType == MasterTypes.IEC104 || masterType == MasterTypes.LoadProfile) //Ajay: 31/07/2018 LoadProfile added { foreach (XmlAttribute item in aiNode.Attributes) { try { if (this.GetType().GetProperty(item.Name) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(item.Name).SetValue(this, item.Value); } } catch (System.NullReferenceException) { } } } //Namrata: 21/04/2018 #region If master Type is IEC61850Client if (masterType == MasterTypes.IEC61850Client) { if (aiNode.Name == "AO") { foreach (XmlAttribute xmlattribute in aiNode.Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", xmlattribute.Name, xmlattribute.Value); try { if (xmlattribute.Name == "ResponseType") { Iec61850ResponseType = aiNode.Attributes[1].Value; } else if (xmlattribute.Name == "Index") { Iec61850Index = aiNode.Attributes[2].Value; } else if (xmlattribute.Name == "FC") { fc = aiNode.Attributes[3].Value; } else { if (this.GetType().GetProperty(xmlattribute.Name) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(xmlattribute.Name).SetValue(this, xmlattribute.Value); } } } catch (System.NullReferenceException) { } } } } #endregion If master Type is IEC61850Client } else if (aiNode.NodeType == XmlNodeType.Comment) { isNodeComment = true; comment = aiNode.Value; } if (imported)//Generate a new unique id... { this.AONo = (Globals.AONo + 1).ToString(); } } catch (Exception Ex) { MessageBox.Show(strRoutineName + ": " + "Error: " + Ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public DI(XmlNode diNode, MasterTypes mType, int mNo, int iNo, bool imported) { string StrRoutineName = "DI"; try { masterType = mType; masterNo = mNo; IEDNo = iNo; SetSupportedAttributes(); SetSupportedResponseTypes(); //Namrata: 17/10/2017 SetSupportedDataTypes(); Utils.WriteLine(VerboseLevel.DEBUG, "diNode name: '{0}'", diNode.Name); if (diNode.Attributes != null) { try { dinType = (diType)Enum.Parse(typeof(diType), diNode.Name); } catch (System.ArgumentException) { Utils.WriteLine(VerboseLevel.WARNING, "Enum argument {0} not supported!!!", diNode.Name); } if (masterType == MasterTypes.ADR || masterType == MasterTypes.IEC101 || masterType == MasterTypes.IEC103 || masterType == MasterTypes.MODBUS || masterType == MasterTypes.Virtual) { foreach (XmlAttribute item in diNode.Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", item.Name, item.Value); try { if (this.GetType().GetProperty(item.Name) != null) //Ajay: 10/08/2018 { this.GetType().GetProperty(item.Name).SetValue(this, item.Value); } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "DI: Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", item.Name, item.Value); } } //Namrata: 17/7/2017 if (masterType == MasterTypes.ADR) { if (diNode.HasChildNodes) { if (diNode.ChildNodes[0].Name == "Event") { foreach (XmlAttribute xmlattribute in diNode.ChildNodes[0].Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", xmlattribute.Name, xmlattribute.Value); try { //To Get Values From XML if (this.GetType().GetProperty(xmlattribute.Name) != null) //Ajay: 10/08/2018 { this.GetType().GetProperty(xmlattribute.Name).SetValue(this, xmlattribute.Value); } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "DI: Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", xmlattribute.Name, xmlattribute.Value); } } } } } } //Namrata: 17/7/2017 if (masterType == MasterTypes.IEC61850Client) { if (diNode.Name == "DI") { foreach (XmlAttribute xmlattribute in diNode.Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", xmlattribute.Name, xmlattribute.Value); try { if (xmlattribute.Name == "ResponseType") { Iec61850DIResponseType = diNode.Attributes[1].Value; } else if (xmlattribute.Name == "Index") { Iec61850DIIndex = diNode.Attributes[2].Value; } else if (xmlattribute.Name == "FC") { fc = diNode.Attributes[3].Value; } else { if (this.GetType().GetProperty(xmlattribute.Name) != null) //Ajay: 10/08/2018 { this.GetType().GetProperty(xmlattribute.Name).SetValue(this, xmlattribute.Value); } } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "DI: Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", xmlattribute.Name, xmlattribute.Value); } } } } Utils.Write(VerboseLevel.DEBUG, "\n"); } else if (diNode.NodeType == XmlNodeType.Comment) { isNodeComment = true; comment = diNode.Value; } if (imported)//Generate a new unique id... { this.DINo = (Globals.DINo + 1).ToString(); } } catch (Exception ex) { MessageBox.Show(StrRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public frmMasterList(MasterTypes masterOf) { masterType = masterOf; InitializeComponent(); }