Exemple #1
0
            protected override bool Update(object newValue)
            {
                var orderChanged = false;
                var stringValue  = newValue.ToString();
                var electionKey  = Page.GetElectionKey();

                if (!IsNullOrWhiteSpace(stringValue))
                {
                    var referendumKeys = stringValue
                                         .Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)
                                         .Select(s => s.Substring(s.LastIndexOf('-') + 1));
                    var referendumOrder = 10;
                    foreach (var referendumKey in referendumKeys)
                    {
                        var oldReferendumOrder =
                            Referendums.GetOrderOnBallot(electionKey, referendumKey, 0);
                        if (referendumOrder != oldReferendumOrder)
                        {
                            Referendums.UpdateOrderOnBallot(referendumOrder, electionKey, referendumKey);
                            LogDataChange.LogUpdate(Referendums.Column.OrderOnBallot,
                                                    oldReferendumOrder.ToString(CultureInfo.InvariantCulture),
                                                    referendumOrder.ToString(CultureInfo.InvariantCulture), DateTime.UtcNow,
                                                    electionKey, referendumKey);
                            orderChanged = true;
                        }
                        referendumOrder += 10;
                    }
                }
                LoadControl();
                return(orderChanged);
            }