void LoadMenu() { con.open(); DataTable pram = con.execReturnDataTable("SELECT m.MenuID,t.Content FROM MEN_Menu m left join tblMD_Message t on t.MessageID= m.MenuID WHERE m.IsVisible= 'True' and ParentMenuID='Mnu' and t.Language='VN' order by m.Priority"); tblMenu = con.execReturnDataTable("SELECT m.MenuID,t.Content as Text, LOWER(dbo.fn_RemoveToneMark(t.Content)) as Content, m.ParentMenuID FROM MEN_Menu m left join tblMD_Message t on t.MessageID= m.MenuID WHERE m.IsVisible= 'True' and t.Language='VN'"); con.close(); foreach (DataRow item in pram.Rows) { TileGroup t = new TileGroup { Name = item["MenuID"].ToString(), Text = item["Content"].ToString() }; DataRow[] rows = tblMenu.Select("ParentMenuID = '" + t.Name + "'"); foreach (DataRow i in rows) { TileItem ti = new TileItem { Name = i["MenuID"].ToString(), Text = i["Text"].ToString() }; // ti.ItemClick += ti_ItemClick; t.Items.Add(ti); } lstGroup.Add(t); tileControl1.Groups.Add(t); } }
private void btnTestConnection_Click(object sender, EventArgs e) { strServer = txtServerName.Text.Trim(); strDatabase = txtDatabaseName.Text.Trim(); strUser = txtUserName.Text.Trim(); strPassword = txtPassword.Text.Trim(); if (strServer == "" || strDatabase == "" || strUser == "") { MessageBox.Show(this, "Test Connection string failed!", "Paradise", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { EzSqlCollection.EzSql2 ezsql2 = new EzSqlCollection.EzSql2(strServer, strDatabase, strUser, strPassword); ezsql2.open(); ezsql2.close(); MessageBox.Show(this, "Test Connection string successfully!", "Paradise", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show(this, "Test Connection string failed!", "Paradise", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnSave_Click(object sender, EventArgs e) { StaticVars.ConnectionString = String.Format("Server = {0}{1}Database = {2}{1}UID = {3}{1}PWD = {4}", txtServerName.Text.Trim(), SEMICOLON_CHAR, txtDatabaseName.Text.Trim(), txtUserName.Text.Trim(), txtPassword.Text.Trim()); try { EzSqlCollection.EzSql2 ezsql2 = new EzSqlCollection.EzSql2(txtServerName.Text.Trim(), txtDatabaseName.Text.Trim(), txtUserName.Text.Trim(), txtPassword.Text.Trim()); ezsql2.open(); ezsql2.close(); Methods.WriteFile(Encryption.EncryptText(StaticVars.ConnectionString, true)); MessageBox.Show(this, "Connection setting has saved successfully. Changes will be applied for the next log on.", "Paradise", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show(this, "Connection setting can not saved. Please re-install Paradise if you can.", "Paradise", MessageBoxButtons.OK, MessageBoxIcon.Error); } isNewConnection = false; }
private void btnClose_Click(object sender, EventArgs e) { if (!isNewConnection) { try { EzSqlCollection.EzSql2 ezsql2 = new EzSqlCollection.EzSql2(txtServerName.Text.Trim(), txtDatabaseName.Text.Trim(), txtUserName.Text.Trim(), txtPassword.Text.Trim()); ezsql2.open(); ezsql2.close(); Application.Restart(); } catch { MessageBox.Show(this, "Connection setting is not available.", "Paradise", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else Application.Exit(); }
private void btnClose_Click(object sender, EventArgs e) { if (!isNewConnection) { try { EzSqlCollection.EzSql2 ezsql2 = new EzSqlCollection.EzSql2(txtServerName.Text.Trim(), txtDatabaseName.Text.Trim(), txtUserName.Text.Trim(), txtPassword.Text.Trim()); ezsql2.open(); ezsql2.close(); Application.Restart(); } catch { MessageBox.Show(this, "Connection setting is not available.", "Paradise", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { Application.Exit(); } }
private void BaseForm_FormClosed(object sender, FormClosedEventArgs e) { DBEngine.close(); }