internal void SaveProperties(Hashtable hshNewProps) { foreach (Control c in ControlCollection) { if (c.GetType() == typeof(TextBox)) { if (((TextBox)c).TextMode == TextBoxMode.Password) { if (((TextBox)c).Text != "") { string enc = CoreFunctions.Encrypt(((TextBox)c).Text, "kKGBJ768d3q78^#&^dsas"); hshNewProps.Add(c.ID, enc); } } else { hshNewProps.Add(c.ID, ((TextBox)c).Text); } } else if (c.GetType() == typeof(DropDownList)) { hshNewProps.Add(c.ID, ((DropDownList)c).SelectedValue); } else if (c.GetType() == typeof(CheckBox)) { hshNewProps.Add(c.ID, ((CheckBox)c).Checked.ToString()); } } _core.SaveProperties(intlistid, hshNewProps); }
protected void Button1_Click(object sender, EventArgs e) { bool success = true; SPSecurity.RunWithElevatedPrivileges(delegate() { Hashtable hshProps = new Hashtable(); hshProps.Add("IDColumn", ddlIDColumn.SelectedValue); hshProps.Add("SPColumn", ddlSPColumn.SelectedValue); if (ddlSharePointMatch.SelectedValue == "") { hshProps.Add("ItemMatch", ""); } else { hshProps.Add("ItemMatch", ddlSharePointMatch.SelectedValue + "|" + ddlIntegrationMatch.SelectedValue); } hshProps.Add("SecMatch", ddlSecMatch.SelectedValue); intcore.SaveProperties(intlistid, hshProps); hshProps = new Hashtable(); hshProps.Add("intlistid", intlistid); intcore.ExecuteQuery("Delete from INT_COLUMNS where INT_LIST_ID=@intlistid", hshProps, false); foreach (DropDownList ddl in ArrControls) { if (ddl.SelectedValue != "") { hshProps = new Hashtable(); hshProps.Add("intlistid", intlistid); hshProps.Add("SharePointColumn", ddl.ID); hshProps.Add("IntegrationColumn", ddl.SelectedValue); intcore.ExecuteQuery("INSERT INTO INT_COLUMNS (INT_LIST_ID, SharePointColumn, IntegrationColumn) VALUES (@intlistid, @SharePointColumn, @IntegrationColumn)", hshProps, false); } } if (Request["wizard"] == "1") { hshProps = new Hashtable(); hshProps.Add("intlistid", intlistid); string message = ""; if (intcore.InstallIntegration(intlistid, new Guid(Request["List"]), out message)) { intcore.ExecuteQuery("UPDATE INT_LISTS set active=1 where INT_LIST_ID=@intlistid", hshProps, true); } else { success = false; lblError.Text = message + "<br>"; lblError.Visible = true; } } if (chkCleanup.Checked) { intcore.ExecuteQuery("UPDATE INT_LISTS set lastsynch=null where INT_LIST_ID=@intlistid", hshProps, true); } intcore.CloseConnection(true); }); if (success) { if (Request["ret"] == "Manage") { SPUtility.Redirect("epmlive/integration/manage.aspx", SPRedirectFlags.RelativeToLayoutsPage, System.Web.HttpContext.Current); } else { SPUtility.Redirect("epmlive/integration/integrationlist.aspx?LIST=" + Request["List"], SPRedirectFlags.RelativeToLayoutsPage, System.Web.HttpContext.Current); } } }