private void UpdateRequiredKeys(HashSet <ParameterKey> requiredKeys, Dictionary <ParameterKey, ParameterDependency> allDependencies, ParameterKey key, HashSet <ParameterDependency> requiredDependencies) { if (requiredKeys.Add(key)) { ParameterDependency dependency; if (allDependencies.TryGetValue(key, out dependency)) { requiredDependencies.Add(dependency); foreach (var source in dependency.Sources) { // Add Dependencies (if not already overriden) // This is done only at this level because top-level keys dependencies are supposed to be present. var sourceMetadata = source.Metadatas.OfType <ParameterKeyValueMetadata>().FirstOrDefault(); if (sourceMetadata != null && sourceMetadata.DefaultDynamicValue != null && !allDependencies.ContainsKey(source)) { allDependencies[source] = new ParameterDependency { Destination = source, Dynamic = sourceMetadata.DefaultDynamicValue, Sources = sourceMetadata.DefaultDynamicValue.Dependencies }; } UpdateRequiredKeys(requiredKeys, allDependencies, source, requiredDependencies); } } } }
protected void btnSave_Click(object sender, EventArgs e) { ParameterDependency parameterDependency = new ParameterDependency(); for (int i = 0; i < gvDependencyTransaction.Rows.Count; i++) { parameterDependency.Parameter1 = (gvDependencyTransaction.Rows[i].FindControl("lblParam1") as Label).Text; parameterDependency.Parameter1Value = (gvDependencyTransaction.Rows[i].FindControl("lblParam1Value") as Label).Text; parameterDependency.Parameter2 = (gvDependencyTransaction.Rows[i].FindControl("lblParam2") as Label).Text; parameterDependency.Parameter2Value = (gvDependencyTransaction.Rows[i].FindControl("ddlParam2Value") as DropDownList).Text; int result = DBAccess.saveParameterDependencyValue(parameterDependency); if (result.Equals(0)) { ScriptManager.RegisterStartupScript(this, GetType(), "RecordsTextopenModaladded", "openErrorModal('Records insertion failed.');", true); return; } } bindParameterDependencyValue(ddlIP1.SelectedItem == null ? "" : ddlIP1.SelectedItem.ToString()); ScriptManager.RegisterStartupScript(this, typeof(Page), "Success" + 1, "<script>showpop5('Records saved successfully!')</script>", false); }
protected void btnSave_Click(object sender, EventArgs e) { try { for (int i = 0; i < gvDependencyTransaction.Rows.Count; i++) { ParameterDependency parameterDependency = new ParameterDependency(); parameterDependency.Parameter1 = (gvDependencyTransaction.Rows[i].FindControl("lblDependentParam") as Label).Text; parameterDependency.ParameterId1 = (gvDependencyTransaction.Rows[i].FindControl("hdDependentParamID") as HiddenField).Value; parameterDependency.Parameter2 = (gvDependencyTransaction.Rows[i].FindControl("hdIndependentParam") as HiddenField).Value; parameterDependency.ParameterId2 = (gvDependencyTransaction.Rows[i].FindControl("hdIndependentParamID") as HiddenField).Value; parameterDependency.Parameter2Value = (gvDependencyTransaction.Rows[i].FindControl("lblIndependentParamValue") as Label).Text; parameterDependency.LSL = (gvDependencyTransaction.Rows[i].FindControl("txtLSL") as TextBox).Text; parameterDependency.USL = (gvDependencyTransaction.Rows[i].FindControl("txtUSL") as TextBox).Text; if (parameterDependency.LSL == "" && parameterDependency.USL == "") { continue; } string result = DBAccess.saveUpdateParameterRelationshipData(parameterDependency); if (result == "Saved") { } else if (result == "Not Saved") { ScriptManager.RegisterStartupScript(this, GetType(), "RecordsTextopenModaladded", "openWarningrModal();", true); return; } else { ScriptManager.RegisterStartupScript(this, GetType(), "RecordsTextopenModaladded", "openErrorModal('Records insertion failed.');", true); return; } } } catch (Exception ex) { } btnView_Click(sender, e); ScriptManager.RegisterStartupScript(this, typeof(Page), "Success" + 1, "<script>showpop5('Records saved successfully!')</script>", false); }
protected void btnSave_Click(object sender, EventArgs e) { ParameterDependency parameterDependency = new ParameterDependency(); for (int i = 0; i < gvDependencyMaster.Rows.Count; i++) { string param1 = (gvDependencyMaster.Rows[i].FindControl("lblParam1") as Label).Text; string param2 = (gvDependencyMaster.Rows[i].FindControl("ddlParam2") as DropDownList).SelectedItem.ToString(); if (param1 == "" || param2 == "") { ScriptManager.RegisterStartupScript(this, GetType(), "RecordsTextopenModaladded", "openWarningModal('Dependent and Independent parameters required.');", true); return; } int result = DBAccess.saveParameterDependency(param1, param2, ddlInputModule.SelectedItem == null ? "" : ddlInputModule.SelectedItem.ToString()); if (result.Equals(0)) { ScriptManager.RegisterStartupScript(this, GetType(), "RecordsTextopenModaladded", "openErrorModal('Records insertion failed.');", true); return; } } bindParameterDependency(); ddlInputModule_SelectedIndexChanged(sender, e); ScriptManager.RegisterStartupScript(this, typeof(Page), "Success" + 1, "<script>showpop5('Records saved successfully!')</script>", false); }