Exemplo n.º 1
0
        private void InsertMonitorCommands()
        {
            HiddenField1.Value = "Insert";
            var monitorCommand = new MonitorCommand()
            {
                Name = txtName.Text.Trim(),
                Type = ddlType.SelectedValue.Trim(),
                Arg1 = txtArg1.Text.Trim(),
                Arg2 = txtArg2.Text.Trim()
            };

            try
            {
                monitorCommand.Unit =
                    monitorCommandHelps.Find
                        (x => x.Type == monitorCommand.Type).Unit;
                monitorDb.InsertMonitorCommand(monitorCommand);
                Response.Redirect(Request.RawUrl);
            }
            catch (Exception ex)
            {
                throw new Exception($"Exception:{ex.Message}");
            }
        }