private void btnInstall_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Multiselect = false; dialog.Filter = "UDT 定議 (*.tsml;*.tml)|*.tsml;*.tml"; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { try { ConnectionHelper conn = ConnectionHelper.GetConnection(PrimaryKey); XElement udsdef = XElement.Load(dialog.FileName); if (dialog.FileName.EndsWith(".tsml", StringComparison.InvariantCultureIgnoreCase)) { conn.CallService("UDTService.DDL.SetTables", new Envelope(new XStringHolder(udsdef.ToString()))); } else if (dialog.FileName.EndsWith(".tml", StringComparison.InvariantCultureIgnoreCase)) { conn.CallService("UDTService.DDL.SetTable", new Envelope(new XStringHolder(udsdef.ToString()))); } else { throw new ArgumentException("不支援的格式!"); } MessageBox.Show("安裝/更新 UDT 完成。"); OnPrimaryKeyChanged(EventArgs.Empty); } catch (Exception ex) { RTOut.WriteError(ex); MessageBox.Show(ex.Message); } } }
private void btnReset_Click(object sender, EventArgs e) { try { ConnectionHelper ch = ConnectionHelper.GetConnection(PrimaryKey); DataGridViewRow row = dgvTransfers.SelectedRows[0]; string uid = row.Tag.ToString(); string sql = "update $st_transferout set status='1', transfertarget=null,accepttoken=null where uid='" + uid + "';"; XElement req = new XElement("Request", new XElement("Command", sql)); Envelope rsp = ch.CallService("UDTService.DML.Command", new Envelope(new XStringHolder(req))); OnPrimaryKeyChanged(EventArgs.Empty); } catch (Exception ex) { MessageBox.Show(ex.Message); } }