protected void Page_Load(object sender, EventArgs e)
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                try
                {
                    intlistid = new Guid(Request["intlistid"]);
                }
                catch { }
                try
                {
                    moduleid = new Guid(Request["module"]);
                }
                catch { }

                intcore  = new API.Integration.IntegrationCore(Web.Site.ID, Web.ID);
                intadmin = new API.Integration.IntegrationAdmin(intcore, intlistid, moduleid);


                PageHead = intadmin.GetIntegrationHeader();

                Hashtable hshProps = new Hashtable();
                if (intlistid != Guid.Empty)
                {
                    hshProps = intcore.GetProperties(intlistid);
                }

                XmlDocument doc = intcore.GetModuleProperties(intlistid, moduleid);

                XmlNode ndCon = doc.FirstChild.SelectSingleNode("/Properties/Connection");

                lblMain.Controls.AddAt(0, intadmin.GetPropertyPanel(ndCon, hshProps, this));



                if (Request["wizard"] == "1")
                {
                    Button1.Text = "Next >";
                    InputFormSection4.Visible = false;
                }

                Button1.OnClientClick = "CheckConnection();";
                Button2.OnClientClick = "Install();";
            });
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool removed = false;

            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                try
                {
                    intlistid = new Guid(Request["intlistid"]);
                }catch {}
                try
                {
                    moduleid = new Guid(Request["module"]);
                }catch {}

                intcore  = new API.Integration.IntegrationCore(Web.Site.ID, Web.ID);
                intadmin = new API.Integration.IntegrationAdmin(intcore, intlistid, moduleid);



                string message = "";
                if (!intadmin.DeleteIntegration(intlistid, out message))
                {
                    lblError.Text = "Error: " + message;
                }
                else
                {
                    removed = true;
                }
            });

            if (removed)
            {
                SPUtility.Redirect("epmlive/integration/integrationlist.aspx?LIST=" + Request["List"], SPRedirectFlags.RelativeToLayoutsPage, System.Web.HttpContext.Current);
            }
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ddlTimed.Attributes.Add("OnChange", "ChangeTimed()");
            ddlScheduleType.Attributes.Add("OnChange", "ChangeSchedule()");

            //if(!IsPostBack)
            {
                for (int i = 1; i < 31; i++)
                {
                    ddlDayOfMonth.Items.Add(i.ToString());
                }


                for (int i = 0; i < 24; i++)
                {
                    ddlHour.Items.Add(new ListItem(i.ToString() + ":00", i.ToString()));
                }
            }

            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                try
                {
                    intlistid = new Guid(Request["intlistid"]);
                }
                catch { }

                lblID.Text = intlistid.ToString();

                try
                {
                    moduleid = new Guid(Request["module"]);
                }
                catch { }

                intcore  = new API.Integration.IntegrationCore(Web.Site.ID, Web.ID);
                intadmin = new API.Integration.IntegrationAdmin(intcore, intlistid, moduleid);


                PageHead = intadmin.GetIntegrationHeader();

                Hashtable hshProps = new Hashtable();
                if (intlistid != Guid.Empty)
                {
                    hshProps = intcore.GetProperties(intlistid);
                }

                XmlDocument doc = intcore.GetModuleProperties(intlistid, moduleid);

                XmlNode ndCon = doc.FirstChild.SelectSingleNode("/Properties/General");

                lblMain.Controls.AddAt(0, intadmin.GetPropertyPanel(ndCon, hshProps, this));

                try
                {
                    lblURL.Text = intcore.GetAPIUrl(Web.Site.WebApplication.Id);
                }
                catch { }
                Dictionary <string, string> sASO = intcore.GetDropDownProperties(intadmin.ModuleID, intadmin.intlistid, new Guid(Request["LIST"]), "AvailableSynchOptions", "") ??
                                                   new Dictionary <string, string>();

                if (sASO.Count == 0)
                {
                    sASO.Add("LI", "LI");
                    sASO.Add("LO", "LO");
                    sASO.Add("TO", "TO");
                    sASO.Add("TI", "TI");
                }

                if (!sASO.ContainsKey("LI"))
                {
                    chkLin.Enabled = false;
                }
                if (!sASO.ContainsKey("LO"))
                {
                    chkLout.Enabled = false;
                }
                if (!sASO.ContainsKey("TO"))
                {
                    ddlTimed.Items.Remove(ddlTimed.Items.FindByValue("out"));
                }
                if (!sASO.ContainsKey("TI"))
                {
                    ddlTimed.Items.Remove(ddlTimed.Items.FindByValue("in"));
                }

                if (intlistid != Guid.Empty)
                {
                    if (!IsPostBack)
                    {
                        Hashtable hshParms = new Hashtable();
                        hshParms.Add("intlistid", intlistid);
                        DataSet dsInfo = intcore.GetDataSet("SELECT * FROM INT_LISTS where INT_LIST_ID=@intlistid", hshParms);
                        DataRow dr     = dsInfo.Tables[0].Rows[0];

                        lblKey.Text = dr["INT_KEY"].ToString();

                        if (dr["LIVEOUTGOING"].ToString() == "True")
                        {
                            chkLout.Checked = true;
                        }
                        if (dr["LiveIncoming"].ToString() == "True")
                        {
                            chkLin.Checked = true;
                        }


                        if (dr["TIMEOUTGOING"].ToString() == "True")
                        {
                            ddlTimed.SelectedValue = "out";
                        }
                        if (dr["TIMEINCOMING"].ToString() == "True")
                        {
                            ddlTimed.SelectedValue = "in";
                        }

                        try
                        {
                            chkDeleteList.Checked = bool.Parse(hshProps["AllowDeleteList"].ToString());
                        }
                        catch { }
                        try
                        {
                            chkDeleteInt.Checked = bool.Parse(hshProps["AllowDeleteInt"].ToString());
                        }
                        catch { }

                        try
                        {
                            chkAddList.Checked = bool.Parse(hshProps["AllowAddList"].ToString());
                        }
                        catch { }
                        try
                        {
                            chkAddInt.Checked = bool.Parse(hshProps["AllowAddInt"].ToString());
                        }
                        catch { }
                    }
                }
                else
                {
                    chkLout.Checked = true;
                }


                if (lblKey.Text == "")
                {
                    lblKey.Text = Guid.NewGuid().ToString("N") + Guid.NewGuid().ToString("N");
                }

                if (Request["wizard"] == "1")
                {
                    Button1.Text = "Next >";
                }

                if (!IsPostBack)
                {
                    if (ddlTimed.SelectedValue != "")
                    {
                        using (var connection = new SqlConnection(CoreFunctions.getConnectionString(Web.Site.WebApplication.Id)))
                        {
                            connection.Open();

                            using (var command = new SqlCommand("SELECT scheduletype, runtime, days from TIMERJOBS where listguid=@listguid and jobtype=70 and [key]=@key", connection))
                            {
                                command.Parameters.AddWithValue("@listguid", Request["List"]);
                                command.Parameters.AddWithValue("@key", Request["intlistid"]);
                                using (var dataReader = command.ExecuteReader())
                                {
                                    if (dataReader.Read())
                                    {
                                        ddlScheduleType.SelectedValue = dataReader.GetInt32(0).ToString();
                                        if (ddlScheduleType.SelectedValue == "2")
                                        {
                                            ddlHour.SelectedValue = dataReader.GetInt32(1).ToString();

                                            var arrayList = new ArrayList(dataReader.GetString(2).Split(','));
                                            foreach (ListItem listItem in chkDayOfWeek.Items)
                                            {
                                                if (arrayList.Contains(listItem.Value))
                                                {
                                                    listItem.Selected = true;
                                                }
                                            }
                                        }
                                        else if (ddlScheduleType.SelectedValue == "3")
                                        {
                                            ddlDayOfMonth.SelectedValue = dataReader.GetInt32(1).ToString();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            });
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                try
                {
                    intlistid = new Guid(Request["intlistid"]);
                }
                catch { }

                intcore  = new API.Integration.IntegrationCore(Web.Site.ID, Web.ID);
                intadmin = new API.Integration.IntegrationAdmin(intcore, intlistid, moduleid);

                bool bWizard = false;

                try
                {
                    if (Request["wizard"] == "1")
                    {
                        bWizard = true;
                    }
                }catch {}



                PageHead = intadmin.GetIntegrationHeader();

                Hashtable hshProps = new Hashtable();
                if (intlistid != Guid.Empty)
                {
                    hshProps = intcore.GetProperties(intlistid);
                }

                SPList list = Web.Lists[intadmin.ListId];

                List <ColumnProperty> ColumnList = intcore.GetColumns(hshProps, intadmin.ModuleID, intlistid, list);

                DropDownList ddlColsTemp = new DropDownList();

                foreach (ColumnProperty Column in ColumnList)
                {
                    ListItem li1 = new ListItem(Column.DiplayName, Column.ColumnName);
                    ddlIDColumn.Items.Add(li1);

                    ListItem li2 = new ListItem(Column.DiplayName, Column.ColumnName);
                    ddlSPColumn.Items.Add(li2);

                    ListItem li3 = new ListItem(Column.DiplayName, Column.ColumnName);
                    ddlSecMatch.Items.Add(li3);

                    ListItem li4 = new ListItem(Column.DiplayName, Column.ColumnName);
                    ddlIntegrationMatch.Items.Add(li4);
                }


                SPList List = Web.Lists[new Guid(Request["List"])];


                pnlColumns.Controls.Add(new LiteralControl("<table>"));
                pnlColumns.Controls.Add(new LiteralControl("<tr><td><b>SharePoint Column</b></td><td><b>Integration Column</b></td></tr>"));

                SortedList sl = new SortedList();
                foreach (SPField field in List.Fields)
                {
                    if (field.Reorderable)
                    {
                        if (!sl.Contains(field.Title))
                        {
                            sl.Add(field.Title, field.InternalName);
                        }
                    }
                }

                sl.Add("Created By", "Author");

                Hashtable hshParams = new Hashtable();
                hshParams.Add("intlistid", intlistid);

                DataSet ds          = intcore.GetDataSet("SELECT * FROM INT_COLUMNS WHERE INT_LIST_ID=@intlistid", hshParams);
                DataTable dtColumns = ds.Tables[0];

                foreach (DictionaryEntry de in sl)
                {
                    DropDownList ddl = new DropDownList();
                    ddl.ID           = de.Value.ToString();
                    ddl.Items.Add(new ListItem("--Select Column--", ""));


                    ListItem li3 = new ListItem(de.Key.ToString(), de.Value.ToString());
                    ddlSharePointMatch.Items.Add(li3);

                    string curCol = "";

                    if (!IsPostBack)
                    {
                        DataRow [] drCol = dtColumns.Select("SharePointColumn='" + de.Value.ToString() + "'");
                        if (drCol.Length > 0)
                        {
                            curCol = drCol[0]["IntegrationColumn"].ToString();
                        }
                    }

                    foreach (ColumnProperty Column in ColumnList)
                    {
                        ListItem li2 = new ListItem(Column.DiplayName, Column.ColumnName);
                        if (!IsPostBack)
                        {
                            if (bWizard && Column.DefaultListColumn == de.Value.ToString())
                            {
                                li2.Selected = true;
                            }
                            else if (curCol == Column.ColumnName)
                            {
                                li2.Selected = true;
                            }
                        }

                        ddl.Items.Add(li2);
                    }

                    bool selectedFound = false;

                    foreach (ListItem listItem in ddl.Items)
                    {
                        if (!selectedFound)
                        {
                            selectedFound = listItem.Selected;
                        }
                        else
                        {
                            listItem.Selected = false;
                        }
                    }

                    ArrControls.Add(ddl);

                    pnlColumns.Controls.Add(new LiteralControl("<tr><td>" + de.Key.ToString() + "</td><td>"));

                    pnlColumns.Controls.Add(ddl);

                    pnlColumns.Controls.Add(new LiteralControl("</td></tr>"));
                }

                pnlColumns.Controls.Add(new LiteralControl("</table>"));

                if (!IsPostBack)
                {
                    if (bWizard)
                    {
                        foreach (ColumnProperty Column in ColumnList)
                        {
                            ListItem li2 = new ListItem(Column.DiplayName, Column.ColumnName);
                            if (Column.DefaultListColumn == "INTUID")
                            {
                                ddlIDColumn.SelectedValue = Column.ColumnName;
                            }
                            if (Column.DefaultListColumn == "SPID")
                            {
                                ddlSPColumn.SelectedValue = Column.ColumnName;
                            }
                            if (Column.DefaultListColumn == "SECMATCH")
                            {
                                ddlSecMatch.SelectedValue = Column.ColumnName;
                            }
                        }
                    }
                    else
                    {
                        try
                        {
                            ddlIDColumn.SelectedValue = hshProps["IDColumn"].ToString();
                        }
                        catch { }

                        try
                        {
                            ddlSPColumn.SelectedValue = hshProps["SPColumn"].ToString();
                        }
                        catch { }

                        try
                        {
                            ddlSecMatch.SelectedValue = hshProps["SecMatch"].ToString();
                        }
                        catch { }

                        try
                        {
                            string[] match = hshProps["ItemMatch"].ToString().Split('|');
                            ddlSharePointMatch.SelectedValue  = match[0];
                            ddlIntegrationMatch.SelectedValue = match[1];
                        }
                        catch { }
                    }
                }


                if (bWizard)
                {
                    Button1.Text          = "Finish";
                    Button1.OnClientClick = "Install();";
                }
                else
                {
                    Button1.OnClientClick = "DisableButtons();";
                }
            });
        }