public UpdateParameter ( |
||
parameter | Parameter object. | |
리턴 | void |
protected void GrdParams_UpdateCommand(object source, DataGridCommandEventArgs e) { try { // init vars var objParam = new ParameterInfo(); // set values if (e.Item.ItemIndex > -1) { objParam.Id = Convert.ToInt32(grdParams.DataKeys[e.Item.ItemIndex]); } objParam.ModuleId = ModuleId; objParam.Name = ((TextBox)e.Item.FindControl(ControlNames.ParameterName)).Text; objParam.Type = ((DropDownList)e.Item.FindControl(ControlNames.ParameterType)).SelectedValue; if (objParam.IsArgumentRequired() || (SupportsFallbackValues && objParam.SupportsFallbackValue())) { objParam.TypeArgument = ((TextBox)e.Item.FindControl(ControlNames.ParameterArgument)).Text; } objParam.IsValueRequired = ((CheckBox)e.Item.FindControl(ControlNames.ParameterIsValueRequired)).Checked; // add/update param if (objParam.IsValidDefinition) { var objController = new ParameterController(Purpose); if (objParam.IsNew) { objController.AddParameter(objParam); } else { objController.UpdateParameter(objParam); } // clear edit row grdParams.EditItemIndex = -1; // bind data BindParameters(); } else { ErrorMessagePlaceHolder.Controls.Add( UI.Skins.Skin.GetModuleMessageControl( Localization.GetString(LocaleKeys.ParameterInvalidHeader, LocalResourceFile), Localization.GetString(LocaleKeys.ParameterInvalid, LocalResourceFile), ModuleMessage.ModuleMessageType.RedError)); } //Module failed to load } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
protected void GrdParams_UpdateCommand(object source, DataGridCommandEventArgs e) { try { // init vars var objParam = new ParameterInfo(); // set values if (e.Item.ItemIndex > -1) objParam.Id = Convert.ToInt32(grdParams.DataKeys[e.Item.ItemIndex]); objParam.ModuleId = ModuleId; objParam.Name = ((TextBox) e.Item.FindControl(ControlNames.ParameterName)).Text; objParam.Type = ((DropDownList) e.Item.FindControl(ControlNames.ParameterType)).SelectedValue; if (objParam.IsArgumentRequired() || (SupportsFallbackValues && objParam.SupportsFallbackValue())) objParam.TypeArgument = ((TextBox) e.Item.FindControl(ControlNames.ParameterArgument)).Text; objParam.IsValueRequired = ((CheckBox) e.Item.FindControl(ControlNames.ParameterIsValueRequired)).Checked; // add/update param if (objParam.IsValidDefinition) { var objController = new ParameterController(Purpose); if (objParam.IsNew) { objController.AddParameter(objParam); } else { objController.UpdateParameter(objParam); } // clear edit row grdParams.EditItemIndex = -1; // bind data BindParameters(); } else { ErrorMessagePlaceHolder.Controls.Add( UI.Skins.Skin.GetModuleMessageControl( Localization.GetString(LocaleKeys.ParameterInvalidHeader, LocalResourceFile), Localization.GetString(LocaleKeys.ParameterInvalid, LocalResourceFile), ModuleMessage.ModuleMessageType.RedError)); } //Module failed to load } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }