public GenerateExamApplication(CandidateInfo info, ICandidateInfoRepository candidateRepository, IInstructorRepository instructorRepository, DataGridView dgvCandidates, DataGridView dgvExamHistory, TreeView treeCandidates) : this(dgvCandidates, dgvExamHistory, treeCandidates) { _info = info; _candidateRepository = candidateRepository; _instructorRepository = instructorRepository; }
private TreeNode GetOrAddParentNode(CandidateInfo info) { var selectedNode = _treeView.Nodes.Find(info.LastName.First().ToString(), false).FirstOrDefault(); if (selectedNode != null) { return(selectedNode); } var index = _treeView.Nodes.Add( new TreeNode { Name = info.LastName.First().ToString(), Text = info.LastName.First().ToString(), Tag = "parent", Nodes = { new TreeNode { Name = $"{info.LastName} {info.FirstName}", Text = $"{info.LastName} {info.FirstName}", Tag = info } } }); selectedNode = _treeView.Nodes[index]; return(selectedNode); }
public void Put(CandidateInfo c) { CandidateDAL dal = new CandidateDAL(); dal._conn = this._conn; dal.Put(c); }
public List <CandidateInfo> Get() { List <CandidateInfo> lst = new List <CandidateInfo>(); string query = @" SELECT CandidateId, CandidateName, CandidateAge, YearsOfExperience, ResumePath " + " FROM dbo.Candidate "; SqlDataReader dr; using (SqlConnection conn = new SqlConnection(_conn)) { conn.Open(); using (SqlCommand command = new SqlCommand(query, conn)) { dr = command.ExecuteReader(); while (dr.Read()) { CandidateInfo info = new CandidateInfo(); info.CandidateId = int.Parse(dr["CandidateId"].ToString()); info.CandidateName = dr["CandidateName"].ToString(); info.CandidateAge = int.Parse(dr["CandidateAge"].ToString()); info.YearsOfExperience = int.Parse(dr["YearsOfExperience"].ToString()); info.ResumePath = dr["ResumePath"].ToString(); lst.Add(info); } dr.Close(); conn.Close(); } } return(lst); }
public async Task <IActionResult> Process() { Parser parser = new Parser(); DataTable dt = parser.ParseData(); foreach (DataRow row in dt.Rows) { candidate = new CandidateInfo(); candidate.Name = row["name"].ToString(); candidate.Email = row["email"].ToString(); candidate.Phone = row["phone"].ToString(); candidate.Skills = row["skills"].ToString(); candidate.Summary = row["summary"].ToString(); candidate.Experience = row["experience"].ToString(); candidate.Education = row["education"].ToString(); // candidate. = row["interests"].ToString(); if (ModelState.IsValid) { _context.Add(candidate); await _context.SaveChangesAsync(); //return RedirectToAction(nameof(Index)); } } return(View()); }
public Election NominateCandidate(Guid electionId, User user) { Election election; if (!electionsDict.TryGetValue(electionId, out election)) { return(null); } lock (election) { if (election.IsNominationFinished) { return(null); } if (election.Candidates.Any(info => info.Id == user.Id)) { return(null); } election.Candidates.Add(CandidateInfo.Create(user)); var clone = election.Clone(); PrivateKey privateKey; if (electionPrivateKeys.TryGetValue(clone.Id, out privateKey)) { clone.PrivateKeyForCandidates = privateKey; } return(clone); } }
private void BindValues(CandidateInfo info) { txtFirstName.Text = info.FirstName; txtLastName.Text = info.LastName; txtNameOfParent.Text = info.NameOfParent; txtJmbg.Text = info.Jmbg; txtAddress.Text = info.Address; txtPhone.Text = info.Phone; txtPostalCode.Text = info.PostalCode; txtCity.Text = info.City; txtCitizenship.Text = info.Citizenship; txtOccupancy.Text = info.Occupancy; txtDrivingLicenceId.Text = info.DrivingLicence?.LicenceId; txtCategory.Text = info.DrivingLicence?.Category; txtNotes.Text = info.DrivingLicence?.Notes; if (info.DrivingLicence != null) { dtpIssueOn.Value = info.DrivingLicence.IssuedOn; } if (info.DrivingLicence != null) { dtpExpiresOn.Value = info.DrivingLicence.ExpiresOn; } SharedViewLogic.LoadExamHistory(info.Exams ?? Enumerable.Empty <ExamInfo>(), dgvExamHistory); }
public JsonResult Put(CandidateInfo c) { CandidateBLL bll = new CandidateBLL(); bll._conn = _configuration.GetConnectionString("ATSAppCon"); bll.Put(c); return(new JsonResult("Updated Successfully")); }
public void RemoveCandidate(CandidateInfo candidate) { if (!BasicValidation(candidate)) { return; } _repository.Delete(candidate); }
public void UpdateCandidate(CandidateInfo candidate) { if (!BasicValidation(candidate)) { return; } _repository.Update(candidate); }
private bool BasicValidation(CandidateInfo candidate) { if (candidate == null || candidate.Name.IsNullOrEmpty()) { return(false); } return(true); }
private void FillInDataFromDb(Candidate candidate, CandidateInfo candidateInfo) { candidate.CandidateId = candidateInfo.CandidateId; candidate.FirstName = candidateInfo.FirstName; candidate.LastName = candidateInfo.LastName; candidate.MiddleName = candidateInfo.MiddleName; candidate.PrimaryEmail = candidateInfo.PrimaryEmail; candidate.PrimaryContactNo = candidateInfo.PrimaryContactNo; }
public IActionResult Create([Bind] CandidateInfo objCan) { if (ModelState.IsValid) { candidateDB.AddCandidate(objCan); return(RedirectToAction("Index")); } return(View(objCan)); }
public void AddCandidate(CandidateInfo candidate) { if (!BasicValidation(candidate)) { return; } _repository.Add(candidate); }
public AddOrUpdateForm(bool isAdd, CandidateInfo info, TreeView treeView, DataGridView dgvCandidates, ICandidateInfoRepository candidateRepository, IInstructorRepository instructorRepository) : this() { SetButtons(isAdd); _info = info; _treeView = treeView; _dgvCandidates = dgvCandidates; _candidateRepository = candidateRepository; _instructorRepository = instructorRepository; }
public CandidateInfo GetCandidate(string vsCandidateId) { int id; VsCandidatesTable candidate = null; if (int.TryParse(vsCandidateId, out id)) { candidate = VsCandidates.GetData(id); } if (candidate == null || candidate.Count == 0) { return(null); } var candidateItems = VsCandidatesItems.GetData(id); var candidateWebAddresses = VsCandidatesWebAddresses.GetData(id); var webAddressTypes = VsWebAddressTypes.GetAllData() .ToDictionary(r => r.WebAddressTypeId, r => r.Name); var info = new CandidateInfo { LastRefreshDate = candidate[0].LastRefreshDate.AsUtc(), FirstName = candidate[0].FirstName, MiddleName = candidate[0].MiddleName, Nickname = candidate[0].Nickname, LastName = candidate[0].LastName, Suffix = candidate[0].Suffix, BirthDate = candidate[0].BirthDate, BirthPlace = candidate[0].BirthPlace, Pronunciation = candidate[0].Pronunciation, Gender = candidate[0].Gender, Family = candidate[0].Family, Photo = candidate[0].Photo, HomeCity = candidate[0].HomeCity, HomeState = candidate[0].HomeState, Education = candidate[0].Education, Profession = candidate[0].Profession, Political = candidate[0].Political, Religion = candidate[0].Religion, CongMembership = candidate[0].CongMembership, OrgMembership = candidate[0].OrgMembership, SpecialMsg = candidate[0].SpecialMsg, Items = candidateItems.OrderBy(r => r.ItemName) .Select(r => new SimpleListItem(r.ItemName, r.ItemData)) .ToList(), WebAddresses = candidateWebAddresses .OrderBy(r => r.WebAddressTypeId) .Select(r => new SimpleListItem(webAddressTypes.ContainsKey(r.WebAddressTypeId) ? webAddressTypes[r.WebAddressTypeId] : "Code " + r.WebAddressTypeId, Validation.StripWebProtocol(r.WebAddress))) .ToList() }; return(info); }
public void Update(CandidateInfo info) { try { Delete(info.FirstName, info.LastName); Create(info); } catch (Exception e) { Helper.Logger.Error($"Method: ICandidateInfoRepository.Update {Environment.NewLine} Error: {e.Message}{Environment.NewLine}{e}"); } }
public IActionResult Edit(int?id, [Bind] CandidateInfo objCan) { if (id == null) { return(NotFound()); } if (ModelState.IsValid) { candidateDB.UpdateCandidate(objCan); return(RedirectToAction("Index")); } return(View(candidateDB)); }
public IActionResult Delete(int?id) { if (id == null) { return(NotFound()); } CandidateInfo can = candidateDB.GetCandidateById(id); if (can == null) { return(NotFound()); } return(View(can)); }
void OnTriggerExit(Collider collider) { CandidateInfo info = null; if (!directGrabCandidates_.TryGetValue(collider, out info)) { return; } info.refCount--; if (info.refCount <= 0) { directGrabCandidates_.Remove(collider); } }
public ActionResult Index(List <CandidateInfo> candidates) { DB db = new DB(); foreach (CandidateInfo can in candidates) { CandidateInfo Existed_Can = candidateDB.GetCandidateById(can.ID); Existed_Can.State = can.State; Existed_Can.Republicans = can.Republicans; Existed_Can.Democrats = can.Democrats; db.UpdateCandidate(can); } return(View(candidates)); }
public void Create(CandidateInfo info) { try { var parentPath = Helper.GetOrCreateParentPath(info.LastName.Substring(0, 1)); var candidatePath = Path.Combine(parentPath, $"{info.LastName} {info.FirstName}.json"); info.CandidateId = Guid.NewGuid().ToString("N"); Helper.SaveJson(candidatePath, info); } catch (Exception e) { Helper.Logger.Error($"Method: ICandidateInfoRepository.Create {Environment.NewLine} Error: {e.Message}{Environment.NewLine}{e}"); } }
private bool PointLineDistance(CandidateInfo candidateInfo) { Vector3 point = candidateInfo.position; var(direction, origin) = (searchDirection, searchOrigin); var distanceAlongDirectionToClosestPoint = Vector3.Dot(point - origin, direction); var closestPointOnLine = origin + distanceAlongDirectionToClosestPoint * (direction); var distance = Vector3.Distance(point, closestPointOnLine); //The distance corresponds to the length of x, if (Mathf.Pow(distance, 2f) * (6f / itemMult) <= Vector3.Distance(closestPointOnLine, origin) && enabled) { return(true); } return(false); }
public void Post(CandidateInfo c) { string query = @" INSERT INTO dbo.Candidate VALUES (" + "'" + c.CandidateName + "'," + c.CandidateAge + "," + c.YearsOfExperience + "," + "'" + c.ResumePath + "')"; SqlDataReader sr; using (SqlConnection conn = new SqlConnection(_conn)) { conn.Open(); using (SqlCommand command = new SqlCommand(query, conn)) { sr = command.ExecuteReader(); sr.Close(); conn.Close(); } } }
public void Put(CandidateInfo c) { string query = @" UPDATE dbo.Candidate SET " + " CandidateName = '" + c.CandidateName + "'," + " CandidateAge = " + c.CandidateAge + "," + " YearsOfExperience = " + c.YearsOfExperience + "," + " ResumePath = '" + c.ResumePath + "'" + " WHERE CandidateId = " + c.CandidateId; SqlDataReader sr; using (SqlConnection conn = new SqlConnection(_conn)) { conn.Open(); using (SqlCommand command = new SqlCommand(query, conn)) { sr = command.ExecuteReader(); sr.Close(); conn.Close(); } } }
void OnTriggerEnter(Collider collider) { var grabbable = collider.GetComponent <VrgGrabbable>() ?? collider.GetComponentInParent <VrgGrabbable>(); if (!grabbable) { return; } CandidateInfo info; if (!directGrabCandidates_.TryGetValue(collider, out info)) { info = new CandidateInfo(); info.collider = collider; info.grabbable = grabbable; directGrabCandidates_.Add(collider, info); } info.refCount++; }
public Guid StartElection(string electionName, User firstCandidate, bool isPublic, DateTime nominateTill, DateTime till) { var homoKeyPair = HomoKeyPair.GenKeyPair(MaxVotesPerElection); var election = new Election { Id = Guid.NewGuid(), Name = electionName, NominateTill = nominateTill, VoteTill = till, PublicKey = homoKeyPair.PublicKey, Votes = new List <Vote>(), Candidates = new List <CandidateInfo> { CandidateInfo.Create(firstCandidate) }, IsPublic = isPublic }; statePersister.SaveKey(election.Id, homoKeyPair.PrivateKey); lock (electionsList) { electionPrivateKeys[election.Id] = homoKeyPair.PrivateKey; electionsDict[election.Id] = election; electionsList.AddFirst(election); while (electionsList.Count > MaxElections) { var node = electionsList.Last; Election dummy; electionsDict.TryRemove(node.Value.Id, out dummy); electionsList.RemoveLast(); } } return(election.Id); }
public override IActionResult Edit(string id, RecoveryForm model) { if (ModelState.IsValid) { var User = _userHelper.GetUser(id); if (User != null) { // Insert Vacancy var NewVacancy = new VacancyList(); NewVacancy.AccountNameId = model.AccountNameId; NewVacancy.ApproverOneId = model.ApproverOneId; NewVacancy.ApproverTwoId = model.SourcingId; NewVacancy.CostCodeId = model.CostCodeId; NewVacancy.CreatedAt = DateTime.Now; NewVacancy.DepartmentId = model.DepartmentId; NewVacancy.DepartmentSubId = model.DepartmentSubId; NewVacancy.JobStageId = model.JobStageId; NewVacancy.JoinDate = model.JoinDate; NewVacancy.NetworkId = model.NetworkId; NewVacancy.NoarmalRate = model.NoarmalRate; NewVacancy.OtLevel = model.OtLevel; NewVacancy.RequestBy = _userHelper.GetUserProfile(model.ApproverOneId); NewVacancy.PackageTypeId = model.PackageTypeId; NewVacancy.ServicePackCategoryId = model.ServicePackCategoryId; NewVacancy.ServicePackId = model.ServicePackId; //NewVacancy.Status = VacanStatusFive.Done; NewVacancy.VacancyStatus = ApproverStatus.Completed; NewVacancy.isHrms = model.isHrms; NewVacancy.isLaptop = model.isLaptop == 1 ? true : false; NewVacancy.isManager = model.isManager; NewVacancy.isUsim = model.isUsim; NewVacancy.StatusOne = SrfApproveStatus.Approved; NewVacancy.StatusTwo = SrfApproveStatus.Approved; NewVacancy.StatusThree = SrfApproveStatus.Approved; NewVacancy.StatusFourth = SrfApproveStatus.Approved; _vacancy.Add(NewVacancy); if (NewVacancy.Id != null) { // Insert Candidate var UserProfile = _profileService.GetByUserId(id); var GetCandidate = _candidate.GetAll().Where(x => x.AccountId == UserProfile.Id).FirstOrDefault(); if (GetCandidate == null) { var Candidate = new CandidateInfo(); Candidate.Account = UserProfile; Candidate.Address = UserProfile.Address; Candidate.AgencyId = model.AgencyId; Candidate.AgencyType = AgencyType.Agency; Candidate.ApproveOneDate = DateTime.Now; Candidate.ApproveOneStatus = ApproverStatus.Selected; Candidate.ApproveTwoeDate = DateTime.Now; Candidate.CreatedAt = DateTime.Now; Candidate.Email = User.Email; Candidate.Gender = UserProfile.Gender.Value; Candidate.HomePhoneNumber = UserProfile.HomePhoneNumber; Candidate.IdNumber = UserProfile.IdNumber; Candidate.IsCandidate = false; Candidate.IsContractor = true; Candidate.IsUser = true; Candidate.Martial = Martial.M1; Candidate.MobilePhoneNumber = UserProfile.MobilePhoneNumber; Candidate.Name = UserProfile.Name; Candidate.Nationality = "Indonesia"; Candidate.NickName = UserProfile.Name; Candidate.PlaceOfBirth = UserProfile.Birthplace; Candidate.DateOfBirth = UserProfile.Birthdate.Value; Candidate.RequestBy = _userHelper.GetUserProfile(model.AgencyId); Candidate.ApproveTwoStatus = ApproverStatus.Completed; Candidate.Vacancy = NewVacancy; GetCandidate = _candidate.Add(Candidate); } if (GetCandidate != null) { var Department = _department.GetById(model.DepartmentId); var Network = _network.GetById(model.NetworkId); // Insert SRF SrfRequest NewSrf = new SrfRequest(); NewSrf.CreatedAt = DateTime.Now; NewSrf.Number = "0000"; NewSrf.Type = SrfType.New; NewSrf.ApproveStatusOne = SrfApproveStatus.Approved; NewSrf.ApproveStatusTwo = SrfApproveStatus.Approved; NewSrf.ApproveStatusThree = SrfApproveStatus.Approved; NewSrf.ApproveStatusFour = SrfApproveStatus.Approved; NewSrf.ApproveStatusFive = SrfApproveStatus.Approved; NewSrf.ApproveStatusSix = SrfApproveStatus.Approved; NewSrf.RequestBy = _userHelper.GetUserProfile(model.ApproverOneId).Name; NewSrf.SrfBegin = model.SrfBegin; NewSrf.SrfEnd = model.SrfEnd; NewSrf.ServiceLevel = model.OtLevel; NewSrf.isWorkstation = model.isLaptop == 1 ? true : false; NewSrf.isCommunication = model.isUsim; NewSrf.IsHrms = model.isHrms; NewSrf.IsOps = Department.OperateOrNon == 1 ? true : false; NewSrf.IsManager = false; NewSrf.RateType = Domain.Models.Enum.RateType.Normal; NewSrf.IsExtended = false; NewSrf.IsLocked = false; NewSrf.Status = Domain.Models.Enum.SrfStatus.Done; NewSrf.SpectValue = 0; NewSrf.IsActive = false; NewSrf.ServicePackId = model.ServicePackId; NewSrf.NetworkId = model.NetworkId; NewSrf.CostCenterId = model.CostCodeId; NewSrf.LineManagerId = model.ApproverOneId; NewSrf.ActivityCode = _activity.GetAll().OrderBy(x => Guid.NewGuid()).FirstOrDefault(); NewSrf.DepartmentId = model.DepartmentId; NewSrf.DepartmentSubId = model.DepartmentSubId; NewSrf.ProjectManagerId = Network.ProjectManagerId; NewSrf.ApproveOneId = model.ApproverOneId; NewSrf.ApproveTwoId = model.ApproveTwoId; NewSrf.ApproveThreeId = model.ApproveThreeId; NewSrf.ApproveFourId = model.ApproveFourId; NewSrf.ApproveSixId = model.ApproveSixId; NewSrf.Candidate = GetCandidate; NewSrf.AccountId = model.AccountNameId; NewSrf.IsLocked = false; NewSrf.IsActive = true; var AnnualLeave = MonthDistance(model.SrfBegin, model.SrfEnd); NewSrf.AnnualLeave = AnnualLeave; Service.Add(NewSrf); if (NewSrf.Id != null) { TempData["Success"] = true; } } } } } return(RedirectToAction("Index")); }
protected override bool ParseSectionContent(BinaryReader binaryReader) { long sectionPosition = (binaryReader.BaseStream as SubStream)?.SubStreamPosition ?? 0; ushort environmentReferencesLength = binaryReader.ReadUInt16(); ushort numEnvironmentReferences = binaryReader.ReadUInt16(); if (!version2) { if (environmentReferencesLength == 0 || numEnvironmentReferences == 0) { throw new InvalidDataException(); } } else { if (environmentReferencesLength != 0 || numEnvironmentReferences != 0) { throw new InvalidDataException(); } } SchemaSection = new SectionRef <HierarchicalSchemaSection>(binaryReader.ReadUInt16()); ushort hierarchicalSchemaReferenceLength = binaryReader.ReadUInt16(); DecisionInfoSection = new SectionRef <DecisionInfoSection>(binaryReader.ReadUInt16()); ushort resourceValueTypeTableSize = binaryReader.ReadUInt16(); ushort ItemToItemInfoGroupCount = binaryReader.ReadUInt16(); ushort itemInfoGroupCount = binaryReader.ReadUInt16(); uint itemInfoCount = binaryReader.ReadUInt32(); uint numCandidates = binaryReader.ReadUInt32(); uint dataLength = binaryReader.ReadUInt32(); uint largeTableLength = binaryReader.ReadUInt32(); if (PriFile.GetSectionByRef(DecisionInfoSection) == null) { return(false); } byte[] environmentReferencesData = binaryReader.ReadBytes(environmentReferencesLength); byte[] schemaReferenceData = binaryReader.ReadBytes(hierarchicalSchemaReferenceLength); if (schemaReferenceData.Length != 0) { using (BinaryReader r = new BinaryReader(new MemoryStream(schemaReferenceData, false))) { ushort majorVersion = r.ReadUInt16(); ushort minorVersion = r.ReadUInt16(); r.ExpectUInt32(0); uint checksum = r.ReadUInt32(); uint numScopes = r.ReadUInt32(); uint numItems = r.ReadUInt32(); HierarchicalSchemaVersionInfo versionInfo = new HierarchicalSchemaVersionInfo(majorVersion, minorVersion, checksum, numScopes, numItems); ushort stringDataLength = r.ReadUInt16(); r.ExpectUInt16(0); uint unknown1 = r.ReadUInt32(); uint unknown2 = r.ReadUInt32(); string uniqueName = r.ReadNullTerminatedString(Encoding.Unicode); if (uniqueName.Length != stringDataLength - 1) { throw new InvalidDataException(); } HierarchicalSchemaReference = new HierarchicalSchemaReference(versionInfo, unknown1, unknown2, uniqueName); } } List <ResourceValueType> resourceValueTypeTable = new List <ResourceValueType>(resourceValueTypeTableSize); for (int i = 0; i < resourceValueTypeTableSize; i++) { binaryReader.ExpectUInt32(4); ResourceValueType resourceValueType = (ResourceValueType)binaryReader.ReadUInt32(); resourceValueTypeTable.Add(resourceValueType); } List <ItemToItemInfoGroup> itemToItemInfoGroups = new List <ItemToItemInfoGroup>(); for (int i = 0; i < ItemToItemInfoGroupCount; i++) { ushort firstItem = binaryReader.ReadUInt16(); ushort itemInfoGroup = binaryReader.ReadUInt16(); itemToItemInfoGroups.Add(new ItemToItemInfoGroup(firstItem, itemInfoGroup)); } List <ItemInfoGroup> itemInfoGroups = new List <ItemInfoGroup>(); for (int i = 0; i < itemInfoGroupCount; i++) { ushort groupSize = binaryReader.ReadUInt16(); ushort firstItemInfo = binaryReader.ReadUInt16(); itemInfoGroups.Add(new ItemInfoGroup(groupSize, firstItemInfo)); } List <ItemInfo> itemInfos = new List <ItemInfo>(); for (int i = 0; i < itemInfoCount; i++) { ushort decision = binaryReader.ReadUInt16(); ushort firstCandidate = binaryReader.ReadUInt16(); itemInfos.Add(new ItemInfo(decision, firstCandidate)); } byte[] largeTable = binaryReader.ReadBytes((int)largeTableLength); if (largeTable.Length != 0) { using (BinaryReader r = new BinaryReader(new MemoryStream(largeTable, false))) { uint ItemToItemInfoGroupCountLarge = r.ReadUInt32(); uint itemInfoGroupCountLarge = r.ReadUInt32(); uint itemInfoCountLarge = r.ReadUInt32(); for (int i = 0; i < ItemToItemInfoGroupCountLarge; i++) { uint firstItem = r.ReadUInt32(); uint itemInfoGroup = r.ReadUInt32(); itemToItemInfoGroups.Add(new ItemToItemInfoGroup(firstItem, itemInfoGroup)); } for (int i = 0; i < itemInfoGroupCountLarge; i++) { uint groupSize = r.ReadUInt32(); uint firstItemInfo = r.ReadUInt32(); itemInfoGroups.Add(new ItemInfoGroup(groupSize, firstItemInfo)); } for (int i = 0; i < itemInfoCountLarge; i++) { uint decision = r.ReadUInt32(); uint firstCandidate = r.ReadUInt32(); itemInfos.Add(new ItemInfo(decision, firstCandidate)); } if (r.BaseStream.Position != r.BaseStream.Length) { throw new InvalidDataException(); } } } List <CandidateInfo> candidateInfos = new List <CandidateInfo>((int)numCandidates); for (int i = 0; i < numCandidates; i++) { byte type = binaryReader.ReadByte(); if (type == 0x01) { ResourceValueType resourceValueType = resourceValueTypeTable[binaryReader.ReadByte()]; ushort sourceFileIndex = binaryReader.ReadUInt16(); ushort valueLocation = binaryReader.ReadUInt16(); ushort dataItemSection = binaryReader.ReadUInt16(); candidateInfos.Add(new CandidateInfo(resourceValueType, sourceFileIndex, valueLocation, dataItemSection)); } else if (type == 0x00) { ResourceValueType resourceValueType = resourceValueTypeTable[binaryReader.ReadByte()]; ushort length = binaryReader.ReadUInt16(); uint stringOffset = binaryReader.ReadUInt32(); candidateInfos.Add(new CandidateInfo(resourceValueType, length, stringOffset)); } else { throw new InvalidDataException(); } } long stringDataStartOffset = binaryReader.BaseStream.Position; Dictionary <ushort, CandidateSet> candidateSets = new Dictionary <ushort, CandidateSet>(); for (int itemToItemInfoGroupIndex = 0; itemToItemInfoGroupIndex < itemToItemInfoGroups.Count; itemToItemInfoGroupIndex++) { ItemToItemInfoGroup itemToItemInfoGroup = itemToItemInfoGroups[itemToItemInfoGroupIndex]; ItemInfoGroup itemInfoGroup; if (itemToItemInfoGroup.ItemInfoGroup < itemInfoGroups.Count) { itemInfoGroup = itemInfoGroups[(int)itemToItemInfoGroup.ItemInfoGroup]; } else { itemInfoGroup = new ItemInfoGroup(1, (uint)(itemToItemInfoGroup.ItemInfoGroup - itemInfoGroups.Count)); } for (uint itemInfoIndex = itemInfoGroup.FirstItemInfo; itemInfoIndex < itemInfoGroup.FirstItemInfo + itemInfoGroup.GroupSize; itemInfoIndex++) { ItemInfo itemInfo = itemInfos[(int)itemInfoIndex]; ushort decisionIndex = (ushort)itemInfo.Decision; Decision decision = PriFile.GetSectionByRef(DecisionInfoSection).Decisions[decisionIndex]; List <Candidate> candidates = new List <Candidate>(decision.QualifierSets.Count); for (int i = 0; i < decision.QualifierSets.Count; i++) { CandidateInfo candidateInfo = candidateInfos[(int)itemInfo.FirstCandidate + i]; if (candidateInfo.Type == 0x01) { ReferencedFileRef?sourceFile; if (candidateInfo.SourceFileIndex == 0) { sourceFile = null; } else { sourceFile = new ReferencedFileRef(candidateInfo.SourceFileIndex - 1); } candidates.Add(new Candidate(decision.QualifierSets[i].Index, candidateInfo.ResourceValueType, sourceFile, new DataItemRef(new SectionRef <DataItemSection>(candidateInfo.DataItemSection), candidateInfo.DataItemIndex))); } else if (candidateInfo.Type == 0x00) { ByteSpan data = new ByteSpan(sectionPosition + stringDataStartOffset + candidateInfo.DataOffset, candidateInfo.DataLength); candidates.Add(new Candidate(decision.QualifierSets[i].Index, candidateInfo.ResourceValueType, data)); } } ushort resourceMapItemIndex = (ushort)(itemToItemInfoGroup.FirstItem + (itemInfoIndex - itemInfoGroup.FirstItemInfo)); CandidateSet candidateSet = new CandidateSet( new ResourceMapItemRef(SchemaSection, resourceMapItemIndex), decisionIndex, candidates); candidateSets.Add(resourceMapItemIndex, candidateSet); } } CandidateSets = candidateSets; return(true); }
private void VacancyAndCandidate() { Data dt = new Data("vacany_candidate"); foreach (var row in dt.GetData()) { int index = 1; var Data = (List <String>)row; var Org = _department.GetAll().Where(x => Truncate(x.Name) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1; var SubOrg = _departmentSub.GetAll().Where(x => Truncate(x.SubName) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1; var CostCr = _costCenter.GetAll().Where(x => Truncate(x.Code) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1; var AnnName = _account.GetAll().Where(x => Truncate(x.Name) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1; var Net = _networkNumber.GetAll().Where(x => Truncate(x.Code) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1; if (Net == null) { Net = _networkNumber.GetAll().OrderBy(x => Guid.NewGuid()).FirstOrDefault(); } var JoinDate = DateTime.Parse(Data[index].ToString()); index += 1; var PackageType = _packageType.GetAll().Where(x => Truncate(x.Name) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1; var SsowCategory = _ssow_category.GetAll().Where(x => Truncate(x.Name) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1; var Ssow = _ssow.GetAll().Where(x => Truncate(x.Name) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1; var BasiServiceLevel = int.Parse(Data[index].ToString()); index += 1; var IsWorkstation = int.Parse(Data[index].ToString()); index += 1; var IsUsim = int.Parse(Data[index].ToString()); index += 1; var IsManager = int.Parse(Data[index].ToString()); index += 1; var NormalRate = int.Parse(Data[index].ToString()); index += 1; var IsSignum = int.Parse(Data[index].ToString()); index += 1; var Jobstage = _jobstage.GetAll().Where(x => Truncate(x.Stage) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1; var LineManager = _userProfile.GetAll().Where(x => Truncate(x.Name) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1; var Sourcing = _userProfile.GetAll().Where(x => Truncate(x.Email) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1; var NewVacancy = new VacancyList(); NewVacancy.AccountName = AnnName; NewVacancy.ApproverOne = LineManager; NewVacancy.ApproverTwo = Sourcing; NewVacancy.CostCenter = CostCr; NewVacancy.CreatedAt = JoinDate; NewVacancy.Departement = Org; NewVacancy.DepartementSub = SubOrg; NewVacancy.JobStage = Jobstage; NewVacancy.JoinDate = JoinDate; NewVacancy.Network = Net; NewVacancy.NoarmalRate = NormalRate; NewVacancy.OtLevel = BasiServiceLevel; NewVacancy.RequestBy = LineManager; NewVacancy.PackageType = PackageType; NewVacancy.ServicePackCategory = SsowCategory; NewVacancy.ServicePack = Ssow; NewVacancy.Status = VacanStatusFive.Done; NewVacancy.VacancyStatus = ApproverStatus.Completed; NewVacancy.isHrms = IsSignum == 1 ? true : false; NewVacancy.isLaptop = IsWorkstation == 1 ? true : false; NewVacancy.isManager = IsManager == 1 ? true : false; NewVacancy.isUsim = IsUsim == 1 ? true : false; NewVacancy.StatusOne = VacanStatusFirst.Selected; NewVacancy.StatusTwo = VacanStatusSecond.Approved; NewVacancy.StatusThree = VacanStatusThirth.Done; NewVacancy.StatusFourth = VacanStatusFourth.Approved; var AgencyType = int.Parse(Data[index].ToString()); index += 1; var CandidateName = Data[index].ToString(); index += 1; var NickName = Data[index].ToString(); index += 1; var Email = Data[index].ToString(); index += 1; var IdNumber = Data[index].ToString(); index += 1; if (IdNumber.Length > 16) { IdNumber = IdNumber.Substring(0, 16); } var Nationality = Data[index].ToString(); index += 1; var PlaceOfBirth = Data[index].ToString(); index += 1; var DateOfBirth = DateTime.Parse(Data[index].ToString()); index += 1; var Address = Data[index].ToString(); index += 1; var Gender = Data[index].ToString(); index += 1; var Martial = Data[index].ToString(); index += 1; var PhoneNMobile = Data[index].ToString(); index += 1; var PhoneHome = Data[index].ToString(); index += 1; var Description = Data[index].ToString(); index += 1; var HomeBase = Data[index].ToString(); index += 1; var AhId = Data[index].ToString(); index += 1; var FormEricsson = int.Parse(Data[index].ToString()); index += 1; var Agency = Data[index].ToString(); var UserCurrent = _userManager.FindByEmailAsync(Email).Result; if (UserCurrent != null) { var delete = _userManager.DeleteAsync(UserCurrent).Result; } var UserAgency = _userProfile.GetAll().Where(x => Truncate(x.Email) == Truncate(Agency)).FirstOrDefault(); var UserProfile = new UserProfile(); UserProfile.Address = Address; UserProfile.Birthdate = DateOfBirth; UserProfile.Email = Email; UserProfile.Gender = Gender.Equals(Truncate("F")) ? Domain.Models.Enum.Gender.Female : Domain.Models.Enum.Gender.Male; UserProfile.HomePhoneNumber = PhoneHome; UserProfile.IdNumber = IdNumber; UserProfile.IsActive = true; UserProfile.MobilePhoneNumber = PhoneNMobile; UserProfile.Name = CandidateName; UserProfile.Roles = "Contractor"; UserProfile.UserName = Email; UserProfile.IsBlacklist = false; UserProfile.IsTerminate = false; UserProfile.AhId = AhId; List <String> Role = new List <string>() { "Contractor" }; ApplicationUser NewUser = new ApplicationUser() { Email = Email, UserName = Email, UserProfile = UserProfile }; var created = _userManager.CreateAsync(NewUser, "welcome1!").Result; if (created.Succeeded) { var addRole = _userManager.AddToRolesAsync(NewUser, Role).Result; if (addRole.Succeeded) { _vacancy.Add(NewVacancy); var code = _userManager.GenerateEmailConfirmationTokenAsync(NewUser).Result; var Succseed = _userManager.ConfirmEmailAsync(NewUser, code).Result; var Candidate = new CandidateInfo(); Candidate.Account = NewUser.UserProfile; Candidate.Address = Address; Candidate.Agency = UserAgency; Candidate.AgencyType = (AgencyType)AgencyType; Candidate.ApproveOneDate = JoinDate; Candidate.ApproveOneStatus = ApproverStatus.Selected; Candidate.ApproveTwoeDate = JoinDate; Candidate.CreatedAt = JoinDate; Candidate.Email = Email; Candidate.Gender = Gender.Equals(Truncate("F")) ? Domain.Models.Enum.Gender.Female : Domain.Models.Enum.Gender.Male; Candidate.HomePhoneNumber = PhoneNMobile; Candidate.IdNumber = IdNumber; Candidate.IsCandidate = false; Candidate.IsContractor = true; Candidate.IsUser = true; Candidate.Martial = (Martial)Enum.Parse(typeof(Martial), Martial, true); Candidate.MobilePhoneNumber = PhoneNMobile; Candidate.Name = CandidateName; Candidate.Nationality = Nationality; Candidate.NickName = NickName; Candidate.PlaceOfBirth = PlaceOfBirth; Candidate.DateOfBirth = DateOfBirth; Candidate.RequestBy = UserAgency; Candidate.ApproveTwoStatus = ApproverStatus.Completed; Candidate.Vacancy = NewVacancy; _candidate.Add(Candidate); if (Candidate != null) { Console.WriteLine(Email + " has been added "); } Count++; } } } Console.WriteLine(Count + " Candidate record has been saved "); }