public ActionResult GetPendingTrans()
        {
            var WF = new BusinessLogic.FFWorkFlow();
            IEnumerable<KeyValuePair<int, string>> trans = new List<KeyValuePair<int,string>>();


            if (User.IsInRole("administrators") || User.IsInRole("sales"))
                trans = trans.Union(WF.GetTranForSales());

            if (User.IsInRole("administrators") || User.IsInRole("operation"))
                trans = trans.Union(WF.GetTranForOperations());

            if (User.IsInRole("administrators") || User.IsInRole("accounting"))
                trans = trans.Union(WF.GetTranForAccounting());

            if (User.IsInRole("administrators") || User.IsInRole("customersservice") || User.IsInRole("accounting"))
                trans = trans.Union(WF.GetTranToBePaid());

            if (User.IsInRole("administrators") || User.IsInRole("customersservice") || User.IsInRole("operation"))
                trans = trans.Union(WF.GetTranETA());

            if (trans == null)
            {
                return Json(null, JsonRequestBehavior.AllowGet);
            }

            return Json(trans, JsonRequestBehavior.AllowGet);

        }
Example #2
0
    public static CombinedSequence GetCombinedSequence(string seq1, string seq2)
    {
      List<CombinedSequence> scores = new List<CombinedSequence>();
      for (int i = 0; i < 3; i++)
      {
        List<int> vs = new List<int>();
        for (int j = 0; j < i; j++)
        {
          vs.Add(j);
        }

        var subseq1 = seq1.Substring(i);
        scores.Add(new CombinedSequence()
        {
          Sequence1 = seq1,
          Sequence2 = seq2,
          Position1 = i,
          Position2 = 0,
          MismatchPositions = vs.Union(GetMismatchIndecies(subseq1, seq2).ConvertAll(m => m + i)).ToArray()
        });

        var subseq2 = seq2.Substring(i);
        scores.Add(new CombinedSequence()
        {
          Sequence1 = seq1,
          Sequence2 = seq2,
          Position1 = 0,
          Position2 = i,
          MismatchPositions = vs.Union(GetMismatchIndecies(seq1, subseq2).ConvertAll(m => m + i)).ToArray()
        });
      }

      var min = scores.Min(m => m.MismatchPositions.Length);
      return scores.Find(m => m.MismatchPositions.Length == min);
    }
        public SiteExport(Guid siteID, ExportType exportWhat)
        {
            SiteData s = null;
            List<ContentPageExport> pages = new List<ContentPageExport>();

            s = SiteData.GetSiteByID(siteID);

            if (exportWhat == ExportType.AllData) {
                pages = ContentImportExportUtils.ExportAllSiteContent(siteID);
            } else {
                if (exportWhat == ExportType.ContentData) {
                    List<ContentPageExport> lst = ContentImportExportUtils.ExportPages(siteID);
                    pages = pages.Union(lst).ToList();
                }
                if (exportWhat == ExportType.BlogData) {
                    List<ContentPageExport> lst = ContentImportExportUtils.ExportPosts(siteID);
                    pages = pages.Union(lst).ToList();
                }
            }

            this.TheUsers = (from u in ExtendedUserData.GetUserList()
                             select new SiteExportUser {
                                 Email = u.Email,
                                 Login = u.UserName,
                                 FirstName = u.FirstName,
                                 LastName = u.LastName,
                                 UserNickname = u.UserNickName
                             }).ToList();

            SetVals(s, pages);
        }
        /// <summary>
        /// Accessor for all of the critical nodes in the tree.
        /// </summary>
        /// <returns>a list of the critical nodes in the tree</returns>
        public List<TreeNode> GetCritical()
        {
            List<TreeNode> list = new List<TreeNode>();
            list = list.Union(this.parentless).ToList();
            list = list.Union(this.childless ).ToList();
            list = list.Union(this.merging   ).ToList();

            return list;
        }
 public IEnumerable<Member> GetAlltimeChatMembers(Chat chat)
 {
     IEnumerable<string> participants = new List<string>();
     participants = participants.Union(chat.Participants.Split(' '));
     participants = participants.Union(chat.ActiveMembers.Split(' '));
     participants = participants.Union(chat.Posters.Split(' '));
     var members = LoadMembers(participants);
     return members;
 }
        public override IList<string> GetUsedTypes()
        {
            var returnList = new List<string>();

            returnList = returnList.Union(GetUsedTypesFromAstNodes(Body)).ToList();
            returnList = returnList.Union(GetUsedTypesFromAstNodes(Condition)).ToList();

            return returnList;
        }
        public override IList<string> GetUsedTypes()
        {
            var returnList = new List<string>();

            returnList = returnList.Union(GetUsedTypesFromAstNodes(Body)).ToList();
            returnList = returnList.Union(GetUsedTypesFromInputElements(ExceptionTypes)).ToList();

            return returnList;
        }
        public override IList<string> GetUsedTypes()
        {
            var returnList = new List<string>();

            returnList = returnList.Union(GetUsedTypesFromAstNodes(AssignedValue)).ToList();
            returnList = returnList.Union(GetUsedTypesFromInputElements(Modifiers)).ToList();
            AddUsedTypeIfIdentifierToken(VariableType, returnList);

            return returnList;
        }
        public static IEnumerable<Type> GetImplementingTypes(Type typeToImplement)
        {
            Assembly asm = Assembly.GetExecutingAssembly();
            List<Type> ret = new List<Type>();
            ret = ret.Union(GetImplementingTypesInAssembly(typeToImplement, asm)).ToList();
            asm = Assembly.GetCallingAssembly();
            if (asm != null)
                ret = ret.Union(GetImplementingTypesInAssembly(typeToImplement, asm)).ToList();

            return ret;
        }
        public override IList<string> GetUsedTypes()
        {
            var returnList = new List<string>();

            returnList = returnList.Union(GetUsedTypesFromAstNodes(TryBody)).ToList();
            returnList = returnList.Union(GetUsedTypesFromAstNodes(FinallyBody)).ToList();

            foreach (var catchStatement in CatchStatements)
            {
                returnList = returnList.Union(catchStatement.GetUsedTypes()).ToList();
            }

            return returnList;
        }
        public override IList<string> GetUsedTypes()
        {
            var returnList = new List<string>();

            returnList = returnList.Union(GetUsedTypesFromAstNodes(Condition)).ToList();
            returnList = returnList.Union(GetUsedTypesFromAstNodes(Body)).ToList();
            returnList = returnList.Union(GetUsedTypesFromAstNodes(ElseBody)).ToList();

            foreach (var conditionalElse in ConditionalElses)
            {
                returnList = returnList.Union(conditionalElse.GetUsedTypes()).ToList();
            }

            return returnList;
        }
        public override IList<string> GetUsedTypes()
        {
            var returnList = new List<string>();

            foreach (var argument in Arguments)
            {
                returnList = returnList.Union(argument.GetUsedTypes()).ToList();
            }

            AddUsedTypeIfIdentifierToken(ReturnType, returnList);
            returnList = returnList.Union(GetUsedTypesFromAstNodes(Body)).ToList();
            AddUsedTypeIfIdentifierToken(ThrowsType, returnList);

            return returnList;
        }
Example #13
0
        protected virtual List<int> GetAvailableTransitions(TreeNode node)
        {
            List<int> tSet = new List<int>();
            for (int i = 0; i < node.Marking.rows; i++)
            {
                if (node.Marking[i] > 0)
                {
                    tSet = tSet.Union(GetPostPSet(i, (int)node.Marking[i])).ToList();
                }
            }

            List<int> tRes = new List<int>();
            for (int i = 0; i < tSet.Count; i++)
            {
                bool available = true, dead = true;
                for (int p = 0; p < PetriNet.PlacesCount; p++)
                {
                    if (PetriNet.WeightMatrix[p, tSet[i]] != null &&
                        PetriNet.WeightMatrix[p, tSet[i]].PT > 0 && PetriNet.WeightMatrix[p, tSet[i]].PT > node.Marking[p])
                    {
                        available = false;
                    }
                    //if (PetriNet.WeightMatrix[p, tSet[i]] != null && PetriNet.WeightMatrix[p, tSet[i]].TP > 0)
                    //{
                    //    dead = false;
                    //}
                }
                if (available )//&& !dead)
                    tRes.Add(tSet[i]);
            }
            return tRes;
        }
 private Entities.Models.ForumTopic GetLastTopicOfForum(long id)
 {
     var forum = _forumRepository.Get(id);
     var topics = new List<Entities.Models.ForumTopic>();
     forum.Children.ForEach(a => topics.AddRange(a.Topics));
     return topics.Union(forum.Topics).OrderByDescending(a => a.CreateDate).FirstOrDefault();
 }
Example #15
0
        static JavaScriptUtils()
        {
            IList<char> escapeChars = new List<char>
            {
                '\n', '\r', '\t', '\\', '\f', '\b',
            };
            for (var i = 0; i < ' '; i++)
                escapeChars.Add((char) i);

            foreach (var escapeChar in escapeChars.Union(new[] {'\''}))
                SingleQuoteCharEscapeFlags[escapeChar] = true;
            foreach (var escapeChar in escapeChars.Union(new[] {'"'}))
                DoubleQuoteCharEscapeFlags[escapeChar] = true;
            foreach (var escapeChar in escapeChars.Union(new[] {'"', '\'', '<', '>', '&'}))
                HtmlCharEscapeFlags[escapeChar] = true;
        }
        public override void Execute(ServiceBusConfiguration configuration)
        {
            var factoryTypes = new List<Type>();

            ReflectionService.GetAssemblies(AppDomain.CurrentDomain.BaseDirectory).ForEach(assembly => factoryTypes.AddRange(ReflectionService.GetTypes<IQueueFactory>(assembly)));

            foreach (var type in factoryTypes.Union(ReflectionService.GetTypes<IQueueFactory>()))
            {
                try
                {
                    type.AssertDefaultConstructor(string.Format(Resources.DefaultConstructorRequired,
                                                                "Queue factory", type.FullName));

                    var instance = (IQueueFactory)Activator.CreateInstance(type);

                    if (!configuration.Queues.ContainsQueueFactory(instance.Scheme))
                    {
                        configuration.Queues.RegisterQueueFactory(instance);
                    }
                }
                catch (Exception ex)
                {
                    Log.Warning(string.Format("Queue factory not instantiated: {0}", ex.Message));
                }
            }
        }
        private async Task<ShipmentQuantity> TotalQuantityReceived(Guid importNotificationId, Shipment shipment)
        {
            await authorization.EnsureAccessAsync(importNotificationId);

            var movements = await context.ImportMovements.Where(m => m.NotificationId == importNotificationId).ToArrayAsync();

            var allMovementReceipts = new List<ImportMovementReceipt>();

            foreach (var movement in movements)
            {
                var movementReceipts = await context.ImportMovementReceipts.Where(mr => mr.MovementId == movement.Id).ToListAsync();
                allMovementReceipts = allMovementReceipts.Union(movementReceipts).ToList();
            }

            if (!allMovementReceipts.Any())
            {
                return new ShipmentQuantity(0, shipment == null ? ShipmentQuantityUnits.Tonnes : shipment.Quantity.Units);
            }
            
            var totalReceived = allMovementReceipts.Sum(m =>
                ShipmentQuantityUnitConverter.ConvertToTarget(
                    m.Unit,
                    shipment.Quantity.Units,
                    m.Quantity));

            return new ShipmentQuantity(totalReceived, shipment.Quantity.Units);
        }
Example #18
0
        public ActionResult Province(string name)
        {
            var province = db.Area.First(a => a.Name == name);

            var root = Area.CreateTree(db.Area.ToArray(), province);
            List<Dealer> dealers = new List<Dealer>();
            foreach (var a in root.Leafs)
            {
                dealers = dealers.Union(a.Data.Dealers).ToList();
            }
            List<Dictionary<string, object>> jdealers = new List<Dictionary<string, object>>();
            foreach (var d in dealers)
            {
                var obj = ClassHelper.ToDictionary(d, "Id", "Name", "Address", "Contact", "Tel", "Mobile", "Fax", "Website", "Zipcode", "latitude", "longitude");
                jdealers.Add(obj);
            }

            var children = province.Children.ToList();
            List<Dictionary<string, object>> cities = new List<Dictionary<string, object>>();
            foreach (var c in children)
            {
                cities.Add(ClassHelper.ToDictionary(c, "Id", "ParentId", "Name"));
            }

            return Json(new { id = province.Id, dealers = jdealers, cities = cities }, JsonRequestBehavior.AllowGet);
        }
Example #19
0
        public ActionResult SidebarMenu()
        {
            //获取第一层菜单
            //var model = new List<SideBarMenuModel>();

            //var parentMenus = _permissionService.GetAllPermissionsByParentId(0).Select(t =>
            //        new SideBarMenuModel
            //        {
            //            Name = t.Name,
            //            Area = t.Area,
            //            Controller = t.Controller,
            //            Action = t.Action
            //        }
            //    ).ToList();

            //model.AddRange(parentMenus);

            //SortMenuForTree(model, parentMenus);
            //return PartialView(model);

            //var currentUser = _workContextService.CurrentUser;
            var currentUser = _userService.GetUserById(1);

            var permissions = new List<Permission> { };

            var rolePermissions = currentUser.Roles.Select(t => t.Permissions).ToList();

            foreach (var rp in rolePermissions)
            {
                permissions = permissions.Union(rp).ToList();
            }

            var model = SortMenuForTree(0, permissions);
            return PartialView(model);
        }
 public void Union()
 {
     var Orwells = new List<string> { "1984", "Animal Farm", "Homage to Catalonia", "Burmese Days" };
     var great_novels = new List<string> { "Hear of Darkness", "1984", "Animal Farm", "Ulysses" };
     var all = great_novels.Union(Orwells).ToList();
     Assert.Equal(all, FILL_ME_IN);
 }
Example #21
0
 public static void Test()
 {
     List<Person> personList1 = new List<Person>(){new Person(){Id = 2,IsMale = true, Height = 178.5, Name = null}};
     List<Person> personList2 = new List<Person>() { new Person() { Id = 3, IsMale = true, Height = 178.5, Name = "Test2" } };
     var list = personList1.Union(personList2).ToArray();
     Console.WriteLine(list[0].Name);
 }
        public void TestAverageVertexes()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;

            var selPl1 = ed.GetEntity("Pl1");
            if (selPl1.Status != PromptStatus.OK) return;
            var selPl2 = ed.GetEntity("Pl2");
            if (selPl2.Status != PromptStatus.OK) return;

            using (var t = db.TransactionManager.StartTransaction())
            {
                var pl1 = selPl1.ObjectId.GetObject(OpenMode.ForWrite) as Polyline;
                var pl2 = selPl2.ObjectId.GetObject(OpenMode.ForWrite) as Polyline;

                pl1.AverageVertexes(ref pl2, new Autodesk.AutoCAD.Geometry.Tolerance(1, 1));

                var pls = new List<Polyline> { pl1, pl2 };

                var plUnion = pls.Union(null);

                EntityHelper.AddEntityToCurrentSpace(plUnion);

                t.Commit();
            }
        }
Example #23
0
        static void Main(string[] args)
        {
            Console.WriteLine("Enter anything but int to exit.\r\n");

            while (true)
            {
                int pad = 18;
                List<int> inputNumbers = new List<int>();
                List<int> addThose = new List<int>();

                try
                {
                    Console.Write("Enter numbers: ".PadLeft(pad));
                    inputNumbers = Array.ConvertAll(Console.ReadLine().Split(' '), i => int.Parse(i)).ToList();

                    Console.Write("numbers to add: ".PadLeft(pad));
                    addThose = Array.ConvertAll(Console.ReadLine().Split(' '), i => int.Parse(i)).ToList();
                }
                catch (Exception)
                {
                    return;
                }

                List<int> outputSorted = inputNumbers.Union(addThose).ToList();
                outputSorted.Sort();

                Console.Write("Result: ".PadLeft(pad));
                Console.WriteLine(string.Join(" ", outputSorted.ToArray()));
                Console.WriteLine(new string('-', pad));
            }
        }
Example #24
0
        public void ActivateToolBarItems()
        {
            IEnumerable<string> activeKeys = new List<string>();
            _menuClients.ToList().ForEach(item => activeKeys = activeKeys.Union(item.GetActiveMenuKeys(MingApp.Instance.GetCurrentTreeViewItem())));

            foreach (var bar in _toolBarTray.ToolBars)
            {
                foreach (var item in bar.Items)
                {
                    var button = item as Button;
                    if (button != null)
                    {
                        if (activeKeys.Contains(button.Name))
                        {
                            button.Opacity = 1.0;
                            button.IsEnabled = true;
                        }
                        else
                        {
                            button.Opacity = 0.4;
                            button.IsEnabled = false;
                        }
                    }
                }
            }
        }
Example #25
0
        public List<InsurancePolicy> RefreshPolicies(List<InsurancePolicy> currentPolicies)
        {
            if (OnRefreshPolicies != null)
                OnRefreshPolicies();

            return currentPolicies.Union(_insuranceInfos).ToList();
        }
Example #26
0
        public static List<GeneradorDeNumero> GenerarComplementos(List<int> excluidos)
        {
            var posibles = digitos.Except(excluidos);

            var variaciones = new Variations<int>(posibles, 4);
            return variaciones.Select(variacion => new GeneradorDeNumero(variacion[0], variacion[1], variacion[2], variacion[3], excluidos.Union(variacion).ToList())).ToList();
        }
Example #27
0
        public AlbumsViewModel(User user, Group group)
        {
            GroupAlbums = new List<AlbumViewModel>();
            UserAlbums = new List<AlbumViewModel>();

            CreateGroupAlbum = new AlbumCreateEditViewModel();
            CreateUserAlbum = new AlbumCreateEditViewModel();

            if (group != null)
            {
                GroupId = group.Id;
                GroupAlbums = group.Albums.Select(x => new AlbumViewModel(x)).ToList();

                CreateGroupAlbum = new AlbumCreateEditViewModel(group);
            }

            if (user != null)
            {
                UserId = user.Id;
                UserAlbums = user.Albums.Select(x => new AlbumViewModel(x)).ToList();

                CreateUserAlbum = new AlbumCreateEditViewModel(user);
            }

            Albums = GroupAlbums.Union(UserAlbums).ToList();
        }
        public static List<SalesHistoryData> GetSalesHistory()
        {
            List<SalesHistoryData> result = new List<SalesHistoryData>();
            try
            {
                // The encrypted list will timeout for slightly large lists (in the hundreds), so the list is
                // being grabbed in smaller chunks.  Transaction logic is used to lock the list while the list is being
                // grabbed.
                TransactionOptions transactionOptions = new TransactionOptions();
                transactionOptions.IsolationLevel = IsolationLevel.RepeatableRead;
                transactionOptions.Timeout = new TimeSpan(0, 2, 0);
                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.RequiresNew, transactionOptions))
                {
                    Console.WriteLine("Test 1: List all Sales Orders");
                    int take = 5;
                    int count = UserSession.Current.Client.GetSalesOrderListCount();
                    for (int skip = 0; skip < count; skip = skip + take)
                    {
                        List<SalesHistoryData> salesOrders = UserSession.Current.Client.GetSalesHistory(take, skip).ToList();
                        result = result.Union(salesOrders).ToList();
                    }
                    result = result.OrderByDescending(so => so.SalesOrderNumber).ThenBy(so => so.SortOrder).ToList();
                    //No scope.Complete here as no write tasks are being scoped.

                    scope.Dispose();
                }
            }
            catch (Exception) { throw; }
            return result;
        }
Example #29
0
 public static string[] GetReferences(MonoIsland island, string projectDirectory)
 {
     List<string> list = new List<string>();
     List<string> first = new List<string>();
     IEnumerator<string> enumerator = first.Union<string>(island._references).GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             string current = enumerator.Current;
             string fileName = Path.GetFileName(current);
             if (string.IsNullOrEmpty(fileName) || (!fileName.Contains("UnityEditor.dll") && !fileName.Contains("UnityEngine.dll")))
             {
                 string file = !Path.IsPathRooted(current) ? Path.Combine(projectDirectory, current) : current;
                 if (AssemblyHelper.IsManagedAssembly(file) && !AssemblyHelper.IsInternalAssembly(file))
                 {
                     list.Add(file);
                 }
             }
         }
     }
     finally
     {
         if (enumerator == null)
         {
         }
         enumerator.Dispose();
     }
     return list.ToArray();
 }
Example #30
0
        public ActionResult DealerList(int id)
        {
            var area = db.Area.First(a => a.Id == id);
            var root = Area.CreateTree(db.Area.ToArray(), area);

            List<Dealer> dealers = new List<Dealer>();
            if (!root.HasChildren)
            {
                dealers = root.Data.Dealers.ToList();
            }
            else
            {
                foreach (var a in root.Leafs)
                {
                    dealers = dealers.Union(a.Data.Dealers).ToList();
                }
            }
            List<Dictionary<string, object>> jdealers = new List<Dictionary<string, object>>();
            foreach (var d in dealers)
            {
                var obj = ClassHelper.ToDictionary(d, "Id", "Address", "Contact", "Tel", "Mobile", "Fax", "Website", "Zipcode", "latitude", "longitude");
                obj.Add("Name", d.MyArea.Name);
                jdealers.Add(obj);
            }
            return Json(new { dealers = jdealers }, JsonRequestBehavior.AllowGet);
        }