예제 #1
0
 /// <summary>
 /// 对当前候选集中的项集求support counting
 /// </summary>
 /// <param name="candidate">候选项集</param>
 /// <param name="depth">当前的候选项集的项的个数</param>
 /// <returns>返回support counting大于等于minsup的项集</returns>
 static Candidates<int> DoSupportCounting(Candidates<int> candidate, int depth)
 {
     //建立hash树
     HashTree<int> tree = new HashTree<int>(HashCode, 0, 2, depth, NodePrint);
     foreach (var tmp in candidate.ItemSets)
     {
         tree.AddNode(tmp);
     }
     //计算候选集中的support counting
     foreach (var tmp in transactions)
     {
         tree.ClearTag(tree.Root);
         tree.SupportCounting(tmp, tree.Root, -1);
     }
     //将support counting大于minsup的加入频繁项的集合
     Candidates<int> tmpCandi = new Candidates<int>();
     tree.ClearTag(tree.Root);
     TreeNode<int> node = tree.GetLeaves(tree.Root);
     while (node != null)
     {
         foreach (var d in node.list)
         {
             if (d.value >= minsup * transactions.Count()) tmpCandi.AddCandidate(d);
         }
         node = tree.GetLeaves(tree.Root);
     }
     return SortInTrie(tmpCandi);
 }
예제 #2
0
        static LinkedList<Transaction<int>> transactions; //项集的集合

        #endregion Fields

        #region Methods

        /// <summary>
        /// Apriori算法
        /// </summary>
        static void Apriori()
        {
            //初始化,生成含有一个项的频繁项集
            AprioriInitialize();
            int depth = 1;
            Console.WriteLine(depth.ToString() + "层结束");

            Candidates<int> lastCandi = frequentItemsets.Last();
            while(lastCandi.ItemSets.Count>0)
            {
                Candidates<int> tmpCandi = new Candidates<int>();
                depth++;
                //根据上一次的频繁项集合并生成新的候选集
                foreach (var tmp in lastCandi.GenerateNewCandidates()) tmpCandi.AddCandidate(tmp, 0);
                if (tmpCandi.ItemSets.Count == 0) break;
                //判断当前候选集中的项集的所有子集是否都在上一层的频繁项集中
                tmpCandi.Pruning(lastCandi.ItemSets);
                //计算support counting留下大于minsup的项集
                Candidates<int> newCandi = DoSupportCounting(tmpCandi,depth);
                frequentItemsets.AddLast(newCandi);
                lastCandi = newCandi;
                Console.WriteLine(depth.ToString() + "层结束");
            }
            Console.WriteLine("按回车结束程序...");
        }
예제 #3
0
 /// <summary>
 /// Apriori算法初始化,生成含有一个项的频繁项集
 /// </summary>
 static void AprioriInitialize()
 {
     frequentItemsets = new LinkedList<Candidates<int>>();
     Candidates<int> newCandidate = new Candidates<int>();
     //生成项数为1的项集
     foreach (var tmp in itemName)
     {
         newCandidate.AddCandidate(new[] { tmp }, 0);
     }
     frequentItemsets.AddFirst(DoSupportCounting(newCandidate, 1));
 }
        public async Task <CandidateViewModel> CreateCandidateAsync(CandidateViewModel candidateVM)
        {
            candidates = new Candidates
            {
                CandidateName      = candidateVM.CandidateName,
                VideoUrl           = candidateVM.VideoUrl,
                ImageUrl           = candidateVM.ImageUrl,
                Objectives         = candidateVM.Objectives,
                Profile            = candidateVM.Profile,
                Position           = candidateVM.Position,
                Location           = candidateVM.Location,
                Experince          = candidateVM.Experince,
                CurrentSalary      = candidateVM.CurrentSalary,
                ExpectedSalaryFrom = candidateVM.ExpectedSalaryFrom,
                ExpectedSalaryTo   = candidateVM.ExpectedSalaryTo,
                IsFullTime         = candidateVM.IsFullTime,
                IsPermanent        = candidateVM.IsPermanent,
                IsPartTime         = candidateVM.IsPartTime,
                IsTemporary        = candidateVM.IsTemporary,
                IsRemote           = candidateVM.IsRemote,
                IsLocum            = candidateVM.IsLocum,
                Skills             = candidateVM.Skills,
                MobileNo           = candidateVM.MobileNo,
                Email = candidateVM.Email,
                Sex   = candidateVM.Sex,

                AuthID       = candidateVM.AuthID,
                FirstName    = candidateVM.FirstName,
                IndustryList = candidateVM.IndustryList,
                Surname      = candidateVM.Surname,
                DocumentList = candidateVM.DocumentList
            };

            await _db.Candidates.InsertOneAsync(candidates);

            return(GetCandidateByID(candidates._id));
        }
예제 #5
0
 private void button3_Click(object sender, EventArgs e)
 {
     Candidates.Clear();
     if (InkOverlay.Ink.Strokes.Count <= 0)
     {
         return;
     }
     using (var context = new RecognizerContext())
     {
         context.Strokes = InkOverlay.Ink.Strokes;
         var result = context.Recognize(out RecognitionStatus status);
         if (status == RecognitionStatus.NoError)
         {
             var candidates = result.GetAlternatesFromSelection();
             foreach (var candidate in candidates)
             {
                 Candidates.Add(candidate.ToString());
             }
         }
     }
     comboBox1.DataSource    = null;
     comboBox1.DataSource    = Candidates;
     comboBox1.SelectedIndex = 0;
 }
예제 #6
0
        /// <summary>
        /// Dispatches the expression to one of the more specialized visit methods in this class.
        /// </summary>
        /// <param name="node">The expression to visit.</param>
        /// <returns>
        /// The modified expression, if it or any subexpression was modified; otherwise, returns the
        /// original expression.
        /// </returns>
        public override Expression Visit(Expression node)
        {
            if (node is null)
            {
                return(node !);
            }
            var saveCannotBeEvaluated = CanNotBeEvaluated;

            CanNotBeEvaluated = false;
            base.Visit(node);
            if (!CanNotBeEvaluated)
            {
                if (FunctionCanBeEvaluated(node))
                {
                    Candidates.Add(node);
                }
                else
                {
                    CanNotBeEvaluated = true;
                }
            }
            CanNotBeEvaluated |= saveCannotBeEvaluated;
            return(node);
        }
        public async Task InitializeAsync()
        {
            IsBusy = true;

            try
            {
                var candidates = await recruitmentQueryService.GetAcceptedCandidatesAsync();

                Candidates.Clear();

                foreach (var candidate in candidates)
                {
                    Candidates.Add(candidate);
                }
            }
            catch (Exception exc)
            {
                await alertService.DisplayAlertAsync(string.Empty, "Something went wrong", "OK");
            }
            finally
            {
                IsBusy = false;
            }
        }
예제 #8
0
        public void Add(T item)
        {
            if (TopResult == null)
            {
                TopResult = item;
                return;
            }

            var result = _comparer.Compare(TopResult, item);

            if (result == 0)
            {
                Candidates.Add(item);
                return;
            }

            if (result > 0)
            {
                return;
            }

            TopResult = item;
            Candidates.Clear();
        }
예제 #9
0
        public IActionResult RegisterPhone([FromBody] Candidates candidates)
        {
            try
            {
                var userId = this.help.GetCurrentUser(HttpContext);

                if (userId <= 0)
                {
                    return(StatusCode(401, "الرجاء الـتأكد من أنك قمت بتسجيل الدخول"));
                }
                string codePhoneNumber = candidates.Phone.Substring(0, 3);
                if (!codePhoneNumber.Equals("091") && !codePhoneNumber.Equals("092") && !codePhoneNumber.Equals("093") && !codePhoneNumber.Equals("094"))
                {
                    return(BadRequest(new { message = "يجب أن يبدأ الرقم ب091 أو 092 أو 093 أو 094" }));
                }

                if (candidates.Phone.Length != 10)
                {
                    return(BadRequest(new { message = "يجب أن يكون رقم الهاتف بطول 10 أرقام" }));
                }

                var phoneCount = db.Candidates.Where(x => x.Phone == candidates.Phone).Count();

                if (phoneCount > 0)
                {
                    return(BadRequest(new { message = "لقد تم إستخدام هذا الرقم بالفعل من قبل مرشح أخر" }));
                }


                return(Ok(new { isVerifyCodeSent = true, message = "الرجاء إدخال رمز التحقق" }));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, new { ex = ex.InnerException.Message, message = "حدث خطاء، حاول مجدداً" }));
            }
        }
예제 #10
0
 public void AddCandidate(ServerPlayer player)
 {
     lock (this)
     {
         if (player.Union != null)
         {
             player.SendMessageBox("您已经有公会了", 180, Color.Yellow);
             return;
         }
         if (Candidates.Contains(player.Name))
         {
             player.SendMessageBox("您已经在公会的申请列表中,请耐心等待审核", 180, Color.Yellow);
             return;
         }
         if (Candidates.Count >= MAX_CANDIDATES)
         {
             player.SendMessageBox("公会申请人数已满,无法申请", 180, Color.OrangeRed);
             return;
         }
         Candidates.Add(player.Name);
         SyncToOwner();
         player.SendMessageBox("申请成功,请等待会长审核", 180, Color.LimeGreen);
     }
 }
예제 #11
0
        public HttpResponseMessage Get(int id)
        {
            try
            {
                if (id > 0)
                {
                    Candidates     cand   = this._repo.GetCandidate(id);
                    Resumes        resume = this._repo.GetResume(cand.CandidateID);
                    CandidateModel model  = new CandidateModel()
                    {
                        Candidate = cand,
                        Resume    = resume
                    };
                    if (!string.IsNullOrWhiteSpace(resume.ResumePath))
                    {
                        string f = resume.ResumePath.Substring(resume.ResumePath.LastIndexOf("\\") + 1);
                        model.ResumeVirtualPath = "/Resumes/" + resume.CandidateID + "/" + f; //Request.GetRequestContext().VirtualPathRoot +
                    }
                    HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, model);

                    return(response);
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NoContent, new Exception("No input found to get data")));
                }
            }
            catch (Exception ex)
            {
                _tracer.Error(Request, this.ControllerContext.ControllerDescriptor.ControllerType.FullName, ex.StackTrace);
                return(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content = new StringContent(ex.Message)
                });
            }
        }
        public async Task <ActionResult <Candidates> > Put(
            [FromServices] DataContext context,
            [FromBody] Candidates model, [FromRoute] int id)
        {
            var candidates = await context.Candidates.FindAsync(id);

            // Console.WriteLine(candidates.Id);
            candidates.Name       = model.Name;
            candidates.Skill      = model.Skill;
            candidates.Stack      = model.Stack;
            candidates.Experience = model.Experience;
            if (candidates.Id == id && ModelState.IsValid)
            {
                context.Candidates.Update(candidates);
                context.Entry(candidates).State = EntityState.Modified;
                await context.SaveChangesAsync();

                return(candidates);
            }
            else
            {
                return(BadRequest(ModelState));
            }
        }
예제 #13
0
 public DataTable check_Candidate_Exists_EmailId_MobileNo(Candidates c)
 {
     _param = new SqlParameter[] { new SqlParameter("@cId", c.cId), new SqlParameter("@email", c.email), new SqlParameter("@mobile", c.mobile) };
     return(_sf.returnDTWithProc_executeReader("p_tblCandidate_checkExistsEmailId_MobileNo", _param));
 }
예제 #14
0
 public int updateCandidateStatus(Candidates c)
 {
     _param = new SqlParameter[] { new SqlParameter("@cId", c.cId), new SqlParameter("@csSubCatId", c.csSubCatId), new SqlParameter("@comments", c.comments), new SqlParameter("@crtUserId", c.crtUserId) };
     return(_sf.executeNonQueryWithProc("updateCandidateStatus", _param));
 }
예제 #15
0
파일: Cell.cs 프로젝트: lukas-m/Sudoku
 public static string ToString(Candidates value)
 {
     return(ToValue(value).ToString());
 }
예제 #16
0
        public void Candidates_Count_should_depend_on_selected_candidates(Candidates candidates, int expected)
        {
            var actual = candidates.Count();

            actual.Should().Be(expected);
        }
예제 #17
0
파일: Contest.cs 프로젝트: kevinle108/Day17
 public void AddCandidate(Candidate cand)
 {
     Candidates.Add(cand);
 }
예제 #18
0
 private void CheckResult(Grid grid, List <ISolvingTechnique> results, House house, IReadOnlyList <Position> pos, Candidates candidates)
 {
     foreach (var value in candidates.ToValues())
     {
         var position = pos.First(pos => grid.HasCandidate(pos, value));
         results.Add(new HiddenSingle(position, value, house));
     }
 }
예제 #19
0
 public int GetCandidatesSize() => Candidates.Count();
예제 #20
0
 /// <summary> <!-- {{{1 --> setup
 /// </summary>
 public TestCandidate()
 {
     tgt = new Candidates();
 }
예제 #21
0
        public void Developer()
        {
            HomeofficeController controller = new HomeofficeController();

            CandidatesModel model = new CandidatesModel();

            var candidates = new Candidates()
            {
                CandidateID = 2092,
                Email       = "*****@*****.**"
            };

            var occupation = new OccupationArea()
            {
                OccupationAreaID = 2092,
                Name             = "tes",
                Skype            = "tes",
                Linkedin         = "https://linkedin.com/in/test",
                Cyte             = "Itabuna",
                State            = "Bahia",
                Portfolio        = "https://github.com/test",
                Willingness      = "Morning",
                Horary           = "7-8",
                Salary           = 20,
            };

            var information = new InformationBank()
            {
                InformationBankID = 2092,
                Cpf           = "05453390573",
                BanK          = "Banco do Brasil",
                Agency        = "987898",
                AccountType   = "corrente",
                AccountNumber = "6457"
            };

            var knowledge = new Knowledge()
            {
                KnowledgeID   = 2092,
                Ionic         = 3,
                Android       = 5,
                Ios           = 4,
                Majento       = 2,
                WordPress     = 3,
                Html          = 4,
                Css           = 4,
                Bootstrap     = 4,
                Django        = 3,
                Jquery        = 3,
                Angular       = 4,
                Vue           = 4,
                SqlServer     = 5,
                MySql         = 5,
                Java          = 5,
                Phyton        = 3,
                Cake          = 4,
                Php           = 4,
                AspNetMvc     = 4,
                Ruby          = 4,
                C             = 3,
                C_            = 3,
                Photoshop     = 3,
                Illustraitor  = 4,
                Salesforce    = 4,
                Seo           = 3,
                OtherLanguage = "JS-2",
                Crud          = "https://github.com/test",
            };

            model.Candidates      = candidates;
            model.OccupationArea  = occupation;
            model.InformationBank = information;
            model.Knowledge       = knowledge;

            controller.ModelState.AddModelError("", "error");

            //string expectedView = "Developer";

            var actual = controller.Developer(model) as ViewResult;

            Assert.IsNotNull(actual);
            //Assert.AreEqual(expectedView, actual.ViewName);
            Assert.AreEqual(model, actual.Model);
        }
예제 #22
0
 /// <summary>
 /// 按字典序输出结果
 /// </summary>
 static void OutputInTrieTree()
 {
     Candidates<int> result = new Candidates<int>();
     TrieTree<int> trieTree = new TrieTree<int>();
     //将所有项集按字典序排序
     foreach(var candi in frequentItemsets)
     {
         foreach(var itemset in candi.ItemSets)
         {
             result.AddCandidate(itemset);
         }
     }
     result = SortInTrie(result);
     //输出
     StreamWriter sw = new StreamWriter(addrRoot + @"result.txt");
     foreach(var itemset in result.ItemSets)
     {
         foreach (var item in itemset.data) sw.Write(item.ToString() + " ");
         sw.WriteLine(((double)itemset.value / (double)transactions.Count).ToString("0.000"));
     }
     sw.Close();
 }
예제 #23
0
 /// <summary>
 ///   Creates new cell struct with specified candidate values
 /// </summary>
 /// <param name="candidates">Possible values for cell to hold</param>
 public Cell(Candidates candidates)
 {
     _data = (int)candidates;
 }
 private void addConfigsToCandidates()
 {
     Candidates.ToList()
     .ForEach(e => e.CandidateProjects = ConfigProjectCandidateCollection.Where(cp => cp.ConfigCandidateID.Equals(e.ID)).ToList().ToObservableCollection());
 }
예제 #25
0
 /// <summary> <!-- {{{1 --> teardown
 /// </summary>
 public void Dispose()
 {
     tgt = null;
 }
예제 #26
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                LogoutLabel.Visibility = Visibility.Collapsed;

                //Create background worker to download candidates from server
                _candidateWorker         = new BackgroundWorker();
                _candidateWorker.DoWork += (s, ea) =>
                {
                    try
                    {
                        //Set loading overlay
                        Dispatcher.Invoke(() =>
                        {
                            LoadingContainer.Visibility = Visibility.Visible;
                            LoadingLabel.Foreground     = ColorHelper.HexToColorBrush("#1c9ad2");
                            LoadingLabel.Content        = "Loading candidates...";
                        });

                        //Download candidates and parse them into list of objects
                        using (System.Net.WebClient client = new System.Net.WebClient()
                        {
                            Encoding = Encoding.UTF8
                        })
                        {
                            string jsonData =
                                client.DownloadString(new Uri("http://webtask.future-processing.com:8069/candidates"));

                            CandidateRoot root =
                                JsonConvert.DeserializeObject <CandidateRoot>(jsonData);

                            Candidates = root.Candidates.Candidate;
                            Candidates.Select(obj => obj.Party)
                            .Distinct()
                            .ToList()
                            .ForEach(obj => Parties.Add(new Party()
                            {
                                Name = obj
                            }));
                        }
                    }
                    catch (Exception)
                    {
                        MessageBox.Show(
                            "An error occurred while loading program, please contact person responsible for managing the system",
                            "Error occured", MessageBoxButton.OK);
                        Environment.Exit(Environment.ExitCode);
                    }
                };

                _candidateWorker.RunWorkerCompleted += (s, ea) =>
                {
                    //Hide loading overlay
                    LoadingContainer.Visibility = Visibility.Collapsed;

                    Init();
                };
                _candidateWorker.RunWorkerAsync();
            }
            catch (Exception)
            {
                MessageBox.Show(
                    "An error occurred while loading program, please contact person responsible for managing the system",
                    "Error occured", MessageBoxButton.OK);
                Environment.Exit(Environment.ExitCode);
            }
        }
예제 #27
0
        public void Find()
        {
            Candidates.Clear();
            SupplementaryList.Clear();

            int numberOfSpaces       = FindTableau.NumberOfSpaces;
            int maxExtraSuits        = ExtraSuits(numberOfSpaces);
            int maxExtraSuitsToSpace = ExtraSuits(numberOfSpaces - 1);

            for (int from = 0; from < NumberOfPiles; from++)
            {
                HoldingStack holdingStack = HoldingStacks[from];
                Pile         fromPile     = FindTableau[from];
                holdingStack.Clear();
                holdingStack.StartingRow = fromPile.Count;
                int extraSuits = 0;
                for (int fromRow = fromPile.Count - 1; fromRow >= 0; fromRow--)
                {
                    Card fromCard = fromPile[fromRow];
                    if (fromCard.IsEmpty)
                    {
                        break;
                    }
                    if (fromRow < fromPile.Count - 1)
                    {
                        Card previousCard = fromPile[fromRow + 1];
                        if (!previousCard.IsSourceFor(fromCard))
                        {
                            break;
                        }
                        if (fromCard.Suit != previousCard.Suit)
                        {
                            // This is a cross-suit run.
                            extraSuits++;
                            if (extraSuits > maxExtraSuits + holdingStack.Suits)
                            {
                                break;
                            }
                        }
                    }

                    // Add moves to other piles.
                    if (fromCard.Face < Face.King)
                    {
                        PileList piles = FaceLists[(int)fromCard.Face + 1];
                        for (int i = 0; i < piles.Count; i++)
                        {
                            for (int count = 0; count <= holdingStack.Count; count++)
                            {
                                HoldingSet holdingSet = new HoldingSet(holdingStack, count);
                                if (extraSuits > maxExtraSuits + holdingSet.Suits)
                                {
                                    continue;
                                }
                                int to = piles[i];
                                if (from == to || holdingSet.Contains(from))
                                {
                                    continue;
                                }

                                // We've found a legal move.
                                Pile toPile = FindTableau[to];
                                Algorithm.ProcessCandidate(new Move(from, fromRow, to, toPile.Count, AddHolding(holdingSet)));

                                // Update the holding pile move.
                                int holdingSuits = extraSuits;
                                if (fromRow > 0 && (!fromPile[fromRow - 1].IsTargetFor(fromCard) || fromCard.Suit != fromPile[fromRow - 1].Suit))
                                {
                                    holdingSuits++;
                                }
                                if (holdingSuits > holdingStack.Suits)
                                {
                                    int length = holdingStack.FromRow - fromRow;
                                    holdingStack.Push(new HoldingInfo(from, fromRow, to, holdingSuits, length));
                                }

                                break;
                            }
                        }
                    }

                    // Add moves to an space.
                    for (int i = 0; i < FindTableau.NumberOfSpaces; i++)
                    {
                        int to = FindTableau.Spaces[i];

                        if (fromRow == 0)
                        {
                            // No point in moving from a full pile
                            // from one open position to another unless
                            // there are more cards to turn over.
                            if (FindTableau.GetDownCount(from) == 0)
                            {
                                continue;
                            }
                        }
                        else
                        {
                            // No point in moving anything less than
                            // as much as possible to an space.
                            Card nextCard = fromPile[fromRow - 1];
                            if (fromCard.Suit == nextCard.Suit)
                            {
                                if (nextCard.IsTargetFor(fromCard))
                                {
                                    continue;
                                }
                            }
                        }

                        for (int count = 0; count <= holdingStack.Count; count++)
                        {
                            HoldingSet holdingSet = new HoldingSet(holdingStack, count);
                            if (holdingSet.FromRow == fromRow)
                            {
                                // No cards left to move.
                                continue;
                            }
                            if (extraSuits > maxExtraSuitsToSpace + holdingSet.Suits)
                            {
                                // Not enough spaces.
                                continue;
                            }

                            // We've found a legal move.
                            Pile toPile = FindTableau[to];
                            Algorithm.ProcessCandidate(new Move(from, fromRow, to, toPile.Count, AddHolding(holdingSet)));
                            break;
                        }

                        // Only need to check the first space
                        // since all spaces are the same
                        // except for undealt cards.
                        break;
                    }
                }
            }
        }
예제 #28
0
 public bool ContainCandidate(int number) => Candidates.Contains(number);
 public PolymorphicCandidateProvider(IComposableProvider composableProvider)
 {
     Candidates       = composableProvider.GetAll <IPolymorphicCandidateCreator>().SelectMany(c => c.Create()).ToList().AsReadOnly();
     CandidatesById   = new ReadOnlyDictionary <string, PolymorphicCandidateDescriptor>(Candidates.ToDictionary(c => c.Id, c => c));
     CandidatesByType = new ReadOnlyDictionary <Type, PolymorphicCandidateDescriptor>(Candidates.ToDictionary(c => c.Type, c => c));
 }
예제 #30
0
        public int SaveCandidate(Candidates candidate)
        {
            try
            {
                // add/update indent
                var count = this.Candidates.Count(a => a.CandidateID.Equals(candidate.CandidateID));
                if (count == 0)
                {
                    candidate.CreatedDate = DateTime.UtcNow;
                    Candidates.Add(candidate);
                }
                else
                {
                    Candidates u = this.Candidates.Where(s => s.CandidateID == candidate.CandidateID).FirstOrDefault <Candidates>();
                    // insert into candidate history before update
                    CandidatesHistory ch = new CandidatesHistory();
                    ch.CandidateID           = u.CandidateID;
                    ch.IndentNumber          = u.IndentNumber;
                    ch.FirstName             = u.FirstName;
                    ch.LastName              = u.LastName;
                    ch.Gender                = u.Gender;
                    ch.DOB                   = u.DOB.HasValue ? u.DOB.Value : (DateTime?)null;
                    ch.Email                 = u.Email;
                    ch.ContactNumber         = u.ContactNumber;
                    ch.Skills                = u.Skills;
                    ch.CurrentTitle          = u.CurrentTitle;
                    ch.CurrentCompany        = u.CurrentCompany;
                    ch.CurrentLocation       = u.CurrentLocation;
                    ch.Certifications        = u.Certifications;
                    ch.TotalExperience       = u.TotalExperience;
                    ch.Passport              = u.Passport;
                    ch.Visa                  = u.Visa;
                    ch.AadhaarNumber         = u.AadhaarNumber;
                    ch.TravelledOnsiteBefore = u.TravelledOnsiteBefore;
                    ch.Reference1            = u.Reference1;
                    ch.Reference1Contact     = u.Reference1Contact;
                    ch.Reference2            = u.Reference2;
                    ch.Reference2Contact     = u.Reference2Contact;
                    ch.ResumeSourceTypeID    = u.ResumeSourceTypeID;
                    ch.ResumeSourceDetail    = u.ResumeSourceDetail;
                    ch.CurrentCTC            = u.CurrentCTC;
                    ch.ExpectedCTC           = u.ExpectedCTC;
                    ch.CandidateStatusTypeID = u.CandidateStatusTypeID;
                    ch.Remarks               = u.Remarks;
                    ch.CreatedBy             = candidate.ModifiedBy;
                    ch.CreatedDate           = DateTime.UtcNow;
                    CandidatesHistory.Add(ch);
                    // update candidate
                    if (u != null)
                    {
                        u.CandidateID           = candidate.CandidateID;
                        u.IndentNumber          = candidate.IndentNumber;
                        u.FirstName             = candidate.FirstName;
                        u.LastName              = candidate.LastName;
                        u.Gender                = candidate.Gender;
                        u.DOB                   = candidate.DOB.HasValue ? candidate.DOB.Value : (DateTime?)null;
                        u.Email                 = candidate.Email;
                        u.ContactNumber         = candidate.ContactNumber;
                        u.Skills                = candidate.Skills;
                        u.CurrentTitle          = candidate.CurrentTitle;
                        u.CurrentCompany        = candidate.CurrentCompany;
                        u.CurrentLocation       = candidate.CurrentLocation;
                        u.Certifications        = candidate.Certifications;
                        u.TotalExperience       = candidate.TotalExperience;
                        u.Passport              = candidate.Passport;
                        u.Visa                  = candidate.Visa;
                        u.AadhaarNumber         = candidate.AadhaarNumber;
                        u.TravelledOnsiteBefore = candidate.TravelledOnsiteBefore;
                        u.Reference1            = candidate.Reference1;
                        u.Reference1Contact     = candidate.Reference1Contact;
                        u.Reference2            = candidate.Reference2;
                        u.Reference2Contact     = candidate.Reference2Contact;
                        u.ResumeSourceTypeID    = candidate.ResumeSourceTypeID;
                        u.ResumeSourceDetail    = candidate.ResumeSourceDetail;
                        u.CurrentCTC            = candidate.CurrentCTC;
                        u.ExpectedCTC           = candidate.ExpectedCTC;
                        u.CandidateStatusTypeID = candidate.CandidateStatusTypeID;
                        u.Remarks               = candidate.Remarks;
                        u.ModifiedBy            = candidate.ModifiedBy;
                        u.ModifiedDate          = DateTime.UtcNow;
                    }
                    this.Entry(u).State = EntityState.Modified;
                }

                this.SaveChanges();

                return(candidate.CandidateID);
            }
            catch
            {
                throw;
            }
        }
예제 #31
0
 /// <summary>
 /// 将candidate按字典序排好
 /// </summary>
 /// <param name="candidate"></param>
 /// <returns>按字典序排好的新的candidate</returns>
 static Candidates<int> SortInTrie(Candidates<int> candidate)
 {
     //建树
     TrieTree<int> trieTree = new TrieTree<int>();
     foreach (var itemset in candidate.ItemSets)
     {
         trieTree.AddNode(itemset.data, itemset.value);
     }
     //取出
     Candidates<int> result = new Candidates<int>();
     trieTree.ClearTag(trieTree.Root);
     foreach (var node in trieTree.Root.children)
     {
         string str = trieTree.GetNodeData(node);
         while (str != "")
         {
             string[] strData = str.Split(new char[] { ' ' });
             int[] data = new int[strData.Length - 1];
             for (int i = 0; i < strData.Length - 1; i++) data[i] = Convert.ToInt32(strData[i]);
             result.AddCandidate(data, Convert.ToInt32(strData[strData.Length - 1]));
             str = trieTree.GetNodeData(node);
         }
     }
     return result;
 }
예제 #32
0
 public void serializeCandidates(Candidates candidates, string dstfile)
 {
     return;
 }
예제 #33
0
 public override Pawn ChooseLeader() => Candidates.RandomElementWithFallback();
예제 #34
0
        private void GetEntries()
        {
            Entries.Clear();
            Candidates.Clear();

            ResourceMapSection        primaryResourceMapSection = PriFile.GetSectionByRef(PriFile.PriDescriptorSection.PrimaryResourceMapSection.Value);
            HierarchicalSchemaSection schemaSection             = PriFile.GetSectionByRef(primaryResourceMapSection.SchemaSection);

            Dictionary <ResourceMapEntry, EntryViewModel> entriesToViewModels = new Dictionary <ResourceMapEntry, EntryViewModel>();

            bool parentMissing = false;

            do
            {
                foreach (ResourceMapScope scope in schemaSection.Scopes)
                {
                    if (scope.FullName == string.Empty)
                    {
                        continue;
                    }

                    IList <EntryViewModel> targetEntryCollection;

                    if (scope.Parent == null)
                    {
                        targetEntryCollection = Entries;
                    }
                    else
                    {
                        EntryViewModel parentViewModel;

                        if (scope.Parent.FullName == string.Empty)
                        {
                            targetEntryCollection = Entries;
                        }
                        else
                        if (!entriesToViewModels.TryGetValue(scope.Parent, out parentViewModel))
                        {
                            parentMissing = true;
                            continue;
                        }
                        else
                        {
                            targetEntryCollection = parentViewModel.Children;
                        }
                    }

                    EntryViewModel entry = new EntryViewModel(scope);

                    GetEntryType(entry);

                    entriesToViewModels.Add(scope, entry);

                    targetEntryCollection.Add(entry);
                }
            } while (parentMissing);

            foreach (ResourceMapItem item in schemaSection.Items)
            {
                EntryViewModel parentViewModel;

                if (!entriesToViewModels.TryGetValue(item.Parent, out parentViewModel))
                {
                    continue;
                }

                parentViewModel.Children.Add(new EntryViewModel(item));

                GetEntryType(parentViewModel.Children.Last());
            }

            CollapseStringResources();
        }
예제 #35
0
 public bool RemoveCandidate(int number) => Candidates.Remove(number);