public FrmMainScreen() { InitializeComponent(); this.BTN_NeueSuche.Top = this.BTN_Suchen.Top; this.BTN_NeueSuche.Left = this.BTN_Suchen.Left; this.BTN_NeueSuche_1.Left = this.BTN_Suchen_1.Left; this.BTN_NeueSuche_2.Left = this.BTN_Suchen_2.Left; this.BTN_NeueSuche_3.Left = this.BTN_Suchen_3.Left; this.BTN_OpenFolderDocumente.Top = this.BTN_Excel.Top; this.BTN_OpenFolderDocumente.Left = this.BTN_Excel.Left; FuncGeneral.Start(); this.BS_Eingabe = new BindingSource(); this.BS_Messwerte = new BindingSource(); this.BS_Ergebnis = new BindingSource(); this.DBGRID_Eingabe.DataSource = this.BS_Eingabe; this.DBGRID_Messwerte.DataSource = this.BS_Messwerte; this.DBGRID_Ergebnis.DataSource = this.BS_Ergebnis; this.toolStripMenuItem2.Image = Bmp.btg_exit; this.toolStripMenuItem1.Image = Bmp.btg_Excel; this.suchenToolStripMenuItem.Image = Bmp.btg_Requery; this.oeffnenToolStripMenuItem.Image = Bmp.btg_folder; this.TXT_Link_Eingabe.Focus(); }
private void CreateAll() { this.m_Datas.Clear(); this.CreateTableColumnList(); string cbx_name = ""; for (int i = 1; i <= 6; i++) { cbx_name = "CbxTabelle" + FuncString.FillForward(i.ToString(), "0", 2); ComboBox obj_cbx_tabelle = (ComboBox)FuncGeneral.GetControlByName(this, cbx_name); obj_cbx_tabelle.Items.Clear(); obj_cbx_tabelle.Items.AddRange(this.m_Tablelist.ToArray()); obj_cbx_tabelle.SelectedIndexChanged += new System.EventHandler(this.CbxTable_SelectedIndexChanged); obj_cbx_tabelle.SelectedIndex = obj_cbx_tabelle.Items.IndexOf(this.m_ClsIni.getValue("AuswahlTabelle", cbx_name)); cbx_name = "CbxSpalte" + FuncString.FillForward(i.ToString(), "0", 2); ComboBox obj_cbx_column = (ComboBox)FuncGeneral.GetControlByName(this, cbx_name); obj_cbx_column.SelectedIndex = obj_cbx_column.Items.IndexOf(this.m_ClsIni.getValue("AuswahlTabelle", cbx_name)); obj_cbx_column.SelectedIndexChanged += new System.EventHandler(this.CbxColumn_SelectedIndexChanged); cbx_name = "txtFilter" + FuncString.FillForward(i.ToString(), "0", 2); TextBox obj_txt_filter = (TextBox)FuncGeneral.GetControlByName(this, cbx_name); obj_txt_filter.Text = this.m_ClsIni.getValue("AuswahlTabelle", cbx_name); obj_txt_filter.TextChanged += new System.EventHandler(this.txtFilter_TextChanged); } for (int i = 1; i <= 2; i++) { cbx_name = "cbxAndOr" + FuncString.FillForward(i.ToString(), "0", 2); ComboBox obj_cbx_column = (ComboBox)FuncGeneral.GetControlByName(this, cbx_name); obj_cbx_column.SelectedIndex = obj_cbx_column.Items.IndexOf(this.m_ClsIni.getValue("AuswahlTabelle", cbx_name)); obj_cbx_column.SelectedIndexChanged += new System.EventHandler(this.cbxAndOr_SelectedIndexChanged); } }
private LedRound CreateLED(Control c) { LedRound led = new LedRound(); led.Name = FuncGeneral.GetControlName(led); c.Controls.Add(led); return(led); }
private InputBox CreateInputBox(Control c) { InputBox inp = new InputBox(); inp.Name = FuncGeneral.GetControlName(inp); c.Controls.Add(inp); return(inp); }
private GroupBox CreateGB(int PageNr) { GroupBox gb = new GroupBox(); gb.Name = FuncGeneral.GetControlName(gb); this.m_TabControlDaten.TabPages[PageNr].Controls.Add(gb); return(gb); }
private void bitButton1_Click(object sender, EventArgs e) { DialogResult msg = MessageBox.Show("Wollen Sie wirklich alle Excel-Instanzen beenden.", "Excel", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (msg == System.Windows.Forms.DialogResult.Yes) { FuncGeneral.KillProgram("EXCEL"); } }
public void SQL2Excel(string SQLBefehl, string Connection = "") { SQLHelper sqlHelper; if (Connection.Length > 0) { sqlHelper = new SQLHelper(Connection); } else { sqlHelper = new SQLHelper(); } sqlHelper.Cmd.CommandText = SQLBefehl; SqlDataReader reader = sqlHelper.Cmd.ExecuteReader(); int anz = reader.RecordsAffected; int anzCol = reader.FieldCount; int anzRow = 1; var data = new object[anzRow, anzCol]; int row = 0; anzRow = 0; bool first_start = true; while (reader.Read()) { if (first_start == true) { for (int i = 0; i < reader.FieldCount; i++) { data[row, i] = reader.GetName(i); } first_start = false; row++; anzRow++; FuncGeneral.Resize2D(ref data, row + 1, anzCol); } for (int i = 0; i < reader.FieldCount; i++) { data[row, i] = reader.GetValue(i); } row++; anzRow++; FuncGeneral.Resize2D(ref data, row + 1, anzCol); } reader.Close(); Microsoft.Office.Interop.Excel.Range range1 = this.XlWorkSheet.Cells[1, 1]; Microsoft.Office.Interop.Excel.Range range2 = this.XlWorkSheet.Cells[anzRow, anzCol]; Microsoft.Office.Interop.Excel.Range range = this.XlWorkSheet.get_Range(range1, range2); range.Value2 = data; sqlHelper = null; }
private void CreatePage() { int pageNumber = this.m_TabControlDaten.TabPages.Count; string textPage = "Seite " + (pageNumber + 1); this.m_TabControlDaten.TabPages.Add(textPage); this.m_TabControlDaten.TabPages[pageNumber].Name = FuncGeneral.GetControlName(this.m_TabControlDaten.TabPages[pageNumber]); this.m_TabControlDaten.TabPages[pageNumber].BackColor = Color.Silver; }
public FrmDatenauswertung() { InitializeComponent(); GlobalVar.Glb_SQLConnecton = m_ConnectionString; frm1 = new FrmDarstellung(); this.BS_Source = new BindingSource(); this.BS_Drain = new BindingSource(); this.sqlHelper = new SQLHelper(m_ConnectionString); List <SQLHelper.SQLSpalten> felder = new List <SQLHelper.SQLSpalten>(); SQLHelper.SQLSpalten feld; feld.Feldname = "Spalte"; feld.Feldtype = "nvarchar(50)"; felder.Add(feld); feld.Feldname = "Von"; feld.Feldtype = "datetime"; felder.Add(feld); feld.Feldname = "Bis"; feld.Feldtype = "datetime"; felder.Add(feld); this.sqlHelper.CheckTableSpalten("Auswahl", felder); this.DBGRID_Source.DataSource = this.BS_Source; this.DBGRID_Drain.DataSource = this.BS_Drain; FuncGeneral.Start(); glb_FrmMng = ClsFormularManager.CreateInstance(); glb_FrmMng.AddBitButtonCloseAll(); glb_FrmMng.AddButton(BtnStyle.btg_Graph, frm1.Name); this.ShowClose = true; ToolTip toolTip1 = new ToolTip(); toolTip1.AutoPopDelay = 0; toolTip1.ShowAlways = true; toolTip1.UseAnimation = false; toolTip1.SetToolTip(this.BTN_Menu, "Menue"); toolTip1.SetToolTip(this.BTN_Keyboard, "Tastatur"); toolTip1.SetToolTip(this.BTN_Close, "Programm beenden"); toolTip1.SetToolTip(this.BTN_Darstellung, "Grafik anzeigen"); toolTip1.SetToolTip(this.BTN_Delete, "Auswahl loeschen"); toolTip1.SetToolTip(this.BTN_SuchenLoeschen, "Suchfeld loeschen"); toolTip1.SetToolTip(this.BTN_Auswaehlen, "Auswaehlen"); this.toolStripMenuItem1.Image = Bmp.btg_esc; this.wwwwToolStripMenuItem.Image = Bmp.btg_pfeilre; }
private Label CreateLBL(Control c) { Label lbl = new Label(); lbl.Name = FuncGeneral.GetControlName(lbl); lbl.AutoSize = false; lbl.Text = lbl.Name; lbl.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; c.Controls.Add(lbl); return(lbl); }
public FrmMain() { this.m_errorTickerCounter = 0; this.m_errorNoRecords = 0; this.m_errorList = new List <string>(); this.m_errorList.Clear(); this.m_parameter = ClsSingeltonParameter.CreateInstance(); this.m_sqliteConnection = new SQLiteConnection(); this.m_sqliteConnection.ConnectionString = this.m_parameter.ConnectionString; this.m_sqliteConnection.Open(); this.m_sqliteCommand = new SQLiteCommand(this.m_sqliteConnection); FuncGeneral.Start(); this.InitializeComponent(); this.Width = 1024; this.Height = 768; this.m_formularManager = ClsSingeltonFormularManager.CreateInstance(); this.m_userManagement = ClsSingeltonUserManagement.CreateInstance(this); this.m_varCollect = ClsSingeltonVariablesCollecter.CreateInstance(); this.m_dataBinding = ClsSingeltonDataBinding.CreateInstance(); this.m_plcPara.ProgBar = this.BarPlcProgress; this.m_plcPara.LblStatus = this.lblState; this.m_plcPara.BtnStart = this.BtnStartPlc; this.m_plcPara.BtnStopp = this.BtnStoppPlc; this.m_plcPara.IP = this.m_parameter.PlcIp; this.m_plcPara.IP = "192.168.56.1"; this.m_plcPara.Rack = this.m_parameter.PlcRack; this.m_plcPara.Slot = this.m_parameter.PlcSlot; this.m_plcPara.LblPlc = this.LblPlcNoConnect; this.m_plc = ClsSingeltonPlc.CreateInstance(this.m_plcPara); this.m_language = ClsSingeltonLanguage.CreateInstance(this); this.FrmHeater = new FrmHeater(); this.FrmParameter = new FrmPara(); this.FrmInformation = new FrmInfo(); this.FrmService = new FrmServ(); this.FrmError = new FrmError(); this.FrmRelease = new FrmRelease(); this.FrmErrorReportingSystem = new FrmErrorReportingSystem(); this.FrmO2Curve = new FrmO2Curve(); this.BtnStartPlc.Click += new System.EventHandler(this.BtnStartPlc_Click); this.BtnStoppPlc.Click += new System.EventHandler(this.BtnStoppPlc_Click); this.TmrErrorTicker.Enabled = true; }
private void rotaBitButton1_Click(object sender, EventArgs e) { FuncGeneral.KillProgram("EXCEL"); ExcelHelper xls = new ExcelHelper(); xls.Workbook_Hinzufuegen(); this.m_SqlHelper.SQLBuilderHinzufuegen("", SQLHelper.SQLBuilder.NoSpace); int i = 0; bool add_select = true; foreach (string ert in this.m_Tablelist) { string table = m_Tablelist[i]; string[] cols = m_ColumnlistOutput[i]; foreach (string col in cols) { if (add_select == true) { add_select = false; this.m_SqlHelper.SQLBuilderHinzufuegen("SELECT TOP 100", SQLHelper.SQLBuilder.DeleteSQL); } string suchen = table + "." + col + ","; this.m_SqlHelper.SQLBuilderHinzufuegen(suchen, SQLHelper.SQLBuilder.NoSpace); } i++; } string sql = ""; string sql_where = ""; string sql_inner_join = ""; sql = this.m_SqlHelper.SQLBuilderHinzufuegen("", SQLHelper.SQLBuilder.NoSpace); sql = FuncGeneral.DeleteRight(sql, 1); this.m_SqlHelper.SQLBuilderHinzufuegen(sql, SQLHelper.SQLBuilder.DeleteSQL); sql = this.m_SqlHelper.SQLBuilderHinzufuegen("", SQLHelper.SQLBuilder.NoSpace); sql_inner_join = this.m_SqlHelperInnerJoin.SQLBuilderHinzufuegen("", SQLHelper.SQLBuilder.NoSpace); sql_where = this.m_SqlHelperWhere.SQLBuilderHinzufuegen("", SQLHelper.SQLBuilder.NoSpace); this.textBox2.Text = sql + sql_inner_join + sql_where; xls.SQL2Excel(this.textBox2.Text, m_ConnectionString); string file_name = "Messwerte" + FuncString.GetOnlyNumeric(FuncString.GetTimestamp()); xls.DateiSpeichern(file_name); xls.ExcelHelperClose(); xls = null; }
private void CreateTabControl() { int tabControlWidth = this.GB_Datenausgabe.Width - (2 * GlobalVar.Const_ControlSpacing + 1); // 2 * Abstand + 1 pixel int tabControlHeight = this.GB_Datenausgabe.Height - 25; // Top + Abstand this.m_TabControlDaten = new TabControl(); this.m_TabControlDaten.Top = 20; this.m_TabControlDaten.Left = GlobalVar.Const_ControlSpacing; this.m_TabControlDaten.Width = tabControlWidth; this.m_TabControlDaten.Height = tabControlHeight; this.m_TabControlDaten.ItemSize = new System.Drawing.Size(0, 39); this.m_TabControlDaten.Name = FuncGeneral.GetControlName(this.m_TabControlDaten); this.GB_Datenausgabe.Controls.Add(this.m_TabControlDaten); }
private DatenService ParseCommentService(string SymboleName, string Comment) { DatenService retval; string[] commentData = Comment.Split(':'); string comment = commentData[1]; retval.SymbolTabText = commentData[0]; retval.SymbolName = SymboleName; retval.Seite = this.m_TabInfo[retval.SymbolTabText]; retval.SymbolEinheit = FuncGeneral.Parse("\\[EH.*\\]", ref comment); int.TryParse(FuncString.GetOnlyNumeric(FuncGeneral.Parse("\\[ZE[0-9]\\]", ref comment)), out retval.Zeile); int.TryParse(FuncString.GetOnlyNumeric(FuncGeneral.Parse("\\[SP[0-9]\\]", ref comment)), out retval.Spalte); retval.SymbolKommentar = comment; return(retval); }
public frmMainScreen() { InitializeComponent(); FuncGeneral.Start(); glb_DataBinding = ClsDataBinding.CreateInstance(); frmMng = ClsFormularManager.CreateInstance(); frmMng.AddButton(BtnStyle.btg_Para, "FrmPara"); frmMng.AddButton(BtnStyle.btg_Service, "FrmService"); frmMng.AddButton(BtnStyle.btg_Freigabe, "FrmRelease"); frmMng.AddButton(BtnStyle.btg_Error, "FrmError"); frmMng.AddBitButtonCloseAll(); glb_plc = ClsPLC.CreateInstance(); helperMakroControl = new HelperMakroControl(); helperLibNoDave = new HelperLibNoDave(this); }
private void CreatePage(string Text) { int pageNumber = this.m_TabControlDaten.TabPages.Count; string textPage = Text; this.m_TabControlDaten.TabPages.Add(textPage); this.m_TabControlDaten.TabPages[pageNumber].Name = FuncGeneral.GetControlName(this.m_TabControlDaten.TabPages[pageNumber]); this.m_TabControlDaten.TabPages[pageNumber].BackColor = Color.Silver; int breite = this.m_TabControlDaten.Width - GlobalVar.Const_ControlSpacing * 3 - 2; int hoehe = this.m_TabControlDaten.Height - this.m_TabControlDaten.ItemSize.Height - GlobalVar.Const_ControlSpacing * 3 - 2; GroupBox gb = this.CreateGB(pageNumber); gb.Text = Text; gb.Left = GlobalVar.Const_ControlSpacing; gb.Top = GlobalVar.Const_ControlSpacing; gb.Width = breite; gb.Height = hoehe; this.m_GroupBoxDaten.Add(gb); }
public FrmDatenlogger() { InitializeComponent(); glb_DataBinding = ClsDataBinding.CreateInstance(); frmMng = ClsFormularManager.CreateInstance(); glb_plc = ClsPLC.CreateInstance(); sqlHelper = new SQLHelper(m_ConnectionString); FuncGeneral.Start(); this.ShowClose = true; this.LoadPlc(); this.BindConrols(); glb_plc.IP = "10.100.72.125"; glb_plc.Rack = 0; glb_plc.Slot = 2; glb_plc.Open(); glb_plc.Read(); this.CreateListView(); }
private void TXT_Link_Changed(object sender, EventArgs e) { TextBox txtBox = (TextBox)sender; TextBox txtBoxMesswerte = (TextBox)FuncGeneral.GetControlByName(this, "TXT_Link_Messwerte"); TextBox txtBoxErgebnis = (TextBox)FuncGeneral.GetControlByName(this, "TXT_Link_Ergebnis"); TextBox txtBoxEingabe = (TextBox)FuncGeneral.GetControlByName(this, "TXT_Link_Eingabe"); if (txtBox.Name.ToString() == "TXT_Link_Messwerte") { txtBoxErgebnis.Text = txtBox.Text; txtBoxEingabe.Text = txtBox.Text; } if (txtBox.Name.ToString() == "TXT_Link_Ergebnis") { txtBoxMesswerte.Text = txtBox.Text; txtBoxEingabe.Text = txtBox.Text; } if (txtBox.Name.ToString() == "TXT_Link_Eingabe") { txtBoxMesswerte.Text = txtBox.Text; txtBoxErgebnis.Text = txtBox.Text; } }
public FrmMainScreen() { InitializeComponent(); this.m_ClsIni = new ClsIni("cfg.ini"); this.m_Columnlist = new List <string[]>(); this.m_ColumnlistOutput = new List <string[]>(); this.m_Tablelist = new List <string>(); this.ShowClose = true; this.m_CanChange = false; this.m_SqlHelper = new SQLHelper(m_ConnectionString); this.m_SqlHelperWhere = new SQLHelper(m_ConnectionString); this.m_SqlHelperFrom = new SQLHelper(m_ConnectionString); this.m_SqlHelperInnerJoin = new SQLHelper(m_ConnectionString); this.m_Datas = new Hashtable(); this.m_TableInfo = new Hashtable(); this.m_BS_Auswahl = new BindingSource(); this.DBGRID_Auswahl.DataSource = this.m_BS_Auswahl; FuncGeneral.Start(); }
private void CbxTable_SelectedIndexChanged(object sender, EventArgs e) { ComboBox cbx_table = (ComboBox)sender; string nummer = FuncString.FillForward(FuncString.GetOnlyNumeric(cbx_table.Name), "0", 2); string obj_name = "CbxSpalte" + nummer; ComboBox cbx_column = (ComboBox)FuncGeneral.GetControlByName(this, obj_name); cbx_column.Items.Clear(); cbx_column.Items.AddRange(this.m_Columnlist[cbx_table.SelectedIndex]); int id = cbx_column.Items.IndexOf(this.m_ClsIni.getValue("AuswahlTabelle", obj_name)); if (id > -1) { cbx_column.SelectedIndex = id; } else { cbx_column.Text = ""; } this.m_ClsIni.setValue("AuswahlTabelle", cbx_table.Name, cbx_table.SelectedItem.ToString()); this.m_ClsIni.Save(); }
private void BTN_Excel_Click(object sender, EventArgs e) { if (FuncGeneral.ProgramRunning("EXCEL") == true) { MessageBox.Show("Excel ist noch offen. Bitte alle Exceldateien schliessen und Export nochmal starten."); } else { string link = this.TXT_Link_Eingabe.Text; ExcelHelper xl = new ExcelHelper(); xl.Workbook_Hinzufuegen(); query = "SELECT * FROM MW_KENNDATEN_EINGABE Where Link='" + link + "' order by link"; xl.Setze_TabelleBlatt("Sheet1"); xl.Setze_TabelleBlattName("Sheet1", "Eingabe"); xl.SQL2Excel(query, this.m_ConnectionString); query = "SELECT * FROM MW_ERGEBNIS Where Link='" + link + "' order by link"; xl.Setze_TabelleBlatt("Sheet2"); xl.Setze_TabelleBlattName("Sheet2", "Ergebnis"); xl.SQL2Excel(query, this.m_ConnectionString); query = "SELECT * FROM MW_WERTE_MESSUNG Where Link='" + link + "' order by link, messnr"; xl.Setze_TabelleBlatt("Sheet3"); xl.Setze_TabelleBlattName("Sheet3", "Messwerte"); xl.SQL2Excel(query, this.m_ConnectionString); xl.DateiSpeichern(link.TrimEnd()); xl.ExcelHelperClose(); GC.Collect(); } }
private void CreateSymbols() { int pageNr = 0; string symbolName = ""; string groupName = ""; string comment = ""; string groupNameBefore = ""; int row = 0; GroupBox groupBoxBefore = null; GroupBox groupBox = null; foreach (PLCDatas data in m_glb_PLC.Daten) { if (data.DatabaseNumber == 54) { m_Releases.Add(data.Symbolname, data.Comment); } } List <string> sortList = m_Releases.Keys.ToList(); sortList.Sort(); groupNameBefore = ""; int topGroupBox = 0; int colomnGroupBox = 0; int tabPagegheight = 0; int rest = 0; foreach (string symbol in sortList) { symbolName = symbol; comment = m_Releases[symbolName]; string[] kom = comment.Split(':'); comment = kom[1]; groupName = kom[0]; if (groupNameBefore != groupName) { row = 0; if (groupBoxBefore == null) { topGroupBox = GlobalVar.Const_ControlSpacing; colomnGroupBox = 0; } else { tabPagegheight = this.m_TabControlDaten.Height - this.m_TabControlDaten.ItemSize.Height - 8; rest = tabPagegheight - groupBoxBefore.Top - groupBoxBefore.Height - GlobalVar.Const_GroupBoxOffsetRest; if (rest < 0) { topGroupBox = GlobalVar.Const_ControlSpacing; colomnGroupBox++; if (colomnGroupBox > 1) { colomnGroupBox = 0; groupBoxBefore = null; row = 0; this.CreatePage(); pageNr++; } } else { topGroupBox = groupBoxBefore.Top + groupBoxBefore.Height + GlobalVar.Const_ControlSpacing; } } groupBox = this.CreateGB(pageNr); groupBox.Top = topGroupBox; groupBox.Left = colomnGroupBox * (GlobalVar.Const_GroupBoxWidth + GlobalVar.Const_ControlSpacing) + GlobalVar.Const_ControlSpacing; groupBox.Width = GlobalVar.Const_GroupBoxWidth; groupBox.Text = groupName; groupNameBefore = groupName; groupBoxBefore = groupBox; } tabPagegheight = this.m_TabControlDaten.Height - this.m_TabControlDaten.ItemSize.Height - 8; rest = tabPagegheight - groupBox.Top - groupBox.Height - GlobalVar.Const_GroupBoxOffsetRest;; if (rest < 0) { colomnGroupBox++; if (colomnGroupBox > 1) { colomnGroupBox = 0; groupBoxBefore = null; row = 0; this.CreatePage(); pageNr++; } row = 0; topGroupBox = GlobalVar.Const_ControlSpacing; groupBox = this.CreateGB(pageNr); groupBox.Top = topGroupBox; groupBox.Left = colomnGroupBox * (GlobalVar.Const_GroupBoxWidth + GlobalVar.Const_ControlSpacing) + GlobalVar.Const_ControlSpacing; groupBox.Width = GlobalVar.Const_GroupBoxWidth; groupBox.Text = groupName; groupNameBefore = groupName; groupBoxBefore = groupBox; } int ledTop = row * (GlobalVar.Const_LedHeigt + GlobalVar.Const_LedSpacing) + GlobalVar.Const_GroupBoxOffset; LedRound led = this.CreateLED(groupBox); led.Type = LEDType.Release; led.Name = FuncGeneral.GetControlName(led); led.Top = ledTop; led.Left = GlobalVar.Const_ControlSpacing; m_glb_DataBinding.AddList(this.Name, led.Name.ToString(), "State", "DB54." + symbolName); row++; groupBox.Height = row * (GlobalVar.Const_LedHeigt + GlobalVar.Const_LedSpacing) + GlobalVar.Const_GroupBoxOffset + GlobalVar.Const_LedSpacing; Label lbl = this.CreateLBL(groupBox); lbl.Top = led.Top; lbl.Height = led.Height; lbl.Left = led.Left + led.Width + GlobalVar.Const_ControlSpacing; lbl.Width = GlobalVar.Const_GroupBoxWidth - lbl.Left - GlobalVar.Const_ControlSpacing; lbl.Text = comment; } }
private void Form1_Load(object sender, EventArgs e) { this.helperLibNoDave.LoadPlcData(); this.LoadComponentBindings(); glb_plc.IP = "10.100.72.125"; glb_plc.Rack = 0; glb_plc.Slot = 2; glb_plc.Open(); glb_plc.Read(); FrmRelease frmRelease = new FrmRelease(); FrmError frmError = new FrmError(); FrmPara frmPara = new FrmPara(); FrmService frmService = new FrmService(); List <Helper.Valve> Schieber = new List <Helper.Valve>(); Schieber.Add(this.ValveV100); Schieber.Add(this.ValveV110); Schieber.Add(this.ValveV120); Schieber.Add(this.ValveV130); Schieber.Add(this.ValveV140); Schieber.Add(this.ValveV200); Schieber.Add(this.ValveV210); Schieber.Add(this.ValveV220); Schieber.Add(this.ValveV300); Schieber.Add(this.ValveV310); Schieber.Add(this.ValveV320); Schieber.Add(this.ValveV400); Schieber.Add(this.ValveV410); Schieber.Add(this.ValveV420); Schieber.Add(this.ValveV500); Schieber.Add(this.ValveV510); Schieber.Add(this.ValveV600); Schieber.Add(this.ValveV610); Schieber.Add(this.ValveV620); Schieber.Add(this.ValveV630); Schieber.Add(this.ValveV640); Schieber.Add(this.ValveV650); Schieber.Add(this.ValveV660); Schieber.Add(this.ValveV670); Schieber.Add(this.ValveV680); Schieber.Add(this.ValveV690); Schieber.Add(this.ValveV700); Schieber.Add(this.ValveV710); frmSchieber = new FrmSchieber[Schieber.Count]; int counter = 0; foreach (Helper.Valve schieber in Schieber) { schieber.Click += new System.EventHandler(this.valve); frmSchieber[counter] = new FrmSchieber(); frmSchieber[counter].TopMost = true; string frmName = "FrmSchieber" + schieber.Name; frmSchieber[counter].Name = frmName; string titelFormular = "Schieber " + schieber.Name.Substring(5, 2) + "." + schieber.Name.Substring(7); frmSchieber[counter].Text = titelFormular; frmMng.FormularAdd(frmSchieber[counter], frmName); frmSchieber[counter].BindDatas(FuncString.GetOnlyNumeric(schieber.Name)); Point xyValve = FuncGeneral.GetMiddle(schieber); Point xyFrm = FuncGeneral.GetMiddle(frmSchieber[counter]); Point valvePos = new Point(); valvePos.X = schieber.Left + xyValve.X; valvePos.Y = schieber.Top - xyValve.Y; frmSchieber[counter].Left = valvePos.X - xyFrm.X; frmSchieber[counter].Top = valvePos.Y - xyFrm.Y * 2 - xyValve.Y + 35; if (frmSchieber[counter].Left < 0) { frmSchieber[counter].Left = 0; } if (frmSchieber[counter].Top < 0) { frmSchieber[counter].Top = valvePos.Y + xyValve.Y + 70; } } List <Helper.Scale> Behaelter = new List <Helper.Scale>(); Behaelter.Add(this.ScaleT1); frmBehaelter = new FrmBehaelter[Behaelter.Count]; counter = 0; foreach (Helper.Scale behaelter in Behaelter) { behaelter.Click += new System.EventHandler(this.Behaelter); frmBehaelter[counter] = new FrmBehaelter(); frmBehaelter[counter].TopMost = true; string frmName = "FrmBehaelter" + behaelter.Name; frmBehaelter[counter].Name = frmName; string titelFormular = "Behaelter " + behaelter.Name.Substring(5, 2) + "." + behaelter.Name.Substring(7); frmBehaelter[counter].Text = titelFormular; frmMng.FormularAdd(frmBehaelter[counter], frmName); frmBehaelter[counter].BindDatas(FuncString.GetOnlyNumeric(behaelter.Name)); Point xyValve = FuncGeneral.GetMiddle(behaelter); Point xyFrm = FuncGeneral.GetMiddle(frmBehaelter[counter]); Point valvePos = new Point(); valvePos.X = behaelter.Left + xyValve.X; valvePos.Y = behaelter.Top - xyValve.Y; frmBehaelter[counter].Left = valvePos.X - xyFrm.X; frmBehaelter[counter].Top = valvePos.Y - xyFrm.Y * 2 - xyValve.Y + 35; if (frmBehaelter[counter].Left < 0) { frmBehaelter[counter].Left = 0; } if (frmBehaelter[counter].Top < 0) { frmBehaelter[counter].Top = valvePos.Y + xyValve.Y + 70; } ToolTip toolTip1 = new ToolTip(); toolTip1.AutoPopDelay = 0; toolTip1.ShowAlways = true; toolTip1.UseAnimation = false; toolTip1.SetToolTip(this.BTN_Menu, "Menue"); toolTip1.SetToolTip(this.BTN_Error, "Fehlermeldungen"); } this.Left = 0; this.Top = 0; this.Width = Screen.PrimaryScreen.Bounds.Width; this.Height = Screen.PrimaryScreen.Bounds.Height; this.timer1.Interval = 100; this.timer1.Enabled = true; }
private void CreateTableColumnList() { this.m_TableInfo.Clear(); string table_name = ""; this.m_Columnlist.Clear(); this.m_ColumnlistOutput.Clear(); List <string> columns = new List <string>(); List <string> all_columns = new List <string>(); this.m_Tablelist.Clear(); bool first_start = true; string table = ""; string left_txt = ""; foreach (string txt in this.richTextBox1.Lines) { if (txt.Length > 0) { table = txt; left_txt = txt.Substring(0, 1); if (left_txt == "[") { table = FuncGeneral.DeleteLeft(txt, 1); table = FuncGeneral.DeleteRight(table, 1); this.m_Tablelist.Add(table); if (first_start == true) { first_start = false; } else { this.m_Columnlist.Add(columns.ToArray()); this.m_ColumnlistOutput.Add(all_columns.ToArray()); } columns.Clear(); all_columns.Clear(); table_name = table; this.FillTableInfo(table_name); } else { TableStruct table_struc; table_struc.Table = table_name; string display = ""; left_txt = txt.Substring(0, 1); bool add_to_select = false; if (left_txt != "#") { display = txt; add_to_select = true; } else { display = FuncGeneral.DeleteLeft(txt, 1); } string[] daten = display.Split(';'); if (daten.Count() > 1) { table_struc.Column = daten[0]; table_struc.Display = daten[1]; } else { table_struc.Column = display; table_struc.Display = ""; } if (add_to_select) { columns.Add(table_struc.Column); } string key = table_struc.Table + table_struc.Column; all_columns.Add(table_struc.Column); table_struc.Columntype = (string)this.m_TableInfo[key]; this.m_Datas.Add(key, table_struc); } } } this.m_Columnlist.Add(columns.ToArray()); this.m_ColumnlistOutput.Add(all_columns.ToArray()); columns = null; }
private void btnStartQuery_Click(object sender, EventArgs e) { string cbx_name = ""; string txt_name = ""; string conjunction = ""; bool add_where = true; bool add_select = true; this.m_SqlHelper.SQLBuilderHinzufuegen("", SQLHelper.SQLBuilder.DeleteSQL); this.m_SqlHelperWhere.SQLBuilderHinzufuegen("", SQLHelper.SQLBuilder.DeleteSQL); for (int i = 1; i <= 6; i++) { cbx_name = "CbxTabelle" + FuncString.FillForward(i.ToString(), "0", 2); ComboBox obj_cbx_tabelle = (ComboBox)FuncGeneral.GetControlByName(this, cbx_name); cbx_name = "CbxSpalte" + FuncString.FillForward(i.ToString(), "0", 2); ComboBox obj_cbx_column = (ComboBox)FuncGeneral.GetControlByName(this, cbx_name); txt_name = "txtFilter" + FuncString.FillForward(i.ToString(), "0", 2); TextBox obj_txt_filter = (TextBox)FuncGeneral.GetControlByName(this, txt_name); if (obj_cbx_tabelle.SelectedItem != null) { string table = obj_cbx_tabelle.SelectedItem.ToString(); if (obj_cbx_column.SelectedItem != null) { if (add_select == true) { add_select = false; this.m_SqlHelper.SQLBuilderHinzufuegen("SELECT TOP 100", SQLHelper.SQLBuilder.DeleteSQL); } string column = obj_cbx_column.SelectedItem.ToString(); string suchen = table + column; TableStruct table_struct = (TableStruct)this.m_Datas[suchen]; string display = table_struct.Display; this.m_SqlHelper.SQLBuilderHinzufuegen(table, SQLHelper.SQLBuilder.NoSpace); this.m_SqlHelper.SQLBuilderHinzufuegen(".", SQLHelper.SQLBuilder.NoSpace); this.m_SqlHelper.SQLBuilderHinzufuegen(column, SQLHelper.SQLBuilder.NoSpace); if (display.Length > 0) { this.m_SqlHelper.SQLBuilderHinzufuegen(" AS"); this.m_SqlHelper.SQLBuilderHinzufuegen(display, SQLHelper.SQLBuilder.NoSpace); this.m_SqlHelper.SQLBuilderHinzufuegen(",", SQLHelper.SQLBuilder.NoSpace); } else { this.m_SqlHelper.SQLBuilderHinzufuegen(",", SQLHelper.SQLBuilder.NoSpace); } if (obj_txt_filter.Text.Length > 0) { if (add_where == true) { add_where = false; this.m_SqlHelperWhere.SQLBuilderHinzufuegen("WHERE", SQLHelper.SQLBuilder.DeleteSQL); } if (conjunction.Length > 0) { this.m_SqlHelperWhere.SQLBuilderHinzufuegen(conjunction); } if ((table_struct.Columntype == "char") || (table_struct.Columntype == "nchar")) { this.m_SqlHelperWhere.SQLBuilderHinzufuegen(table_struct.Table + "." + table_struct.Column); this.m_SqlHelperWhere.SQLBuilderHinzufuegen("LIKE"); this.m_SqlHelperWhere.SQLBuilderHinzufuegen("N'%", SQLHelper.SQLBuilder.NoSpace); this.m_SqlHelperWhere.SQLBuilderHinzufuegen(obj_txt_filter.Text, SQLHelper.SQLBuilder.NoSpace); this.m_SqlHelperWhere.SQLBuilderHinzufuegen("%'", SQLHelper.SQLBuilder.NoSpace); } else { this.m_SqlHelperWhere.SQLBuilderHinzufuegen(table_struct.Table + "." + table_struct.Column); this.m_SqlHelperWhere.SQLBuilderHinzufuegen("="); this.m_SqlHelperWhere.SQLBuilderHinzufuegen(obj_txt_filter.Text, SQLHelper.SQLBuilder.NoSpace); } if (i >= 1 || i < 3) { conjunction = " AND"; } if (i == 4) { conjunction = " " + this.cbxAndOr01.Text; } if (i == 5) { conjunction = " " + this.cbxAndOr02.Text; } } } } } string sql = ""; string sql_where = ""; string sql_inner_join = ""; sql = this.m_SqlHelper.SQLBuilderHinzufuegen("", SQLHelper.SQLBuilder.NoSpace); sql = FuncGeneral.DeleteRight(sql, 1); this.m_SqlHelper.SQLBuilderHinzufuegen(sql, SQLHelper.SQLBuilder.DeleteSQL); this.m_SqlHelperInnerJoin.SQLBuilderHinzufuegen("FROM", SQLHelper.SQLBuilder.DeleteSQL); this.m_SqlHelperInnerJoin.SQLBuilderHinzufuegen("MW_KENNDATEN_EINGABE"); this.m_SqlHelperInnerJoin.SQLBuilderHinzufuegen("INNER JOIN"); this.m_SqlHelperInnerJoin.SQLBuilderHinzufuegen("MW_ERGEBNIS"); this.m_SqlHelperInnerJoin.SQLBuilderHinzufuegen("ON"); this.m_SqlHelperInnerJoin.SQLBuilderHinzufuegen("MW_KENNDATEN_EINGABE.LINK = MW_ERGEBNIS.Link"); this.m_SqlHelperInnerJoin.SQLBuilderHinzufuegen("INNER JOIN"); this.m_SqlHelperInnerJoin.SQLBuilderHinzufuegen("MW_WERTE_MESSUNG"); this.m_SqlHelperInnerJoin.SQLBuilderHinzufuegen("ON"); this.m_SqlHelperInnerJoin.SQLBuilderHinzufuegen("MW_KENNDATEN_EINGABE.LINK = MW_WERTE_MESSUNG.Link"); sql = this.m_SqlHelper.SQLBuilderHinzufuegen("", SQLHelper.SQLBuilder.NoSpace); sql_inner_join = this.m_SqlHelperInnerJoin.SQLBuilderHinzufuegen("", SQLHelper.SQLBuilder.NoSpace); sql_where = this.m_SqlHelperWhere.SQLBuilderHinzufuegen("", SQLHelper.SQLBuilder.NoSpace); this.textBox1.Text = sql + sql_inner_join + sql_where; this.BindData(this.textBox1.Text, this.m_BS_Auswahl); }
private void Form1_Load(object sender, EventArgs e) { this.ShowClose = true; m_dataBinding.AddList(this, "Txt01", "Text", "DB50.P1_Qmin_1"); m_dataBinding.AddList(this, "Txt02", "Text", "DB50.P1_Qmin_2"); m_dataBinding.AddList(this, "Txt03", "Text", "DB50.P1_Qmin_3"); m_dataBinding.AddList(this, "Txt04", "Text", "DB50.P1_Qmin_4"); m_dataBinding.AddList(this, "Txt05", "Text", "DB50.P1_Qmin_5"); m_dataBinding.AddList(this, "Txt06", "Text", "DB50.P1_Qmin_1"); m_dataBinding.AddList(this, "Txt07", "Text", "DB50.P1_Qmin_2"); m_dataBinding.AddList(this, "Txt08", "Text", "DB50.P1_Qmin_3"); m_dataBinding.AddList(this, "Txt09", "Text", "DB50.P1_Qmin_4"); m_dataBinding.AddList(this, "Txt10", "Text", "DB50.P1_Qmin_5"); m_dataBinding.AddList(this, "Txt11", "Text", "DB50.P1_Qmin_1"); m_dataBinding.AddList(this, "Txt12", "Text", "DB50.P1_Qmin_2"); m_dataBinding.AddList(this, "Txt13", "Text", "DB50.P1_Qmin_3"); m_dataBinding.AddList(this, "Txt14", "Text", "DB50.P1_Qmin_4"); m_dataBinding.AddList(this, "Txt15", "Text", "DB50.P1_Qmin_5"); m_dataBinding.AddList(this, "Txt16", "Text", "DB51.P1_Qmin_1"); m_dataBinding.AddList(this, "Txt17", "Text", "DB51.P1_Qmin_2"); m_dataBinding.AddList(this, "Txt18", "Text", "DB51.P1_Qmin_3"); m_dataBinding.AddList(this, "Txt19", "Text", "DB51.P1_Qmin_4"); m_dataBinding.AddList(this, "Txt20", "Text", "DB51.P1_Qmin_5"); m_dataBinding.AddList(this, "Txt21", "Text", "DB50.P1_Qmin_1"); m_dataBinding.AddList(this, "Vnt01", "State", "DB52.Valve01"); m_dataBinding.AddList(this, "Vnt02", "State", "DB52.Valve02"); m_dataBinding.AddList(this, "Vnt03", "State", "DB52.Valve03"); m_dataBinding.AddList(this, "Vnt04", "State", "DB52.Valve04"); m_dataBinding.AddList(this, "Vnt05", "State", "DB52.Valve05"); m_dataBinding.AddList(this, "Vnt06", "State", "DB52.Valve01"); m_dataBinding.AddList(this, "Vnt07", "State", "DB52.Valve02"); m_dataBinding.AddList(this, "Vnt08", "State", "DB52.Valve03"); m_dataBinding.AddList(this, "Vnt09", "State", "DB52.Valve04"); m_dataBinding.AddList(this, "Vnt10", "State", "DB52.Valve05"); m_dataBinding.AddList(this, "Vnt11", "State", "DB52.Valve01"); m_dataBinding.AddList(this, "Pip01", "Flow", "DB53.Bit01"); m_dataBinding.AddList(this, "Pip02", "Flow", "DB53.Bit02"); m_dataBinding.AddList(this, "Pip03", "Flow", "DB53.Bit03"); m_dataBinding.AddList(this, "Pip04", "Flow", "DB53.Bit04"); m_dataBinding.AddList(this, "Pip05", "Flow", "DB53.Bit05"); m_dataBinding.AddList(this, "Pip06", "Flow", "DB53.Bit06"); m_dataBinding.AddList(this, "Pip07", "Flow", "DB53.Bit01"); m_dataBinding.AddList(this, "Pip08", "Flow", "DB53.Bit08"); m_dataBinding.AddList(this, "Pip09", "Flow", "DB53.Bit09"); m_dataBinding.AddList(this, "Pip10", "Flow", "DB53.Bit10"); m_dataBinding.AddList(this, "Pip11", "Flow", "DB53.Bit11"); m_dataBinding.AddList(this, "Pip12", "Flow", "DB53.Bit12"); m_dataBinding.AddList(this, "Pip13", "Flow", "DB53.Bit13"); m_dataBinding.AddList(this, "Pip14", "Flow", "DB53.Bit14"); m_dataBinding.AddList(this, "Pip15", "Flow", "DB53.Bit15"); m_dataBinding.AddList(this, "Led01", "State", "DB54.Bit20"); m_dataBinding.AddList(this, "Led02", "State", "DB54.Bit23"); m_dataBinding.AddList(this, "Led03", "State", "DB54.Bit24"); m_dataBinding.AddList(this, "Led04", "State", "DB54.Bit25"); m_dataBinding.AddList(this, "Led05", "State", "DB54.Bit27"); m_dataBinding.AddList(this, "Led06", "State", "DB54.Bit29"); this.m_language.SetLanguage(); this.m_formularManager.SetLanguage(); this.m_userManagement.SetUserRight(); this.m_formularManager.SetUserRight(); this.m_formularManager.AddBitButtonCloseAll(); this.m_formularManager.AddButton(CompBitButtonStyle.btg_Para, "FrmPara"); this.m_formularManager.AddButton(CompBitButtonStyle.btg_Info, "FrmInfo"); this.m_formularManager.AddButton(CompBitButtonStyle.btg_Service, "FrmServ"); this.m_formularManager.AddButton(CompBitButtonStyle.btg_Error, "FrmError"); this.m_formularManager.AddButton(CompBitButtonStyle.btg_Freigabe, "FrmRelease"); this.m_formularManager.AddButton(CompBitButtonStyle.btg_Meldesystem, "FrmErrorReportingSystem"); FuncGeneral.CentreObject(this.LblPlcNoConnect, this.GbxOutput); this.Text = "Demo"; }