public override bool Load() { bool ret = true; List <long> idlist = new List <long>(); if (Common.Conn == null) { Common.Conn = new SQLiteConnection(Common.ConnectionString); Common.Conn.Open(); } SQLiteDataReader myReader = null; SQLiteCommand myCommand = new SQLiteCommand(); //if (_SqlConnectionConnection.State == System.Data.ConnectionState.Open) // _SqlConnectionConnection.Close(); //_SqlConnectionConnection.ConnectionString = Common.ConnectionString; //_SqlConnectionConnection.Open(); try { myReader = null; myCommand.CommandText = @"SELECT * FROM [tblFormalParameter] WHERE [FunctionID]= " + this._FunctionID_tblFunction.FunctionID + " order by oIndex;"; myCommand.Connection = Common.Conn; myReader = myCommand.ExecuteReader(); while (myReader.Read()) { idlist.Add(myReader.GetInt64(myReader.GetOrdinal("PinID"))); } myReader.Close(); myCommand.Dispose(); // _SqlConnectionConnection.Close(); for (int i = 0; i < idlist.Count; i++) { tblFormalParameter tblformalparameter = new tblFormalParameter(); tblformalparameter.PinID = idlist[i]; tblformalparameter.m_FunctionID_tblFunction = m_FunctionID_tblFunction; tblformalparameter.Select(); this.Add(tblformalparameter); } } catch (SQLiteException ae) { System.Windows.Forms.MessageBox.Show(ae.Message); return(false); } return(ret); }
public tblFormalParameter(tblFormalParameter ToCopy) { _PinName = ToCopy._PinName; _PinID = ToCopy._PinID; _FunctionID = ToCopy._FunctionID; _Type = ToCopy._Type; _Class = ToCopy._Class; _Extensible = ToCopy._Extensible; _oIndex = ToCopy._oIndex; _Description = ToCopy._Description; _InitializeValue = ToCopy._InitializeValue; _EV_TXT = ToCopy._EV_TXT; _EV_EBL = ToCopy._EV_EBL; _Option = ToCopy._Option; }
public void funcset(string _pinname, string _pindescription) { string str; int oIndex; //acknowledge bool pinexist = false; foreach (tblFunction tblfunction in m_tblFunctionCollection) { if (!tblfunction.IsFunction) { oIndex = -1; pinexist = false; for (int i = 0; i < tblfunction.m_tblFormalParameterCollection.Count; i++) { str = tblfunction.m_tblFormalParameterCollection[i].PinName; if (oIndex < tblfunction.m_tblFormalParameterCollection[i].oIndex) { oIndex = tblfunction.m_tblFormalParameterCollection[i].oIndex; } if (_pinname == str) { pinexist = true; break; } } if (!pinexist) { tblFormalParameter tblformalparameter1 = new tblFormalParameter(); tblformalparameter1.PinName = _pinname; tblformalparameter1.Class = (int)VarClass.Internal; tblformalparameter1.PropertyType = true; tblformalparameter1.Description = _pindescription; tblformalparameter1.Type = (int)VarType.UDINT; tblformalparameter1.Extensible = false; tblformalparameter1.FunctionID = tblfunction.FunctionID; tblformalparameter1.oIndex = ++oIndex; tblformalparameter1.Insert(); } } } }
public bool CheckFormalparameterExistInFunction(string _str, out tblFormalParameter _tblformalparameter) { //string str = ""; string[] varname = _str.Split(new Char[] { '.' }); int count = varname.Length; //if (!IsFunction && !IsStandard) //{ // foreach (tblPou tblpou in tblSolution.m_tblSolution().Dummytblcontroller.m_tblPouCollection) // { // if (tblpou.pouName.ToUpper() == FunctionName.ToUpper()) // { // foreach (tblVariable tblvariable in tblpou.m_tblVariableCollection) // { // if (varname[0].ToUpper() == tblvariable.VarName.ToUpper()) // { // _id = tblvariable.VarNameID; // break; // } // } // break; // } // } //} //else //{ // _id = -1; //} foreach (tblFormalParameter tblformalparameter in m_tblFormalParameterCollection) { if (tblformalparameter.PinName.ToUpper() == varname[0].ToUpper()) { _tblformalparameter = tblformalparameter; return(true); } } _tblformalparameter = null; return(false); }
public bool IsFormalparameterexist(string _str, ref tblFormalParameter _tblformalparameter, ref string _subpropertytxt, ref byte _subproperty) { string str = ""; string[] varname = _str.Split(new Char[] { '.' }); int count = varname.Length; foreach (tblFormalParameter tblformalparameter in m_tblFormalParameterCollection) { if (tblformalparameter.PinName.ToLower() == varname[0]) { _tblformalparameter = tblformalparameter; for (int i = 1; i < count; i++) { str += varname[i] + "."; } if (str == "") { _subpropertytxt = ""; _subproperty = 0; return(true); } else { if (count == 2) { str = str.Remove(str.Length - 1, 1); if (varname[0] == "mode") { uint i = 1; MODE tmode; for (byte k = 0; k < 32; k++) { tmode = (MODE)i; if ((_Mode & i) != 0) { if (varname[1] == tmode.ToString().ToLower()) { _subpropertytxt = tmode.ToString(); _subproperty = k; return(true); } } i *= 2; } } if (varname[0] == "state") { uint i = 1; BlockState blockstate; for (byte k = 0; k < 32; k++) { blockstate = (BlockState)i; if ((_Mode & i) != 0) { if (varname[1] == blockstate.ToString().ToLower()) { _subpropertytxt = blockstate.ToString(); _subproperty = k; return(true); } } i *= 2; } } if ((varname[0] == "als") || (varname[0] == "ala") || (varname[0] == "alb") || (varname[0] == "aeb")) { uint i = 1; AlarmStatus tstatus; for (byte k = 0; k < 32; k++) { tstatus = (AlarmStatus)i; if ((Status & i) != 0) { if (varname[1] == tstatus.ToString().ToLower()) { _subpropertytxt = tstatus.ToString(); _subproperty = k; return(true); } } i *= 2; } } } else { return(false); } } return(true); } } return(false); }
public void funcsetorder() { string str; int oIndex; //acknowledge tblFormalParameter tblformalparameter1; foreach (tblFunction tblfunction in m_tblFunctionCollection) { if (!tblfunction.IsFunction) { oIndex = 10; for (int i = 0; i < tblfunction.m_tblFormalParameterCollection.Count; i++) { str = tblfunction.m_tblFormalParameterCollection[i].PinName; tblformalparameter1 = new tblFormalParameter(); switch (str) { case "Mode": tblformalparameter1.PinID = tblfunction.m_tblFormalParameterCollection[i].PinID; tblformalparameter1.Select(); tblformalparameter1.oIndex = 0; tblformalparameter1.Update(); break; case "State": tblformalparameter1.PinID = tblfunction.m_tblFormalParameterCollection[i].PinID; tblformalparameter1.Select(); tblformalparameter1.oIndex = 1; tblformalparameter1.Update(); break; case "ALS": tblformalparameter1.PinID = tblfunction.m_tblFormalParameterCollection[i].PinID; tblformalparameter1.Select(); tblformalparameter1.oIndex = 2; tblformalparameter1.Update(); break; case "ALA": tblformalparameter1.PinID = tblfunction.m_tblFormalParameterCollection[i].PinID; tblformalparameter1.Select(); tblformalparameter1.oIndex = 3; tblformalparameter1.Update(); break; case "ALB": tblformalparameter1.PinID = tblfunction.m_tblFormalParameterCollection[i].PinID; tblformalparameter1.Select(); tblformalparameter1.oIndex = 4; tblformalparameter1.Update(); break; case "AEB": tblformalparameter1.PinID = tblfunction.m_tblFormalParameterCollection[i].PinID; tblformalparameter1.Select(); tblformalparameter1.oIndex = 5; tblformalparameter1.Update(); break; case "OPN": tblformalparameter1.PinID = tblfunction.m_tblFormalParameterCollection[i].PinID; tblformalparameter1.Select(); tblformalparameter1.oIndex = 6; tblformalparameter1.Update(); break; case "OPH": tblformalparameter1.PinID = tblfunction.m_tblFormalParameterCollection[i].PinID; tblformalparameter1.Select(); tblformalparameter1.oIndex = 7; tblformalparameter1.Update(); break; case "OPM": tblformalparameter1.PinID = tblfunction.m_tblFormalParameterCollection[i].PinID; tblformalparameter1.Select(); tblformalparameter1.oIndex = 8; tblformalparameter1.Update(); break; case "MNN": tblformalparameter1.PinID = tblfunction.m_tblFormalParameterCollection[i].PinID; tblformalparameter1.Select(); tblformalparameter1.oIndex = 9; tblformalparameter1.Update(); break; default: tblformalparameter1.PinID = tblfunction.m_tblFormalParameterCollection[i].PinID; tblformalparameter1.Select(); tblformalparameter1.oIndex = oIndex++; tblformalparameter1.Update(); break; } } } } }
public bool IsVariable(string _str, ref tblController _tblcontroller, ref tblVariable _tblvariable, ref tblFormalParameter _tblformalparameter, ref string _subpropertytxt, ref byte _subproperty, ref bool _isrefernce) { string str = ""; int count = 0; _str = _str.ToLower(); string[] varname = _str.Split(new Char[] { '.' }); _subproperty = 0; count = varname.Length; // count = varname.Count(); if (varname != null) { if (IsFCSName(varname[0], ref _tblcontroller)) { for (int i = 1; i < count; i++) { str += varname[i] + "."; } if (str != "") { str = str.Remove(str.Length - 1, 1); if (_tblcontroller.GetGlobalPOU().IsVariable(str, ref _tblvariable, ref _isrefernce, ref _tblformalparameter, ref _subpropertytxt, ref _subproperty)) { } } } } return(false); }
public bool Contains(tblFormalParameter item) { return(List.Contains(item)); }
public int IndexOf(tblFormalParameter item) { return(List.IndexOf(item)); }
public void Insert(int index, tblFormalParameter item) { List.Insert(index, item); this.OntblFormalParameterChanged(EventArgs.Empty); }
public void Remove(tblFormalParameter item) { List.Remove(item); this.OntblFormalParameterChanged(EventArgs.Empty); }
public void Add(tblFormalParameter item) { List.Add(item); this.OntblFormalParameterChanged(EventArgs.Empty); }