/// <summary> /// 添加人员基本信息 /// </summary> /// <param name="personal"></param> /// <returns></returns> public int AddPersonalInformation(PersonalInformation personal) { using (MySqlConnection conn = DapperHelper.GetConnString()) { conn.Open(); DynamicParameters parameters = new DynamicParameters(); parameters.Add("@Name", personal.Name, null, null, null); parameters.Add("@UserName", personal.UserName, null, null, null); parameters.Add("@Gender", personal.Gender, null, null, null); parameters.Add("@Birthday", personal.Birthday, null, null, null); parameters.Add("@Nation", personal.Nation, null, null, null); parameters.Add("@Employingnit", personal.Employingnit, null, null, null); parameters.Add("@PartnerName", personal.PartnerName, null, null, null); parameters.Add("@ProfessionalSkill", personal.ProfessionalSkill, null, null, null); parameters.Add("@MaritalStatus", personal.MaritalStatus, null, null, null); parameters.Add("@IDNumber", personal.IDNumber, null, null, null); parameters.Add("@PartyGroupings", personal.PartyGroupings, null, null, null); parameters.Add("@Email", personal.Email, null, null, null); parameters.Add("@Post", personal.Post, null, null, null); parameters.Add("@Phone", personal.Phone, null, null, null); parameters.Add("@CardNo", personal.CardNo, null, null, null); parameters.Add("@OpeningBank", personal.OpeningBank, null, null, null); parameters.Add("@CreationTime", personal.CreationTime, null, null, null); parameters.Add("@ModificationTime", personal.ModificationTime, null, null, null); parameters.Add("@IsDelete", personal.IsDelete, null, null, null); string sql = "insert into personalinformation(Name,UserName,Gender,Birthday,Nation,Employingnit,PartnerName,ProfessionalSkill,MaritalStatus,IDNumber,PartyGroupings,Email,Post,Phone,CardNo,OpeningBank,CreationTime,ModificationTime,IsDelete) VALUES (@Name,@UserName,@Gender,@Birthday,@Nation,@Employingnit,@PartnerName,@ProfessionalSkill,@MaritalStatus,@IDNumber,@PartyGroupings,@Email,@Post,@Phone,@CardNo,@OpeningBank,@CreationTime,@ModificationTime,@IsDelete)"; int i = conn.Execute(sql, parameters); return(i); } }
public void TestPersonalInformationConstructor() { string uid = "testID"; string fname = "testFName"; char minit = 'q'; string lname = "testLName"; int addressID = 1; string phoneNumber = "867-5309"; string sex = "testSex"; DateTime DOB = DateTime.Now; string race = "testRace"; string email = "*****@*****.**"; string ssn = "123456789"; PersonalInformation testInformation = new PersonalInformation(uid, fname, minit, lname, addressID, phoneNumber, sex, DOB, race, email, ssn); Assert.AreEqual(testInformation.UID, uid); Assert.AreEqual(testInformation.FName, fname); Assert.AreEqual(testInformation.Minit, minit); Assert.AreEqual(testInformation.LName, lname); Assert.AreEqual(testInformation.AddrID, addressID); Assert.AreEqual(testInformation.PhoneNumber, phoneNumber); Assert.AreEqual(testInformation.Sex, sex); Assert.AreEqual(testInformation.DOB, DOB); Assert.AreEqual(testInformation.Race, race); Assert.AreEqual(testInformation.Email, email); Assert.AreEqual(testInformation.SSN, ssn); }
/// <summary> /// 修改人员基本信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public int UpdatePersonalInformation(PersonalInformation personal) { using (MySqlConnection conn = DapperHelper.GetConnString()) { DynamicParameters parameters = new DynamicParameters(); parameters.Add("@Name", personal.Name, null, null, null); parameters.Add("@UserName", personal.UserName, null, null, null); parameters.Add("@Gender", personal.Gender, null, null, null); parameters.Add("@Birthday", personal.Birthday, null, null, null); parameters.Add("@Nation", personal.Nation, null, null, null); parameters.Add("@Employingnit", personal.Employingnit, null, null, null); parameters.Add("@PartnerName", personal.PartnerName, null, null, null); parameters.Add("@ProfessionalSkill", personal.ProfessionalSkill, null, null, null); parameters.Add("@MaritalStatus", personal.MaritalStatus, null, null, null); parameters.Add("@IDNumber", personal.IDNumber, null, null, null); parameters.Add("@PartyGroupings", personal.PartyGroupings, null, null, null); parameters.Add("@Email", personal.Email, null, null, null); parameters.Add("@Post", personal.Post, null, null, null); parameters.Add("@Phone", personal.Phone, null, null, null); parameters.Add("@CardNo", personal.CardNo, null, null, null); parameters.Add("@OpeningBank", personal.OpeningBank, null, null, null); parameters.Add("@CreationTime", personal.CreationTime, null, null, null); parameters.Add("@ModificationTime", personal.ModificationTime, null, null, null); parameters.Add("@IsDelete", personal.IsDelete, null, null, null); parameters.Add("@Id", personal.Id, null, null, null); string sql = "update personalinformation set Name=@Name,UserName=@UserName,Gender=@Gender,Birthday=@Birthday,Nation=@Nation,Employingnit=@Employingnit,PartnerName=@PartnerName,ProfessionalSkill=@ProfessionalSkill,MaritalStatus=@MaritalStatus,IDNumber=@IDNumber,PartyGroupings=@PartyGroupings,Email=@Email,Post=@Post,Phone=@Phone,CardNo=@CardNo,OpeningBank=@OpeningBank,CreationTime=@CreationTime,ModificationTime=@ModificationTime,IsDelete=@IsDelete where Id=@Id"; int i = conn.Execute(sql, parameters); return(i); } }
public JsonResult GetPersonal() { //PersonalInformation p = Session["PersonalInformation"] as PersonalInformation; if (Request.Cookies["PersonalInformation"] == null) { return(null); } else { string a = Request.Cookies["PersonalInformation"].Value; byte[] b = Convert.FromBase64String(a); MemoryStream ms = new MemoryStream(b, 0, b.Length); BinaryFormatter bf = new BinaryFormatter(); PersonalInformation p = bf.Deserialize(ms) as PersonalInformation; if (p != null) { return(Json(p)); } else { return(null); } } }
public IActionResult UpdatePersonalInformation(PersonalInformation updatePersonalInformation, int personalinformationId) { User userInDb = LoggedIn(); if (userInDb == null) { return(RedirectToAction("LogOut", "Home")); } PersonalInformation update = dbContext.PersonalInformations.FirstOrDefault(n => n.PersonalInformationId == personalinformationId); if (ModelState.IsValid) { update.InfoName = updatePersonalInformation.InfoName; update.InfoContent = EncryptDecrypt.Encrypt(updatePersonalInformation.InfoContent); update.InfoNote = updatePersonalInformation.InfoNote; update.UpdatedAt = updatePersonalInformation.UpdatedAt; dbContext.SaveChanges(); ViewBag.User = userInDb; return(Redirect("/info/dashboard")); } ViewBag.User = userInDb; return(Redirect("/info/dashboard")); }
public string ShowAccountInfo(string login) { string aa = ""; DGMUserInfo userInfo = Session["DGMUserInfo"] as DGMUserInfo; MT4AccountBll mt4Bll = new MT4AccountBll(); userInfo = mt4Bll.GetAccountInfo(login); userInfo.DGMUser_Account = new AccountBll().GetAccountByAccountNumber(login); if (userInfo != null && userInfo.DGMUser_Account != null) { string AccountName = userInfo.DGMUser_Account.CH_Surname + userInfo.DGMUser_Account.CH_Name; //姓名 string AccountLogin = userInfo.DGMUser_Login; //账户 string AccountEmail = userInfo.DGMUser_Account.Email; //邮箱 string pwd = userInfo.DGMUser_Account.AccountPassword; aa += AccountName + "#" + AccountLogin + "#" + AccountEmail + "#" + pwd; ApplyForLiveAccountBll applyBll = new ApplyForLiveAccountBll(); ProfessionInfo professioninfo = applyBll.GetProfessionInfoByAccountInformationId(userInfo.DGMUser_Account.InformationId); PersonalInformation personal = applyBll.GetPersonalInformationByProfessionInfoPersonalInformationId(professioninfo.PersonalInformationId); if (personal != null) { string AccountPhone = personal.PhoneNumber; //电话 string AccountAddress = personal.LiveAddress; //地址 //string AccountRevenue = professioninfo.BEFOREYearRevenue;//税前年收入 //string AccountInvested = professioninfo.DepositAndInvestment;//储蓄和投资总额 aa += "#" + AccountPhone + "#" + AccountAddress; } } return(aa); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Surname,Patronymic,BirthDate,personalInformationXml")] PersonalInformation personalInformation) { if (id != personalInformation.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(personalInformation); personalInformation.personalInformationXml = "Edited"; await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonalInformationExists(personalInformation.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(personalInformation)); }
public void SetPersonalInformation(T data, IList <IViewModel> fields, Entity contact, ContactIdentifier contactIdentifier) { string firstName; string lastName; var personalInformation = contact.GetFacet <PersonalInformation>(); if (personalInformation != null) { firstName = personalInformation.FirstName; lastName = personalInformation.LastName; } else { firstName = GetFieldById(data.FieldFirstNameId, fields); lastName = GetFieldById(data.FieldLastNameId, fields); } var newPersonalInformation = new PersonalInformation { FirstName = firstName, LastName = lastName }; _xConnectContactService.UpdateContactFacet( contactIdentifier, PersonalInformation.DefaultFacetKey, x => { x.FirstName = firstName; x.LastName = lastName; x.PreferredLanguage = Context.Language.ToString(); }, () => newPersonalInformation); }
public async Task <IActionResult> Update(int?id) { //check if id is null if (id == null) { return(NotFound()); } //Get education object var url = "PersonalInformations"; PersonalInformation personalInformation = await ApiHelper.GetOneObject <PersonalInformation>(url, id); //check if object is null if (personalInformation == null) { return(NotFound()); } //set value of object var model = new PersonalInformation() { PersonalInformationId = personalInformation.PersonalInformationId, Name = personalInformation.Name, Surname = personalInformation.Surname, LinkedIn = personalInformation.LinkedIn, Email = personalInformation.Email, Phone = personalInformation.Phone, IntroductionText = personalInformation.IntroductionText, Description = personalInformation.Description }; return(View(model)); }
public new IContact Get(Guid contactId) { string[] facets = new string[8] { "Personal", "Addresses", "Emails", "PhoneNumbers", "Classification", "EngagementMeasures", "SalesforceContact", "CustomSalesforceContact" }; Contact contact = this.GetContact(contactId, facets); PersonalInformation facet1 = this.TryGetFacet <PersonalInformation>(contact, "Personal"); AddressList facet2 = this.TryGetFacet <AddressList>(contact, "Addresses"); EmailAddressList facet3 = this.TryGetFacet <EmailAddressList>(contact, "Emails"); PhoneNumberList facet4 = this.TryGetFacet <PhoneNumberList>(contact, "PhoneNumbers"); Classification facet5 = this.TryGetFacet <Classification>(contact, "Classification"); EngagementMeasures facet6 = this.TryGetFacet <EngagementMeasures>(contact, "EngagementMeasures"); SalesforceContactInformation facet7 = this.TryGetFacet <SalesforceContactInformation>(contact, "SalesforceContact"); CustomSalesforceContactInformation facet8 = this.TryGetFacet <CustomSalesforceContactInformation>(contact, "CustomSalesforceContact"); return((IContact)this.CreateContact(contact.Id.GetValueOrDefault(), facet5, facet6, facet1, facet3, facet4, facet2, facet7, facet8, contact.Identifiers.ToList <ContactIdentifier>())); }
public async Task Delete(int personalInformationId) { PersonalInformation personalInformation = this.GetById(personalInformationId); _context.Remove(personalInformation); await _context.SaveChangesAsync(); }
public IHttpActionResult PostPersonalInformations(PersonalInformationModel model) { try { _logger.Debug(string.Format("ini process - Post,idUser:{0}", CurrentIdUser)); if (!ModelState.IsValid) { _logger.Debug(string.Format("ini Post - inValid,idUser:{0}", CurrentIdUser)); return(BadRequest(ModelState)); } PersonalInformation personalinformation = AutoMapper.Mapper.Map <PersonalInformation>(model); personalinformation.LastActivityIdUser = CurrentIdUser; personalinformation.CreationIdUser = CurrentIdUser; _personalinformationBL.Insert(personalinformation); _logger.Debug(string.Format("finish Post - success,idUser:{0}", CurrentIdUser)); return(Ok(new JsonResponse { Success = true, Message = "PersonalInformation was Saved successfully", Data = personalinformation })); } catch (Exception ex) { LogError(ex); return(InternalServerError(ex)); } }
public bool SavePersonalInformation(PersonalInformationModel personalInformationModel) { try { PersonalInformation personalInformation = new PersonalInformation() { EnglishName = personalInformationModel.EnglishName, BanglaName = personalInformationModel.BanglaName, //DepartmentId = personalInformationModel.Departments.Id, }; if (personalInformationModel.Departments != null) { personalInformation.Departments = new Department() { DepartmentName = personalInformationModel.Departments.DepartmentName }; } _dbContext.PersonalInformations.Add(personalInformation); _dbContext.SaveChanges(); return(true); } catch (Exception ex) { string val = ex.Message; return(false); } }
/// <summary> /// Updates the current object with the new data from the updated facet /// </summary> /// <param name="personalInformation">The existing data</param> /// <param name="updatedPersonalInformation">The new data</param> public static void Update(this PersonalInformation personalInformation, PersonalInformation updatedPersonalInformation) { //If no updates, nothing has changed if (updatedPersonalInformation == null) { return; } //If a birthdate value is provided and existing is blank or different, there is a change if (updatedPersonalInformation.Birthdate.HasValue && (!personalInformation.Birthdate.HasValue || updatedPersonalInformation.Birthdate.Value != personalInformation.Birthdate.Value)) { personalInformation.Birthdate = updatedPersonalInformation.Birthdate; } //Loop over all string properties foreach (var stringProp in typeof(PersonalInformation).GetProperties(BindingFlags.Instance | BindingFlags.Public).Where(x => x.PropertyType == typeof(String))) { var currentValue = (String)stringProp.GetValue(personalInformation); var updatedValue = (String)stringProp.GetValue(updatedPersonalInformation); if (personalInformation.HasNewValue(currentValue, updatedValue)) { stringProp.SetValue(personalInformation, updatedValue); } } }
public PersonalInformation Get(int clientId) { _personalInfo = new PersonalInformation(); _personalInfo.Client = getClientPersonalInfo(clientId); _personalInfo.Spouse = getSpousePersonalInfo(clientId); return(_personalInfo); }
public ContactFacetData GetContactData() { ContactFacetData data = new ContactFacetData(); var id = this.GetContactId(); if (id != null) { var contactReference = new IdentifiedContactReference(id.Source, id.Identifier); using (var client = SitecoreXConnectClientConfiguration.GetClient()) { try { var contact = client.Get(contactReference, new ContactExpandOptions(this.facetsToUpdate)); if (contact != null) { PersonalInformation personalInformation = contact.Personal(); if (personalInformation != null) { data.FirstName = personalInformation.FirstName; data.MiddleName = personalInformation.MiddleName; data.LastName = personalInformation.LastName; data.Birthday = personalInformation.Birthdate.ToString(); data.Gender = personalInformation.Gender; data.Language = personalInformation.PreferredLanguage; } var email = contact.Emails(); if (email != null) { data.EmailAddress = email.PreferredEmail?.SmtpAddress; } var phones = contact.PhoneNumbers(); if (phones != null) { data.PhoneNumber = phones.PreferredPhoneNumber?.Number; } if (contact.Facets.ContainsKey(SportType.DefaultKey)) { data.SportType = ((SportType)contact.Facets[SportType.DefaultKey]).Value; } if (contact.Facets.ContainsKey(SportName.DefaultKey)) { data.SportName = ((SportName)contact.Facets[SportName.DefaultKey]).Value; } } } catch (XdbExecutionException ex) { Log.Error($"Could not get the xConnect contact facets", ex, this); } } } return(data); }
public CrmContact() { PersonalInformation = new PersonalInformation(); EmailAddresses = new List<IEmailAddress>(); PhoneNumbers = new List<IPhoneNumber>(); Addresses = new List<IAddress>(); }
private Contact CreateContact() { var identifier = CreateUniqueIdentifier(); using (var client = GetXConnectClient()) { var xGenContact = new Contact(identifier); client.AddContact(xGenContact); var contactPersonalInfo = new PersonalInformation() { FirstName = Name.First(), LastName = Name.Last() }; client.SetFacet(xGenContact, PersonalInformation.DefaultFacetKey, contactPersonalInfo); var contactEmailAddresses = new EmailAddressList(new EmailAddress(Internet.Email($"{contactPersonalInfo.FirstName} {contactPersonalInfo.LastName}"), true), "Work"); client.SetFacet(xGenContact, EmailAddressList.DefaultFacetKey, contactEmailAddresses); client.Submit(); xGenContact = client.Get <Contact>(new IdentifiedContactReference(identifier.Source, identifier.Identifier), new ExpandOptions()); return(xGenContact); } }
private static void AddContact() { using (var client = GetClient()) { var contact = new Contact(new ContactIdentifier("domain", "docker.examples", ContactIdentifierType.Known)); var personalInfo = new PersonalInformation { FirstName = "Docker", LastName = "Examples" }; client.SetFacet(contact, PersonalInformation.DefaultFacetKey, personalInfo); var emailFacet = new EmailAddressList(new EmailAddress("*****@*****.**", true), "domain"); client.SetFacet(contact, EmailAddressList.DefaultFacetKey, emailFacet); // Add our custom facet var demoFacet = new DemoFacet { FavoriteAnimal = "Whale" }; client.SetFacet(contact, DemoFacet.DefaultFacetKey, demoFacet); client.AddContact(contact); client.Submit(); Console.WriteLine("Added contact!"); } }
/// <summary> /// Authorize permission /// </summary> /// <param name="permission">Permission record</param> /// <param name="customer">Customer</param> /// <returns>true - authorized; otherwise, false</returns> public virtual bool Authorize(PermissionRecord permission, PersonalInformation person) { bool answer = false; if (permission == null) return answer; if (person == null) return answer; var query = from p in _permissionRecordRepository.Table where p.Id == person.Id && p.Description.ToLower() == permission.Description.ToLower() //where p.Name == permission.Name && p.Description.ToLower() == permission.Description.ToLower() select p; if (query.Count() == 0) { query = from p in _rolePermissionRep.Table where p.TelehireRole.RoleName.ToLower() == person.UserRole.ToLower() && p.Permission.Description.ToLower() == permission.Description.ToLower() select p.Permission; if (query.Count() > 0) answer = true; } else answer = true; return answer; //throw new NotImplementedException(); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Surname,Email,Number,PassportNumber,Birth,Parent,Child,Baby,Message")] PersonalInformation personalInformation) { if (id != personalInformation.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(personalInformation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonalInformationExists(personalInformation.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(personalInformation)); }
public void SetContactData(string firstName, string lastName, string email) { IContactRepository repository = new XConnectContactRepository(); var contact = repository.GetCurrentContact(PersonalInformation.DefaultFacetKey); var personalInfo = contact.Personal(); if (personalInfo == null) { personalInfo = new PersonalInformation(); } personalInfo.FirstName = firstName; personalInfo.LastName = lastName; repository.SaveFacet(contact, PersonalInformation.DefaultFacetKey, personalInfo); repository.ReloadCurrentContact(); contact = repository.GetCurrentContact(EmailAddressList.DefaultFacetKey); var emails = contact.Emails(); if (emails == null) { emails = new EmailAddressList(new EmailAddress(email, true), "default"); } emails.PreferredEmail = new EmailAddress(email, true); repository.SaveFacet(contact, EmailAddressList.DefaultFacetKey, emails); repository.ReloadCurrentContact(); }
public async Task <IActionResult> PutPersonalInformation(int id, PersonalInformation personalInformation) { if (id != personalInformation.PersonalInformationId) { return(BadRequest()); } _context.Entry(personalInformation).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonalInformationExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public IActionResult Get() { var personalList = new List <PersonalInformation>(); var dataList = db.PersonalInformations.Include(c => c.PersonalInformationDetails).ThenInclude(d => d.Language).Include(c => c.City).Include(c => c.Country).ToList(); if (dataList?.Count == 0) { return(BadRequest(new { error = "Empty Data List!" })); } foreach (var data in dataList) { var obj = new PersonalInformation(); obj.Id = data.Id; obj.Name = data.Name; obj.CityId = data.CityId; obj.CountryName = data.Country.Name; obj.CountryId = data.CountryId; obj.CityName = data.City.Name; obj.DateTime = data.DateTime.Date; obj.PersonalInformationDetails = GetDetails(data.PersonalInformationDetails); obj.File = data.File; personalList.Add(obj); } return(Ok(personalList)); }
/// <summary> /// Checks the current data against the updated personal information to look for any changes. /// </summary> /// <param name="updatedPersonalInformation"></param> /// <returns></returns> public static bool HasChanged(this PersonalInformation personalInformation, PersonalInformation updatedPersonalInformation) { //If no updates, nothing has changed if (updatedPersonalInformation == null) { return(false); } //If a birthdate value is provided and existing is blank or different, there is a change if (updatedPersonalInformation.Birthdate.HasValue && (!personalInformation.Birthdate.HasValue || updatedPersonalInformation.Birthdate.Value != personalInformation.Birthdate.Value)) { return(true); } //For each String property, do a comparison check to see if a change has happened. if ((personalInformation.HasNewValue(personalInformation.FirstName, updatedPersonalInformation.FirstName)) || (personalInformation.HasNewValue(personalInformation.Gender, updatedPersonalInformation.Gender)) || (personalInformation.HasNewValue(personalInformation.JobTitle, updatedPersonalInformation.JobTitle)) || (personalInformation.HasNewValue(personalInformation.LastName, updatedPersonalInformation.LastName)) || (personalInformation.HasNewValue(personalInformation.MiddleName, updatedPersonalInformation.MiddleName)) || (personalInformation.HasNewValue(personalInformation.Nickname, updatedPersonalInformation.Nickname)) || (personalInformation.HasNewValue(personalInformation.PreferredLanguage, updatedPersonalInformation.PreferredLanguage)) || (personalInformation.HasNewValue(personalInformation.Suffix, updatedPersonalInformation.Suffix)) || (personalInformation.HasNewValue(personalInformation.Title, updatedPersonalInformation.Title)) ) { return(true); } return(false); }
public CashFlowCalculation GetCashFlowData(int clientId, int planId, int riskProfileId) { _clientId = clientId; _planId = planId; _riskProfileId = riskProfileId; ClientPersonalInfo clientPersonalInfo = new ClientPersonalInfo(); PersonalInformation personalInfo = clientPersonalInfo.Get(clientId); fillPersonalData(personalInfo); _riskProfileInfo = new RiskProfileInfo(); PlannerAssumption plannerAssumption = new PlannerAssumptionInfo().GetAll(_planId); if (plannerAssumption != null) { fillCashFlowFromPlannerAssumption(plannerAssumption); } IList <Income> incomes = new IncomeInfo().GetAll(_planId); IList <Expenses> expenses = new ExpensesInfo().GetAll(_planId); IList <Loan> loans = new LoanInfo().GetAll(_planId); IList <Goals> goals = new GoalsInfo().GetAll(_planId); fillCashFlowFromIncomes(incomes); fillCashFlowFromExpenses(expenses); fillCashFlowFromLoans(loans); fillCashFlowFromGoals(goals); return(_cashFlow); }
public Employee GetNextEmployee() { Random rand = new Random(Guid.NewGuid().GetHashCode()); int Id = EmployeeId; EmployeeId++; string Email = "Mail" + rand.Next(1000); int AccessFailedCount = 0; DateTime LockoutEndsDateTimeUTC = DateTime.Now.AddDays(-1); Address ContactAddress = GetNextAddress(); Address ResidentialAddress = GetNextAddress(); string PhoneNumber = "PhoneNumber" + rand.Next(1000); List <Password> Passwords = new List <Password>(); int r1 = rand.Next() % 5 + 1; for (int i = 0; i < r1; i++) { Passwords.Add(GetNextPassword(Id)); } List <UserHasRole> UserRoles = new List <UserHasRole>(); int r2 = rand.Next() % NumberOfRoles + 1; List <int> notThisRoleId = new List <int>(); for (int i = 0; i < r2; i++) { UserHasRole a = GetNextUserHasRole(Id, notThisRoleId); notThisRoleId.Add(a.Role.Id); UserRoles.Add(a); } string Position = "Position" + rand.Next(1000); PersonalInformation Information = GetNextPersonalInformation(); return(new Employee(Id, Email, Position, Information, AccessFailedCount, LockoutEndsDateTimeUTC, ContactAddress, ResidentialAddress, PhoneNumber, Passwords, UserRoles)); }
/// <summary> /// AddNewPerson функція, що вносить дані про користувача який забронював авіаквиток. /// </summary> public void AddNewPerson() { var sum = Int32.Parse(new String(string.Join(" ", Seating.Split(' ').ToList()[2]).Where(Char.IsDigit).ToArray())); PersonalInformation personalInformation = new PersonalInformation(); personalInformation.FirstName = FirstName; personalInformation.SecondName = SecondName; personalInformation.Document = Document; personalInformation.Gender = Gender.ToString(); personalInformation.FlightId = FlightId; personalInformation.BirthDate = BirthDate; personalInformation.Seating = string.Join(" ", Seating.Split(' ').ToList().GetRange(0, 2)).ToString(); personalInformation.Login = Login; CountTickets -= 1; Clients.Add(personalInformation, sum); if (CountTickets == 0) { Views.Payment menu = new Views.Payment(Login); menu.Show(); CloseWindow(); } else { Views.Personal_Information personal_Information = new Views.Personal_Information(Login, FlightId, CountTickets); personal_Information.Show(); CloseWindow(); } }
public static void AddContact(string contactIdentifier) { using (var client = Client.GetClient()) { var identifiers = new ContactIdentifier[] { new ContactIdentifier("VoiceApp", contactIdentifier, ContactIdentifierType.Known) }; var contact = new Contact(identifiers); var personalInfoFacet = new PersonalInformation { FirstName = "Test", LastName = "User" }; client.SetFacet <PersonalInformation>(contact, PersonalInformation.DefaultFacetKey, personalInfoFacet); //assuming contact identifier is an email value var emailFacet = new EmailAddressList(new EmailAddress(contactIdentifier, true), "hackathon"); client.SetFacet <EmailAddressList>(contact, EmailAddressList.DefaultFacetKey, emailFacet); client.AddContact(contact); client.Submit(); } }
protected void setData(KeyValuePair <Guid, string> keyValuePair) { // Initialize a client using the validated configuration using (var client = XConnectHelper.GetClient()) { try { var channelId = Guid.Parse("52B75873-4CE0-4E98-B63A-B535739E6180"); // "email newsletter" channel // Create a new contact with the identifier Contact knownContact = new Contact(); PersonalInformation personalInfoFacet = new PersonalInformation(); personalInfoFacet.FirstName = "Abhi" + Guid.NewGuid().ToString(); personalInfoFacet.LastName = "Marwah"; personalInfoFacet.JobTitle = "Sitecore Architect"; personalInfoFacet.Gender = "Male"; personalInfoFacet.Nickname = "Aussie"; client.SetFacet <PersonalInformation>(knownContact, PersonalInformation.DefaultFacetKey, personalInfoFacet); EmailAddressList emails = new EmailAddressList(new EmailAddress("*****@*****.**", true), "Email"); client.SetFacet(knownContact, emails); PageViewEvent pageView = new PageViewEvent(DateTime.Now.ToUniversalTime(), keyValuePair.Key, 1, "en"); pageView.ItemLanguage = "en"; pageView.Duration = new TimeSpan(3000); pageView.SitecoreRenderingDevice = new SitecoreDeviceData(new Guid("{fe5d7fdf-89c0-4d99-9aa3-b5fbd009c9f3}"), "Default"); pageView.Url = keyValuePair.Value; client.AddContact(knownContact); // Create a new interaction for that contact Interaction interaction = new Interaction(knownContact, InteractionInitiator.Brand, channelId, ""); // Add events - all interactions must have at least one event interaction.Events.Add(pageView); IpInfo ipInfo = new IpInfo("127.0.0.1"); ipInfo.BusinessName = "Sitecore Consultancy"; client.SetFacet <IpInfo>(interaction, IpInfo.DefaultFacetKey, ipInfo); // Add the contact and interaction client.AddInteraction(interaction); // Submit contact and interaction - a total of two operations client.Submit(); } catch (XdbExecutionException ex) { // Deal with exception } } }
/// <summary>Viewを表示した後呼び出されます。</summary> /// <param name="navigationContext">Navigation Requestの情報を表すNavigationContext。</param> void INavigationAware.OnNavigatedTo(NavigationContext navigationContext) { if (this.personInfo != null) { return; } this.personInfo = navigationContext.Parameters["TargetData"] as PersonalInformation; //var person = navigationContext.Parameters["TargetData"] as PersonalInformation; //this.personInfo.Name = person.Name; //this.personInfo.ClassNumber = person.ClassNumber; //this.personInfo.Sex = person.Sex; this.Name = this.personInfo .ToReactivePropertyAsSynchronized(x => x.Name) .AddTo(this.disposables); this.ClassNumber = this.personInfo .ToReactivePropertyAsSynchronized(x => x.ClassNumber) .AddTo(this.disposables); this.Sex = this.personInfo .ToReactivePropertyAsSynchronized(x => x.Sex) .AddTo(this.disposables); this.RaisePropertyChanged(null); //this.RaisePropertyChanged(nameof(this.Name)); //this.RaisePropertyChanged(nameof(this.ClassNumber)); //this.RaisePropertyChanged(nameof(this.Sex)); }
private static void AddContact() { using (var client = GetClient()) { var identifiers = new ContactIdentifier[] { new ContactIdentifier("twitter", "longhorntaco", ContactIdentifierType.Known), new ContactIdentifier("domain", "longhorn.taco", ContactIdentifierType.Known) }; var contact = new Contact(identifiers); var personalInfoFacet = new PersonalInformation { FirstName = "Longhorn", LastName = "Taco" }; client.SetFacet <PersonalInformation>(contact, PersonalInformation.DefaultFacetKey, personalInfoFacet); var emailFacet = new EmailAddressList(new EmailAddress("*****@*****.**", true), "twitter"); client.SetFacet <EmailAddressList>(contact, EmailAddressList.DefaultFacetKey, emailFacet); client.AddContact(contact); client.Submit(); } }
protected PersonalInformation GetCurrentUserPersonalInfo() { if (_cachedPersonalInfo != null) return _cachedPersonalInfo; // PersonalInformation info = null; if (_httpContext != null) { _cachedPersonalInfo = EngineContext.Current.Resolve<IAuthenticationService>().GetAuthenticatedUser(); } return _cachedPersonalInfo; }
public void CreateUser(PersonalInformation userInfo) { try { AuditTrail trail = new AuditTrail(); trail.TimeStamp = CurrentDate; trail.UserId = PersonalInformation.UserId; trail.UserIP = _UtilityService.RemoteIP; trail.AuditActionId = (int)Telehire.Core.Utility.SystemEnums.AuditActionEnum.Create_User; trail.Details = PersonalInformation.FullName + " created a user: " + userInfo.FullName; //trail.AirlineId = PersonalInformation.AirlineId; _AuditTrailRep.SaveOrUpdate(trail); } catch { } }
public static PersonalInformation ToEntity(this AdminRegisterUserModel model, PersonalInformation destination) { return Mapper.Map(model, destination); }
public string CreateUser(PersonalInformation pInfo, string UserRole, bool isApproved, string password) { string msg = ""; MembershipCreateStatus status = new MembershipCreateStatus(); Membership.CreateUser(pInfo.Email, password, pInfo.Email, "What's your Email Address?", pInfo.Email, true, out status); if (status == MembershipCreateStatus.Success) { Roles.AddUserToRole(pInfo.Email, UserRole.ToString()); var user = Membership.GetUser(pInfo.Email); Membership.UpdateUser(user); pInfo.UserRole = UserRole.ToString(); pInfo.UserId = (Guid)user.ProviderUserKey; pInfo.EmailVerified = true; _personalInformation.SaveOrUpdate(pInfo); //string body = _EmailSender.NewAcountMail(pInfo.FirstName, "", "", pInfo.Email, pInfo.Email, password, "", "", ""); //send user Mail: try { //_IAsyncRunner.Run<IEmailSender>(sender => //{ // sender.SendEmail(SystemEmailTypes.NEW_ACCOUNT, body, pInfo.Email, pInfo.FullName); //}); } catch (Exception ex) { } } else { msg = GetErrorMessage(status); } return msg; }
public void UpdateUser(PersonalInformation pInfo) { throw new NotImplementedException(); }
public string UpdateUser(PersonalInformation pInfo, string UserRole, bool isApproved, string password) { string msg = ""; if (pInfo != null) { //if (pInfo.EmailVerified) //{ var user = Membership.GetUser(pInfo.Email); if (user != null) { if (Roles.GetRolesForUser(pInfo.Email).FirstOrDefault().ToLower() != UserRole.ToString().ToLower()) { Roles.RemoveUserFromRole(pInfo.Email, Roles.GetRolesForUser(pInfo.Email).FirstOrDefault()); Roles.AddUserToRole(pInfo.Email, UserRole.ToString()); } pInfo.EmailVerified = isApproved; pInfo.UserRole = UserRole.ToString(); _personalInformation.SaveOrUpdate(pInfo); user.IsApproved = isApproved; //if(isLocked) //user.UnlockUser(); Membership.UpdateUser(user); // string body = "";// _EmailSender.NewAcountMail(pInfo.FirstName, "", "", pInfo.Email, pInfo.Email, password, "", "", ""); ////send user Mail: // try // { // _IAsyncRunner.Run<IEmailSender>(sender => // { // sender.SendEmail(VATCollect.BussinessLogic.Utility.SystemEnums.EmailTypes.USER_UPDATED, body, pInfo.Email, pInfo.FullName); // }); // } // catch (Exception ex) // { // } } else msg = "This person is not valid on the system."; } else msg = "This person is not valid on the system."; return msg; }