private Domain GetUmbracoDomain(HttpRequest request) { // Get the Umbraco request (it may be NULL) PublishedRequest pcr = _umbracoContextAccessor.UmbracoContext?.PublishedRequest; // Return the domain of the Umbraco request if (pcr != null) { return(pcr.Domain); } // Find domain via DomainService based on current request domain var domain = DomainUtils.FindDomainForUri(_domains, request.Url); return(domain); }
public override string GetLocalizedString(GridStringId id) { try { var ret = DomainUtils.GetPopMenuValue(id.ToString().Replace("GridStringId.", string.Empty)); if (string.IsNullOrEmpty(ret) || ret.Equals(id)) { ret = base.GetLocalizedString(id); } return(ret); } catch { return(base.GetLocalizedString(id)); } }
public static bool Eval(string a, Teacher aVal, string b, Teacher bVal) { var aClass = DomainUtils.DecodeClass(a); var bClass = DomainUtils.DecodeClass(b); var aDay = DomainUtils.DecodeDay(a); var bDay = DomainUtils.DecodeDay(b); var aHour = int.Parse(DomainUtils.DecodeHour(a)); var bHour = int.Parse(DomainUtils.DecodeHour(b)); if (aClass == bClass && aDay == bDay && (aHour - 1 == bHour || aHour + 1 == bHour)) { return(aVal != bVal); } return(true); }
public void NameTooLong() { IDomain domain1 = DomainUtils.AddDomain(_workspace, DomainUtils.CreateCodedValueDomain( "DOM_FIELD1", esriFieldType.esriFieldTypeInteger, new CodedValue(1, "Value 1 abc"), new CodedValue(2, "Value 2"))); IDomain domain2 = DomainUtils.AddDomain(_workspace, DomainUtils.CreateCodedValueDomain( "DOM_FIELD2", esriFieldType.esriFieldTypeInteger, new CodedValue(1, "Value 1"), new CodedValue(2, "Value 2 123"))); IField field1 = FieldUtils.CreateField("FIELD1", esriFieldType.esriFieldTypeInteger); IField field2 = FieldUtils.CreateField("FIELD2", esriFieldType.esriFieldTypeInteger); IField field3 = FieldUtils.CreateField("FIELD3", esriFieldType.esriFieldTypeInteger); ((IFieldEdit)field1).Domain_2 = domain1; ((IFieldEdit)field2).Domain_2 = domain2; ((IFieldEdit)field3).Domain_2 = domain2; // reuse domain2 - to test if error is reported only once ITable table = DatasetUtils.CreateTable(_workspace, MethodBase.GetCurrentMethod().Name, FieldUtils.CreateOIDField(), field1, field2, field3); const int maxLength = 10; const int minimumValueCount = 1; const int minimumNonEqualNameValueCount = 1; const bool allowEmptyName = false; var runner = new QaTestRunner(new QaSchemaFieldDomainCodedValues( table, maxLength, UniqueStringsConstraint.UniqueAnyCase, minimumValueCount, minimumNonEqualNameValueCount, allowEmptyName)); runner.Execute(); Assert.AreEqual(2, runner.Errors.Count); }
public void TestIsOwnedByConnectedUser() { IWorkspace workspace = WorkspaceUtils.OpenSDEWorkspace( "PROSUITE_DDX", DirectConnectDriver.SqlServer, @".\SQLEXPRESS"); var domain = new CodedValueDomainClass { Name = "Test", FieldType = esriFieldType.esriFieldTypeInteger, Owner = "DBO" }; Assert.True(DomainUtils.IsOwnedByConnectedUser(domain, workspace)); workspace = WorkspaceUtils.OpenPgdbWorkspace(_simpleGdbPath); domain.Owner = string.Empty; // or null Assert.True(DomainUtils.IsOwnedByConnectedUser(domain, workspace)); }
public bool Send(string queueName, string routingKey, MessageDto message) { try { lock (_factory) { using (_connection = _factory.CreateConnection()) { using (_model = _connection.CreateModel()) { _model.ExchangeDeclare(_rabbitMQSettings.ExchangeName, _rabbitMQSettings.Type, durable: true); _model.QueueDeclare(queueName, true, false, false, null); _model.QueueBind(queueName, _rabbitMQSettings.ExchangeName, routingKey); message.InstanceId = Me.GetInstance().Id; message.RequestId = Guid.NewGuid(); message.CreateAt = DomainUtils.GetLocalDate(); byte[] objsend = ObjectSerialize.Serialize(message); _model.BasicPublish(_rabbitMQSettings.ExchangeName, routingKey, null, objsend); } } } using (var scope = Services.CreateScope()) { var scopedProcessingService = scope.ServiceProvider.GetRequiredService <IMessageService>(); scopedProcessingService.InsertAsync(message).Wait(); } return(true); } catch (System.Exception ex) { System.Console.WriteLine(ex.ToString()); _model.Dispose(); _connection.Dispose(); return(false); } }
private void SetFieldNames(LayoutControl control) { try { if (control.Items.Count > 0) { foreach (var item in control.Items) { if (item.GetType() == typeof(LayoutControlItem) && ((LayoutControlItem)item).Name.ToLower().Contains("lcitem")) { ((LayoutControlItem)item).AppearanceItemCaption.TextOptions.HAlignment = HorzAlignment.Far; ((LayoutControlItem)item).AppearanceItemCaption.TextOptions.VAlignment = VertAlignment.Center; var itemName = ((LayoutControlItem)item).Name.Replace("lcItem", string.Empty); itemName = StringUtils.ToUpperUnderscoreByPattern(itemName); var itemText = DomainUtils.GetFieldName(itemName); if (string.IsNullOrEmpty(itemText)) { itemText = itemName.Replace("_", " "); } if (((LayoutControlItem)item).Tag != null && ((LayoutControlItem)item).Tag.GetType() == typeof(bool) && (bool)((LayoutControlItem)item).Tag == true) { ((LayoutControlItem)item).Text = string.Format("*{0}:", itemText); ((LayoutControlItem)item).AppearanceItemCaption.ForeColor = (SkinUtils.IsDarkSkin) ? Color.Yellow : Color.Red; ((LayoutControlItem)item).AppearanceItemCaption.Options.UseForeColor = true; } else { ((LayoutControlItem)item).Text = itemText + ":"; ((LayoutControlItem)item).AppearanceItemCaption.Options.UseForeColor = false; } } } } } catch (Exception ex) { ShowErrBox(ex); } }
public void CanCreateDoubleCodedValueDomainConstraint() { ICodedValueDomain doubleCvDomain = DomainUtils.CreateCodedValueDomain( "CanCreateDoubleCodedValueDomainConstraint", esriFieldType.esriFieldTypeDouble, null, esriSplitPolicyType.esriSPTDuplicate, esriMergePolicyType.esriMPTDefaultValue, new CodedValue(1.00000000001, "Value 1.00000000001"), new CodedValue(2.00000000002, "Value 2.00000000002"), new CodedValue(3.00000000003, "Value 3.00000000003")); DomainUtils.AddDomain(_testWs, doubleCvDomain); IField doubleField = FieldUtils.CreateDoubleField("DoubleField"); ((IFieldEdit)doubleField).Domain_2 = (IDomain)doubleCvDomain; ITable table = DatasetUtils.CreateTable(_testWs, "CanCreateDoubleCodedValueDomainConstraint", FieldUtils.CreateOIDField(), doubleField); List <ConstraintNode> constraints = GdbConstraintUtils.GetGdbConstraints(table); Assert.NotNull(constraints); foreach (ConstraintNode constraint in constraints) { Console.WriteLine(constraint); } Assert.AreEqual(2, constraints.Count); Assert.AreEqual( "DoubleField IS NULL OR (Convert(DoubleField, 'System.Single') IN " + "(Convert(1.00000000001, 'System.Single'), " + "Convert(2.00000000002, 'System.Single'), " + "Convert(3.00000000003, 'System.Single')))", constraints[0].Condition); Assert.AreEqual("OBJECTID >= 0", constraints[1].Condition); }
private IDomain GetUmbracoDomain() { // Get the Umbraco request (it may be NULL) PublishedContentRequest pcr = UmbracoContext.Current == null ? null : UmbracoContext.Current.PublishedContentRequest; // Return the domain of the Umbraco request if (pcr != null) { return(pcr.UmbracoDomain); } // Find domain via DomainService based on current request domain var domain = DomainUtils.FindDomainForUri(Request.Url); if (domain != null) { return(domain); } return(null); }
/// <summary> /// </summary> public AddUserForm(List <User> AllUsers) { foreach (User user in AllUsers) { PotentialUsers.Add(user.Username); } List <string> DomainUsers = DomainUtils.GetDomainUsers(); foreach (string user in DomainUsers) { if (!PotentialUsers.Contains(user)) { PotentialUsers.Add(user); } } PotentialUsers.Sort(); InitializeComponent(); }
public void TooLong() { IDomain domain1 = DomainUtils.AddDomain(_workspace, DomainUtils.CreateCodedValueDomain( "DOM_FIELD1", esriFieldType.esriFieldTypeInteger, "Description of DOM_FIELD1_toolong", new CodedValue(1, "Value 1"), new CodedValue(2, "Value 2"))); IDomain domain2 = DomainUtils.AddDomain(_workspace, DomainUtils.CreateCodedValueDomain( "DOM_FIELD2", esriFieldType.esriFieldTypeInteger, "Description of DOM_FIELD2", new CodedValue(1, "Value 1"), new CodedValue(2, "Value 2"))); IField field1 = FieldUtils.CreateField("FIELD1", esriFieldType.esriFieldTypeInteger); IField field2 = FieldUtils.CreateField("FIELD2", esriFieldType.esriFieldTypeInteger); IField field3 = FieldUtils.CreateTextField("FIELD3", 20); ((IFieldEdit)field1).Domain_2 = domain1; ((IFieldEdit)field2).Domain_2 = domain2; ITable table = DatasetUtils.CreateTable(_workspace, MethodBase.GetCurrentMethod().Name, FieldUtils.CreateOIDField(), field1, field2, field3); const int maxLength = 25; const bool noDuplicates = true; var runner = new QaTestRunner(new QaSchemaFieldDomainDescriptions(table, maxLength, noDuplicates, null)); runner.Execute(); Assert.AreEqual(1, runner.Errors.Count); }
public void CanCreateStringCodedValueDomainConstraintNotNull() { ICodedValueDomain stringCvDomain = DomainUtils.CreateCodedValueDomain( "CanCreateStringCodedValueDomainConstraintNotNull", esriFieldType.esriFieldTypeString, null, esriSplitPolicyType.esriSPTDuplicate, esriMergePolicyType.esriMPTDefaultValue, new CodedValue("a", "Value a"), new CodedValue("b", "Value b"), new CodedValue("c", "Value c")); DomainUtils.AddDomain(_testWs, stringCvDomain); IField textField = FieldUtils.CreateTextField("TextField", 100); ((IFieldEdit)textField).Domain_2 = (IDomain)stringCvDomain; ITable table = DatasetUtils.CreateTable(_testWs, "CanCreateStringCodedValueDomainConstraintNotNull", FieldUtils.CreateOIDField(), textField); List <ConstraintNode> constraints = GdbConstraintUtils.GetGdbConstraints( table, allowNullForCodedValueDomains: false); Assert.NotNull(constraints); foreach (ConstraintNode constraint in constraints) { Console.WriteLine(constraint); } Assert.AreEqual(2, constraints.Count); Assert.AreEqual("TextField IN ('a', 'b', 'c')", constraints[0].Condition); Assert.AreEqual("OBJECTID >= 0", constraints[1].Condition); }
private ITable CreateTestTable([NotNull] string tableName, out int cvFieldIndex, out int rangeFieldIndex) { IRangeDomain rangeDomain = DomainUtils.CreateRangeDomain( tableName + "_range", esriFieldType.esriFieldTypeInteger, 0, 100); DomainUtils.AddDomain(_testWs, rangeDomain); ICodedValueDomain cvDomain = DomainUtils.CreateCodedValueDomain( tableName + "_cv", esriFieldType.esriFieldTypeInteger, null, esriSplitPolicyType.esriSPTDuplicate, esriMergePolicyType.esriMPTDefaultValue, new CodedValue(1, "Value 1"), new CodedValue(2, "Value 2"), new CodedValue(3, "Value 3")); DomainUtils.AddDomain(_testWs, cvDomain); IField cvField = FieldUtils.CreateIntegerField("CvField"); ((IFieldEdit)cvField).Domain_2 = (IDomain)cvDomain; IField rangeField = FieldUtils.CreateIntegerField("RangeField"); ((IFieldEdit)rangeField).Domain_2 = (IDomain)rangeDomain; ITable table = DatasetUtils.CreateTable(_testWs, tableName, FieldUtils.CreateOIDField(), cvField, rangeField); cvFieldIndex = table.FindField(cvField.Name); rangeFieldIndex = table.FindField(rangeField.Name); return(table); }
public void CanCreateIntegerCodedValueDomainConstraint() { ICodedValueDomain integerCvDomain = DomainUtils.CreateCodedValueDomain( "CanCreateIntegerCodedValueDomainConstraint", esriFieldType.esriFieldTypeInteger, null, esriSplitPolicyType.esriSPTDuplicate, esriMergePolicyType.esriMPTDefaultValue, new CodedValue(1, "Value 1"), new CodedValue(2, "Value 2"), new CodedValue(3, "Value 3")); DomainUtils.AddDomain(_testWs, integerCvDomain); IField integerField = FieldUtils.CreateIntegerField("IntegerField"); ((IFieldEdit)integerField).Domain_2 = (IDomain)integerCvDomain; ITable table = DatasetUtils.CreateTable(_testWs, "CanCreateIntegerCodedValueDomainConstraint", FieldUtils.CreateOIDField(), integerField); List <ConstraintNode> constraints = GdbConstraintUtils.GetGdbConstraints(table); Assert.NotNull(constraints); foreach (ConstraintNode constraint in constraints) { Console.WriteLine(constraint); } Assert.AreEqual(2, constraints.Count); Assert.AreEqual("IntegerField IS NULL OR (IntegerField IN (1, 2, 3))", constraints[0].Condition); Assert.AreEqual("OBJECTID >= 0", constraints[1].Condition); }
public ActionResult Domain(int rowCount = 25, int page = 1, string keyword = null, string name = null, string bigFootOwned = null, string websiteCurrent = null, string locked = null, string websiteUse = null, string BFStrategy = null, string buySideFunnel = null, string FMVOrderOfMagnitude = null, string companyWebsite = null, string status = null, string autoRenew = null, string version = null, string WHOIS = null, string category = null) { var searchResultObject = new VMSearchResultObject <DomainN> { Caption = "Domain" }; var startIndex = (page - 1) * rowCount; var query = DomainUtils.BuildQuery(startIndex, rowCount, keyword ?? name, bigFootOwned, websiteCurrent, locked, websiteUse, BFStrategy, buySideFunnel, FMVOrderOfMagnitude, companyWebsite, status, autoRenew, version, WHOIS, category); var domains = this._managementDomainService.GetByQuery(query.Item1, query.Item2, out int total); searchResultObject.ObjectResult = new VMPageResult <DomainN> { StartIndex = startIndex, RowCount = rowCount, Page = page, Total = total, Records = domains }; if (!string.IsNullOrWhiteSpace(keyword)) { var searchResultWrapperList = this._searchService.Search(name ?? keyword); searchResultObject.SearchResult = new VMSearchResult { Table = searchResultWrapperList }; } ViewBag.Keyword = keyword ?? name; ViewBag.IsAdvanceSearch = string.IsNullOrWhiteSpace(keyword); return(View(searchResultObject)); }
public static void UpdateAProduct(IDocumentStore documentStore) { Console.WriteLine("---" + Environment.NewLine + "Enter a product id"); var productId = Console.ReadLine().Trim(); using (var session = documentStore.OpenSession()) { var product = session.Load <Product>(productId); if (product != null) { DomainUtils.UpdateProductTags(product); // This method will be used to update the product session.Store(product); session.SaveChanges(); } else { Console.WriteLine("Id does not match with any product"); } } }
/// <summary> /// GridColumn 배열로 그리드의 컬럼을 추가한다. /// </summary> /// <param name="columns">GridColumn 배열</param> public void AddGridColumns(params GridColumn[] columns) { MainView.BeginUpdate(); MainView.Columns.Clear(); foreach (GridColumn col in columns) { if (string.IsNullOrEmpty(col.Caption)) { col.Caption = DomainUtils.GetFieldName(col.FieldName); } col.OptionsColumn.AllowMerge = DefaultBoolean.False; col.OptionsFilter.FilterPopupMode = FilterPopupMode.CheckedList; col.CustomizationCaption = col.Caption; col.AppearanceHeader.Options.UseTextOptions = true; col.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center; } MainView.Columns.AddRange(columns); MainView.EndUpdate(); }
public void CanCreateDateTimeRangeDomainConstraintNotNull() { IRangeDomain dateRangeDomain = DomainUtils.CreateRangeDomain( "CanCreateDateTimeRangeDomainConstraintNotNull", esriFieldType.esriFieldTypeDate, new DateTime(2011, 12, 31), new DateTime(2012, 1, 31, 23, 55, 59)); DomainUtils.AddDomain(_testWs, dateRangeDomain); IField dateField = FieldUtils.CreateDateField("DateField"); ((IFieldEdit)dateField).Domain_2 = (IDomain)dateRangeDomain; ITable table = DatasetUtils.CreateTable(_testWs, "CanCreateDateTimeRangeDomainConstraintNotNull", FieldUtils.CreateOIDField(), dateField); List <ConstraintNode> constraints = GdbConstraintUtils.GetGdbConstraints( table, allowNullForRangeDomains: false); Assert.NotNull(constraints); foreach (ConstraintNode constraint in constraints) { Console.WriteLine(constraint); } Assert.AreEqual(2, constraints.Count); Assert.AreEqual( "DateField >= #12/31/2011 00:00:00# AND DateField <= #01/31/2012 23:55:59#", constraints[0].Condition); Assert.AreEqual("OBJECTID >= 0", constraints[1].Condition); }
private static Dictionary <string, List <IDomain> > GetDomainsByDescription( [NotNull] IWorkspace targetWorkspace) { Assert.ArgumentNotNull(targetWorkspace, nameof(targetWorkspace)); var result = new Dictionary <string, List <IDomain> >( StringComparer.CurrentCultureIgnoreCase); foreach (IDomain existingDomain in DomainUtils.GetDomains(targetWorkspace)) { string description = existingDomain.Description; List <IDomain> domains; if (!result.TryGetValue(description, out domains)) { domains = new List <IDomain>(); result.Add(description, domains); } domains.Add(existingDomain); } return(result); }
protected virtual void SetFieldName(LayoutControlItem item, string fieldName, HorzAlignment horzAlign, VertAlignment vertAlign) { item.Text = DomainUtils.GetFieldName(fieldName) + ":"; }
public void DomainUtils_GetDomainFromHostname() { var actual = DomainUtils.GetDomainFromHostname("mycomp.v123.example.com"); Assert.Equal("v123.example.com", actual); }
public void DomainUtils_GetDomainFromHostname_Return_Hostname_If_Not_Found_Domain() { var actual = DomainUtils.GetDomainFromHostname("mycomp"); Assert.Equal("mycomp", actual); }
private void GridViewPopupMenuShowing(object sender, PopupMenuShowingEventArgs e) { try { var menu = e.Menu as GridViewMenu; if (menu == null) { return; } if (e.MenuType == GridMenuType.Column && e.HitInfo.InColumn) { menu.Items.Add(new DXMenuItem(DomainUtils.GetPopMenuValue("MenuColumnFrameLeftFix"), new EventHandler(GridViewMenuClicked)) { BeginGroup = true, Tag = new XGridMenuItem() { Name = "FrameLeftFix", Column = e.HitInfo.Column, GridHitInfo = e.HitInfo } }); menu.Items.Add(new DXMenuItem(DomainUtils.GetPopMenuValue("MenuColumnFrameRightFix"), new EventHandler(GridViewMenuClicked)) { Tag = new XGridMenuItem() { Name = "FrameRightFix", Column = e.HitInfo.Column, GridHitInfo = e.HitInfo } }); menu.Items.Add(new DXMenuItem(DomainUtils.GetPopMenuValue("MenuColumnLeftFix"), new EventHandler(GridViewMenuClicked)) { Tag = new XGridMenuItem() { Name = "LeftFix", Column = e.HitInfo.Column, GridHitInfo = e.HitInfo } }); menu.Items.Add(new DXMenuItem(DomainUtils.GetPopMenuValue("MenuColumnRightFix"), new EventHandler(GridViewMenuClicked)) { Tag = new XGridMenuItem() { Name = "RightFix", Column = e.HitInfo.Column, GridHitInfo = e.HitInfo } }); menu.Items.Add(new DXMenuItem(DomainUtils.GetPopMenuValue("MenuColumnUnFix"), new EventHandler(GridViewMenuClicked)) { Tag = new XGridMenuItem() { Name = "UnFix", Column = e.HitInfo.Column, GridHitInfo = e.HitInfo } }); menu.Items.Add(new DXMenuItem(DomainUtils.GetPopMenuValue("MenuColumnsUnFix"), new EventHandler(GridViewMenuClicked)) { Tag = new XGridMenuItem() { Name = "UnFixAll", Column = e.HitInfo.Column, GridHitInfo = e.HitInfo } }); menu.Items.Add(new DXMenuItem(DomainUtils.GetPopMenuValue("MenuSaveLayout"), new EventHandler(GridViewMenuClicked)) { BeginGroup = true, Tag = new XGridMenuItem() { Name = "SaveLayout", Column = e.HitInfo.Column, GridHitInfo = e.HitInfo } }); menu.Items.Add(new DXMenuItem(DomainUtils.GetPopMenuValue("MenuDeleteLayout"), new EventHandler(GridViewMenuClicked)) { Tag = new XGridMenuItem() { Name = "DeleteLayout", Column = e.HitInfo.Column, GridHitInfo = e.HitInfo } }); menu.Items.Add(new DXMenuItem(DomainUtils.GetPopMenuValue("MenuExportExcel"), new EventHandler(GridViewMenuClicked)) { BeginGroup = true, Tag = new XGridMenuItem() { Name = "ExportExcel", Column = e.HitInfo.Column, GridHitInfo = e.HitInfo } }); menu.Items.Add(new DXMenuItem(DomainUtils.GetPopMenuValue("MenuCellMerge"), new EventHandler(GridViewMenuClicked)) { BeginGroup = true, Tag = new XGridMenuItem() { Name = "CellMerge", Column = e.HitInfo.Column, GridHitInfo = e.HitInfo } }); if (e.HitInfo.Column.RealColumnEdit.GetType() == typeof(RepositoryItemCheckEdit) && e.HitInfo.Column.OptionsColumn.AllowEdit == true && e.HitInfo.Column.OptionsColumn.ReadOnly == false) { menu.Items.Add(new DXMenuItem(DomainUtils.GetPopMenuValue("MenuCheckAll"), new EventHandler(GridViewMenuClicked)) { BeginGroup = true, Tag = new XGridMenuItem() { Name = "CheckAll", Column = e.HitInfo.Column, GridHitInfo = e.HitInfo } }); menu.Items.Add(new DXMenuItem(DomainUtils.GetPopMenuValue("MenuUnCheckAll"), new EventHandler(GridViewMenuClicked)) { Tag = new XGridMenuItem() { Name = "UnCheckAll", Column = e.HitInfo.Column, GridHitInfo = e.HitInfo } }); } } if (e.MenuType == GridMenuType.Row && e.HitInfo.InRowCell) { menu.Items.Add(new DXMenuItem(DomainUtils.GetPopMenuValue("MenuCopyCell"), new EventHandler(GridViewMenuClicked)) { Tag = new XGridMenuItem() { Name = "CopyCell", Column = e.HitInfo.Column, GridHitInfo = e.HitInfo } }); } } catch { throw; } }
public static void Connect(this ILdapConnection connection, int port = (int)LdapPort.LDAP, LdapVersion version = LdapVersion.LDAP_VERSION3) { connection.Connect(DomainUtils.GetDomainFromHostname(), port, version); }
/// <summary> /// 그리드의 밴드에 컬럼을 추가한다. /// </summary> /// <param name="column">XGridColumn</param> public void AddBandColumn(XGridColumn column) { //Caption if (string.IsNullOrEmpty(column.Caption)) { if (!string.IsNullOrEmpty(column.CaptionCode)) { column.Caption = DomainUtils.GetFieldName(column.CaptionCode); } else { column.Caption = DomainUtils.GetFieldName(column.FieldName); } } var bandedColumn = new BandedGridColumn() { Caption = column.Caption, FieldName = column.FieldName, UnboundType = column.ColumnType }; bandedColumn.OptionsColumn.AllowMerge = DefaultBoolean.False; bandedColumn.OptionsFilter.FilterPopupMode = FilterPopupMode.CheckedList; bandedColumn.CustomizationCaption = bandedColumn.Caption; bandedColumn.AppearanceHeader.Options.UseTextOptions = true; bandedColumn.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center; bandedColumn.AppearanceCell.Options.UseTextOptions = true; switch (column.FieldName) { case "ROW_NO": case "INS_TIME": case "INS_USER": case "INS_USER_NAME": case "UPD_TIME": case "UPD_USER": case "UPD_USER_NAME": bandedColumn.AppearanceCell.TextOptions.HAlignment = HorzAlignment.Center; break; default: if (column.FieldName.EndsWith("_DATE")) { bandedColumn.AppearanceCell.TextOptions.HAlignment = HorzAlignment.Center; } else { bandedColumn.AppearanceCell.TextOptions.HAlignment = column.HorzAlignment; } break; } bandedColumn.DisplayFormat.FormatType = bandedColumn.GroupFormat.FormatType = column.FormatType; if (!string.IsNullOrEmpty(column.FormatString)) { bandedColumn.DisplayFormat.FormatString = column.FormatString; bandedColumn.GroupFormat.FormatString = column.FormatString; } if (column.RepositoryItem != null) { bandedColumn.ColumnEdit = column.RepositoryItem; } if ((column.IsSummary) && (MainView.GetType() == typeof(GridView) || MainView.GetType() == typeof(BandedGridView) || MainView.GetType() == typeof(AdvBandedGridView))) { bandedColumn.SummaryItem.SummaryType = column.SummaryItemType; bandedColumn.SummaryItem.FieldName = column.FieldName; if (!string.IsNullOrEmpty(column.FormatString)) { bandedColumn.SummaryItem.DisplayFormat = string.Format("{{0:{0}}}", column.FormatString); } if (column.IsSummaryGroup) { var item = new GridGroupSummaryItem() { FieldName = column.FieldName, ShowInGroupColumnFooter = bandedColumn, ShowInGroupColumnFooterName = column.FieldName, SummaryType = column.SummaryItemType }; if (!string.IsNullOrEmpty(column.FormatString)) { item.DisplayFormat = string.Format("{{0:{0}}}", column.FormatString); } GroupSummaryAdd(item); bandedColumn.OptionsColumn.AllowGroup = DefaultBoolean.True; } } if (column.ReadOnly || MainView.OptionsBehavior.Editable == false) { bandedColumn.OptionsColumn.ReadOnly = true; bandedColumn.OptionsColumn.AllowEdit = false; bandedColumn.OptionsColumn.AllowFocus = false; } else { bandedColumn.OptionsColumn.ReadOnly = false; bandedColumn.OptionsColumn.AllowEdit = true; bandedColumn.OptionsColumn.AllowFocus = true; } if (column.Width > 0) { bandedColumn.Width = column.Width; bandedColumn.MinWidth = column.Width; } else { switch (column.FieldName) { case "ROW_NO": bandedColumn.Width = 50; bandedColumn.MinWidth = 50; break; case "INS_TIME": case "UPD_TIME": bandedColumn.Width = 150; bandedColumn.MinWidth = 150; break; case "INS_USER": case "UPD_USER": bandedColumn.Width = 100; bandedColumn.MinWidth = 100; break; case "INS_USER_NAME": case "UPD_USER_NAME": bandedColumn.Width = 100; bandedColumn.MinWidth = 100; break; default: if (column.FieldName.EndsWith("_DATE")) { bandedColumn.Width = 100; bandedColumn.MinWidth = 100; } else { bandedColumn.BestFit(); } break; } } bandedColumn.Visible = column.Visible; if (column.Visible) { bandedColumn.VisibleIndex = MainView.Columns.Count; } MainView.Columns.Add(bandedColumn); }
private static IRangeDomain CreateRangeDomain(string name) { return(DomainUtils.CreateRangeDomain(name, esriFieldType.esriFieldTypeInteger, 0, 100)); }
private int CheckDomain([NotNull] DomainUsage domainUsage) { IDomain domain = domainUsage.Domain; var codedValueDomain = domain as ICodedValueDomain; if (codedValueDomain == null) { return(NoError); } List <CodedValue> codedValues = DomainUtils.GetCodedValueList(codedValueDomain); int nonEqualNameValueCount = 0; int errorCount = 0; foreach (CodedValue codedValue in codedValues) { if (!Equals(codedValue.Value.ToString().Trim(), codedValue.Name.Trim())) { nonEqualNameValueCount++; } if (!StringUtils.IsNotEmpty(codedValue.Name)) { if (!_allowEmptyName) { errorCount += ReportSchemaPropertyError( Codes[Code.NoName], domain.Name, new[] { codedValue.Value }, "Value [{0}] in coded value domain '{1}' does not have an associated name", codedValue.Value, domain.Name); } continue; } string message; TextLengthIssue?lengthIssue = SchemaTestUtils.HasValidLength( codedValue.Name, _maximumNameLength, "name", out message); if (lengthIssue != null) { errorCount += ReportSchemaPropertyError(GetIssueCode(lengthIssue.Value), domain.Name, new[] { codedValue.Value }, "Value [{0}] in coded value domain '{1}': {2} ('{3}')", codedValue.Value, domain.Name, message, codedValue.Name); } } // report non-unique names errorCount += CheckUniqueNames(domainUsage, codedValues); // report error if the number of coded values is less than the minimum count if (codedValues.Count < _minimumValueCount) { string format = codedValues.Count == 1 ? "Domain '{0}' has {1} coded value. Minimum: {2}" : "Domain '{0}' has {1} coded values. Minimum: {2}"; string description = string.Format(format, domainUsage.DomainName, codedValues.Count, _minimumValueCount); errorCount += ReportSchemaPropertyError(Codes[Code.TooFewCodedValues], domainUsage.DomainName, description); } // report error if the number of coded values with non-equal name/value pair is // less than the minimum count for non-equal values (and the total coded value // count exceeds that minimum value; otherwise an error would always be reported) if (nonEqualNameValueCount < _minimumNonEqualNameValueCount && codedValues.Count >= _minimumNonEqualNameValueCount) { string description = string.Format( "Domain '{0}' has {1} coded values with a name that is different from the value. Minimum: {2}", domainUsage.DomainName, nonEqualNameValueCount, _minimumNonEqualNameValueCount); errorCount += ReportSchemaPropertyError(Codes[Code.NotEnoughNamesDifferentFromValue], domainUsage.DomainName, description); } return(errorCount); }
public static void Init() { try { Logger.Debug("Setting Start!!"); GlobalVar.DatabaseId = "REAL"; GlobalVar.ServerUrl = ServerConsts.REAL; GlobalVar.Settings.SetValue("IS_USESKIN", SkinConsts.IS_USESKIN); GlobalVar.Settings.SetValue("MAIN_SKIN", SkinConsts.MAIN_SKIN); GlobalVar.Settings.SetValue("FORM_SKIN", SkinConsts.FORM_SKIN); GlobalVar.Settings.SetValue("GRID_SKIN", SkinConsts.GRID_SKIN); GlobalVar.Settings.SetValue("GRID_EVEN_AND_ODD", SkinConsts.GRID_EVEN_AND_ODD); if (FontFamily.Families.Where(x => x.Name == SkinConsts.FONT_NAME).Any()) { GlobalVar.Settings.SetValue("FONT_NAME", SkinConsts.FONT_NAME); } else { GlobalVar.Settings.SetValue("FONT_NAME", SystemFonts.DefaultFont.Name); } GlobalVar.Settings.SetValue("FONT_SIZE", SkinConsts.FONT_SIZE); AppearanceObject.DefaultFont = new Font(GlobalVar.Settings.GetValue("FONT_NAME").ToStringNullToEmpty(), (float)GlobalVar.Settings.GetValue("FONT_SIZE")); GlobalVar.Settings.SetValue("VISIBLE_TOOLBAR_NAME", "YES"); GlobalVar.Settings.SetValue("COMPANY_NAME", "JW.Play"); GlobalVar.Settings.SetValue("DEPARTMENT_NAME", "Development Division"); GlobalVar.Settings.SetValue("USER_NAME", "Manager"); GlobalVar.Settings.SetValue("MAINFORM_WINDOW_STATE", FormWindowState.Maximized); SplashUtils.ShowWait("리소스 데이터를 생성하는 중입니다... 잠시만..."); DomainUtils.Init(); try { DataTable data = (DataTable)DBTranHelper.GetData("Auth", "GetSettings", "Setting", new DataMap()).TranList[0].Data; if (data != null && data.Rows.Count > 0) { foreach (DataRow row in data.Rows) { GlobalVar.Settings.SetValue(row["CODE"].ToString(), row["VALUE"]); } } } catch (Exception ex) { MsgBox.Show(ex); } try { DomainUtils.SetData(); } catch (Exception ex) { MsgBox.Show(ex); } SplashUtils.CloseWait(); Logger.Debug("Setting End!!"); } catch (Exception ex) { MsgBox.Show(ex); } }
public void DuplicatesInOtherWorkspace() { IDomain domain1 = DomainUtils.AddDomain(_workspace, DomainUtils.CreateCodedValueDomain( "DOM_FIELD1", esriFieldType.esriFieldTypeInteger, "Description of DOM_FIELD1", new CodedValue(1, "Value 1"), new CodedValue(2, "Value 2"))); IDomain domain2 = DomainUtils.AddDomain(_workspace, DomainUtils.CreateCodedValueDomain( "DOM_FIELD2", esriFieldType.esriFieldTypeInteger, "Description of DOM_FIELD2", new CodedValue(1, "Value 1"), new CodedValue(2, "Value 2"))); // domain (not used in table) with duplicate name - this should not be reported since duplicates are searched in target (?) DomainUtils.AddDomain(_workspace, DomainUtils.CreateCodedValueDomain("DOM_FIELD3", esriFieldType .esriFieldTypeInteger, "Description of DOM_FIELD2", new CodedValue(1, "Value 1"), new CodedValue(2, "Value 2"))); IField field1 = FieldUtils.CreateField("FIELD1", esriFieldType.esriFieldTypeInteger); IField field2 = FieldUtils.CreateField("FIELD2", esriFieldType.esriFieldTypeInteger); IField field3 = FieldUtils.CreateTextField("FIELD3", 20); ((IFieldEdit)field1).Domain_2 = domain1; ((IFieldEdit)field2).Domain_2 = domain2; ITable table = DatasetUtils.CreateTable(_workspace, MethodBase.GetCurrentMethod().Name, FieldUtils.CreateOIDField(), field1, field2, field3); // add domains/table to target workspace IFeatureWorkspace targetWorkspace = TestWorkspaceUtils.CreateTestFgdbWorkspace($"{GetType().Name}_target"); // same name, same description --> should be considered equal, no duplicate DomainUtils.AddDomain(targetWorkspace, DomainUtils.CreateCodedValueDomain("DOM_FIELD1", esriFieldType .esriFieldTypeInteger, "Description of DOM_FIELD1", new CodedValue(1, "Value 1"), new CodedValue(2, "Value 2"))); // different name, same description --> should be reported DomainUtils.AddDomain(targetWorkspace, DomainUtils.CreateCodedValueDomain("DOM_FIELD4", esriFieldType .esriFieldTypeInteger, "Description of DOM_FIELD2", new CodedValue(1, "Value 1"), new CodedValue(2, "Value 2"))); // different name, same description --> should be reported DomainUtils.AddDomain(targetWorkspace, DomainUtils.CreateRangeDomain("DOM_FIELD5", esriFieldType.esriFieldTypeInteger, 0, 100, "Description of DOM_FIELD2")); ITable targetTable = DatasetUtils.CreateTable(targetWorkspace, MethodBase.GetCurrentMethod().Name, FieldUtils.CreateOIDField(), FieldUtils.CreateTextField("FIELD1", 10)); const int maxLength = 25; const bool noDuplicates = true; var runner = new QaTestRunner(new QaSchemaFieldDomainDescriptions(table, maxLength, noDuplicates, targetTable)); runner.Execute(); Assert.AreEqual(1, runner.Errors.Count); }