private void SetHiddenJsonData() { try { string Key = MCS.Web.Library.WebUtility.GetRequestParamString("key", string.Empty); if (!string.IsNullOrEmpty(Key)) { WfGlobalParameters parameters = WfGlobalParameters.LoadProperties(ParametersKey); WfServiceAddressDefinition def = parameters.ServiceAddressDefs[Key]; if (def == null) { return; } //hidResultData.Value = JSONSerializerExecute.Serialize(parameters.ServiceAddressDefs.Find(p=>p.Address==Key)); this.opKey.Value = def.Key; this.opKey.Disabled = true; this.txtServiceAddress.Text = def.Address; this.dropCredential.SelectedValue = def.Credential == null ? "" : def.Credential.Key; this.dropSendType.SelectedValue = def.RequestMethod.ToString(); this.ddlContentType.SelectedValue = def.ContentType.ToString(); } } catch (Exception ex) { WebUtility.ShowClientError(ex.Message, ex.StackTrace, "错误"); } }
public void GlobalAppProgramParametersRecursivelyReadTest() { WfGlobalParameters defaultSettings = WfGlobalParameters.LoadProperties("Default"); defaultSettings.Properties.SetValue("AppName", "SinoOcean"); defaultSettings.Properties.SetValue("ProgName", "DefaultProg"); defaultSettings.Update(); WfGlobalParameters appSettings = WfGlobalParameters.LoadProperties("ADMINISTRATION", "CONTRACT"); appSettings.Properties.SetValue("AppName", string.Empty); appSettings.Properties.SetValue("ProgName", "ContractProg"); appSettings.Update(); Thread.Sleep(500); string pvApp = WfGlobalParameters.GetValueRecursively("ADMINISTRATION", "CONTRACT", "AppName", "DefaultValue"); Assert.AreEqual("SinoOcean", pvApp); string pvProg = WfGlobalParameters.GetValueRecursively("ADMINISTRATION", "CONTRACT", "ProgName", "DefaultValue"); Assert.AreEqual("ContractProg", pvProg); }
protected void btnConfirm_Click(object sender, EventArgs e) { try { string key = this.opKey.Value.Trim(); string address = this.txtServiceAddress.Text.Trim(); string requestMethod = this.dropSendType.SelectedValue; string credentialKey = this.dropCredential.SelectedValue; WfNetworkCredential credential = new WfNetworkCredential(); WfGlobalParameters parameters = WfGlobalParameters.LoadProperties(ParametersKey); WfServiceAddressDefinition serviceAddress = parameters.ServiceAddressDefs[key]; if (serviceAddress == null) { serviceAddress = new WfServiceAddressDefinition(); } serviceAddress.Key = key; serviceAddress.Address = address; serviceAddress.RequestMethod = (WfServiceRequestMethod)Enum.Parse(typeof(WfServiceRequestMethod), requestMethod); serviceAddress.ContentType = (WfServiceContentType)Enum.Parse(typeof(WfServiceContentType), this.ddlContentType.SelectedValue); serviceAddress.Credential = parameters.Credentials.FirstOrDefault(p => p.Key == credentialKey); parameters.ServiceAddressDefs.Remove(p => p.Key == serviceAddress.Key); parameters.ServiceAddressDefs.Add(serviceAddress); parameters.Update(); WebUtility.RefreshParentWindow(); } catch (Exception ex) { throw ex; } }
protected override void OnPreRender(EventArgs e) { propertyGrid.Properties.Clear(); propertyGrid.Properties.CopyFrom(WfGlobalParameters.LoadProperties("Default").Properties); base.OnPreRender(e); }
private void GridBind() { WfGlobalParameters parameters = WfGlobalParameters.LoadProperties(WfGlobalParameters.Default.Key); WfNetworkCredentialCollection coll = parameters.Credentials; CredentialDeluxeGrid.DataSource = coll; CredentialDeluxeGrid.DataBind(); }
public void UpdateGlobalParameters(string key, string propertiesJson) { PropertyValueCollection properties = JSONSerializerExecute.Deserialize <PropertyValueCollection>(propertiesJson); WfGlobalParameters parameters = WfGlobalParameters.LoadProperties(key); parameters.Properties.Clear(); parameters.Properties.CopyFrom(properties); parameters.Update(); }
protected void ConfirmClick(object sender, EventArgs e) { var key = ServicesAddressDeluxeGrid.SelectedKeys.FirstOrDefault(); if (key != null) { WfGlobalParameters parameters = WfGlobalParameters.LoadProperties(WfGlobalParameters.Default.Key); var item = parameters.ServiceAddressDefs[key]; hiddenValue.Value = MCS.Web.Library.Script.JSONSerializerExecute.Serialize(item); this.ClientScript.RegisterStartupScript(this.GetType(), "ConfirmDialog", @"window.returnValue = (Sys.Serialization.JavaScriptSerializer.deserialize($('#hiddenValue').val())); window.close(); ", true); } }
public void GlobalAppProgramParametersReadTest() { WfGlobalParameters settings = WfGlobalParameters.LoadProperties("ADMINISTRATION", "CONTRACT"); settings.Properties.SetValue("AppName", "Seagull II"); settings.Update(); Thread.Sleep(500); WfGlobalParameters settingsLoaded = WfGlobalParameters.GetProperties("ADMINISTRATION", "CONTRACT"); Assert.AreEqual(settings.Properties["AppName"].StringValue, settingsLoaded.Properties["AppName"].StringValue); }
public void GlobalParametersReadTest() { WfGlobalParameters settings = WfGlobalParameters.LoadProperties("Default"); settings.Properties.SetValue("AppName", "SinoOcean"); settings.Update(); Thread.Sleep(500); WfGlobalParameters settingsLoaded = WfGlobalParameters.Default; Assert.AreEqual(settings.Properties["AppName"].StringValue, settingsLoaded.Properties["AppName"].StringValue); }
private void SetHiddenJsonData() { try { string Key = MCS.Web.Library.WebUtility.GetRequestParamString("key", string.Empty); if (!string.IsNullOrEmpty(Key)) { WfGlobalParameters parameters = WfGlobalParameters.LoadProperties(ParametersKey); WfNetworkCredential obj = parameters.Credentials.Find(p => p.Key == Key); this.txtKey.Value = obj.Key; this.txtLogonName.Value = obj.LogOnName; } } catch (Exception ex) { WebUtility.ShowClientError(ex.Message, ex.StackTrace, "错误"); } }
public string GetGlobalParametersJSON(string key) { WfApplicationProgramCodeName codeNames = new WfApplicationProgramCodeName(key); string programName = "全局参数"; WfProgramInApplicationCollection programs = WfApplicationAdapter.Instance.LoadProgramsByApplication(codeNames.ApplicationCodeName); WfProgram program = programs.Find(p => p.CodeName == codeNames.ProgramCodeName); if (program != null) { programName = program.Name; } var result = new { Key = key, Name = programName, Properties = WfGlobalParameters.LoadProperties(key).Properties }; return(JSONSerializerExecute.Serialize(result)); }
private void BindingData() { this.dropSendType.DataSource = Enum.GetNames(typeof(WfServiceRequestMethod)); this.dropSendType.DataBind(); this.ddlContentType.DataSource = Enum.GetNames(typeof(WfServiceContentType)); this.ddlContentType.DataBind(); WfGlobalParameters parameters = WfGlobalParameters.LoadProperties(ParametersKey); //parameters.Credentials this.dropCredential.DataSource = parameters.Credentials; this.dropCredential.DataTextField = "LogOnName"; this.dropCredential.DataValueField = "Key"; this.DataBind(); this.dropCredential.Items.Insert(0, new ListItem() { Text = "空", Value = "" }); }
protected void btnConfirm_Click(object sender, EventArgs e) { string key = this.txtKey.Value; string logonName = this.txtLogonName.Value; string password = this.txtPassword.Value; WfGlobalParameters parameters = WfGlobalParameters.LoadProperties(ParametersKey); WfNetworkCredential credential = parameters.Credentials.Find(obj => obj.Key == key); if (credential == null) { credential = new WfNetworkCredential(); credential.Key = key; } credential.LogOnName = logonName; credential.Password = password; parameters.Credentials.Remove(obj => obj.Key == key); parameters.Credentials.Add(credential); parameters.Update(); }