Exemple #1
0
        public void Init(ServerVersionId pversion)
        {
            _view.Load += SelectDbForm_Load;
            _view.StatusStripSelectDatabase.DoubleClick += StatusBarSelectDatabase_DoubleClick;
            _view.btnTest.Click += btnTest_Click;
            _view.chkWindowsAuthentication.CheckedChanged += cbWindowsAuthentication_CheckedChanged;
            _view.btnSelect.Click             += btnSelect_Click;
            _view.btnCreate.Click             += btnCreate_Click;
            _view.btnDrop.Click               += btnDrop_Click;
            _view.txtServer.Validating        += txtServer_Validating;
            _view.txtDatabase.Validating      += txtDatabase_Validating;
            _view.cboVendors.SelectionChanged += cboVendors_SelectionChanged;

            _view.cboVendors.Items.Clear();
            foreach (ServerVersionId version in DatabaseManagerFactory.Instance.GetSupportedVendors())
            {
                ValueListItem item = _view.cboVendors.Items.Add(version);
                if (version == pversion)
                {
                    _view.cboVendors.SelectedItem = item;
                }
            }

            //if (_view.cboVendors.Items.Count > 0)
            //{
            //    _view.cboVendors.SelectedIndex = 0;
            //}

            setVersionSettings(pversion);
        }
Exemple #2
0
        private ServerVersionId getSelectedServerVersion()
        {
            ValueListItem   item           = _view.cboVendors.SelectedItem;
            ServerVersionId currentSetting = (ServerVersionId)item.DataValue;

            return(currentSetting);
        }
Exemple #3
0
        protected MvcHtmlString ValueListItemBreadcrumb(HtmlHelper htmlHelper, ValueListItem valueListItem, bool ShowAsLink = false)
        {
            RouteValueDictionary routeData = null;
            string name     = "(unknown)";
            bool   showLink = false;

            if (valueListItem != null)
            {
                if (valueListItem.ValueListItemId == 0)
                {
                    name = "New";
                }
                else
                {
                    showLink  = ShowAsLink;
                    routeData = new RouteValueDictionary(new { id = valueListItem.ValueListItemId });
                    name      = "'" + valueListItem.Name + "' [" + valueListItem.ValueListItemId + "]";
                }
            }
            return(new MvcHtmlString(
                       ValueListItemsBreadcrumb(htmlHelper, valueListItem.ValueList, true).ToHtmlString()
                       + " -> "
                       + (showLink ? htmlHelper.ActionLink(name, "ListItemDetails", "ValueListSysAdmin", routeData, null).ToHtmlString() : name)
                       ));
        }
Exemple #4
0
        private void cboVendors_SelectionChanged(object sender, EventArgs e)
        {
            ValueListItem   item          = _view.cboVendors.SelectedItem;
            ServerVersionId serverVersion = (ServerVersionId)item.DataValue;

            setVersionSettings(serverVersion);
        }
Exemple #5
0
        private void dealVlContractedProfession(int VlContractedProfessionid, string value)
        {
            var listitems = GlobalVar.OVault.ValueListItemOperations.GetValueListItems(VlContractedProfessionid);
            var haveit    = false;

            foreach (ValueListItem item in listitems)
            {
                if (item.Name == value)
                {
                    haveit = true;
                    break;
                }
            }
            if (!haveit)
            {
                try
                {
                    ValueListItem newv = new ValueListItem();
                    newv.Name = value;
                    GlobalVar.OVault.ValueListItemOperations.AddValueListItem(VlContractedProfessionid, newv);
                }
                catch (Exception ex)
                {
                    richTextBoxlog.AppendText(Environment.NewLine + string.Format("-值列表插入新值出错-: value={0},VlContractedProfessionid={1},-{2}-", value, VlContractedProfessionid, ex.Message));
                }
            }
        }
Exemple #6
0
        public ActionResult ListItemCreate(ValueListItem valueListItem)
        {
            if (valueListItem.ValueListId == default(int))
            {
                return(HttpBadRequest("Value List id is 0"));
            }

            IGstoreDb db        = GStoreDb;
            ValueList valueList = db.ValueLists.FindById(valueListItem.ValueListId);

            if (valueList == null)
            {
                return(HttpNotFound("Value List not found. Value List id: " + valueListItem.ValueListId));
            }

            if (valueList.ValueListItems.Any(vl => vl.Name.ToLower() == valueListItem.Name.ToLower()))
            {
                ModelState.AddModelError("Name", "An item with name '" + valueListItem.Name + "' already exists. Choose a new name or edit the original value.");
            }

            if (ModelState.IsValid)
            {
                valueListItem.ClientId    = valueList.ClientId;
                valueListItem.ValueListId = valueList.ValueListId;
                valueListItem             = GStoreDb.ValueListItems.Add(valueListItem);
                GStoreDb.SaveChanges();
                AddUserMessage("Value List Item Created", "Value List Item '" + valueListItem.Name.ToHtml() + "' [" + valueListItem.ValueListItemId + "] created successfully", UserMessageType.Success);
                return(RedirectToAction("ListItemIndex", new { id = valueListItem.ValueListId }));
            }

            valueListItem.ValueList = valueList;
            this.BreadCrumbsFunc    = htmlHelper => this.ValueListItemBreadcrumb(htmlHelper, valueListItem, false);
            return(View(valueListItem));
        }
Exemple #7
0
        private static string GetValueListItemName(this WebFormField field, string stringValue)
        {
            //convert id value to text
            int value;

            if (!int.TryParse(stringValue, out value))
            {
                return("invalid value (not int): '" + stringValue + "'");
            }
            if (value == 0)
            {
                return("invalid value: " + stringValue);
            }
            if (field.ValueList == null)
            {
                return("unknown value (no value list): '" + stringValue + "'");
            }
            ValueListItem listItem = field.ValueList.ValueListItems.AsQueryable().WhereIsActive().SingleOrDefault(vli => vli.ValueListItemId == value);

            if (listItem == null)
            {
                return("unknown value (not found): '" + stringValue + "'");
            }
            return("'" + listItem.Name + "'");
        }
Exemple #8
0
        private void FillFromDataSource()
        {
            this.AutoComplete = true;
            if (_dataSource != null && _displayMember != string.Empty && _valueMember != string.Empty)
            {
                Items.Clear();

                DataView dv = new DataView(_dataSource, _filterMember, _sorterMember, DataViewRowState.CurrentRows);

                int count = dv.Count;
                if (count <= _maxItemsDisplay)
                {
                    count = _maxItemsDisplay;
                }
                foreach (DataRowView dr in dv)
                {
                    if (Items.Count < count - 1)
                    {
                        Items.Add(dr[_valueMember], dr[_displayMember].ToString());
                    }
                    else
                    {
                        ValueListItem item = Items.Add(_moreItemsID, _moreItemsDisplayText);
                        item.Appearance.FontData.Bold = DefaultableBoolean.True;

                        return;
                    }
                }
            }
        }
Exemple #9
0
        //German 20101207 - Migracion Infragistic - Tarea 983
        protected override void OnValueChanged(EventArgs args)
        {
            if (SelectedItem != null)
            {
                if (SelectedItem.DataValue is string && ( string )SelectedItem.DataValue == _moreItemsID)
                {
                    mzComboEditorSearch f = new mzComboEditorSearch(DisplayMember, DisplayMemberCaption, ValueMember, ValueMemberCaption, DataSource);
                    if (f.ShowDialog() == DialogResult.OK)
                    {
                        int index = IndexOf(f.SelectedValue());
                        if (index == -1)
                        {
                            ValueListItem item = new ValueListItem();
                            item.DataValue   = f.SelectedValue();
                            item.DisplayText = f.SelectedText();
                            item.Appearance.FontData.Bold = DefaultableBoolean.True;

                            Items.Insert(0, item);
                            SelectedIndex = 0;
                        }
                        else
                        {
                            SelectedIndex = index;
                        }
                    }
                }
                else
                {
                    //German 20101207 - Migracion Infragistic - Tarea 983
                    base.OnValueChanged(args);
                }
            }
        }
        public void AddValueListItem()
        {
            // Create our test runner.
            var runner = new RestApiTestRunner <ValueListItem>(Method.POST, "/REST/valuelists/1/items");

            // Set the expected body.
            var newVLitem = new ValueListItem
            {
                ValueListID = 1,
                Name        = "new valuelistItem name"
            };

            runner.SetExpectedRequestBody(newVLitem);


            // Execute.
            runner.MFWSClient.ValueListItemOperations.AddValueListItem
            (
                1,
                newVLitem
            );

            // Verify.
            runner.Verify();
        }
Exemple #11
0
 public static ValueListItem[] GetValueList_Customer_All()
 {
     List<ValueListItem> lstVL = new List<ValueListItem>();
     wsMDL.IwsMDLClient client = new wsMDL.IwsMDLClient();
     try
     {
         List<MESParameterInfo> lstParameters = new List<MESParameterInfo>() { };
         List<tmdlcustomer> lstCustomer = client.GetCustomerList((new BaseForm()).CurrentContextInfo,
             lstParameters.ToArray<MESParameterInfo>()).ToList();
         var q = from p in lstCustomer orderby p.customername ascending select p;
         for (int i = 0; i < q.Count(); i++)
         {
             ValueListItem item = new ValueListItem()
             {
                 DisplayText = q.ElementAt(i).customername,
                 DataValue = q.ElementAt(i).customerid
             };
             lstVL.Add(item);
         }
         return lstVL.ToArray<ValueListItem>();
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         baseForm.CloseWCF(client);
     }
 }
Exemple #12
0
        public static void SetDefaultsForNew(this ValueListItem valueListItem, ValueList valueList)
        {
            valueListItem.Name  = "New Value";
            valueListItem.Order = 100;
            if (valueList != null)
            {
                valueListItem.ValueList   = valueList;
                valueListItem.ValueListId = valueList.ValueListId;
                valueListItem.ClientId    = valueList.ClientId;
                valueListItem.Client      = valueList.Client;
                valueListItem.Order       = (valueList.ValueListItems.Count == 0) ? 100 : valueList.ValueListItems.Max(vl => vl.Order) + 10;
                if (valueList.ValueListItems.Any(vl => vl.Name.ToLower() == valueListItem.Name.ToLower()))
                {
                    int index = 1;
                    do
                    {
                        index++;
                        valueListItem.Name = "New Value " + index;
                    } while (valueList.ValueListItems.Any(vl => vl.Name.ToLower() == valueListItem.Name.ToLower()));
                }
            }

            valueListItem.Description      = valueListItem.Name;
            valueListItem.IsPending        = false;
            valueListItem.EndDateTimeUtc   = DateTime.UtcNow.AddYears(100);
            valueListItem.StartDateTimeUtc = DateTime.UtcNow.AddMinutes(-1);
        }
Exemple #13
0
        /// <summary>
        /// Load data into the controls
        /// </summary>
        private void InitializeRegistryMappings()
        {
            // Populate the combo box with each of the applications for which we have already got
            // a registry mapping
            _applicationsFile = new ApplicationDefinitionsFile();
            List <string> listRegistryMappings = new List <string>();

            _applicationsFile.SetSection(ApplicationDefinitionsFile.APPLICATION_MAPPINGS_SECTION);
            _applicationsFile.EnumerateKeys(ApplicationDefinitionsFile.APPLICATION_MAPPINGS_SECTION, listRegistryMappings);

            // Iterate through the keys and create an application mapping object
            cbApplications.BeginUpdate();
            cbApplications.Items.Clear();
            //
            foreach (string thisKey in listRegistryMappings)
            {
                // The key is the application name, the value the registry mapping
                ApplicationRegistryMapping applicationMapping = new ApplicationRegistryMapping(thisKey);
                String mappings = _applicationsFile.GetString(thisKey, "");
                if (thisKey == "Travel")
                {
                    int a = 0;
                }
                applicationMapping.AddMapping(mappings);

                // Add this entry to the combo box noting that we store the object with it to make
                // it easier to display the registry keys when selected
                ValueListItem newItem = cbApplications.Items.Add(applicationMapping.ApplicationName);
                newItem.Tag = applicationMapping;
            }
            cbApplications.EndUpdate();

            // Select the first entry
            cbApplications.SelectedIndex = 0;
        }
Exemple #14
0
        public ActionResult ListItemDeleteConfirmed(int id)
        {
            try
            {
                ValueListItem target = GStoreDb.ValueListItems.FindById(id);

                if (target == null)
                {
                    //valueList not found, already deleted? overpost?
                    throw new ApplicationException("Error deleting Value List Item. Value List Item not found. It may have been deleted by another user. Value List Item Id: " + id);
                }

                bool deleted = GStoreDb.ValueListItems.DeleteById(id);
                GStoreDb.SaveChanges();
                if (deleted)
                {
                    AddUserMessage("Value List Item Deleted", "Value List Item [" + id + "] was deleted successfully.", UserMessageType.Success);
                }
                else
                {
                    AddUserMessage("Deleting Value List Item Failed!", "Deleting Value List Item Failed. Value List Id: " + id, UserMessageType.Danger);
                }

                return(RedirectToAction("ListItemIndex", new { id = target.ValueListId }));
            }
            catch (Exception ex)
            {
                throw new ApplicationException("Error deleting Value List Item.  See inner exception for errors.  Related child tables may still have data to be deleted. Value List Item Id: " + id, ex);
            }
        }
        public WorkflowAdmin AddWorkflowAdmin(WorkflowAdmin workflow)
        {
            vault.MetricGatherer.MethodCalled();

            // TODO: verify
            if (workflow is TestWorkflowAdmin)
            {
                vault.Workflows.Add((TestWorkflowAdmin)workflow);
            }
            else
            {
                xWorkflowAdmin    wkAdmin = new xWorkflowAdmin(workflow);
                TestWorkflowAdmin twka    = new TestWorkflowAdmin(wkAdmin);
                vault.Workflows.Add(twka);
            }

            ValueListItem valueListItemWorkflow = new ValueListItem {
                ID = workflow.Workflow.ID, Name = workflow.Workflow.Name
            };

            vault.ValueListItemOperations.AddValueListItem(( int )MFBuiltInValueList.MFBuiltInValueListWorkflows,
                                                           valueListItemWorkflow);
            for (int i = 1; i <= workflow.States.Count; ++i)
            {
                StateAdmin    stateAdmin         = workflow.States[i];
                ValueListItem valueListItemState = new ValueListItem {
                    ID = stateAdmin.ID, Name = stateAdmin.Name, OwnerID = workflow.Workflow.ID
                };
                vault.ValueListItemOperations.AddValueListItem(( int )MFBuiltInValueList.MFBuiltInValueListStates,
                                                               valueListItemState);
            }
            return(workflow);
        }
Exemple #16
0
        public void SetValue(object setValue)
        {
            int index = IndexOf(setValue);

            if (index == -1)
            {
                DataView dv = new DataView(_dataSource, string.Format("{0} = '{1}'", _valueMember, setValue), _sorterMember, DataViewRowState.OriginalRows);
                if (dv.Count == 1)
                {
                    ValueListItem item = new ValueListItem();
                    item.DataValue   = dv[0][_valueMember];
                    item.DisplayText = dv[0][_displayMember].ToString();

                    Items.Insert(0, item);
                    SelectedIndex = 0;
                }
                else
                {
                    throw new Exception("El valor que ha intentado asignar corresponde a varias filas del conjunto de datos.");
                }
            }
            else
            {
                SelectedIndex = index;
            }
        }
Exemple #17
0
        /// <summary>
        /// Creates a new <see cref="valueListItem"/> in the value list with id <see cref="valueListId"/>.
        /// </summary>
        /// <param name="valueListId">The Id of the value list to create the new item in.</param>
        /// <param name="valueListItem">The value list item to create.</param>
        /// <param name="token">A cancellation token for the request.</param>
        /// <returns>The newly created value list item</returns>
        public async Task <ValueListItem> AddValueListItemAsync(int valueListId, ValueListItem valueListItem, CancellationToken token = default(CancellationToken))
        {
            // Sanity.
            if (null == valueListItem)
            {
                throw new ArgumentNullException(nameof(valueListItem));
            }
            if (valueListItem.ValueListID != valueListId)
            {
                valueListItem.ValueListID = valueListId;
            }
            if (string.IsNullOrWhiteSpace(valueListItem.Name))
            {
                throw new ArgumentException("The value list item must have a name.", nameof(valueListItem));
            }

            // Create the request.
            var request = new RestRequest($"/REST/valuelists/{valueListId}/items");

            request.AddJsonBody(valueListItem);

            // Make the request and get the response.
            var response = await this.MFWSClient.Post <ValueListItem>(request, token)
                           .ConfigureAwait(false);

            return(response.Data);
        }
Exemple #18
0
        public static bool ActivateValueListItem(this SystemAdminBaseController controller, int valueListItemId)
        {
            ValueListItem valueListItem = controller.GStoreDb.ValueListItems.FindById(valueListItemId);

            if (valueListItem == null)
            {
                controller.AddUserMessage("Activate Value List Item Failed!", "Value List Item not found by id: " + valueListItemId, AppHtmlHelpers.UserMessageType.Danger);
                return(false);
            }

            if (valueListItem.IsActiveDirect())
            {
                controller.AddUserMessage("Value List Item is already active.", "Value List Item is already active. id: " + valueListItemId, AppHtmlHelpers.UserMessageType.Info);
                return(false);
            }

            valueListItem.IsPending        = false;
            valueListItem.StartDateTimeUtc = DateTime.UtcNow.AddMinutes(-1);
            valueListItem.EndDateTimeUtc   = DateTime.UtcNow.AddYears(100);
            controller.GStoreDb.ValueListItems.Update(valueListItem);
            controller.GStoreDb.SaveChanges();
            controller.AddUserMessage("Activated Value List Item", "Activated Value List Item '" + valueListItem.Name.ToHtml() + "' [" + valueListItem.ValueListItemId + "]" + " - Value List '" + valueListItem.ValueList.Name.ToHtml() + "' [" + valueListItem.ValueList.ValueListId + "]", AppHtmlHelpers.UserMessageType.Info);

            return(true);
        }
        public async Task AddValueListItemValueListIDPopulatedAsync()
        {
            // Create our test runner.
            var runner = new RestApiTestRunner <ValueListItem>(Method.POST, "/REST/valuelists/23/items");

            // Set the expected body.
            var newVLitem = new ValueListItem
            {
                ValueListID = 23,
                Name        = "new valuelistItem name"
            };

            runner.SetExpectedRequestBody(newVLitem);

            // Execute.
            await runner.MFWSClient.ValueListItemOperations.AddValueListItemAsync
            (
                23,
                new ValueListItem
            {
                Name = "new valuelistItem name"
            }
            );

            // Verify.
            runner.Verify();
        }
Exemple #20
0
        public AuditedServers()
        {
            InitializeComponent();

            // Initialize base class fields.
            m_menuConfiguration = new Utility.MenuConfiguration();

            // hook the toolbar labels to the grids so the heading can be used for printing
            _grid_Servers.Tag   = _label_AuditedServers;
            _grid_Databases.Tag = _label_Databases;

            // hook the grids to the toolbars so they can be used for button processing
            _headerStrip_Servers.Tag   = _grid_Servers;
            _headerStrip_Databases.Tag = _grid_Databases;

            _toolStripButton_ServersColumnChooser.Image       =
                _toolStripButton_DatabasesColumnChooser.Image = AppIcons.AppImage16(AppIcons.Enum.GridFieldChooser);
            _toolStripButton_ServersGroupBy.Image             =
                _toolStripButton_DatabasesGroupBy.Image       = AppIcons.AppImage16(AppIcons.Enum.GridGroupBy);
            _toolStripButton_ServersSave.Image        =
                _toolStripButton_DatabasesSave.Image  = AppIcons.AppImage16(AppIcons.Enum.GridSaveToExcel);
            _toolStripButton_ServersPrint.Image       =
                _toolStripButton_DatabasesPrint.Image = AppIcons.AppImage16(AppIcons.Enum.Print);

            _cmsi_Server_exploreUserPermissions.Image = AppIcons.AppImage16(AppIcons.Enum.UserPermissions);
            _cmsi_Server_exploreSnapshot.Image        = AppIcons.AppImage16(AppIcons.Enum.ObjectExplorer);
            _cmsi_Server_properties.Image             = AppIcons.AppImage16(AppIcons.Enum.Properties);
            _cmsi_Server_refresh.Image                 = AppIcons.AppImage16(AppIcons.Enum.Refresh);
            _cmsi_Server_registerSQLServer.Image       = AppIcons.AppImage16(AppIcons.Enum.AuditSQLServer);
            _cmsi_Server_removeSQLServer.Image         = AppIcons.AppImage16(AppIcons.Enum.Remove);
            _cmsi_Server_collectDataSnapshot.Image     = AppIcons.AppImage16(AppIcons.Enum.CollectDataSnapshot);
            _cmsi_Server_configureDataCollection.Image = AppIcons.AppImage16(AppIcons.Enum.ConfigureAuditSettingsSM);


            // load value lists for grid display
            ValueList severityValueList = new ValueList();

            severityValueList.Key          = ValueListYesNo;
            severityValueList.DisplayStyle = ValueListDisplayStyle.DisplayText;
            _grid_Databases.DisplayLayout.ValueLists.Add(severityValueList);

            ValueListItem listItem;

            severityValueList.ValueListItems.Clear();
            listItem = new ValueListItem(true, "Yes");
            severityValueList.ValueListItems.Add(listItem);
            listItem = new ValueListItem(false, "No");
            severityValueList.ValueListItems.Add(listItem);

            // Initialize the grids
            initDataSources();

            _grid_Servers.DisplayLayout.FilterDropDownButtonImage = AppIcons.AppImage16(AppIcons.Enum.GridFilter);
            _grid_Servers.DrawFilter = new Utility.HideFocusRectangleDrawFilter();
            _grid_Servers.DisplayLayout.GroupByBox.Hidden = Utility.Constants.InitialState_GroupByBoxHidden;

            _grid_Databases.DrawFilter = new Utility.HideFocusRectangleDrawFilter();
            _grid_Databases.DisplayLayout.GroupByBox.Hidden = Utility.Constants.InitialState_GroupByBoxHidden;
        }
        private void AddPolicyToComboxBox(Infragistics.Win.UltraWinEditors.UltraComboEditor combo, Sql.Policy p)
        {
            ValueListItem item = new ValueListItem();

            item.DisplayText = "   " + GetDisplayNameForAssessmentInCombo(p);
            item.Tag         = item.Tag = p;
            combo.Items.Add(item);
        }
Exemple #22
0
 /// <summary>
 /// Creates a new <see cref="valueListItem"/> in the value list with id <see cref="valueListId"/>.
 /// </summary>
 /// <param name="valueListId">The Id of the value list to create the new item in.</param>
 /// <param name="valueListItem">The value list item to create.</param>
 /// <param name="token">A cancellation token for the request.</param>
 /// <returns>The newly created value list item</returns>
 public ValueListItem AddValueListItem(int valueListId, ValueListItem valueListItem, CancellationToken token = default(CancellationToken))
 {
     // Execute the async method.
     return(this.AddValueListItemAsync(valueListId, valueListItem, token)
            .ConfigureAwait(false)
            .GetAwaiter()
            .GetResult());
 }
        public ValueListItem AddValueListItem(int valueList, ValueListItem valueListItem, bool administrativeOperation = false)
        {
            vault.MetricGatherer.MethodCalled();

            valueListItem.ValueListID = valueList;
            vault.ValueListItems.Add(new TestValueListItem(valueListItem));
            return(valueListItem);
        }
Exemple #24
0
			/// <summary>
			/// Appends the alias to the workflow state transition object.
			/// </summary>
			/// <param name="id">State Transition ID</param>
			/// <param name="alias">Alias to append.</param>
			public void StateTransitionAlias(int id, string alias)
			{
				// Resolve the workflow state's owner.
				ValueListItem stateVli = this.Vault.ValueListItemOperations.GetValueListItemByID((int) MFBuiltInValueList.MFBuiltInValueListStates, id);

				// Resolve the states owner.
				WorkflowAdmin wfa = this.Vault.WorkflowOperations.GetWorkflowAdmin(stateVli.OwnerID);
				StateAlias(alias, wfa, id);
			}
Exemple #25
0
        /// <summary>
        /// Returns true if store front and client (parent record) are both active
        /// </summary>
        /// <param name="storeFront"></param>
        /// <returns></returns>
        public static bool IsActiveBubble(this ValueListItem valueListItem)
        {
            if (valueListItem == null)
            {
                throw new ArgumentNullException("valueListItem");
            }

            return(valueListItem.IsActiveDirect() && valueListItem.ValueList.IsActiveBubble());
        }
        private void AddCategoryToComboBox(Infragistics.Win.UltraWinEditors.UltraComboEditor combo, string category)
        {
            ValueListItem item = new ValueListItem();

            item.DisplayText = category;
            item.Tag         = null;
            item.Appearance.FontData.Bold = DefaultableBoolean.True;
            combo.Items.Add(item);
        }
        public Form_ExplanationNotes(int policyId, int assessmentId, int metricId, string serverName)
        {
            InitializeComponent();

            this.Description = DESCRIPTION;

            m_PolicyId     = policyId;
            m_AssessmentId = assessmentId;
            m_MetricId     = metricId;
            m_ServerName   = serverName;

            _toolStripButton_ExplanationNotesSave.Image  = AppIcons.AppImage16(AppIcons.Enum.GridSaveToExcel);
            _toolStripButton_ExplanationNotesPrint.Image = AppIcons.AppImage16(AppIcons.Enum.Print);

            // hook the toolbar labels to the grids so the heading can be used for printing
            _grid_ExplanationNotes.Tag = _label_ExplanationNotes;

            // hook the grids to the toolbars so they can be used for button processing
            _headerStrip_ExplanationNotes.Tag = _grid_ExplanationNotes;

            // load value lists for grid display
            ValueList severityValueList = new ValueList();

            severityValueList.Key                    = valueListSeverity;
            severityValueList.DisplayStyle           = ValueListDisplayStyle.Picture;
            severityValueList.Appearance.ImageVAlign = VAlign.Top;
            _grid_ExplanationNotes.DisplayLayout.ValueLists.Add(severityValueList);

            ValueListItem listItem;

            severityValueList.ValueListItems.Clear();
            listItem = new ValueListItem(Utility.Policy.Severity.Ok, DescriptionHelper.GetEnumDescription(Utility.Policy.Severity.Ok));
            listItem.Appearance.Image       = global::Idera.SQLsecure.UI.Console.Properties.Resources.check_16;
            listItem.Appearance.ImageVAlign = VAlign.Top;
            severityValueList.ValueListItems.Add(listItem);
            listItem = new ValueListItem(Utility.Policy.Severity.Low, DescriptionHelper.GetEnumDescription(Utility.Policy.Severity.Low));
            listItem.Appearance.Image       = global::Idera.SQLsecure.UI.Console.Properties.Resources.LowRisk_16;
            listItem.Appearance.ImageVAlign = VAlign.Top;
            severityValueList.ValueListItems.Add(listItem);
            listItem = new ValueListItem(Utility.Policy.Severity.Medium, DescriptionHelper.GetEnumDescription(Utility.Policy.Severity.Medium));
            listItem.Appearance.Image       = global::Idera.SQLsecure.UI.Console.Properties.Resources.MediumRisk_16;
            listItem.Appearance.ImageVAlign = VAlign.Top;
            severityValueList.ValueListItems.Add(listItem);
            listItem = new ValueListItem(Utility.Policy.Severity.High, DescriptionHelper.GetEnumDescription(Utility.Policy.Severity.High));
            listItem.Appearance.Image       = global::Idera.SQLsecure.UI.Console.Properties.Resources.HighRisk_16;
            listItem.Appearance.ImageVAlign = VAlign.Top;
            severityValueList.ValueListItems.Add(listItem);
            listItem = new ValueListItem(Utility.Policy.Severity.Undetermined, DescriptionHelper.GetEnumDescription(Utility.Policy.Severity.Undetermined));
            listItem.Appearance.Image       = AppIcons.AppImage16(AppIcons.Enum.Unknown);
            listItem.Appearance.ImageVAlign = VAlign.Top;
            severityValueList.ValueListItems.Add(listItem);

            _grid_ExplanationNotes.DrawFilter = new Utility.HideFocusRectangleDrawFilter();

            loadDataSource();
        }
Exemple #28
0
        internal controlConfigurePolicyVulnerabilities(ConfigurePolicyControlType state)
        {
            // SQLsecure 3.1 (Anshul Aggarwal) - Represents current state of control - 'Configure Security Check' or 'Export/Import Policy'.
            m_ControlType = state;

            InitializeComponent();

            ultraTabControl1.DrawFilter = new HideFocusRectangleDrawFilter();

            _toolStripButton_ColumnChooser.Image = AppIcons.AppImage16(AppIcons.Enum.GridFieldChooser);
            _toolStripButton_GroupBy.Image       = AppIcons.AppImage16(AppIcons.Enum.GridGroupBy);
            _toolStripButton_Save.Image          = AppIcons.AppImage16(AppIcons.Enum.GridSaveToExcel);
            _toolStripButton_Print.Image         = AppIcons.AppImage16(AppIcons.Enum.Print);

            // load value lists for grid display
            ValueListItem listItem;
            ValueList     severityValueList = new ValueList();

            severityValueList.Key          = Utility.Constants.POLICY_METRIC_VALUE_LIST_SERVERITY;
            severityValueList.DisplayStyle = ValueListDisplayStyle.DisplayText;
            ultraGridPolicyMetrics.DisplayLayout.ValueLists.Add(severityValueList);
            severityValueList.ValueListItems.Clear();
            listItem = new ValueListItem(Utility.Policy.Severity.Ok, DescriptionHelper.GetEnumDescription(Utility.Policy.Severity.Ok));
            listItem.Appearance.Image       = global::Idera.SQLsecure.UI.Console.Properties.Resources.check_16;
            listItem.Appearance.ImageVAlign = VAlign.Top;
            severityValueList.ValueListItems.Add(listItem);
            listItem = new ValueListItem(Utility.Policy.Severity.Low, DescriptionHelper.GetEnumDescription(Utility.Policy.Severity.Low));
            listItem.Appearance.Image       = global::Idera.SQLsecure.UI.Console.Properties.Resources.LowRisk_16;
            listItem.Appearance.ImageVAlign = VAlign.Top;
            severityValueList.ValueListItems.Add(listItem);
            listItem = new ValueListItem(Utility.Policy.Severity.Medium, DescriptionHelper.GetEnumDescription(Utility.Policy.Severity.Medium));
            listItem.Appearance.Image       = global::Idera.SQLsecure.UI.Console.Properties.Resources.MediumRisk_16;
            listItem.Appearance.ImageVAlign = VAlign.Top;
            severityValueList.ValueListItems.Add(listItem);
            listItem = new ValueListItem(Utility.Policy.Severity.High, DescriptionHelper.GetEnumDescription(Utility.Policy.Severity.High));
            listItem.Appearance.Image       = global::Idera.SQLsecure.UI.Console.Properties.Resources.HighRisk_16;
            listItem.Appearance.ImageVAlign = VAlign.Top;
            severityValueList.ValueListItems.Add(listItem);
            listItem = new ValueListItem(Utility.Policy.Severity.Undetermined, DescriptionHelper.GetEnumDescription(Utility.Policy.Severity.Undetermined));
            listItem.Appearance.Image       = AppIcons.AppImage16(AppIcons.Enum.Unknown);
            listItem.Appearance.ImageVAlign = VAlign.Top;
            severityValueList.ValueListItems.Add(listItem);

            ValueList enabledValueList = new ValueList();

            enabledValueList.Key          = Utility.Constants.POLICY_METRIC_VALUE_LIST_ENABLED;
            enabledValueList.DisplayStyle = ValueListDisplayStyle.DisplayText;
            ultraGridPolicyMetrics.DisplayLayout.ValueLists.Add(enabledValueList);
            listItem = new ValueListItem(true, "Yes");
            enabledValueList.ValueListItems.Add(listItem);
            listItem = new ValueListItem(false, "No");
            enabledValueList.ValueListItems.Add(listItem);

            // SQLsecure 3.1 (Anshul Aggarwal) - Change control state based on current control usage type.
            RefreshState();
        }
Exemple #29
0
        private void LocalizeStrings()
        {
            this.btnOK.Text     = ResourceStrings.Text_Ok;
            this.btnCancel.Text = ResourceStrings.Text_Cancel;
            this.ultraFormManager1.FormStyleSettings.Caption = ResourceStrings.Text_Zoom;
            this.lblMagnification.Text = ResourceStrings.Text_Magnification;

            ValueListItem customItem = this.optPresetLevels.ValueList.FindByDataValue(DBNull.Value);

            customItem.DisplayText = ResourceStrings.Lbl_Custom;
        }
        public void Send(T t)
        {
            if (callbacks == null)
            {
                return;
            }

            if (iterating)
            {
                var newItem = new ValueListItem
                {
                    item      = t,
                    callbacks = callbacks
                };
                if (nextValue == null)
                {
                    nextValue = newItem;
                }
                else
                {
                    var lastVal = nextValue;
                    while (lastVal.next != null)
                    {
                        lastVal = lastVal.next;
                    }
                    lastVal.next = newItem;
                }
                return;
            }

            // That is a protection from recursive Send() calls.
            iterating = true;

            var callbacksLocal = callbacks;

iterateCallbacks:
            for (int i = 0; i < callbacksLocal.Count; i++)
            {
                callbacksLocal[i](t);
            }

            if (nextValue != null)
            {
                t = nextValue.item;
                callbacksLocal = nextValue.callbacks;
                nextValue      = nextValue.next;
                goto iterateCallbacks;
            }

            iterating = false;
        }
Exemple #31
0
        public Form_PolicySnapshots(Sql.Policy policy, bool useBaseline, DateTime selectDate)
        {
            InitializeComponent();

            m_Policy      = policy;
            m_UseBaseline = useBaseline;
            m_SelectDate  = selectDate;

            _toolStripButton_ColumnChooser.Image = AppIcons.AppImage16(AppIcons.Enum.GridFieldChooser);
            _toolStripButton_GroupBy.Image       = AppIcons.AppImage16(AppIcons.Enum.GridGroupBy);
            _toolStripButton_Save.Image          = AppIcons.AppImage16(AppIcons.Enum.GridSaveToExcel);
            _toolStripButton_Print.Image         = AppIcons.AppImage16(AppIcons.Enum.Print);

            // load value lists for grid display
            m_statusValueList.Key          = "statusValueList";
            m_statusValueList.DisplayStyle = ValueListDisplayStyle.DisplayText;
            _grid.DisplayLayout.ValueLists.Add(m_statusValueList);

            ValueListItem listItem;

            m_statusValueList.ValueListItems.Clear();
            listItem = new ValueListItem("S", "Successful");
            m_statusValueList.ValueListItems.Add(listItem);
            listItem = new ValueListItem("W", "Warnings");
            m_statusValueList.ValueListItems.Add(listItem);
            listItem = new ValueListItem("E", "Errors");
            m_statusValueList.ValueListItems.Add(listItem);
            listItem = new ValueListItem("I", "In Progress");
            m_statusValueList.ValueListItems.Add(listItem);

            m_baselineValueList.Key          = "baselineValueList";
            m_baselineValueList.DisplayStyle = ValueListDisplayStyle.DisplayText;
            _grid.DisplayLayout.ValueLists.Add(m_baselineValueList);

            m_baselineValueList.ValueListItems.Clear();
            listItem = new ValueListItem("Y", "Yes");
            m_baselineValueList.ValueListItems.Add(listItem);
            listItem = new ValueListItem("N", "No");
            m_baselineValueList.ValueListItems.Add(listItem);
            listItem = new ValueListItem(DBNull.Value, "No");
            m_baselineValueList.ValueListItems.Add(listItem);

            _grid.DrawFilter = new Utility.HideFocusRectangleDrawFilter();
            _grid.DisplayLayout.GroupByBox.Hidden = Utility.Constants.InitialState_GroupByBoxHidden;

            this.Description = string.Format(DescriptionDisplay,
                                             m_UseBaseline ? @"baseline " : string.Empty,
                                             m_SelectDate.ToLocalTime().ToString(Constants.DATETIME_FORMAT));
        }
Exemple #32
0
 public static ValueListItem[] GetValueList_DataTable(DataTable dt, string displayField, string valueField)
 {
     List<ValueListItem> lstVL = new List<ValueListItem>();
     try
     {
         List<MESParameterInfo> lstParameters = new List<MESParameterInfo>() { };
         foreach(DataRow row in dt.Rows)
         {
             ValueListItem item = new ValueListItem()
             {
                 DisplayText = row[displayField].ToString(),
                 DataValue = row[valueField].ToString()
             };
             lstVL.Add(item);
         }
         return lstVL.ToArray<ValueListItem>();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #33
0
        public static ValueListItem[] GetValueList_StaticValue(MES_StaticValue_Type staticValueType)
        {
            List<ValueListItem> lstStaticValue = new List<ValueListItem>();

            string res = string.Empty;

            foreach (tsysstaticvalue item in baseForm.GetStaticValue(staticValueType))
            {
                res = item.svresourceid == null ? string.Empty : item.svresourceid;
                ValueListItem list = new ValueListItem()
                {
                    DisplayText = res == string.Empty ? item.svtext : UtilCulture.GetString(res),
                    DataValue = item.svvalue
                };
                lstStaticValue.Add(list);
            }

            return lstStaticValue.ToArray<ValueListItem>();
        }
Exemple #34
0
        public static ValueListItem[] GetValueList_Employee(string employeeType)
        {
            List<ValueListItem> lstVL = new List<ValueListItem>();
            ValueListItem emptyitem = new ValueListItem()
            {
                DisplayText = " ",
                DataValue = ""
            };
            lstVL.Add(emptyitem);

            wsMDL.IwsMDLClient client = new wsMDL.IwsMDLClient();

            try
            {
                List<MESParameterInfo> lstParameters = new List<MESParameterInfo>();
                lstParameters.Add(new MESParameterInfo()
                {
                    ParamName = "employeetypeid",
                    ParamValue = employeeType,
                    ParamType = "string"
                });
                List<tmdlemployee> lstEmployee = client.GetEmployeeList((new BaseForm()).CurrentContextInfo, lstParameters.ToArray<MESParameterInfo>()).ToList<tmdlemployee>();

                for (int i = 0; i < lstEmployee.Count; i++)
                {
                    ValueListItem item = new ValueListItem()
                    {
                        DisplayText = lstEmployee[i].employeename.Trim(),
                        DataValue = lstEmployee[i].employeeid
                    };
                    lstVL.Add(item);
                }

                return lstVL.ToArray<ValueListItem>();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                baseForm.CloseWCF(client);
            }
        }
Exemple #35
0
        public static ValueListItem[] GetValueList_Employee()
        {
            List<ValueListItem> lstVL = new List<ValueListItem>();
            ValueListItem emptyitem = new ValueListItem()
            {
                DisplayText = " ",
                DataValue = ""
            };
            lstVL.Add(emptyitem);

            wsMDL.IwsMDLClient client = new wsMDL.IwsMDLClient();

            try
            {
                List<MESParameterInfo> lstParameters = new List<MESParameterInfo>();
                //lstParameters.Add(new MESParameterInfo()
                //{
                //    ParamName = "employeestatus",
                //    ParamValue = MES_Flag.Valid.ToString(),
                //    ParamType = "string"
                //});
                List<tmdlemployee> lstEmployee = client.GetEmployeeList((new BaseForm()).CurrentContextInfo, lstParameters.ToArray<MESParameterInfo>()).ToList<tmdlemployee>();
                var q = from p in lstEmployee orderby p.employeename ascending select p;
                for (int i = 0; i < q.Count(); i++)
                {
                    ValueListItem item = new ValueListItem()
                    {
                        DisplayText = q.ElementAt(i).employeename.Trim(),
                        DataValue = q.ElementAt(i).employeeid
                    };
                    lstVL.Add(item);
                }

                return lstVL.ToArray<ValueListItem>();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                baseForm.CloseWCF(client);
            }
        }
Exemple #36
0
        public static ValueListItem[] GetValueList_Enums(Type myenum)
        {
            List<ValueListItem> lstEnum = new List<ValueListItem>();

            foreach (object item in Enum.GetValues(myenum))
            {
                string resource = UtilCulture.GetString("Enum." + item.ToString());
                if (resource == null || resource.Equals("---"))
                {
                    ValueListItem list = new ValueListItem()
                    {
                        DisplayText = item.ToString(),
                        DataValue = item.ToString()
                    };
                    lstEnum.Add(list);
                }
                else
                {
                    ValueListItem list = new ValueListItem()
                    {
                        DisplayText = resource,
                        DataValue = item.ToString()
                    };
                    lstEnum.Add(list);
                }

            }

            return lstEnum.ToArray<ValueListItem>();
        }
Exemple #37
0
        public static ValueListItem[] GetValueList_ReasonCode(MES_ReasonCategory reasonCategory)
        {
            List<ValueListItem> lstVL = new List<ValueListItem>();
            wsMDL.IwsMDLClient client = new wsMDL.IwsMDLClient();
            try
            {
                List<MESParameterInfo> lstParameters = new List<MESParameterInfo>();
                lstParameters.Add(new MESParameterInfo() {
                    ParamName="reasoncategory",
                    ParamValue=reasonCategory.ToString()
                });
                List<tmdlreasoncode> lstReasonCode = client.GetReasonCodeList((new BaseForm()).CurrentContextInfo,
                    lstParameters.ToArray<MESParameterInfo>()).ToList();

                var q = from p in lstReasonCode orderby p.reasoncodedesc ascending select p;
                for (int i = 0; i < q.Count(); i++)
                {
                    ValueListItem item = new ValueListItem()
                    {
                        DisplayText = q.ElementAt(i).reasoncodedesc,
                        DataValue = q.ElementAt(i).reasoncode
                    };
                    lstVL.Add(item);
                }
                return lstVL.ToArray<ValueListItem>();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                baseForm.CloseWCF(client);
            }
        }