public async Task SetBlackAsync(BlackInfo salaryinfo, string id = null, CancellationToken cle = default(CancellationToken)) { if (salaryinfo == null) { throw new ArgumentNullException(nameof(salaryinfo)); } if (id != null) { HumanInfo buildings = new HumanInfo() { Id = id, StaffStatus = StaffStatus.Leave }; Context.Attach(buildings); var entry = Context.Entry(buildings); entry.Property(x => x.StaffStatus).IsModified = true; } if (Context.BlackInfos.Any(x => x.IDCard == salaryinfo.IDCard)) { Context.Attach(salaryinfo); Context.Update(salaryinfo); } else { Context.Add(salaryinfo); } await Context.SaveChangesAsync(cle); }
private void lvList_DataSetRamda_View() { this.lvList.Items.Clear(); var Conn = new OleDbConnection(StrSQL); Conn.Open(); var OleAdapter = new OleDbDataAdapter("SELECT * FROM t_info", Conn); DataSet ds = new DataSet(); DataTable dt = ds.Tables.Add("dsTable"); OleAdapter.Fill(ds, "dsTable"); var query = dt.AsEnumerable(). Select(HumanInfo => new { Id = HumanInfo.Field <int>("m_id").ToString(), Name = HumanInfo.Field <string>("m_name"), Age = HumanInfo.Field <int>("m_age").ToString(), Phone = HumanInfo.Field <string>("m_phone"), Job = HumanInfo.Field <string>("m_job"), }); foreach (var HumData in query) { var strArray = new String[] { HumData.Id, HumData.Name, HumData.Age, HumData.Phone, HumData.Job }; this.lvList.Items.Add(new ListViewItem(strArray)); } Conn.Close(); }
/// <summary> /// ゴール地点頭達時 /// </summary> public void EndPosComplate() { Debug.Log("EndComplete"); if (!GateInHuman) { if (humanLines.Count == 0) { return; } GateInHuman = humanLines.Dequeue(); } GateInHuman.GetComponent <HumanMove>().GotoOutScreen(); isMoveNow = false; //Dequeue //HumanInfo breakInfo = humanLines.Dequeue(); // 次の人がいたら、その人をStartさせる if (humanLines.Count > 0) { HumanInfo firstInfo = humanLines.Peek(); firstHuman = GateInHuman.gameObject; firstInfo.GetComponent <HumanMove>().GotoStartPoss(() => StartPosComplate()); } GateInHuman = null; }
/// <summary> /// 人通行後の不満度加減処理 /// </summary> /// <param name="finishTime"></param> /// <param name="check"></param> public void ActionComplete(float finishTime) { //HumanInfo firstInfo = humanLines.Peek(); HumanInfo firstInfo = null; if (GateInHuman) { firstInfo = GateInHuman.GetComponent <HumanInfo>(); } else { firstInfo = humanLines.Peek(); } float firstTargetTime = firstInfo.GetTargetTime(); float addScore = 10f; float addFrus = 0; float frusPer = 5; // 経過>目標 if (finishTime > firstTargetTime) { addFrus += finishTime - firstTargetTime; } // 経過<目標 else { addScore += firstTargetTime - finishTime; } StageController.instance.PassHuman(); StageController.instance.AddScore(addScore); StageController.instance.AddFrustration(addFrus * frusPer); }
public async Task LeaveHuman(LeaveInfo info, string huid, CancellationToken cancellationToken = default(CancellationToken)) { if (info == null) { throw new ArgumentNullException(nameof(info)); } HumanInfo buildings = new HumanInfo() { Id = huid, LeaveTime = DateTime.Now, StaffStatus = StaffStatus.Leave }; if (Context.LeaveInfos.Any(x => x.IDCard == info.IDCard)) { Context.Attach(info); Context.Update(info); } else { Context.Add(info); } Context.Attach(buildings); var entry = Context.Entry(buildings); entry.Property(x => x.LeaveTime).IsModified = true; entry.Property(x => x.StaffStatus).IsModified = true; await Context.SaveChangesAsync(cancellationToken); }
public async Task <ResponseMessage <LimitInfoResponse> > Save(UserInfo user, LimitInfoRequest request) { ResponseMessage <LimitInfoResponse> r = new ResponseMessage <LimitInfoResponse>(); HumanInfo ui = await _Store.GetUserInfo(request.UserId); if (ui == null) { r.Code = "404"; r.Message = "人员不存在"; return(r); } await checkPermission(r, user.Id, PERMISSION_BXXE, ui.DepartmentId); if (!r.IsSuccess()) { return(r); } LimitInfo li = await _Store.Save(_mapper.Map <SimpleUser>(user), _mapper.Map <LimitInfo>(request)); r.Extension = _mapper.Map <LimitInfoResponse>(li); return(r); }
/// <summary> /// 更新 /// </summary> /// <returns></returns> public async Task <HumanInfo> UpdateAsync(UserInfo user, HumanInfo humanInfo, CancellationToken cancellationToken = default(CancellationToken)) { if (humanInfo == null) { throw new ArgumentNullException(nameof(humanInfo)); } var old = HumanInfos.Where(a => a.Id == humanInfo.Id).SingleOrDefault(); if (old == null) { throw new Exception("更新的对象不存在"); } old.BankAccount = humanInfo.BankAccount; old.BankName = humanInfo.BankName; old.DepartmentId = humanInfo.DepartmentId; old.EmailAddress = humanInfo.EmailAddress; old.Desc = humanInfo.Desc; old.PositionType = humanInfo.PositionType; old.EmergencyContact = humanInfo.EmergencyContact; old.EmergencyContactPhone = humanInfo.EmergencyContactPhone; old.EmergencyContactType = humanInfo.EmergencyContactType; old.EntryTime = humanInfo.EntryTime; old.MaritalStatus = humanInfo.MaritalStatus; old.HighestEducation = humanInfo.HighestEducation; old.HealthCondition = humanInfo.HealthCondition; old.DomicilePlace = humanInfo.DomicilePlace; old.HouseholdType = humanInfo.HouseholdType; old.IDCard = humanInfo.IDCard; old.FamilyAddress = humanInfo.FamilyAddress; old.LeaveTime = humanInfo.LeaveTime; old.BecomeTime = humanInfo.BecomeTime; old.Name = humanInfo.Name; old.NativePlace = humanInfo.NativePlace; old.Nationality = humanInfo.Nationality; old.Picture = humanInfo.Picture; old.Phone = humanInfo.Phone; old.Position = humanInfo.Position; old.PolicitalStatus = humanInfo.PolicitalStatus; old.Sex = humanInfo.Sex; old.UserID = humanInfo.UserID; old.UpdateTime = DateTime.Now; old.UpdateUser = user.Id; old.StaffStatus = humanInfo.StaffStatus; old.Company = humanInfo.Company; old.AdministrativeBack = humanInfo.AdministrativeBack; old.ClothesBack = humanInfo.ClothesBack; old.Modify = humanInfo.Modify; old.OtherBack = humanInfo.OtherBack; old.PortBack = humanInfo.PortBack; old.RecentModify = humanInfo.RecentModify; Context.Update(old); try { await Context.SaveChangesAsync(cancellationToken); } catch (DbUpdateException) { throw; } return(humanInfo); }
/// <summary> /// 新增 /// </summary> /// <returns></returns> public async Task <HumanInfo> CreateAsync(HumanInfo humanInfo, CancellationToken cancellationToken = default(CancellationToken)) { if (humanInfo == null) { throw new ArgumentNullException(nameof(humanInfo)); } Context.Add(humanInfo); try { await Context.SaveChangesAsync(cancellationToken); } catch (DbUpdateException) { throw; } return(humanInfo); }
/// <summary> /// 人生成 /// </summary> public void CreateHuman() { if (humanLines.Count >= MaxHumanCount) { return; } _humanPrefab = Resources.Load("Prefabs/HumanPrefab") as GameObject; _humanPrefab.name = (humanCount++).ToString(); createPos = GameObject.Find("Canvas/CreatePos").GetComponent <RectTransform>().localPosition; startPos = GameObject.Find("Canvas/StartPos").GetComponent <RectTransform>().localPosition; endPos = GameObject.Find("Canvas/EndPos").GetComponent <RectTransform>().localPosition; HumanMove hMove; moveSpeed = StageController.instance.GetHumanMoveSpeed(); // 生成と座標指定--------------------------------* GameObject human = Instantiate(_humanPrefab); human.transform.SetParent(GameObject.Find("HumanCanvas").transform); hMove = human.AddComponent <HumanMove>(); waitingPos = new Vector2(startPos.x - humanLines.Count * human.GetComponent <RectTransform>().sizeDelta.x, startPos.y); createPos = new Vector2(createPos.x - humanLines.Count * human.GetComponent <RectTransform>().sizeDelta.x, createPos.y); //hMove.SetWaitingPos(waitingPos); hMove.Init(createPos, startPos, endPos, moveSpeed); HumanSprite.SpriteSet sprites = StageController.instance.nowStage.humanSprite.GetRndHuman(); hMove.SetSprite(sprites.walk, sprites.pass); // ------------------------------------* // StartPosに移動 hMove.GotoStartPoss(() => StartPosComplate()); // 人情報を配列に入れる---------------------* HumanInfo info = human.AddComponent <HumanInfo>(); TicketType ticketType = StageController.instance.GetRundTicketType(); hMove.SetTicketType(ticketType); info.SetTicket(ticketType); info.SetTargetTime(StageController.instance.GetHumanTargetTime()); humanLines.Enqueue(info); // -----------------------------------------* }
/// <summary> /// チケットを入れた時の処理 /// </summary> public void TicketIn() { // チケットの種類 TicketType type; // 目標通過時間 //float targetTime; // 先頭の情報を取得 HumanInfo firstInfo = humanLines.Peek(); // 情報格納 type = firstInfo.GetTicket(); //targetTime = firstInfo.GetTargetTime(); TicketGate.instance.SetTicket(type); }
public async Task ChangeHuman(ChangeInfo info, string huid, CancellationToken cancellationToken = default(CancellationToken)) { if (info == null) { throw new ArgumentNullException(nameof(info)); } HumanInfo buildings = new HumanInfo() { Id = huid, Position = info.NewPosition, DepartmentId = info.NewDepartmentId, //BaseSalary = info.BaseSalary, //Subsidy = info.Subsidy, ClothesBack = info.ClothesBack, AdministrativeBack = info.AdministrativeBack, PortBack = info.PortBack, OtherBack = info.OtherBack }; if (Context.ChangeInfos.Any(x => x.IDCard == info.IDCard)) { Context.Attach(info); Context.Update(info); } else { Context.Add(info); } Context.Attach(buildings); var entry = Context.Entry(buildings); entry.Property(x => x.Position).IsModified = true; entry.Property(x => x.DepartmentId).IsModified = true; //entry.Property(x => x.BaseSalary).IsModified = true; //entry.Property(x => x.Subsidy).IsModified = true; entry.Property(x => x.ClothesBack).IsModified = true; entry.Property(x => x.AdministrativeBack).IsModified = true; entry.Property(x => x.PortBack).IsModified = true; entry.Property(x => x.OtherBack).IsModified = true; await Context.SaveChangesAsync(cancellationToken); }
private void GateIn() { StartCoroutine(TicketGate.instance.WaitTicketTiming(() => { if (humanLines.Count > 0 && !humanLines.Peek().GetComponent <HumanMove>().isGateStart) { return; } if (!GateInHuman && humanLines.Count == 0) { return; } GateInHuman = humanLines.Dequeue(); firstHuman = GateInHuman.gameObject; //firstInfo.GetComponent<HumanMove>().GotoEndPos(() => EndPosComplate()); GateInHuman.GetComponent <HumanMove>().GotoEndPos(() => { }); isMoveNow = true; })); }
/// <summary> /// 更新人事审核状态 /// </summary> /// <param name="humanId"></param> /// <param name="status"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public async Task UpdateExamineStatus(string humanId, ExamineStatusEnum status, CancellationToken cancellationToken = default(CancellationToken)) { HumanInfo humanInfo = new HumanInfo() { Id = humanId, UpdateTime = DateTime.Now, ExamineStatus = status }; Context.Attach(humanInfo); var entry = Context.Entry(humanInfo); entry.Property(x => x.ExamineStatus).IsModified = true; entry.Property(x => x.UpdateTime).IsModified = true; try { await Context.SaveChangesAsync(cancellationToken); } catch (DbUpdateException) { throw; } }
public async Task <ResponseMessage> Delete(UserInfo user, string userId) { ResponseMessage r = new ResponseMessage(); HumanInfo hi = await _Store.GetUserInfo(userId); if (hi == null) { r.Code = "404"; r.Message = "不存在该员工"; return(r); } await checkPermission(r, user.Id, PERMISSION_BXXE, hi.DepartmentId); if (!r.IsSuccess()) { return(r); } await _Store.Delete(_mapper.Map <SimpleUser>(user), userId); return(r); }
public async Task <HumanInfo> CreateAsync(SimpleUser userinfo, HumanInfo humaninfo, string modifyid, string checkaction, CancellationToken cancellationToken = default(CancellationToken)) { if (userinfo == null) { throw new ArgumentNullException(nameof(userinfo)); } if (string.IsNullOrEmpty(modifyid)) { modifyid = Guid.NewGuid().ToString(); } var modify = new ModifyInfo(); modify.ID = modifyid; modify.Type = CreateHumanModifyType;//创建 modify.IDCard = humaninfo.IDCard; modify.ModifyPepole = userinfo.Id; modify.ModifyStartTime = DateTime.Now; modify.ExamineStatus = ExamineStatusEnum.Auditing; modify.ExamineTime = modify.ModifyStartTime; modify.ModifyCheck = checkaction; modify.Ext1 = humaninfo.Id; modify.Ext2 = humaninfo.Name; humaninfo.CreateUser = userinfo.Id; humaninfo.Modify = 1; humaninfo.RecentModify = modifyid; humaninfo.CreateTime = DateTime.Now; humaninfo.StaffStatus = StaffStatus.NonEntry;//-1黑名单 0 未入职 1离职 2入职 3转正 Context.Add(humaninfo); Context.Add(modify); await Context.SaveChangesAsync(cancellationToken); return(humaninfo); }
public async Task BecomeHuman(SocialInsurance info, string huid, CancellationToken cancellationToken = default(CancellationToken)) { if (!string.IsNullOrEmpty(info.IDCard)) { HumanInfo buildings = new HumanInfo() { Id = huid, //IsSocialInsurance = info.IsSocial, //SocialInsuranceInfo = info.IDCard, BecomeTime = info.EnTime, StaffStatus = StaffStatus.Regular }; Context.Attach(buildings); var entry = Context.Entry(buildings); //entry.Property(x => x.IsSocialInsurance).IsModified = true; //entry.Property(x => x.SocialInsuranceInfo).IsModified = true; entry.Property(x => x.BecomeTime).IsModified = true; entry.Property(x => x.StaffStatus).IsModified = true; if (Context.SocialInsurances.Any(x => x.IDCard == info.IDCard)) { Context.Attach(info); Context.Update(info); } else { Context.Add(info); } await Context.SaveChangesAsync(cancellationToken); } else { throw new ArgumentNullException("have no IDCard"); } }
/// <summary> /// /// </summary> /// <param name="check">ゲートを閉じたことが間違いか否か</param> public void GateClose(bool check) { if (check) { StageController.instance.AddScore(10); Debug.Log("add score"); } else { StageController.instance.AddFrustration(10); } if (!GateInHuman) { humanLines.Dequeue().GetComponent <HumanMove>().ReturnToGate(); isMoveNow = false; return; } HumanMove humanMove = GateInHuman.GetComponent <HumanMove>(); humanMove.ReturnToGate(); GateInHuman = null; isMoveNow = false; }
public static bool IsHumanAlive(HumanInfo info) { bool res = (HumanInfo.IsAlive & info) != 0; return res; }
// Use this for initialization void Start() { m_Player = GetComponent <HumanCharacter> (); info = GetComponent <HumanInfo> (); }
public async Task <HumanInfo> SaveAsync(UserInfo user, HumanInfo humanInfo, CancellationToken cancellationToken = default(CancellationToken)) { if (user == null) { throw new ArgumentNullException(nameof(user)); } if (humanInfo == null) { throw new ArgumentNullException(nameof(humanInfo)); } try { if (!Context.HumanInfos.Any(x => x.Id == humanInfo.Id)) { humanInfo.IsDeleted = false; humanInfo.CreateTime = DateTime.Now; humanInfo.CreateUser = user.Id; humanInfo.StaffStatus = StaffStatus.Entry; humanInfo.ExamineStatus = ExamineStatusEnum.Auditing; Context.Add(humanInfo); if (humanInfo.HumanSalaryStructure != null) { Context.Add(humanInfo.HumanSalaryStructure); } if (humanInfo.HumanSocialSecurity != null) { Context.Add(humanInfo.HumanSocialSecurity); } if (humanInfo.HumanContractInfo != null) { Context.Add(humanInfo.HumanContractInfo); } var HumanTitleInfos = humanInfo.HumanTitleInfos?.ToList(); if (HumanTitleInfos != null) { for (int i = 0; i < HumanTitleInfos.Count; i++) { HumanTitleInfos[i].Id = string.IsNullOrEmpty(HumanTitleInfos[i].Id) ? Guid.NewGuid().ToString() : HumanTitleInfos[i].Id; HumanTitleInfos[i].IsDeleted = false; HumanTitleInfos[i].CreateTime = DateTime.Now; HumanTitleInfos[i].CreateUser = user.Id; } Context.AddRange(HumanTitleInfos); } var HumanWorkHistories = humanInfo.HumanWorkHistories?.ToList(); if (HumanWorkHistories != null) { for (int i = 0; i < HumanWorkHistories.Count; i++) { HumanWorkHistories[i].Id = string.IsNullOrEmpty(HumanWorkHistories[i].Id) ? Guid.NewGuid().ToString() : HumanWorkHistories[i].Id; HumanWorkHistories[i].IsDeleted = false; HumanWorkHistories[i].CreateTime = DateTime.Now; HumanWorkHistories[i].CreateUser = user.Id; } Context.AddRange(HumanWorkHistories); } var HumanEducationInfos = humanInfo.HumanEducationInfos?.ToList(); if (HumanEducationInfos != null) { for (int i = 0; i < HumanEducationInfos.Count; i++) { HumanEducationInfos[i].Id = string.IsNullOrEmpty(HumanEducationInfos[i].Id) ? Guid.NewGuid().ToString() : HumanEducationInfos[i].Id; HumanEducationInfos[i].IsDeleted = false; HumanEducationInfos[i].CreateTime = DateTime.Now; HumanEducationInfos[i].CreateUser = user.Id; } Context.AddRange(HumanEducationInfos); } } else//更新 { var old = await GetDetailQuery().Where(x => x.Id == humanInfo.Id).FirstOrDefaultAsync(cancellationToken); old.BankAccount = humanInfo.BankAccount; old.BankName = humanInfo.BankName; old.DepartmentId = humanInfo.DepartmentId; old.EmailAddress = humanInfo.EmailAddress; old.Desc = humanInfo.Desc; old.PositionType = humanInfo.PositionType; old.EmergencyContact = humanInfo.EmergencyContact; old.EmergencyContactPhone = humanInfo.EmergencyContactPhone; old.EmergencyContactType = humanInfo.EmergencyContactType; old.EntryTime = humanInfo.EntryTime; old.MaritalStatus = humanInfo.MaritalStatus; old.HighestEducation = humanInfo.HighestEducation; old.HealthCondition = humanInfo.HealthCondition; old.DomicilePlace = humanInfo.DomicilePlace; old.HouseholdType = humanInfo.HouseholdType; old.IDCard = humanInfo.IDCard; old.FamilyAddress = humanInfo.FamilyAddress; old.LeaveTime = humanInfo.LeaveTime; old.BecomeTime = humanInfo.BecomeTime; old.Name = humanInfo.Name; old.NativePlace = humanInfo.NativePlace; old.Nationality = humanInfo.Nationality; old.Picture = humanInfo.Picture; old.Phone = humanInfo.Phone; old.Position = humanInfo.Position; old.PolicitalStatus = humanInfo.PolicitalStatus; old.Sex = humanInfo.Sex; old.UserID = humanInfo.UserID; old.UpdateTime = DateTime.Now; old.UpdateUser = user.Id; old.StaffStatus = humanInfo.StaffStatus; old.Company = humanInfo.Company; old.AdministrativeBack = humanInfo.AdministrativeBack; old.ClothesBack = humanInfo.ClothesBack; old.Modify = humanInfo.Modify; old.OtherBack = humanInfo.OtherBack; old.PortBack = humanInfo.PortBack; old.RecentModify = humanInfo.RecentModify; Context.Attach(old); Context.Update(old); if (old.HumanContractInfo != null) { old.HumanContractInfo.ContractEndDate = humanInfo.HumanContractInfo.ContractEndDate; old.HumanContractInfo.ContractNo = humanInfo.HumanContractInfo.ContractNo; old.HumanContractInfo.ContractSignDate = humanInfo.HumanContractInfo.ContractSignDate; old.HumanContractInfo.ContractStartDate = humanInfo.HumanContractInfo.ContractStartDate; old.HumanContractInfo.ContractType = humanInfo.HumanContractInfo.ContractType; old.HumanContractInfo.Id = humanInfo.HumanContractInfo.Id; old.HumanContractInfo.ContractCompany = humanInfo.HumanContractInfo.ContractCompany; Context.Attach(old.HumanContractInfo); Context.Update(old.HumanContractInfo); } else if (humanInfo.HumanContractInfo != null) { Context.Add(humanInfo.HumanContractInfo); } if (old.HumanSalaryStructure != null) { old.HumanSalaryStructure.BaseWages = humanInfo.HumanSalaryStructure.BaseWages; old.HumanSalaryStructure.CommunicationAllowance = humanInfo.HumanSalaryStructure.CommunicationAllowance; old.HumanSalaryStructure.OtherAllowance = humanInfo.HumanSalaryStructure.OtherAllowance; old.HumanSalaryStructure.PostWages = humanInfo.HumanSalaryStructure.PostWages; old.HumanSalaryStructure.TrafficAllowance = humanInfo.HumanSalaryStructure.TrafficAllowance; Context.Attach(old.HumanSalaryStructure); Context.Update(old.HumanSalaryStructure); } else if (humanInfo.HumanSalaryStructure != null) { Context.Add(humanInfo.HumanSalaryStructure); } if (old.HumanSocialSecurity != null) { old.HumanSocialSecurity.EmploymentInjuryInsurance = humanInfo.HumanSocialSecurity.EmploymentInjuryInsurance; old.HumanSocialSecurity.EndowmentInsurance = humanInfo.HumanSocialSecurity.EndowmentInsurance; old.HumanSocialSecurity.HousingProvidentFund = humanInfo.HumanSocialSecurity.HousingProvidentFund; old.HumanSocialSecurity.HousingProvidentFundAccount = humanInfo.HumanSocialSecurity.HousingProvidentFundAccount; old.HumanSocialSecurity.InsuredAddress = humanInfo.HumanSocialSecurity.InsuredAddress; old.HumanSocialSecurity.InsuredTime = humanInfo.HumanSocialSecurity.InsuredTime; old.HumanSocialSecurity.IsGiveUp = humanInfo.HumanSocialSecurity.IsGiveUp; old.HumanSocialSecurity.IsSignCommitment = humanInfo.HumanSocialSecurity.IsSignCommitment; old.HumanSocialSecurity.MaternityInsurance = humanInfo.HumanSocialSecurity.MaternityInsurance; old.HumanSocialSecurity.MedicalInsurance = humanInfo.HumanSocialSecurity.MedicalInsurance; old.HumanSocialSecurity.MedicalInsuranceAccount = humanInfo.HumanSocialSecurity.MedicalInsuranceAccount; old.HumanSocialSecurity.SocialSecurityAccount = humanInfo.HumanSocialSecurity.SocialSecurityAccount; old.HumanSocialSecurity.UnemploymentInsurance = humanInfo.HumanSocialSecurity.UnemploymentInsurance; Context.Attach(old.HumanSocialSecurity); Context.Update(old.HumanSocialSecurity); } else if (humanInfo.HumanSocialSecurity != null) { Context.Add(humanInfo.HumanSocialSecurity); } if (old?.HumanEducationInfos?.Count() > 0) { var HumanEducationInfos = old.HumanEducationInfos.ToList(); for (int i = 0; i < HumanEducationInfos.Count; i++) { var newEducationInfo = humanInfo.HumanEducationInfos?.FirstOrDefault(a => a.Id == HumanEducationInfos[i].Id); if (newEducationInfo != null) { HumanEducationInfos[i].GetDegreeCompany = newEducationInfo.GetDegreeCompany; HumanEducationInfos[i].GetDegree = newEducationInfo.GetDegree; HumanEducationInfos[i].Education = newEducationInfo.Education; HumanEducationInfos[i].EnrolmentTime = newEducationInfo.EnrolmentTime; HumanEducationInfos[i].GetDegreeTime = newEducationInfo.GetDegreeTime; HumanEducationInfos[i].GraduationCertificate = newEducationInfo.GraduationCertificate; HumanEducationInfos[i].GraduationSchool = newEducationInfo.GraduationSchool; HumanEducationInfos[i].GraduationTime = newEducationInfo.GraduationTime; HumanEducationInfos[i].HumanId = newEducationInfo.HumanId; HumanEducationInfos[i].Id = newEducationInfo.Id; HumanEducationInfos[i].LearningType = newEducationInfo.LearningType; HumanEducationInfos[i].Major = newEducationInfo.Major; HumanEducationInfos[i].UpdateTime = newEducationInfo.UpdateTime; HumanEducationInfos[i].UpdateUser = newEducationInfo.UpdateUser; } else { HumanEducationInfos[i].IsDeleted = true; HumanEducationInfos[i].DeleteTime = DateTime.Now; HumanEducationInfos[i].DeleteUser = user.Id; } humanInfo.HumanEducationInfos = humanInfo.HumanEducationInfos.Where(a => a.Id != HumanEducationInfos[i].Id)?.ToList(); Context.Attach(HumanEducationInfos[i]); Context.Update(HumanEducationInfos[i]); } if (humanInfo.HumanEducationInfos.Count() > 0) { var oldHumanEducationInfos = humanInfo.HumanEducationInfos.ToList(); for (int i = 0; i < oldHumanEducationInfos.Count; i++) { oldHumanEducationInfos[i].IsDeleted = false; oldHumanEducationInfos[i].CreateTime = DateTime.Now; oldHumanEducationInfos[i].CreateUser = user.Id; } Context.AddRange(oldHumanEducationInfos); } } else if (humanInfo?.HumanEducationInfos?.Count() > 0) { var HumanEducationInfos = humanInfo.HumanEducationInfos.ToList(); for (int i = 0; i < HumanEducationInfos.Count; i++) { HumanEducationInfos[i].IsDeleted = false; HumanEducationInfos[i].CreateTime = DateTime.Now; HumanEducationInfos[i].CreateUser = user.Id; } Context.AddRange(HumanEducationInfos); } //职称信息处理 if (old?.HumanTitleInfos.Count() > 0) { var HumanTitleInfos = old.HumanTitleInfos.ToList(); for (int i = 0; i < HumanTitleInfos.Count; i++) { var newHumanTitleInfos = humanInfo.HumanTitleInfos?.FirstOrDefault(a => a.Id == HumanTitleInfos[i].Id); if (newHumanTitleInfos != null) { HumanTitleInfos[i].GetTitleTime = newHumanTitleInfos.GetTitleTime; HumanTitleInfos[i].TitleName = newHumanTitleInfos.TitleName; } else { HumanTitleInfos[i].IsDeleted = true; HumanTitleInfos[i].DeleteTime = DateTime.Now; HumanTitleInfos[i].DeleteUser = user.Id; } humanInfo.HumanTitleInfos = humanInfo.HumanTitleInfos.Where(a => a.Id != HumanTitleInfos[i].Id)?.ToList(); Context.Attach(HumanTitleInfos[i]); Context.Update(HumanTitleInfos[i]); } if (humanInfo?.HumanTitleInfos?.Count() > 0) { var oldHumanTitleInfos = humanInfo.HumanTitleInfos.ToList(); for (int i = 0; i < oldHumanTitleInfos.Count; i++) { oldHumanTitleInfos[i].IsDeleted = false; oldHumanTitleInfos[i].CreateTime = DateTime.Now; oldHumanTitleInfos[i].CreateUser = user.Id; } Context.AddRange(oldHumanTitleInfos); } } else if (humanInfo?.HumanTitleInfos?.Count() > 0) { var HumanTitleInfos = humanInfo.HumanTitleInfos.ToList(); for (int i = 0; i < HumanTitleInfos.Count; i++) { HumanTitleInfos[i].IsDeleted = false; HumanTitleInfos[i].CreateTime = DateTime.Now; HumanTitleInfos[i].CreateUser = user.Id; } Context.AddRange(HumanTitleInfos); } //工作经历信息处理 if (old?.HumanWorkHistories?.Count() > 0) { var HumanWorkHistories = old.HumanWorkHistories.ToList(); for (int i = 0; i < HumanWorkHistories.Count; i++) { var newHumanWorkHistories = humanInfo.HumanWorkHistories?.FirstOrDefault(a => a.Id == HumanWorkHistories[i].Id); if (newHumanWorkHistories != null) { HumanWorkHistories[i].Company = newHumanWorkHistories.Company; HumanWorkHistories[i].EndTime = newHumanWorkHistories.EndTime; HumanWorkHistories[i].Position = newHumanWorkHistories.Position; HumanWorkHistories[i].StartTime = newHumanWorkHistories.StartTime; HumanWorkHistories[i].Witness = newHumanWorkHistories.Witness; HumanWorkHistories[i].WitnessPhone = newHumanWorkHistories.WitnessPhone; } else { HumanWorkHistories[i].IsDeleted = true; HumanWorkHistories[i].DeleteTime = DateTime.Now; HumanWorkHistories[i].DeleteUser = user.Id; } humanInfo.HumanWorkHistories = humanInfo.HumanWorkHistories.Where(a => a.Id != HumanWorkHistories[i].Id)?.ToList(); Context.Attach(HumanWorkHistories[i]); Context.Update(HumanWorkHistories[i]); } if (humanInfo.HumanWorkHistories?.Count() > 0) { var oldHumanWorkHistories = humanInfo.HumanWorkHistories.ToList(); for (int i = 0; i < oldHumanWorkHistories.Count; i++) { oldHumanWorkHistories[i].IsDeleted = false; oldHumanWorkHistories[i].CreateTime = DateTime.Now; oldHumanWorkHistories[i].CreateUser = user.Id; } Context.AddRange(oldHumanWorkHistories); } } else if (humanInfo?.HumanWorkHistories?.Count() > 0) { var HumanWorkHistories = humanInfo.HumanWorkHistories.ToList(); for (int i = 0; i < HumanWorkHistories.Count; i++) { HumanWorkHistories[i].IsDeleted = false; HumanWorkHistories[i].CreateTime = DateTime.Now; HumanWorkHistories[i].CreateUser = user.Id; } Context.AddRange(HumanWorkHistories); } } await Context.SaveChangesAsync(cancellationToken); } catch (DbUpdateException) { throw; } return(humanInfo); }
/// <summary> /// React to humans being thrown at me. /// </summary> private void HumanDropped(GameObject human) { // check if not active if (_active) { return; } // check distance if ((_devil.transform.position - transform.position).magnitude < TriggerDistance) { // activate _active = true; // get sinner component var sinner = human.GetComponent <Sinner>(); // check the human var mentalRequired = sinner.RequiredMentalPain; var physicalRequired = sinner.RequiredPhysicalPain; if (((mentalRequired > 0.01f && sinner.MentalPain > mentalRequired && sinner.MentalPain < mentalRequired * 2f) || (mentalRequired < 0.01f && sinner.MentalPain < 20f)) && ((physicalRequired > 0.01f && sinner.PhysicalPain > physicalRequired && sinner.PhysicalPain < physicalRequired * 2f) || (physicalRequired < 0.01f && sinner.PhysicalPain < 20f))) { // human is good _dialogManager.SayPitch(GoodHumanSentences[Random.Range(0, GoodHumanSentences.Length)], new Vector3(0, 40f), .5f, 4f, gameObject); // accept him AcceptHuman(human); // send event var mentalString = HumanInfo.GetPainString( mentalRequired > 0.01f ? sinner.MentalPain / mentalRequired : sinner.MentalPain / 20f, mentalRequired > 0.01f); var physicalString = HumanInfo.GetPainString( physicalRequired > 0.01f ? sinner.PhysicalPain / physicalRequired : sinner.PhysicalPain / 20f, physicalRequired > 0.01f); var mentalWord = mentalString; var physicalWord = physicalString; if (mentalWord.IndexOf('<') >= 0) { mentalWord = mentalWord.Substring(mentalWord.IndexOf('>') + 1, mentalWord.LastIndexOf('<') - mentalWord.IndexOf('>') - 1); } if (physicalWord.IndexOf('<') >= 0) { physicalWord = physicalWord.Substring(physicalWord.IndexOf('>') + 1, physicalWord.LastIndexOf('<') - physicalWord.IndexOf('>') - 1); } Analytics.Send("HumanReturned", new Dictionary <string, object> { { "MentalPain", sinner.MentalPain }, { "PhysicalPain", sinner.PhysicalPain }, { "RequiredMentalPain", mentalRequired }, { "RequiredPhysicalPain", physicalRequired }, { "MentalPainString", mentalString }, { "PhysicalPainString", physicalString }, { "MentalPainWord", mentalWord }, { "PhysicalPainWord", physicalWord }, { "Sins", sinner.Sins.Count } }); // update level score if (mentalRequired < 0.01) { // mental not required if (sinner.MentalPain > 20f) { _score *= Mathf.Lerp(1f, 0.9f, (sinner.MentalPain - 20f) / 80f); } } else { // mental required _score *= Mathf.Lerp(1f, 0.1f, (sinner.MentalPain / mentalRequired) / 10f); } if (physicalRequired < 0.01) { // physical not required if (sinner.PhysicalPain > 20f) { _score *= Mathf.Lerp(1f, 0.9f, (sinner.PhysicalPain - 20f) / 80f); } } else { // physical required _score *= Mathf.Lerp(1f, 0.1f, (sinner.PhysicalPain / physicalRequired) / 10f); } } else { // human is bad if (sinner.MentalPain < mentalRequired || sinner.PhysicalPain < physicalRequired) { // not enough pain _dialogManager.SayPitch(BadHumanNotEnoughSentences[Random.Range(0, BadHumanNotEnoughSentences.Length)], new Vector3(0, 40f), .5f, 4f, gameObject); } else { // too much pain _dialogManager.SayPitch(BadHumanTooMuchSentences[Random.Range(0, BadHumanTooMuchSentences.Length)], new Vector3(0, 40f), .5f, 4f, gameObject); } } // deactivate StartCoroutine(DeactivateAfter(4f)); } }
public async Task <ModifyInfo> UpdateExamineStatus(string modifyId, ExamineStatusEnum status, CancellationToken cancellationToken = default(CancellationToken)) { var modify = await GetModifyAsync(a => a.Where(b => b.ID == modifyId)); if (modify != null) { switch (modify.Type) { case CreateHumanModifyType: { HumanInfo buildings = new HumanInfo() { Id = modify.Ext1, StaffStatus = StaffStatus.Entry }; Context.Attach(buildings); var entry = Context.Entry(buildings); entry.Property(x => x.StaffStatus).IsModified = true; } break; case BecomeHumanModifyType: { SocialInsurance responinfo = JsonHelper.ToObject <SocialInsurance>(modify.Ext2); await BecomeHuman(responinfo, modify.Ext1, cancellationToken); } break; case ChangeHumanModifyType: { ChangeInfo responinfo = JsonHelper.ToObject <ChangeInfo>(modify.Ext2); await ChangeHuman(responinfo, modify.Ext1, cancellationToken); } break; case LeaveHumanModifyType: { LeaveInfo responinfo = JsonHelper.ToObject <LeaveInfo>(modify.Ext2); await LeaveHuman(responinfo, modify.Ext1, cancellationToken); } break; default: break; } ///////////////////// ModifyInfo mbuildings = new ModifyInfo() { ID = modifyId, ExamineTime = DateTime.Now, ExamineStatus = status, }; Context.Attach(mbuildings); var mentry = Context.Entry(mbuildings); mentry.Property(x => x.ExamineStatus).IsModified = true; mentry.Property(x => x.ExamineTime).IsModified = true; await Context.SaveChangesAsync(cancellationToken); } return(modify); }
public async Task SaveAsync(HumanInfo huinfo, CancellationToken cancellationToken = default(CancellationToken)) { }
public async Task UpdateAsync(HumanInfo buildingBase, CancellationToken cancellationToken = default(CancellationToken)) { }
public async Task DeleteAsync(HumanInfo userinfo, string contractid, CancellationToken cancellationToken = default(CancellationToken)) { }