public void OnSaveChange(SPField field, bool isNewField)
        {
            ValidatedInput vi = (ValidatedInput)field;

            //vi.ValidationType = rbl_ValidationMethods.SelectedIndex;
            vi.SetFieldAttribute("ValidationSetting", rbl_ValidationMethods.SelectedIndex);
            switch (rbl_ValidationMethods.SelectedIndex)
            {
            case 0:    //Common patterns
                vi.SetFieldAttribute("CommonPatternIndex", ddl_CommonPatterns.SelectedIndex);
                switch (ddl_CommonPatterns.SelectedItem.Text)
                {
                case "US Phone Number":
                case "Social Security Number":
                case "Zip Code":
                    vi.SetFieldAttribute("ValidationType", (int)ValidatedInput.ValidationTypes.Masked);
                    vi.SetFieldAttribute("Mask", ddl_CommonPatterns.SelectedValue);
                    break;

                case "Email Address":
                case "Web Address":
                    vi.SetFieldAttribute("ValidationType", (int)ValidatedInput.ValidationTypes.Masked);
                    vi.SetFieldAttribute("Mask", ddl_CommonPatterns.SelectedValue);
                    break;
                }

                break;

            case 1:    //Masked input
                vi.SetFieldAttribute("ValidationType", (int)ValidatedInput.ValidationTypes.Masked);
                vi.SetFieldAttribute("Mask", tb_MaskedInputPattern.Text);
                break;

            case 2:    //Regular expressions
                vi.SetFieldAttribute("ValidationType", (int)ValidatedInput.ValidationTypes.Regex);
                vi.SetFieldAttribute("Regex", tb_RegularExpression.Text);
                break;

            case 3:    //Value comparison
                vi.SetFieldAttribute("ValidationType", (int)ValidatedInput.ValidationTypes.Value);
                vi.SetFieldAttribute("ComparisonValue", tb_ComparisonValue.Text);
                vi.SetFieldAttribute("Comparison", ddl_ComparisonTypes.SelectedValue);
                vi.SetFieldAttribute("ComparisonDataType", ddl_ValueType.SelectedValue);
                break;
            }

            vi.SetFieldAttribute("Instructions", tb_Instructions.Text);
            //vi.Update();
        }
        public void InitializeWithField(SPField field)
        {
            ValidatedInput vi = (ValidatedInput)field;

            if (!Page.IsPostBack)
            {
                if (vi != null)
                {
                    int validationSetting = -1;
                    int validationType    = -1;
                    int newIndex          = -1;
                    int.TryParse(vi.GetFieldAttribute("ValidationSetting"), out validationSetting);
                    int.TryParse(vi.GetFieldAttribute("ValidationType"), out validationType);
                    rbl_ValidationMethods.SelectedIndex = validationSetting;
                    HideShowPanels();
                    switch (validationSetting)
                    {
                    case 0:     //common patterns
                        int.TryParse(vi.GetFieldAttribute("CommonPatternIndex"), out newIndex);
                        ddl_CommonPatterns.SelectedIndex = newIndex;
                        SetCommonPatternText();
                        break;

                    case 1:     //masked input
                        tb_MaskedInputPattern.Text = vi.GetFieldAttribute("Mask");
                        break;

                    case 2:     //Regular Expression
                        tb_RegularExpression.Text = vi.GetFieldAttribute("Regex");
                        break;

                    case 3:     // Value comparison
                        //do stuff
                        tb_ComparisonValue.Text           = vi.GetFieldAttribute("ComparisonValue");
                        ddl_ValueType.SelectedIndex       = ddl_ValueType.Items.IndexOf(ddl_ValueType.Items.FindByText(vi.GetFieldAttribute("ComparisonDataType")));
                        ddl_ComparisonTypes.SelectedIndex = ddl_ComparisonTypes.Items.IndexOf(ddl_ComparisonTypes.Items.FindByText(vi.GetFieldAttribute("Comparison")));
                        break;
                    }
                    tb_Instructions.Text = vi.GetFieldAttribute("Instructions");
                }
            }
        }
Beispiel #3
0
 protected override void Prepare()
 {
     StepDescription = "Create New Account/Use current scope";
     ValidatedInput.Add(System_Field_Step_Description, StepDescription);
     base.Prepare();
 }
 protected override void Prepare()
 {
     StepDescription = "Add task to SSIS";
     ValidatedInput.Add(System_Field_Step_Description, StepDescription);
     base.Prepare();
 }
 protected override void Prepare()
 {
     StepDescription = "Create New Cube";
     ValidatedInput.Add(System_Field_Step_Description, StepDescription);
     base.Prepare();
 }
        protected virtual void Prepare()
        {
            using (DataManager.Current.OpenConnection())
            {
                int    sessionID = WizardSession.SessionID;
                int    wizardID  = WizardSession.WizardID;
                int?   stepIndex;
                string scopeName = string.Empty;

                //Get the last step index for current session

                using (SqlCommand sqlCommand = DataManager.CreateCommand(@"SELECT Max(StepIndex) FROM Wizards_Data_Per_WizardID_SessionID_Step_And_Field 
                                                                        WHERE SessionID=@SessionID:Int AND ServiceInstanceID=@ServiceInstanceID:Int"))
                {
                    sqlCommand.Parameters["@SessionID"].Value         = sessionID;
                    sqlCommand.Parameters["@ServiceInstanceID"].Value = Instance.ParentInstance.ParentInstance.InstanceID;

                    stepIndex = sqlCommand.ExecuteScalar() as int?;
                }
                if (stepIndex == null)
                {
                    stepIndex = 1;
                }
                else
                {
                    stepIndex = stepIndex + 1;
                }

                if (!ValidatedInput.ContainsKey("AccountSettings.BI_Scope_Name"))
                {
                    using (SqlCommand sqlCommand = DataManager.CreateCommand(@"Select Value
                                                                                from  Wizards_Data_Per_WizardID_SessionID_Step_And_Field 
                                                                                where WizardID=@WizardID:Int and SessionID=@SessionID:Int AND Field=@Field:Nvarchar"))
                    {
                        sqlCommand.Parameters["@WizardID"].Value  = wizardID;
                        sqlCommand.Parameters["@SessionID"].Value = sessionID;
                        sqlCommand.Parameters["@Field"].Value     = "AccountSettings.BI_Scope_Name";
                        using (SqlDataReader reader = sqlCommand.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                scopeName = reader[0].ToString();
                            }
                        }
                    }
                }

                foreach (KeyValuePair <string, object> input in ValidatedInput)
                {
                    using (SqlCommand sqlCommand = DataManager.CreateCommand(@"INSERT INTO Wizards_Data_Per_WizardID_SessionID_Step_And_Field 
																			(WizardID,SessionID,ServiceInstanceID,ScopeName,StepName,Field,Value,ValueType,StepIndex)
																			Values 
																			(@WizardID:Int,
																			@SessionID:Int,
																			@ServiceInstanceID:BigInt,                                                                           
                                                                            @ScopeName:Nvarchar,
																			@StepName:NvarChar,
																			@Field:NVarChar,
																			@Value:NVarChar,
                                                                            @ValueType:NvarChar,
                                                                            @StepIndex:Int)"))
                    {
                        sqlCommand.Parameters["@WizardID"].Value          = wizardID;
                        sqlCommand.Parameters["@SessionID"].Value         = sessionID;
                        sqlCommand.Parameters["@ServiceInstanceID"].Value = Instance.ParentInstance.ParentInstance.InstanceID;
                        sqlCommand.Parameters["@ScopeName"].Value         = scopeName;
                        sqlCommand.Parameters["@StepName"].Value          = StepName;
                        sqlCommand.Parameters["@Field"].Value             = input.Key;
                        sqlCommand.Parameters["@Value"].Value             = input.Value.ToString();
                        sqlCommand.Parameters["@ValueType"].Value         = input.Value.GetType().AssemblyQualifiedName;
                        sqlCommand.Parameters["@StepIndex"].Value         = stepIndex;
                        sqlCommand.ExecuteNonQuery();
                    }
                }
            }
        }
 protected override void Prepare()
 {
     StepDescription = "Create User on active directory";
     ValidatedInput.Add(System_Field_Step_Description, StepDescription);
     base.Prepare();
 }