protected void Button2_Click(object sender, EventArgs e)
 {
     SPSecurity.RunWithElevatedPrivileges(delegate()
     {
         string message = "";
         if (intcore.InstallIntegration(intlistid, new Guid(Request["List"]), out message))
         {
             lblInstallError.ForeColor = System.Drawing.Color.Green;
             lblInstallError.Text      = "Success";
         }
         else
         {
             lblInstallError.ForeColor = System.Drawing.Color.Red;
             lblInstallError.Text      = message;
         }
     });
 }
예제 #2
0
        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);
                }
            }
        }