Example #1
0
 public async Task<PostsResponse> GetPostByNamesAsync(string[] names, string scheme = "full")
 {
     var groupIds = new GroupNames()
     {
         names = names
     };
     var result = await _webManager.PostData(new Uri(Endpoints.PostByName), null, new StringContent(JsonConvert.SerializeObject(groupIds), Encoding.UTF8, "application/json"));
     return JsonConvert.DeserializeObject<PostsResponse>(result.ResultJson);
 }
            public TypeGroupDescription()
            {
                GroupNames.Add(null);
                var setting = UserSettings.Instance.General.SortCharactersFirst;

                if (setting)
                {
                    GroupNames.Add(CharactersGroup);
                }
                GroupNames.Add(ChannelsGroup);
                if (!setting)
                {
                    GroupNames.Add(CharactersGroup);
                }
            }
        // group names extracted from path to textures and overall quantity of groups
        private static void GroupNameCreation()
        {
            GroupNames.Add(
                GetGroupNameFromPath(PathToTextures, false, '/')
                );

            string[] subdirectories = Directory.GetDirectories(PathToTextures);
            for (Int32 i = 0; i < subdirectories.Length; ++i)
            {
                GroupNames.Add(
                    GetGroupNameFromPath(subdirectories[i], true, '/')
                    );
            }

            GroupCount     = subdirectories.Length + 1;
            subdirectories = null;
        }
Example #4
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = Type != null?Type.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Label != null ? Label.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Category != null ? Category.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Tags != null ? Tags.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (GroupNames != null ? GroupNames.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Link != null ? Link.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (State != null ? State.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (TransformedState != null ? TransformedState.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (StateDescription != null ? StateDescription.GetHashCode() : 0);
                return(hashCode);
            }
        }
Example #5
0
 public List <string> GetGroupMembers(string groupName)
 {
     GroupNames.Add(groupName);
     return(Current.LocalCache.GetSet <List <string> >("ADMembers-" + groupName,
                                                       (old, _) =>
     {
         using (MiniProfiler.Current.Step("Getting members for " + groupName))
         {
             var group = RunCommand(pc =>
             {
                 using (var gp = GroupPrincipal.FindByIdentity(pc, groupName))
                 {
                     return gp?.GetMembers(true).ToList().Select(mp => mp.SamAccountName).ToList() ?? new List <string>();
                 }
             });
             return group ?? old ?? new List <string>();
         }
     }, 5.Minutes(), 24.Hours()));
 }
Example #6
0
 /// <summary>
 /// Selects or deselects a group for frame design.
 /// </summary>
 /// <param name="group">An existing group.</param>
 /// <param name="selectForDesign">True: The specified group is selected as a design group for steel design.
 /// False: The group is not selected for steel design.</param>
 /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception>
 private void set(Group group, bool selectForDesign)
 {
     if (selectForDesign)
     {
         if (!GroupNames.Contains(group.Name))
         {
             GroupNames.Add(group.Name);
         }
         if (!Groups.Contains(group))
         {
             _designGroups.Add(group);
         }
     }
     else
     {
         GroupNames.Remove(group.Name);
         _designGroups.Remove(group);
     }
 }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (Label != null)
         {
             hashCode = hashCode * 59 + Label.GetHashCode();
         }
         if (Category != null)
         {
             hashCode = hashCode * 59 + Category.GetHashCode();
         }
         if (Tags != null)
         {
             hashCode = hashCode * 59 + Tags.GetHashCode();
         }
         if (GroupNames != null)
         {
             hashCode = hashCode * 59 + GroupNames.GetHashCode();
         }
         if (GroupType != null)
         {
             hashCode = hashCode * 59 + GroupType.GetHashCode();
         }
         if (Function != null)
         {
             hashCode = hashCode * 59 + Function.GetHashCode();
         }
         return(hashCode);
     }
 }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            _listBox = (ListBox)GetTemplateChild("ListItems");
            if (ItemsSource != null)
            {
                _collectionView        = CollectionViewSource.GetDefaultView(ItemsSource);
                _collectionView.Filter = CustomerFilter;
            }
            _pupListBox                = (Popup)GetTemplateChild("pupListBox");
            _listBox.ItemsSource       = _collectionView;
            _listBox.DisplayMemberPath = _viewElement;
            //_listBox.SelectionChanged += ListBox_SelectionChanged;
            _listBox.GotFocus  += ListBox_GotFocus;
            _listBox.LostFocus += ListBox_LostFocus;
            _listBox.ItemContainerGenerator.StatusChanged += ItemContainerGenerator_StatusChanged;


            _searchBox              = (TextBox)GetTemplateChild("SearchBox");
            _searchBox.TextChanged += SearchBox_TextChanged;
            _searchBox.GotFocus    += SearchBox_GotFocus;
            _searchBox.LostFocus   += SearchBox_LostFocus;
            _pupListBox.Loaded     += PupListBox_Loaded;
            _pupListBox.KeyUp      += PupListBox_KeyUp;
            _pupListBox.KeyDown    += PupListBox_KeyDown;
            _pupListBox.Opened     += PupListBox_Opened;

            _searchBox.KeyDown += SearchtBox_KeyDown;

            EventManager.RegisterClassHandler(typeof(ListBoxItem), ListBoxItem.MouseLeftButtonDownEvent, new RoutedEventHandler(this.MouseLeftButtonDownClassHandler));

            if (GroupNames != null && GroupNames.Count() > 0)
            {
                GroupNames.ToList().ForEach(
                    x =>
                    _collectionView.GroupDescriptions.Add(new PropertyGroupDescription(x)));
            }

            UpdateStates(false);
        }
Example #9
0
        public List <GroupNames> GetGroupNames()
        {
            MySqlConnection conn = new MySqlConnection(connectionString);
            MySqlCommand    cmd  = conn.CreateCommand();

            cmd.CommandText = "SELECT * FROM groupname;";

            using (conn)
            {
                conn.Open();
                MySqlDataReader reader = cmd.ExecuteReader();

                var allGroupNames = new List <GroupNames>();

                while (reader.Read() == true)
                {
                    var currentGroupName = new GroupNames();
                    currentGroupName.GroupID   = reader.GetInt32("GroupID");
                    currentGroupName.GroupName = reader.GetString("GroupName");
                    allGroupNames.Add(currentGroupName);
                }
                return(allGroupNames);
            }
        }
        /// <summary>
        /// Returns true if EnrichedItemDTO instances are equal
        /// </summary>
        /// <param name="input">Instance of EnrichedItemDTO to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(EnrichedItemDTO input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Type == input.Type ||
                     (Type != null &&
                      Type.Equals(input.Type))
                     ) &&
                 (
                     Name == input.Name ||
                     (Name != null &&
                      Name.Equals(input.Name))
                 ) &&
                 (
                     Label == input.Label ||
                     (Label != null &&
                      Label.Equals(input.Label))
                 ) &&
                 (
                     Category == input.Category ||
                     (Category != null &&
                      Category.Equals(input.Category))
                 ) &&
                 (
                     Tags == input.Tags ||
                     Tags != null &&
                     Tags.SequenceEqual(input.Tags)
                 ) &&
                 (
                     GroupNames == input.GroupNames ||
                     GroupNames != null &&
                     GroupNames.SequenceEqual(input.GroupNames)
                 ) &&
                 (
                     Link == input.Link ||
                     (Link != null &&
                      Link.Equals(input.Link))
                 ) &&
                 (
                     State == input.State ||
                     (State != null &&
                      State.Equals(input.State))
                 ) &&
                 (
                     TransformedState == input.TransformedState ||
                     (TransformedState != null &&
                      TransformedState.Equals(input.TransformedState))
                 ) &&
                 (
                     StateDescription == input.StateDescription ||
                     (StateDescription != null &&
                      StateDescription.Equals(input.StateDescription))
                 ) &&
                 (
                     CommandDescription == input.CommandDescription ||
                     (CommandDescription != null &&
                      CommandDescription.Equals(input.CommandDescription))
                 ) &&
                 (
                     Metadata == input.Metadata ||
                     Metadata != null &&
                     Metadata.SequenceEqual(input.Metadata)
                 ) &&
                 (
                     Editable == input.Editable ||
                     (Editable != null &&
                      Editable.Equals(input.Editable))
                 ));
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        process = true;
        // If control is not visible don't process anything
        if (!Visible || StopProcessing)
        {
            process         = false;
            EnableViewState = false;
            return;
        }
        string forumIDs = null;
        // Group where condition part
        string groupWhere = String.Empty;

        if (SiteName == string.Empty)
        {
            SiteName = SiteContext.CurrentSiteName;
        }
        if (SiteName != TreeProvider.ALL_SITES)
        {
            groupWhere = "GroupSiteID IN (SELECT SiteID FROM CMS_Site WHERE SiteName = N'" + SqlHelper.GetSafeQueryString(SiteName, false) + "')";
        }

        if (CommunityGroupId > 0)
        {
            groupWhere = SqlHelper.AddWhereCondition(groupWhere, "GroupGroupID = " + CommunityGroupId);
        }

        // Add where condition from property
        if (WhereCondition != String.Empty)
        {
            groupWhere = SqlHelper.AddWhereCondition(groupWhere, WhereCondition);
        }

        bool hasGroupRights = false;

        if (CommunityGroupId > 0)
        {
            if (MembershipContext.AuthenticatedUser.IsGroupAdministrator(CommunityGroupId) ||
                MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("cms.groups", "Manage"))
            {
                hasGroupRights = true;
            }
        }

        // Get forums moderated by current user
        else if (!MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Admin))
        {
            // Get forumId where the user is moderator and forum satisfy group where condition
            string whereCond = "UserID =" + MembershipContext.AuthenticatedUser.UserID;
            if (groupWhere != String.Empty)
            {
                whereCond += " AND ForumID IN ( SELECT ForumID FROM Forums_Forum WHERE " +
                             "ForumGroupID IN (SELECT GroupID FROM Forums_ForumGroup WHERE " + groupWhere + "))";
            }

            // Get forums where user is moderator
            DataSet ds = ForumModeratorInfoProvider.GetGroupForumsModerators(whereCond, null);

            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                forumIDs = "";

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    forumIDs += ValidationHelper.GetString(dr["ForumID"], "") + ",";
                }

                // Remove ending ,
                forumIDs = forumIDs.TrimEnd(',');
            }
        }

        string zeroRowText = String.Empty;

        if (ZeroRowText == String.Empty)
        {
            zeroRowText = GetString("general.nodatafound");
        }
        else
        {
            zeroRowText = HTMLHelper.HTMLEncode(ZeroRowText);
        }

        // Hide approvals
        if ((!MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Admin)) && (String.IsNullOrEmpty(forumIDs)) && (hasGroupRights == false))
        {
            if (!HideControlForNoData)
            {
                gridApprove.StopProcessing = true;
                process         = false;
                lblInfo.Text    = zeroRowText;
                lblInfo.Visible = true;
                return;
            }
            else
            {
                Visible = false;
            }
        }

        gridApprove.ZeroRowsText           = zeroRowText;
        gridApprove.OnAction              += gridApprove_OnAction;
        gridApprove.GridView.AllowSorting  = false;
        gridApprove.OnExternalDataBound   += gridApprove_OnExternalDataBound;
        gridApprove.IsLiveSite             = IsLiveSite;
        gridApprove.HideControlForZeroRows = false;

        if ((!RequestHelper.IsPostBack()) && (!string.IsNullOrEmpty(ItemsPerPage)))
        {
            gridApprove.Pager.DefaultPageSize = ValidationHelper.GetInteger(ItemsPerPage, -1);
        }

        if (MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Admin) || hasGroupRights)
        {
            if (groupWhere != String.Empty)
            {
                gridApprove.WhereCondition = "(PostApproved IS NULL OR PostApproved = 0) AND (PostForumID IN (SELECT ForumID FROM [Forums_Forum] WHERE ForumGroupID IN (SELECT GroupID FROM [Forums_ForumGroup] WHERE " + groupWhere + ")))";
            }
            // Show only posts waiting for approval
            else
            {
                gridApprove.WhereCondition = "(PostApproved IS NULL OR PostApproved = 0)";
            }
        }
        else if (forumIDs != null)
        {
            gridApprove.WhereCondition = "((PostApproved IS NULL) OR (PostApproved = 0)) AND (PostForumID IN  (SELECT ForumID FROM [Forums_Forum] WHERE (ForumID IN (" +
                                         forumIDs + "))";
            if (groupWhere != String.Empty)
            {
                gridApprove.WhereCondition += " AND (ForumGroupID IN (SELECT GroupID FROM [Forums_ForumGroup] WHERE " + groupWhere + "))))";
            }
            else
            {
                gridApprove.WhereCondition += "))";
            }
        }


        //Filter group names
        if (GroupNames != String.Empty)
        {
            string where = String.Empty;
            string   parsedNames = String.Empty;
            string[] names       = GroupNames.Split(';');
            if (names.Length > 0)
            {
                foreach (string name in names)
                {
                    parsedNames += "'" + SqlHelper.GetSafeQueryString(name, false) + "',";
                }
                parsedNames = parsedNames.TrimEnd(',');
                where       = "(PostForumID IN (SELECT ForumID FROM [Forums_Forum] WHERE (ForumGroupID IN (SELECT GroupID FROM [Forums_ForumGroup] WHERE GroupName IN (" + parsedNames + ")))))";
                gridApprove.WhereCondition = SqlHelper.AddWhereCondition(gridApprove.WhereCondition, where);
            }
        }
    }
Example #12
0
        public bool InitWndControls()
        {
            using (var wrapper = new DisposableWrapper <ShowAsyncResult>(CWaitingWnd.ShowAsync(Title,
                                                                                               Properties.Resources.resFillingGenerationFromOnlineBDWnd,
                                                                                               this,
                                                                                               CheckAccess()),
                                                                         asyncResult =>
            {
                if (asyncResult?.hFinishedSearchEvent != null)
                {
                    asyncResult.hFinishedSearchEvent.Set();
                }
            }))
            {
                EndYears.Clear();
                StartYears.Clear();
                EndYears.Add((int)enEndYearSpecVals.AndYounger);
                EndYears.Add((int)enEndYearSpecVals.AndElder);
                for (int i = DateTime.Now.Year - 7; i > DateTime.Now.Year - 100; i--)
                {
                    StartYears.Add(i);
                    EndYears.Add(i);
                }


                GroupNames.Clear();
                lock (DBManagerApp.m_AppSettings.m_SettingsSyncObj)
                {
                    foreach (var groupNameDesc in DBManagerApp.m_AppSettings.m_Settings.AvailableGroupNames)
                    {
                        GroupNames.Add(groupNameDesc.GroupName);
                    }
                }

                // Заполняем выпадающие списки текущими значениями
                LocalDBComps.Clear();

                try
                {
                    foreach (var comp in DBManagerApp.m_Entities.descriptions.ToList())
                    {
                        var item = new CompDescLocalWorkbook()
                        {
                            ID        = comp.id_desc,
                            Name      = comp.name,
                            StartDate = DateTime.Today,
                            EndDate   = DateTime.Today.AddDays(2)
                        };
                        item.DestCompFolder   = GetDefaultDestCompFolderName(item);
                        item.PropertyChanged += comp_PropertyChanged;

                        LocalDBComps.Add(item);
                    }
                    SelectedComp = LocalDBComps.LastOrDefault();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this,
                                    string.Format(Properties.Resources.resfmtErrorDuringReadingDataFromOnlineDB, ex.Message),
                                    Title,
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                    return(false);
                }

                cmbMainJudge.Items.Clear();
                foreach (var mainJudge in DBManagerApp
                         .m_Entities
                         .groups
                         .Select(arg => arg.main_judge)
                         .Where(arg => !string.IsNullOrEmpty(arg))
                         .Distinct())
                {
                    cmbMainJudge.Items.Add(mainJudge);
                }

                cmbMainSecretary.Items.Clear();
                foreach (var mainSecretary in DBManagerApp
                         .m_Entities
                         .groups
                         .Select(arg => arg.main_secretary)
                         .Where(arg => !string.IsNullOrEmpty(arg))
                         .Distinct())
                {
                    cmbMainSecretary.Items.Add(mainSecretary);
                }

                cmbRow6.Items.Clear();
                foreach (var row6 in DBManagerApp
                         .m_Entities
                         .groups
                         .Select(arg => arg.row6)
                         .Where(arg => !string.IsNullOrEmpty(arg))
                         .Distinct())
                {
                    cmbRow6.Items.Add(row6);
                }
            }

            return(true);
        }
Example #13
0
 public override int GetHashCode()
 {
     return(ShowActive.GetHashCode() ^ ShowInactive.GetHashCode() ^
            ShowTimers.GetHashCode() ^ ShowAlarms.GetHashCode() ^
            GroupNames.GetHashCode() ^ SearchString.GetHashCode());
 }
Example #14
0
 public Group(GroupNames name, List<Person> students)
 {
     groupName = name;
     this.students = students;
 }
        public override Dictionary <string, string> AsDictionary()
        {
            var dictionary = new Dictionary <string, string>
            {
                { "fields", "taglist" }
            };

            var catArray = Categories?.ToArray();

            if ((catArray?.Length ?? 0) > 0)
            {
                dictionary.Add("category", string.Join(",", catArray));
            }

            if (!string.IsNullOrWhiteSpace(Country))
            {
                dictionary.Add("country", Country);
            }

            var groupIdArray = GroupIds?.ToArray();

            if ((groupIdArray?.Length ?? 0) > 0)
            {
                dictionary.Add("group_id", string.Join(",", groupIdArray));
            }

            var groupNameArray = GroupNames?.ToArray();

            if ((groupNameArray?.Length ?? 0) > 0)
            {
                dictionary.Add("group_urlname", string.Join(",", groupNameArray));
            }

            if (Latitude.HasValue)
            {
                dictionary.Add("lat", Latitude.ToString());
            }

            if (Longitude.HasValue)
            {
                dictionary.Add("lon", Longitude.ToString());
            }

            if (!string.IsNullOrWhiteSpace(Location))
            {
                dictionary.Add("location", Location);
            }

            if (MinimumGroups.HasValue)
            {
                dictionary.Add("min_groups", MinimumGroups.Value.ToString());
            }

            if (MilesRadius.HasValue)
            {
                dictionary.Add("radius", MilesRadius.ToString());
            }

            if (UsedBetween != null)
            {
                dictionary.Add("used_between", UsedBetween.ToUrl);
            }

            if (!string.IsNullOrWhiteSpace(Zip))
            {
                dictionary.Add("zip", Zip);
            }

            AddPagination(dictionary);

            return(dictionary);
        }
Example #16
0
        void HandleEntityDeleted(object sender, EntityIdEventArgs e)
        {
            IGroupListItemViewModel groupListItemViewModel = GroupNames.First(i => i.Id == e.Id);

            GroupNames.Remove(groupListItemViewModel);
        }
Example #17
0
 public Task SubscribeToProject(int projectId)
 {
     return(Groups.Add(Context.ConnectionId, GroupNames.Project(projectId)));
 }
Example #18
0
 public void Save(string name, string value, GroupNames groupName = default(GroupNames))
 {
     throw new NotImplementedException();
 }
Example #19
0
        private Dictionary <byte, TokenDictionaryEntry> GetTokensFromNode(XmlNodeList nodes, out List <string> alts, string prevBytes = "")
        {
            Dictionary <byte, TokenDictionaryEntry> currentTokens = new Dictionary <byte, TokenDictionaryEntry>();

            alts = new List <string>();
            foreach (XmlNode node in nodes)
            {
                //alts = new List<string>();
                if (node.NodeType != XmlNodeType.Comment)
                {
                    if (node.Name == "Token")
                    {
                        byte key = getByteFromXml(node);

                        TokenDictionaryEntry value = new TokenDictionaryEntry()
                        {
                            Byte = key
                        };

                        if (node.Attributes["string"] != null)
                        {
                            value.Name = node.Attributes["string"].Value;
                            if (value.Name == "\\n")
                            {
                                value.Name = "\n";
                            }

                            if (node.Attributes["comment"] != null)
                            {
                                string comment = Regex.Unescape(node.Attributes["comment"].Value);
                                value.Comment = comment;
                                if (!Comments.ContainsKey(value.Name))
                                {
                                    Comments.Add(value.Name, comment);
                                }
                            }

                            if (node.Attributes["site"] != null)
                            {
                                string site = node.Attributes["site"].Value;
                                value.Site = site;
                                if (!Sites.ContainsKey(value.Name))
                                {
                                    Sites.Add(value.Name, site);
                                }
                            }

                            if (node.Attributes["group"] != null)
                            {
                                value.Group = node.Attributes["group"].Value;
                                if (!GroupNames.Contains(value.Group))
                                {
                                    GroupNames.Add(value.Group);
                                }
                            }
                            else
                            {
                                value.Group = "_default";
                            }

                            if (!Groups.ContainsKey(value.Name))
                            {
                                Groups.Add(value.Name, value.Group);
                            }

                            if (node.Attributes["style"] != null)
                            {
                                value.StyleType = node.Attributes["style"].Value;
                            }

                            if (node.Attributes["stringTerminator"] != null)
                            {
                                bool term;
                                value.StringTerminator = bool.TryParse(node.Attributes["stringTerminator"].Value, out term) ? term : false;
                            }

                            if (node.Attributes["stringStarter"] != null)
                            {
                                bool term;
                                value.StringStarter = bool.TryParse(node.Attributes["stringStarter"].Value, out term) ? term : false;
                            }

                            if (node.Attributes["indentGroup"] != null)
                            {
                                value.IndentGroup = node.Attributes["indentGroup"].Value;
                            }

                            if (node.Attributes["indentGroupTerminator"] != null)
                            {
                                if (string.IsNullOrEmpty(value.IndentGroup))
                                {
                                    throw new ArgumentException(string.Format("Cannot have indentGroupTerminator without indentGroup. On token {0}.", value.Name));
                                }

                                bool term;
                                value.IndentGroupTerminator = bool.TryParse(node.Attributes["indentGroupTerminator"].Value, out term) ? term : false;
                            }

                            string bytes = prevBytes + key.ToString("X2");
                            value.Bytes = bytes;
                            StringToBytesTrie.AddData(value.Name, bytes);
                            BytesToStringTrie.AddData(HexHelper.GetByteArray(bytes), value);
                        }
                        List <string> myAlts = new List <string>();
                        if (node.HasChildNodes)
                        {
                            value.SubTokens = GetTokensFromNode(node.ChildNodes, out myAlts, prevBytes + key.ToString("X2"));
                        }
                        currentTokens.Add(key, value);
                        if (value.Name != null)
                        {
                            if (FlatTokens.ContainsKey(value.Name))
                            {
                                throw new AmbiguousTokenException(value.Name);
                            }
                            FlatTokens.Add(value.Name, value);
                            foreach (string alt in myAlts)
                            {
                                if (FlatTokens.ContainsKey(alt))
                                {
                                    throw new AmbiguousTokenException(string.Format("{0} alt: ({1})", value.Name, alt));
                                }
                                value.Alts.Add(alt);
                                FlatTokens.Add(alt, value);
                            }
                            myAlts.Clear();
                        }
                    }
                    else if (node.Name == "Alt")
                    {
                        string alt = node.Attributes["string"].Value;
                        StringToBytesTrie.AddData(alt, prevBytes);
                        alts.Add(alt);
                    }
                }
            }

            return(currentTokens);
        }
Example #20
0
        public EditLegacyBuildingWizard(Building SelectedBuilding = null)
        {
            InitializeComponent();
            DataContext = this;

            MetersCollection = new ObservableCollection <MeterType>();
            InitializeCategoriesList();
            InitializeUnitsList();
            InitializeCostCollection();
            CostBeggining = DateTime.Today;
            if (SelectedBuilding != null)
            {
                _buildingLocalCopy = new Building(SelectedBuilding);

                BuildingName       = SelectedBuilding.Name;
                BuildingCity       = SelectedBuilding.City;
                BuildingZipCode    = SelectedBuilding.ZipCode;
                BuildingRoadName   = SelectedBuilding.RoadName;
                BuildingRoadNumber = SelectedBuilding.BuildingNumber;

                foreach (var c in SelectedBuilding.CostCollection)
                {
                    var clv = new Helpers.CostListView {
                        BegginingDate = c.BegginingDate.Date, EndingDate = c.EndingDate.Date, Cost = c.CostPerUnit, CostUnit = UnitsNames.Where(x => x.EnumValue == c.BuildingChargeBasisDistribution).FirstOrDefault(), CategoryName = CategoriesNames.Where(x => x.BuildingChargeBasisCategoryId.Equals(c.BuildingChargeBasisCategoryId)).FirstOrDefault().CategoryName, CostGroup = GroupNames.Where(x => x.BuildingChargeGroupNameId == c.BuildingChargeGroupNameId).FirstOrDefault()
                    };
                    CostCollection.Add(clv);
                }
                MetersCollection = new ObservableCollection <MeterType>(SelectedBuilding.MeterCollection);
            }
            if (_buildingLocalCopy != null)
            {
                GroupBankAccounts = new ObservableCollection <BuildingChargeGroupBankAccount>(GroupBankAccountsTotal.Where(x => !x.IsDeleted && x.Building.BuildingId == _buildingLocalCopy.BuildingId).ToList());
            }
            else
            {
                GroupBankAccounts = new ObservableCollection <BuildingChargeGroupBankAccount>();
            }
        }
Example #21
0
 public string Load(string name, GroupNames groupName = default(GroupNames))
 {
     throw new NotImplementedException();
 }
Example #22
0
 private int getParamIndex(string[] arrayNames, GroupNames group)
 {
     return(Array.IndexOf(arrayNames, Enum.GetName(typeof(GroupNames), group)));
 }
Example #23
0
 /// <summary>
 /// Gets the internal descriptive group name of the given group.
 /// </summary>
 /// <param name="modelGroup">The group.</param>
 /// <returns>The descriptive name.</returns>
 public string GetInternalDescriptiveGroupName(ModelGroup modelGroup)
 {
     return(GroupNames.GetInternalDescriptiveGroupName(modelGroup));
 }
Example #24
0
//        public ParamGroup(string sqlParam, string tmplParam,

        public ParamGroup(string sqlParam, string tmplPatam,
                          GroupNames paramGroup, List <FieldBase> fields, FieldFunc ownField)
        {
            string[] sqlArray   = sqlParam.Split(')')[0].Split(new Char[] { ' ', ',' });
            string[] paramArray = tmplPatam.Split(new Char[] { ' ', ',', ')' });
            GroupName = paramGroup.ToString();

            for (int i = 0; i < sqlArray.Length; i++)
            {
                if (i >= paramArray.Length)
                {
                    msgError += String.Format(";missed param. {0}", sqlArray[i]);
                    if (GroupNames.outPar != paramGroup)
                    {
                        AllFound = false;
                    }
                    break;
                }

                string resName = paramArray[i];
                if (paramGroup == GroupNames.outPar)
                {
                    resName = String.Format("{0}.{1}", ownField.ResName, resName);
                }
                FieldBase field = fields.Find(x => (x.ResName == resName) & (x.Attr != attrName.Myltiply));
                if (field == null)
                {
                    var multyFiels = fields.FindAll(x => x.Attr == attrName.Myltiply);
                    field = multyFiels.Find(x => (x as FieldMultiply).NameVal1 == resName | (x as FieldMultiply).NameVal2 == resName);
                }
                bool isSystem = !paramArray[i].Any(Char.IsLower);
                if ((field == null) && !isSystem)
                {
                    msgError += String.Format(";missed field {0}", paramArray[i]);
                    if (GroupNames.outPar != paramGroup)
                    {
                        AllFound = false;
                    }
                    continue;
                }

                ParamBase newParam = null;
                switch (paramGroup)
                {
                case GroupNames.outPar:
                    newParam = new ParamAnswer(paramArray[i], sqlArray[i], ownField, field);
                    break;

                default:
                    if (isSystem)
                    {
                        newParam = new ParamSys(paramArray[i], sqlArray[i], ownField);
                    }
                    else
                    {
                        newParam = new ParamToSql(paramArray[i], sqlArray[i], ownField, field);
                    }
                    break;
                }
                if (newParam != null)
                {
                    Add(newParam);
                }
            }
            if ((paramGroup != GroupNames.outPar) && AllFound)
            {
                foreach (ParamBase param in this)
                {
                    if (!param.XlsExist)
                    {
                        AllFound = false;
                        break;
                    }
                }
            }
        }