Beispiel #1
0
    protected void btnFilter_Click(object sender, EventArgs e)
    {
        string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);

        using (Utils utility = new Utils())
        {
            utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
        this._listOperation = new ListOperation();
        try
        {
            this.grdNotes.XGridBindSearch();
        }
        catch (Exception ex)
        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            using (Utils utility = new Utils())
            {
                utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
            }
            string str2 = "Error Request=" + id + ".Please share with Technical support.";
            base.Response.Redirect("Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
        }
        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }
Beispiel #2
0
    protected void extddlFilter_SelectedIndexChanged(object sender, EventArgs e)
    {
        string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);

        using (Utils utility = new Utils())
        {
            utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
        }

        _listOperation = new ListOperation();
        try
        {
            grdNotes.XGridBindSearch();
            //grdNotes.CurrentPageIndex = 0;
            //_listOperation.WebPage = this.Page;
            //_listOperation.Xml_File = "NoteSearch.xml";
            //_listOperation.LoadList();
        }
        catch (Exception ex)
        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            using (Utils utility = new Utils())
            {
                utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
            }
            string str2 = "Error Request=" + id + ".Please share with Technical support.";
            base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
        }
        //Method End

        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }
Beispiel #3
0
        public ActionResult ListOperation(int containerId, ListOperation operation, SortBy?sortBy, SortDirection?sortByDirection, PagerParameters pagerParameters)
        {
            var items = _containerService.GetContentItems(containerId, VersionOptions.Latest).Select(x => x.As <ContainablePart>());

            switch (operation)
            {
            case ViewModels.ListOperation.Reverse:
                _containerService.Reverse(items);
                _services.Notifier.Success(T("The list has been reversed."));
                break;

            case ViewModels.ListOperation.Shuffle:
                _containerService.Shuffle(items);
                _services.Notifier.Success(T("The list has been shuffled."));
                break;

            case ViewModels.ListOperation.Sort:
                _containerService.Sort(items, sortBy.GetValueOrDefault(), sortByDirection.GetValueOrDefault());
                _services.Notifier.Success(T("The list has been sorted."));
                break;

            default:
                _services.Notifier.Error(T("Please select an operation to perform on the list."));
                break;
            }

            return(RedirectToAction("List", new { containerId, page = pagerParameters.Page, pageSize = pagerParameters.PageSize }));
        }
        public void RunSimpleExample(AerospikeClient client, Arguments args)
        {
            Key    key     = new Key(args.ns, args.set, "listkey");
            string binName = args.GetBinName("listbin");

            // Delete record if it already exists.
            client.Delete(args.writePolicy, key);

            IList inputList = new List <Value>();

            inputList.Add(Value.Get(55));
            inputList.Add(Value.Get(77));

            // Write values to empty list.
            Record record = client.Operate(args.writePolicy, key, ListOperation.AppendItems(binName, inputList));

            console.Info("Record: " + record);

            // Pop value from end of list and also return new size of list.
            record = client.Operate(args.writePolicy, key, ListOperation.Pop(binName, -1), ListOperation.Size(binName));

            console.Info("Record: " + record);

            // There should be one result for each list operation on the same list bin.
            // In this case, there are two list operations (pop and size), so there
            // should be two results.
            IList list = record.GetList(binName);

            foreach (object value in list)
            {
                console.Info("Received: " + value);
            }
        }
        public void OperateList1()
        {
            Key key = new Key(args.ns, args.set, "oplkey1");

            client.Delete(null, key);

            // Calling append() multiple times performs poorly because the server makes
            // a copy of the list for each call, but we still need to test it.
            // Using appendItems() should be used instead for best performance.
            Record record = client.Operate(null, key,
                                           ListOperation.Append(binName, Value.Get(55)),
                                           ListOperation.Append(binName, Value.Get(77)),
                                           ListOperation.Pop(binName, -1),
                                           ListOperation.Size(binName)
                                           );

            AssertRecordFound(key, record);

            IList list = record.GetList(binName);

            long size = (long)list[0];

            Assert.AreEqual(1, size);

            size = (long)list[1];
            Assert.AreEqual(2, size);

            long val = (long)list[2];

            Assert.AreEqual(77, val);

            size = (long)list[3];
            Assert.AreEqual(1, size);
        }
Beispiel #6
0
 private static IEnumerable <ListOperation <T> > Enumerate([NotNull] IEnumerable <T> items, int index)
 {
     foreach (var item in items)
     {
         yield return(ListOperation <T> .OnAdd(item, index ++));
     }
 }
Beispiel #7
0
        //SetListVariables()
        private void SetListVariables(ListOperation operation, LNode node)
        {
            //These operations cost very high in delete operations.
            //if (_isDeleteFrequent == true)
            //    return;
            switch (operation)
            {
            case ListOperation.Delete:
                Length--;
                //Set Maximum
                //Set Minimum
                //Set Priority
                break;

            case ListOperation.Insert:
                //Set Length for all data structures
                Length++;

                //TODO
                ////Set Maximum
                //if (node.IntegerData > MaximumInteger)
                //    MaximumInteger = node.IntegerData;
                ////Set Minimum
                //if (node.IntegerData < MinimumInteger)
                //    MinimumInteger = node.IntegerData;
                ////Set Priority
                //if (node.priority > HighestPriority)
                //    HighestPriority = node.priority;
                //if (node.priority < LowestPriority)
                //    LowestPriority = node.priority;
                break;

            default: return;
            }
        }
Beispiel #8
0
    /// <summary>
    /// Drop scenes from the scene list into the level list or move levels inside the level list
    /// </summary>
    private void DropScenesInLevels(IList <int> sceneIndices, int index, Type dragSource)
    {
        if (dragSource.Equals(typeof(SMSceneListDragSource)))
        {
            BeforeChange("Add scenes as level");
            IList <string> selectedScenes = ListOperation <string> .FilterList(scenes, sceneIndices);

            SMGroupedSceneConfigurationOperation.Build(Target).Level(selectedScenes, SelectedGroup)
            .MoveLevelToPosition(selectedScenes, index, SelectedGroup).Apply(Target);
            RebuildLevelOfCurrentGroup();
            levelListData.SetSelectedItems(currentGroupLevels, selectedScenes);
            SyncBuildSettingsIfRequired();
        }
        else
        {
            BeforeChange("Move level");
            IList <string> selectedLevel = ListOperation <string> .FilterList(currentGroupLevels, sceneIndices);

            SMGroupedSceneConfigurationOperation.Build(Target).MoveLevelToPosition(selectedLevel, index, SelectedGroup)
            .Apply(Target);
            RebuildLevelOfCurrentGroup();
            levelListData.SetSelectedItems(currentGroupLevels, selectedLevel);
        }
        EditorUtility.SetDirty(Target);
    }
        public void OperateListSort()
        {
            Key key = new Key(args.ns, args.set, "oplkey10");

            client.Delete(null, key);

            IList itemList = new List <Value>();

            itemList.Add(Value.Get(-44));
            itemList.Add(Value.Get(33));
            itemList.Add(Value.Get(-1));
            itemList.Add(Value.Get(33));
            itemList.Add(Value.Get(-2));

            Record record = client.Operate(null, key,
                                           ListOperation.AppendItems(ListPolicy.Default, binName, itemList),
                                           ListOperation.Sort(binName, ListSortFlags.DROP_DUPLICATES),
                                           ListOperation.Size(binName)
                                           );

            AssertRecordFound(key, record);

            IList results = record.GetList(binName);
            int   i       = 0;

            long size = (long)results[i++];

            Assert.AreEqual(5L, size);

            long val = (long)results[i++];

            Assert.AreEqual(4L, val);
        }
    private void SearchList()
    {
        string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);

        using (Utils utility = new Utils())
        {
            utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
        this._listOperation = new ListOperation();
        try
        {
            this.BindGrid();
            if (this.grdCaseMaster.Items.Count > 0)
            {
                this.btnSave.Enabled = true;
                this.selectAllCheckBox();
            }
        }
        catch (Exception ex)
        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            using (Utils utility = new Utils())
            {
                utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
            }
            string str2 = "Error Request=" + id + ".Please share with Technical support.";
            base.Response.Redirect("Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
        }
        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }
Beispiel #11
0
 public void AddCardToCollection(int collectionId, int cardId)
 {
     try
     {
         Key    cardKey          = MakeKey(Entities.Card, cardId);
         Key    collectionKey    = MakeKey(Entities.Collection, collectionId);
         Record collectionRecord = Client.Get(Policy, collectionKey, "Cards");
         if (Exists(collectionKey) && Exists(cardKey) &&
             !collectionRecord.GetList("Cards").Contains((long)cardId))
         {
             Client.Operate((WritePolicy)Policy, collectionKey,
                            ListOperation.Append("Cards", Value.Get(cardId)));
         }
         else
         {
             throw new DatabaseWriteException
                       ($"The Collection with id={collectionId}" +
                       $"or Card with id {cardId} never existed.");
         }
     }
     catch (Exception e)
     {
         throw new DatabaseWriteException
                   ($"Error while updating Collection with id={collectionId}", e);
     }
 }
Beispiel #12
0
 public void AddCollectionToUser(int userId, int collectionId)
 {
     try
     {
         Key    collectionKey = MakeKey(Entities.Collection, collectionId);
         Key    userKey       = MakeKey(Entities.User, userId);
         Record userRecord    = Client.Get(Policy, userKey, "Collections");
         if (Exists(userKey) && Exists(collectionKey) &&
             !userRecord.GetList("Collections").Contains((long)collectionId))
         {
             Client.Operate((WritePolicy)Policy, userKey,
                            ListOperation.Append("Collections", Value.Get(collectionId)));
         }
         else
         {
             throw new DatabaseWriteException
                       ($"The User with id={userId}" +
                       $"or Collection with id {collectionId} never existed.");
         }
     }
     catch (Exception e)
     {
         throw new DatabaseWriteException
                   ($"Error while updating User with id={userId}", e);
     }
 }
Beispiel #13
0
    private void BindGrid()
    {
        string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);

        using (Utils utility = new Utils())
        {
            utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
        _listOperation = new ListOperation();
        try
        {
            _listOperation.WebPage  = this.Page;
            _listOperation.Xml_File = "ICCode.xml";
            _listOperation.LoadList();
        }
        catch (Exception ex)
        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            using (Utils utility = new Utils())
            {
                utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
            }
            string str2 = "Error Request=" + id + ".Please share with Technical support.";
            base.Response.Redirect("Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
        }
        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }
        public void RunNestedListCreateExample(AerospikeClient client, Arguments args)
        {
            Key    key     = new Key(args.ns, args.set, "mapkey3");
            string binName = args.GetBinName("mapbin");

            // Delete record if it already exists.
            client.Delete(args.writePolicy, key);

            IList <Value> l1 = new List <Value>();

            l1.Add(Value.Get(7));
            l1.Add(Value.Get(9));
            l1.Add(Value.Get(5));

            IDictionary <Value, Value> inputMap = new Dictionary <Value, Value>();

            inputMap[Value.Get("key1")] = Value.Get(l1);

            // Create maps.
            client.Put(args.writePolicy, key, new Bin(binName, inputMap));

            // Create ordered list at map's "key2" only if list does not exist.
            // Append 2,1 to ordered list.
            CTX    ctx    = CTX.MapKey(Value.Get("key2"));
            Record record = client.Operate(args.writePolicy, key,
                                           ListOperation.Create(binName, ListOrder.ORDERED, false, ctx),
                                           ListOperation.Append(binName, Value.Get(2), ctx),
                                           ListOperation.Append(binName, Value.Get(1), ctx),
                                           Operation.Get(binName)
                                           );

            record = client.Get(args.policy, key);
            console.Info("Record: " + record);
        }
        public void OperateListRemoveRelative()
        {
            Key key = new Key(args.ns, args.set, "oplkey14");

            client.Delete(null, key);

            List <Value> itemList = new List <Value>();

            itemList.Add(Value.Get(0));
            itemList.Add(Value.Get(4));
            itemList.Add(Value.Get(5));
            itemList.Add(Value.Get(9));
            itemList.Add(Value.Get(11));
            itemList.Add(Value.Get(15));

            Record record = client.Operate(null, key,
                                           ListOperation.AppendItems(new ListPolicy(ListOrder.ORDERED, ListWriteFlags.DEFAULT), binName, itemList),
                                           ListOperation.RemoveByValueRelativeRankRange(binName, Value.Get(5), 0, ListReturnType.VALUE),
                                           ListOperation.RemoveByValueRelativeRankRange(binName, Value.Get(5), 1, ListReturnType.VALUE),
                                           ListOperation.RemoveByValueRelativeRankRange(binName, Value.Get(5), -1, ListReturnType.VALUE),
                                           ListOperation.RemoveByValueRelativeRankRange(binName, Value.Get(3), -3, 1, ListReturnType.VALUE),
                                           ListOperation.RemoveByValueRelativeRankRange(binName, Value.Get(3), -3, 2, ListReturnType.VALUE),
                                           ListOperation.RemoveByValueRelativeRankRange(binName, Value.Get(3), -3, 3, ListReturnType.VALUE)
                                           );

            AssertRecordFound(key, record);

            IList results = record.GetList(binName);
            int   i       = 0;

            long size = (long)results[i++];

            Assert.AreEqual(6L, size);

            IList list = (IList)results[i++];

            Assert.AreEqual(4L, list.Count);
            Assert.AreEqual(5L, list[0]);
            Assert.AreEqual(9L, list[1]);
            Assert.AreEqual(11L, list[2]);
            Assert.AreEqual(15L, list[3]);

            list = (IList)results[i++];
            Assert.AreEqual(0L, list.Count);

            list = (IList)results[i++];
            Assert.AreEqual(1L, list.Count);
            Assert.AreEqual(4L, list[0]);

            list = (IList)results[i++];
            Assert.AreEqual(0L, list.Count);

            list = (IList)results[i++];
            Assert.AreEqual(0L, list.Count);

            list = (IList)results[i++];
            Assert.AreEqual(1L, list.Count);
            Assert.AreEqual(0L, list[0]);
        }
        public void OperateListWildcard()
        {
            Key key = new Key(args.ns, args.set, "oplkey17");

            client.Delete(null, key);

            List <Value> i1 = new List <Value>();

            i1.Add(Value.Get("John"));
            i1.Add(Value.Get(55));

            List <Value> i2 = new List <Value>();

            i2.Add(Value.Get("Jim"));
            i2.Add(Value.Get(95));

            List <Value> i3 = new List <Value>();

            i3.Add(Value.Get("Joe"));
            i3.Add(Value.Get(80));

            List <Value> itemList = new List <Value>();

            itemList.Add(Value.Get(i1));
            itemList.Add(Value.Get(i2));
            itemList.Add(Value.Get(i3));

            Record record = client.Operate(null, key,
                                           ListOperation.AppendItems(binName, itemList)
                                           );

            AssertRecordFound(key, record);

            long size = record.GetLong(binName);

            Assert.AreEqual(3L, size);

            itemList = new List <Value>();
            itemList.Add(Value.Get("Jim"));
            itemList.Add(Value.WILDCARD);

            record = client.Operate(null, key,
                                    ListOperation.GetByValue(binName, Value.Get(itemList), ListReturnType.VALUE)
                                    );

            AssertRecordFound(key, record);

            IList results = record.GetList(binName);
            int   i       = 0;

            IList  items = (IList)results[i++];
            String s     = (String)items[0];

            Assert.AreEqual("Jim", s);

            long v = (long)items[1];

            Assert.AreEqual(95L, v);
        }
        public void OperateList2()
        {
            Key key = new Key(args.ns, args.set, "oplkey2");

            client.Delete(null, key);

            IList itemList = new List <Value>();

            itemList.Add(Value.Get(12));
            itemList.Add(Value.Get(-8734));
            itemList.Add(Value.Get("my string"));

            Record record = client.Operate(null, key,
                                           ListOperation.AppendItems(binName, itemList),
                                           Operation.Put(new Bin("otherbin", "hello"))
                                           );

            AssertRecordFound(key, record);

            record = client.Operate(null, key,
                                    ListOperation.Insert(binName, -1, Value.Get(8)),
                                    Operation.Append(new Bin("otherbin", Value.Get("goodbye"))),
                                    Operation.Get("otherbin"),
                                    ListOperation.GetRange(binName, 0, 4),
                                    ListOperation.GetRange(binName, 3)
                                    );

            AssertRecordFound(key, record);
            //System.out.println("Record: " + record);

            string val = record.GetString("otherbin");

            Assert.AreEqual("hellogoodbye", val);

            IList list = record.GetList(binName);

            long size = (long)list[0];

            Assert.AreEqual(4, size);

            IList rangeList = (IList)list[1];
            long  lval      = (long)rangeList[0];

            Assert.AreEqual(12, lval);

            lval = (long)rangeList[1];
            Assert.AreEqual(-8734, lval);

            lval = (long)rangeList[2];
            Assert.AreEqual(8, lval);

            val = (string)rangeList[3];
            Assert.AreEqual("my string", val);

            rangeList = (IList)list[2];
            val       = (string)rangeList[0];
            Assert.AreEqual("my string", val);
        }
        private static IEnumerable <ListOperation <T> > Enumerate([NotNull] IListInsertOperation <T> insert)
        {
            var index = insert.Index;

            foreach (var item in insert.Items)
            {
                yield return(ListOperation <T> .OnAdd(item, index ++));
            }
        }
Beispiel #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DateTimeListFilterCondition"/> class.
 /// </summary>
 /// <exception cref="ArgumentNullException"><paramref name="values"/> is <see langword="null" />.</exception>
 public DateTimeListFilterCondition(DateTimeAttributes attribute, ListOperation operation, [NotNull] IEnumerable <DateTime?> values)
 {
     if (values == null)
     {
         throw new ArgumentNullException(nameof(values));
     }
     _Attribute = attribute;
     _Operation = operation;
     _Values    = new List <DateTime?>(values);
 }
Beispiel #20
0
        /// <summary>
        /// Delete value from list.
        /// </summary>
        /// <param name="value">value to delete</param>
        public void Remove(Value value)
        {
            Key subKey = MakeSubKey(value);

            client.Delete(this.policy, subKey);
            IList digestList = GetDigestList();
            int   index      = digestList.IndexOf(subKey.digest);

            client.Operate(this.policy, this.key, ListOperation.Remove(this.binNameString, index));
        }
Beispiel #21
0
        /// <summary>
        /// Return size of list.
        /// </summary>
        public int Size()
        {
            Record record = client.Operate(this.policy, this.key, ListOperation.Size(this.binNameString));

            if (record != null)
            {
                return(record.GetInt(this.binNameString));
            }
            return(0);
        }
Beispiel #22
0
 public ListOperationTreeNode(ListOperation operation, TreeNode[] parameters, TreeNode parent = null) : base(parent)
 {
     Operation  = operation;
     Parameters = new TreeNode[parameters.Length];
     for (int i = 0; i < parameters.Length; ++i)
     {
         Parameters[i]        = parameters[i];
         Parameters[i].Parent = this;
     }
 }
Beispiel #23
0
        /// <summary>
        /// Add value to list.  Fail if value's key exists and list is configured for unique keys.
        /// If value is a map, the key is identified by "key" entry.  Otherwise, the value is the key.
        /// If large list does not exist, create it.
        /// </summary>
        /// <param name="value">value to add</param>

        public void Add(Value value)
        {
            Key subKey = MakeSubKey(value);

            client.Put(this.policy, subKey, new Bin(ListElementBinName, value));

            // add the digest of the subKey to the CDT List in the Customer record
            Value digest = Value.Get(subKey.digest);

            client.Operate(this.policy, this.key, ListOperation.Append(this.binNameString, digest));
        }
Beispiel #24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StringListFilterCondition"/> class.
        /// </summary>
        /// <exception cref="ArgumentNullException"><paramref name="values"/> is <see langword="null" />.</exception>
        public StringListFilterCondition(StringAttributes attribute, ListOperation operation, [NotNull] IEnumerable <string> values)
        {
            if (values == null)
            {
                throw new ArgumentNullException(nameof(values));
            }

            _Attribute = attribute;
            _Operation = operation;
            _Values    = new List <string>(values);
        }
Beispiel #25
0
    /// <summary>
    /// Drop levels from the level list into the scene list
    /// </summary>
    private void DropLevelInScenes(IList <int> levelIndices)
    {
        BeforeChange("Remove levels");
        IList <string> selectedLevels = ListOperation <string> .FilterList(Target.levels, levelIndices);

        SMSceneConfigurationOperation.Build(Target).Ignore(selectedLevels).Apply(Target);
        sceneListData.SetSelectedItems(scenes, selectedLevels);
        levelListData.ClearSelection();
        SyncBuildSettingsIfRequired();
        EditorUtility.SetDirty(Target);
    }
        /// <exception cref="ArgumentNullException"><paramref name="values"/> is <see langword="null" />.</exception>
        public IntegerListFilterCondition(IntegerAttributes attribute, ListOperation operation, [NotNull] IEnumerable <int?> values)
        {
            if (values == null)
            {
                throw new ArgumentNullException(nameof(values));
            }

            _Attribute = attribute;
            _Operation = operation;
            _Values    = new List <int?>(values);
        }
Beispiel #27
0
    private void SearchList()
    {
        string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);

        using (Utils utility = new Utils())
        {
            utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
        _listOperation = new ListOperation();
        _reportBO      = new Bill_Sys_ReportBO();
        try
        {
            DataSet objDT = new DataSet();
            if ((((Bill_Sys_SystemObject)Session["SYSTEM_OBJECT"]).SZ_LOCATION == "1"))
            {
                DataTable objDTL = new DataTable();
                objDT  = _reportBO.GetPatientVisitSummary("SP_PATIENT_VISIT_SUMMARY_REPORT", txtCompanyID.Text);
                objDTL = DisplayLocationInGrid(objDT);
                grdCaseMaster.DataSource = objDTL;
                grdCaseMaster.DataBind();
                for (int i = 0; i < grdCaseMaster.Items.Count; i++)
                {
                    string str = grdCaseMaster.Items[i].Cells[2].Text.ToString();
                    str = str.ToString().Trim();
                    if (str.ToString().Trim() == "&nbsp;")
                    {
                        ((CheckBox)grdCaseMaster.Items[i].Cells[0].FindControl("chkSelect")).Visible = false;
                    }
                }
            }
            else
            {
                _listOperation.WebPage  = this.Page;
                _listOperation.Xml_File = "SearchCase.xml";
                _listOperation.LoadList();
            }
        }
        catch (Exception ex)
        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            using (Utils utility = new Utils())
            {
                utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
            }
            string str2 = "Error Request=" + id + ".Please share with Technical support.";
            base.Response.Redirect("Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
        }
        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }
            public void OnSuccess(Key key, bool existed)
            {
                IList itemList = new List <Value>();

                itemList.Add(Value.Get(55));
                itemList.Add(Value.Get(77));

                client.Operate(null, new ReadHandler(parent), key,
                               ListOperation.AppendItems(binName, itemList),
                               ListOperation.Pop(binName, -1),
                               ListOperation.Size(binName)
                               );
            }
        public void OperateList8()
        {
            // Test null values.
            Key key = new Key(args.ns, args.set, "oplkey8");

            client.Delete(null, key);

            WritePolicy policy = new WritePolicy();

            policy.respondAllOps = true;

            IList itemList = new List <Value>();

            itemList.Add(Value.Get(1));
            itemList.Add(Value.Get(2));
            itemList.Add(Value.Get(3));

            Record record = client.Operate(null, key,
                                           ListOperation.AppendItems(binName, itemList),
                                           ListOperation.Increment(binName, 2),
                                           ListOperation.Increment(ListPolicy.Default, binName, 2),
                                           ListOperation.Increment(binName, 1, Value.Get(7)),
                                           ListOperation.Increment(ListPolicy.Default, binName, 1, Value.Get(7)),
                                           ListOperation.Get(binName, 0)
                                           );

            AssertRecordFound(key, record);

            IList results = record.GetList(binName);
            int   i       = 0;

            long size = (long)results[i++];

            Assert.AreEqual(3, size);

            long val = (long)results[i++];

            Assert.AreEqual(4, val);

            val = (long)results[i++];
            Assert.AreEqual(5, val);

            val = (long)results[i++];
            Assert.AreEqual(9, val);

            val = (long)results[i++];
            Assert.AreEqual(16, val);

            val = (long)results[i++];
            Assert.AreEqual(1, val);
        }
        private static IEnumerable <ListOperation <T> > Enumerate([NotNull] IListResetOperation <T> reset)
        {
            yield return(ListOperation <T> .OnClear());

            var index = 0;

            if (reset.Items != null)
            {
                foreach (var item in reset.Items)
                {
                    yield return(ListOperation <T> .OnAdd(item, index ++));
                }
            }
        }
Beispiel #31
0
        public ActionResult ListOperation(int containerId, ListOperation operation, SortBy? sortBy, SortDirection? sortByDirection, PagerParameters pagerParameters) {
            var items = _containerService.GetContentItems(containerId, VersionOptions.Latest).Select(x => x.As<ContainablePart>());
            switch (operation) {
                case ViewModels.ListOperation.Reverse:
                    _containerService.Reverse(items);
                    _services.Notifier.Information(T("The list has been reversed."));
                    break;
                case ViewModels.ListOperation.Shuffle:
                    _containerService.Shuffle(items);
                    _services.Notifier.Information(T("The list has been shuffled."));
                    break;
                case ViewModels.ListOperation.Sort:
                    _containerService.Sort(items, sortBy.GetValueOrDefault(), sortByDirection.GetValueOrDefault());
                    _services.Notifier.Information(T("The list has been sorted."));
                    break;
                default:
                    _services.Notifier.Error(T("Please select an operation to perform on the list."));
                    break;
            }

            return RedirectToAction("List", new {containerId, page = pagerParameters.Page, pageSize = pagerParameters.PageSize});
        }