/// <summary>
        /// RowCommand implmentations
        /// </summary>
        protected void Grid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "New")
            {
                string connectionname = ((TextBox)Grid.FooterRow.FindControl("newConnectionName")).Text;
                string username       = ((TextBox)Grid.FooterRow.FindControl("newUserName")).Text;
                string password       = ((TextBox)Grid.FooterRow.FindControl("newPassword")).Text;
                string timeout        = ((TextBox)Grid.FooterRow.FindControl("newTimeOut")).Text;
                bool   secure         = ((CheckBox)Grid.FooterRow.FindControl("newSecure")).Checked;
                string maxrows        = ((TextBox)Grid.FooterRow.FindControl("newMaxRows")).Text;
                string connectstring  = ((TextBox)Grid.FooterRow.FindControl("newConnectString")).Text;

                IDataSource          odsSrc  = (IDataSource)ServiceDataSource;
                ObjectDataSourceView odsView = (ObjectDataSourceView)odsSrc.GetView("DefaultView");

                OrderedDictionary dict = new OrderedDictionary();
                dict.Add("ConnectionName", connectionname);
                dict.Add("Username", username);
                dict.Add("Password", password);
                dict.Add("Timeout", timeout);
                dict.Add("Secure", secure);
                dict.Add("Maxrows", maxrows);
                dict.Add("ConnectString", connectstring);
                odsView.Insert(dict);
            }
        }
Пример #2
0
        /// <summary>
        /// RowCommand implmentations
        /// </summary>
        protected void Grid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "New")
            {
                if (!CheckModifyAccess())
                {
                    e.Handled = false;
                    SPUtility.HandleAccessDenied(new UnauthorizedAccessException("You are not authorized to access this page."));
                }
                string assembly = ((TextBox)Grid.FooterRow.FindControl("newAssemblyFulldescription")).Text;
                string comptype = ((TextBox)Grid.FooterRow.FindControl("newAssemblyTypeDescription")).Text;
                bool   selected = ((CheckBox)Grid.FooterRow.FindControl("cbnSelected")).Checked;
                bool   trace    = ((CheckBox)Grid.FooterRow.FindControl("cbnTrace")).Checked;
                bool   claims   = ((CheckBox)Grid.FooterRow.FindControl("cbnClaims")).Checked;
                if (CheckIsValidAssembly(assembly, comptype, !claims))
                {
                    IDataSource          odsSrc  = (IDataSource)ServiceDataSource;
                    ObjectDataSourceView odsView = (ObjectDataSourceView)odsSrc.GetView("DefaultView");

                    OrderedDictionary dict = new OrderedDictionary();
                    dict.Add("AssemblyFulldescription", assembly);
                    dict.Add("AssemblyTypeDescription", comptype);
                    dict.Add("Selected", selected);
                    dict.Add("TraceResolve", trace);
                    dict.Add("ClaimsExt", claims);
                    odsView.Insert(dict);
                }
                else
                {
                    IValidator cv1 = this.Page.Validators[0];
                    IValidator cv2 = this.Page.Validators[1];
                    cv1.IsValid      = false;
                    cv2.IsValid      = false;
                    cv1.ErrorMessage = GetUIString("DLLVALIDATORADDMESSAGE"); //"Invalid Assembly or Component type. \nThis reference can't be trusted";
                    if (claims)
                    {
                        cv2.ErrorMessage = GetUIString("DLLVALIDATORDETMESSAGE1"); //"You must implement SharePoint.IdentityService.Core.IIdentityServiceClaimsAugmenter in your assembly and deploy it.";
                    }
                    else
                    {
                        cv2.ErrorMessage = GetUIString("DLLVALIDATORDETMESSAGE2"); // "You must implement SharePoint.IdentityService.Core.IWrapper in your assembly and deploy it";
                    }
                    e.Handled = false;
                }
            }
        }
        /// <summary>
        /// RowCommand implmentations
        /// </summary>
        protected void Grid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "New")
            {
                string domainname  = ((TextBox)Grid.FooterRow.FindControl("newDisplayName")).Text;
                string compdnsname = ((TextBox)Grid.FooterRow.FindControl("newDnsname")).Text;
                string connection  = ((DropDownList)Grid.FooterRow.FindControl("newConnection")).SelectedValue;
                bool   enabled     = ((CheckBox)Grid.FooterRow.FindControl("newEnabled")).Checked;
                string position    = ((TextBox)Grid.FooterRow.FindControl("newPosition")).Text;

                IDataSource          odsSrc  = (IDataSource)ServiceDataSource;
                ObjectDataSourceView odsView = (ObjectDataSourceView)odsSrc.GetView("DefaultView");

                OrderedDictionary dict = new OrderedDictionary();
                dict.Add("DisplayName", domainname);
                dict.Add("DnsName", compdnsname);
                dict.Add("Connection", connection);
                dict.Add("Enabled", enabled);
                dict.Add("DisplayPosition", position);
                odsView.Insert(dict);
            }
        }