/// <summary> /// Creates a new instance of the class and /// initialize the list with values parsed from parameter. /// </summary> /// <param name="groupSortParam">string to parse sort values from</param> public GroupSortParam(string groupSortParam) { this.GroupFields = new List <FieldOrder>(); this.SortField = new FieldOrder(); parseGroupSortParam(groupSortParam); }
/// <summary> /// Fills an instantiated object with values /// parsed from supplied parameter string. /// </summary> /// <param name="groupSortParam">string to parse sort values from</param> public void parseGroupSortParam(string groupSortParam) { try { //Variables int sortPairsIndex = 1; //Split tring by comma string[] sortPairs = groupSortParam.Trim().Split(','); foreach (string sortPair in sortPairs) { //process each grouping, last row is for table sort if (sortPairsIndex < sortPairs.Length) { //Split tring by space string[] fieldOrders = sortPair.Trim().Split(' '); //Add to group list FieldOrder grp = new FieldOrder(fieldOrders[0].Trim(), fieldOrders[1].Trim()); this.GroupFields.Add(grp); //increment index sortPairsIndex++; } else { //Add to sort this.SortField.field = sortPair.Trim(); } } } catch { throw; } }
/// <summary> /// Creates a new instance of the class and initialize the list. /// </summary> public GroupSortParam() { this.GroupFields = new List <FieldOrder>(); this.SortField = new FieldOrder(); }