private void save_Click(object sender, RoutedEventArgs e) { aTz = Atz.Text; aFn = Afn.Text; aLn = Aln.Text; aGender = Age.Text; aDob = Adate.Text; try { ClubMember clubMemberToAdd = new ClubMember(aTz, aFn, aLn, aGender, aDob); // create club member itsBL.add(clubMemberToAdd); // add employee if (isUse.Hierarchy == Hierarchy.Customer) { isUse.UserName = aTz; isUse.Hierarchy = Hierarchy.Clubmember; itsBL.edit(isUse); } itsBL.saveDataToFile(); MessageBox.Show("successfully asved"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public ClubMember ClubMemberConverterToContext(Backend.ClubMember currentClubMember) { CreditCard dataContextCreditCard = new CreditCard(); ClubMember dataContextClubMember = new ClubMember(); //Customer Entity Customer currtCusAsClub = new Customer(); currtCusAsClub.IsAClubMember = true; currtCusAsClub.FirstName = currentClubMember.FirstName; currtCusAsClub.LastName = currentClubMember.LastName; currtCusAsClub.Id = currentClubMember.Id; dataContextClubMember.Customer = currtCusAsClub; //Credit Card Entity if (currentClubMember.CreditCard != null) { dataContextCreditCard.CreditNumber = currentClubMember.CreditCard.CreditNumber; dataContextCreditCard.ExpirationDate = currentClubMember.CreditCard.ExpirationDate; dataContextCreditCard.FirstName = currentClubMember.CreditCard.FirstName; dataContextCreditCard.LastName = currentClubMember.CreditCard.LastName; dataContextClubMember.Customer.CreditCard1 = dataContextCreditCard; dataContextClubMember.Customer.CreditCard = currentClubMember.CreditCard.CreditNumber; } //Clubmember Entity dataContextClubMember.DateOfBirth = currentClubMember.DateOfBirth; dataContextClubMember.Gender = (int)currentClubMember.Gender; dataContextClubMember.MemberID = currentClubMember.MemberID; return(dataContextClubMember); }
public async Task <ActionResult <bool> > PostClubMember(PostModel data) { var uid = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; if (uid == null) { return(NotFound()); } var nUid = Convert.ToInt64(uid); var clubMember = await _context.ClubMembers .Where(cm => cm.ClubId == data.ClubId && cm.MemberId == nUid) .AsNoTracking() .FirstOrDefaultAsync(); var member = new ClubMember { ClubId = data.ClubId, MemberId = nUid, Role = EClubMemberRoles.User, MemberSince = DateTime.Now }; // If no such member exists, add one bool isMember; if (clubMember == null) { await _context.ClubMembers.AddAsync(member); isMember = true; } else // If the member does exist, remove them { // But only if it's not the founder if (clubMember.Role != EClubMemberRoles.Founder) { _context.ClubMembers.Remove(clubMember); isMember = false; } else { isMember = true; } } // Save try { await _context.SaveChangesAsync(); } catch (Exception e) { Console.WriteLine(e); return(StatusCode(500)); } return(new OkObjectResult(isMember)); }
public async Task <IHttpActionResult> Register(RegisterBindingModel model) { //if (!ModelState.IsValid) //{ // return BadRequest(ModelState); //} ClubMember member = db.members.Where(m => m.Name == model.Email).SingleOrDefault(); if (member == null) { return(NotFound()); } var user = new ApplicationUser() { UserName = model.UserID, Email = model.Email, memberName = model.Name }; IdentityResult result = await UserManager.CreateAsync(user, model.Password); if (!result.Succeeded) { return(GetErrorResult(result)); } return(Ok()); }
/// <summary> /// This method shows an easy method to get violations on /// required properties not set and length of field violations /// </summary> /// <param name="pMemberList1"></param> public void AddBadMember1(ClubMember pMemberList1) { using (var context = new ClubMembersEntity()) { context.Entry(pMemberList1).State = EntityState.Added; try { context.SaveChanges(); } catch (FormattedDbEntityValidationException fve) { mHasException = true; _validationErrors = fve.ValidationErrors(); _validationErrorMessage = fve.Message; } catch (Exception ex) { mHasException = true; mLastException = ex; } } }
public async Task <IActionResult> Edit(int id, [Bind("Id,AmNumber,Active")] ClubMember clubMember) { if (id != clubMember.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(clubMember); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClubMemberExists(clubMember.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(clubMember)); }
public void OnPost() { var author = new ClubMember { MemberID = 1, FName = "Walker", LName = "Chesley", }; //do something to save user created content here. var newContent = new Content { ContentTitle = contentTitle, ContentBody = contentBody, //add whoever is logged in as the author Author = author, }; try { _context.Content.Add(newContent); _context.SaveChanges(); } catch (Exception e) { _logger.LogWarning(e, "Error saving to database"); } }
protected void Page_Load(object sender, EventArgs e) { try { string szUser = (Request.PathInfo.Length > 0 && Request.PathInfo.StartsWith("/", StringComparison.OrdinalIgnoreCase)) ? Request.PathInfo.Substring(1) : string.Empty; const string szDefault = "~/Public/tabimages/ProfileTab.png"; string szReturn = szDefault; if (!String.IsNullOrEmpty(szUser) && Page.User.Identity.IsAuthenticated) { // Two scenarios where we're allowed to see the image: // (a) we're the user or // (b) we are both in the same club. // ClubMember.ShareClub returns true for both of these. if (ClubMember.CheckUsersShareClub(Page.User.Identity.Name, szUser, true, false)) { Profile pf = Profile.GetUser(szUser); if (pf.HasHeadShot) { Response.Clear(); Response.ContentType = "image/jpeg"; Response.Cache.SetExpires(DateTime.UtcNow.AddDays(14)); #pragma warning disable CA3002 // Review code for XSS vulnerabilities - this came from the database, it's not arbitrary. Response.BinaryWrite(pf.HeadShot.ToArray()); #pragma warning restore CA3002 // Review code for XSS vulnerabilities Response.Flush(); Response.End(); } } } Response.Redirect(szReturn); } catch (System.Web.HttpException) { } // eat any exception. }
protected void gvMembers_RowCommand(object sender, GridViewCommandEventArgs e) { if (e == null) { throw new ArgumentNullException(nameof(e)); } if (e.CommandName.CompareOrdinalIgnoreCase("_Delete") == 0) { ClubMember cm = CurrentClub.Members.FirstOrDefault(pf => pf.UserName.CompareOrdinalIgnoreCase(e.CommandArgument.ToString()) == 0); if (cm != null) { if (cm.RoleInClub == ClubMember.ClubMemberRole.Owner) { lblManageMemberError.Text = Resources.Club.errCannotDeleteOwner; } else { if (!cm.FDeleteClubMembership()) { lblManageMemberError.Text = cm.LastError; } else { CurrentClub.InvalidateMembers(); gvMembers.DataSource = CurrentClub.Members; gvMembers.DataBind(); } } } } }
public async Task UpdateClubMember_ToNotExistingClubMembership_DatabaseUpdates() { var clubSubscription = new ClubSubscription() { ClubId = Guid.NewGuid(), ClubSubscriptionId = Guid.NewGuid() }; var clubMember = new ClubMember() { ClubId = clubSubscription.ClubId, UserId = Guid.NewGuid(), ClubSubscriptionId = clubSubscription.ClubSubscriptionId }; using (var context = _factory.CreateContext()) { await context.ClubSubscriptions.AddRangeAsync(clubSubscription); await context.ClubMembers.AddAsync(clubMember); await context.SaveChangesAsync(); } var request = new UpdateClubMemberRequest() { ClubId = clubSubscription.ClubId, ClubSubscriptionId = Guid.NewGuid(), UserId = clubMember.UserId }; Assert.ThrowsAsync <DbUpdateException>(async() => await _mutations.UpdateClubMemberAsync(request)); await _publish.Received(0).Publish(Arg.Any <ClubMemberUpdatedEvent>()); }
//when passing the id back from JS script, the var apparently has to be the same name the model function is looking for: public async Task <IActionResult> OnPost(int?MemberId) { _logger.LogInformation($"On post fired...{MemberId.ToString()}"); if (MemberId == null) { return(NotFound()); } ClubMember MemberToDelete = await _context.ClubMember.FindAsync(MemberId); if (MemberToDelete == null) { _logger.LogWarning($"Club member not found in database \nID: {MemberId}"); return(NotFound()); } else { try { _context.ClubMember.Remove(MemberToDelete); await _context.SaveChangesAsync(); } catch (Exception e) { _logger.LogWarning(e, "Error removing Member"); } } return(RedirectToPage("./Members")); }
public async Task <IActionResult> GetClubMember([FromQuery] int athleteId) { var response = new SingleModelResponse <ClubMember>() as ISingleModelResponse <ClubMember>; try { if (athleteId < 1) { throw new Exception("Model is missing"); } response.Model = await Task.Run(() => { ClubMember member = _context.GetMemberByID(athleteId); if (member == null) { throw new Exception("Club Member does not Exist"); } return(member); }); } catch (Exception ex) { response.DidError = true; response.ErrorMessage = ex.Message; } return(response.ToHttpResponse()); }
public async Task <IActionResult> DeRegisterMember([FromQuery] int athleteId) { var response = new SingleModelResponse <ClubMember>() as ISingleModelResponse <ClubMember>; try { if (athleteId.ToString() == null) { throw new Exception("Model is missing"); } response.Model = await Task.Run(() => { _context.DeRegisterMember(athleteId); ClubMember member = new ClubMember { AthleteId = athleteId }; return(member); }); } catch (Exception ex) { response.DidError = true; response.ErrorMessage = ex.Message; } return(response.ToHttpResponse()); }
public static void WriteClubMember(PacketWriter pWriter, ClubMember member) { pWriter.WriteLong(member.Player.AccountId); pWriter.WriteLong(member.Player.CharacterId); pWriter.WriteUnicodeString(member.Player.Name); pWriter.WriteByte(); pWriter.Write(member.Player.Job); pWriter.Write(member.Player.JobCode); pWriter.WriteShort(member.Player.Levels.Level); pWriter.WriteInt(member.Player.MapId); pWriter.WriteShort(member.Player.ChannelId); pWriter.WriteUnicodeString(member.Player.ProfileUrl); pWriter.WriteInt(member.Player.Account.Home?.PlotMapId ?? 0); pWriter.WriteInt(member.Player.Account.Home?.PlotNumber ?? 0); pWriter.WriteInt(member.Player.Account.Home?.ApartmentNumber ?? 0); pWriter.WriteLong(member.Player.Account.Home?.Expiration ?? 0); foreach (int trophyCategory in member.Player.TrophyCount) { pWriter.WriteInt(trophyCategory); } pWriter.WriteLong(member.JoinTimestamp); pWriter.WriteLong(member.Player.LastLogTime); pWriter.WriteBool(!member.Player.Session?.Connected() ?? true); }
protected void btnSendMessage_Click(object sender, EventArgs e) { Profile pf = MyFlightbook.Profile.GetUser(Page.User.Identity.Name); IEnumerable <ClubMember> lst = ClubMember.AdminsForClub(CurrentClub.ID); using (MailMessage msg = new MailMessage()) { MailAddress maFrom = new MailAddress(pf.Email, pf.UserFullName); msg.From = new MailAddress(Branding.CurrentBrand.EmailAddress, String.Format(CultureInfo.CurrentCulture, Resources.SignOff.EmailSenderAddress, Branding.CurrentBrand.AppName, pf.UserFullName)); msg.ReplyToList.Add(maFrom); foreach (ClubMember cm in lst) { msg.To.Add(new MailAddress(cm.Email, cm.UserFullName)); } msg.Subject = String.Format(CultureInfo.CurrentCulture, Branding.ReBrand(Resources.Club.ContactSubjectTemplate), CurrentClub.Name); msg.Body = txtContact.Text + "\r\n\r\n" + String.Format(CultureInfo.CurrentCulture, Resources.Club.MessageSenderTemplate, pf.UserFullName, pf.Email); msg.IsBodyHtml = false; util.SendMessage(msg); } if (ckRequestMembership.Checked) { foreach (ClubMember admin in lst) { new CFIStudentMapRequest(Page.User.Identity.Name, admin.Email, CFIStudentMapRequest.RoleType.RoleRequestJoinClub, CurrentClub).Send(); } } mpuGuestContact.Hide(); txtContact.Text = string.Empty; ckRequestMembership.Checked = false; lblMessageStatus.Visible = true; }
void showMembers(List <ClubMember> members) { for (int i = 0; i < members.Count; i++) { Transform item = getItem(i); ClubMember mb = members[i]; setText(item, "name", mb.name); setText(item, "id", "" + mb.id); setText(item, "score", "" + mb.score); setText(item, "limit", "" + mb.limit); setIcon(item, "icon", mb.logo); setBtnEvent(item, "btn_edit", () => { mEditMember = mb; onBtnEdit(); }); setBtnEvent(item, "btn_history", () => { ClubHistory ch = GameObject.Find("PClubHistory").GetComponent <ClubHistory>(); ch.enter(mClubID, mb.id); }); } updateItems(members.Count); }
public void InvitedPlayerResponse(Player player, ClubInviteResponse inviteResponse) { if (!Members.Any(x => x.Player.CharacterId == player.CharacterId)) { return; } ClubMember member = player.ClubMembers.FirstOrDefault(x => x.ClubId == Id); member.InviteResponse = inviteResponse; if (inviteResponse == ClubInviteResponse.Reject) { List <GameSession> memberSessions = GetSessions(); foreach (GameSession session in memberSessions) { session.Send(ClubPacket.ClubProposalInviteResponse(Id, inviteResponse, player.Name)); session.Send(ClubPacket.DeleteUnestablishedClub(Id)); ClubMember membership = session.Player.ClubMembers.First(x => x.ClubId == Id); session.Player.ClubMembers.Remove(membership); session.Player.Clubs.Remove(this); } GameServer.ClubManager.RemoveClub(this); return; } EstablishClub(player); }
private void delete2_Click(object sender, RoutedEventArgs e) { DataGridRow dgRow = (DataGridRow)(gridClubMember.ItemContainerGenerator.ContainerFromItem(gridClubMember.SelectedItem)); ClubMember selectedClub = gridClubMember.Items[gridClubMember.SelectedIndex] as ClubMember; string textToFind = Convert.ToString(selectedClub.MemberID); if (whoUse.Hierarchy == Hierarchy.Clubmember || whoUse.Hierarchy == Hierarchy.Customer || whoUse.Hierarchy == Hierarchy.Worker) { MessageBox.Show("You are not allowed to delete this item"); } else { try { List <object> wentedList = itsBL.queryByString(Classes.ClubMember, stringFields.memberID, textToFind); if (wentedList == null) { throw new Exception("there is no item to delete"); } ClubMember deleteClub = wentedList.Cast <ClubMember>().ElementAt(0); itsBL.remove(deleteClub); itsBL.saveDataToFile(); MessageBox.Show("item sucessfuly deleted"); tablePanel.Children.Clear(); DepartmentT showProduct = new DepartmentT(itsBL, Permanent, whoUse); tablePanel.Children.Add(showProduct); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
/// <summary> /// Service method to create new member /// </summary> /// <param name="clubMember">club member model</param> /// <returns>true or false</returns> public bool Create(ClubMember clubMember) { using (var context = new SocialClubDbContext()) { context.ClubMembers.Add(clubMember); return(context.SaveChanges() > 0); } }
public ConfirmationPage(ClubMember member, int memberNo) { InitializeComponent(); this.member = member; this.memberNo = memberNo; Loaded += new RoutedEventHandler(ConfirmationPage_Loaded); }
//申請成為社團成員 public static void ApplyMember(ClubMember cm) { DBEntities db = new DBEntities(); db.ClubMembers.Add(cm); db.SaveChanges(); }
private void ScheduleMember(ClubMember member, string speakerRole) { var role = _roleTypes.First(r => r.Role == speakerRole); var sMember = _members.First(i => i.Member == member); sMember.SelectedRole = role; Members.Remove(sMember); }
public MemberMessageViewModel(TIDbContext context, ClubMember member) : base(context) { var message = context.MemberMessages.Create(); message.Member = member; message.DateEntered = DateTime.Now; Load(message); }
public void AddMemberCustomer(ClubMember customer) { var countries = GetCountries().ToList(); var co = countries.Where(c => c.Country == customer.Country.Country).FirstOrDefault(); co.ClubMembers.Add(customer); context.SaveChanges(); }
public void AddMember(Player player, out ClubMember member) { member = new ClubMember(player, Id); player.Clubs.Add(this); player.ClubMembers.Add(member); Members.Add(member); player.UpdateSocials(); }
public DayOffRequestsViewModel(TIDbContext context, ClubMember member) : this(context) { _member = member; DayOffRequests = ( from req in context.DayOffRequests where req.Message.MemberId == _member.Id select req).ToList(); }
public void Init() { c1 = new ClubMember(1, "Anders", "And", 15); c2 = new ClubMember(2, "Bjørn", "Borg", 30); c3 = new ClubMember(3, "Cristian", "Nielsen", 20); c4 = new ClubMember(4, "Kurt", "Nielsen", 33); c5 = new ClubMember(5, "Lis", "Sørnsen", 18); }
public void SelectEvaluators(ClubMember evaluator1, ClubMember evaluator2, ClubMember evaluator3) { Meeting.Evaluator1 = evaluator1; ScheduleMember(evaluator1, "Evaluator"); Meeting.Evaluator2 = evaluator2; ScheduleMember(evaluator2, "Evaluator"); Meeting.Evaluator3 = evaluator3; ScheduleMember(evaluator3, "Evaluator"); }
public void SelectMinorRoles(ClubMember openingThought, ClubMember jokeMaster, ClubMember closingThought) { Meeting.OpeningThought = openingThought; ScheduleMember(openingThought, "Opening Thought and Ballot Counter"); Meeting.JokeMaster = jokeMaster;; ScheduleMember(jokeMaster, "Joke Master"); Meeting.ClosingThought = closingThought; ScheduleMember(closingThought, "Closing Thought and Greeter"); }
protected void Page_Load(object sender, EventArgs e) { Master.SelectedTab = tabID.actMyClubs; try { if (Request.PathInfo.Length > 0 && Request.PathInfo.StartsWith("/", StringComparison.OrdinalIgnoreCase)) { if (!IsPostBack) { CurrentClub = Club.ClubWithID(Convert.ToInt32(Request.PathInfo.Substring(1), CultureInfo.InvariantCulture)); if (CurrentClub == null) { throw new MyFlightbookException(Resources.Club.errNoSuchClub); } Master.Title = CurrentClub.Name; lblClubHeader.Text = CurrentClub.Name; ClubMember cm = CurrentClub.GetMember(Page.User.Identity.Name); if (!IsManager) { throw new MyFlightbookException(Resources.Club.errNotAuthorizedToManage); } gvMembers.DataSource = CurrentClub.Members; gvMembers.DataBind(); vcEdit.ShowDelete = (cm.RoleInClub == ClubMember.ClubMemberRole.Owner); cmbClubAircraft.DataSource = CurrentClub.MemberAircraft; cmbClubAircraft.DataBind(); cmbClubMembers.DataSource = CurrentClub.Members; cmbClubMembers.DataBind(); dateStart.Date = (Request.Cookies[szCookieLastStart] != null && DateTime.TryParse(Request.Cookies[szCookieLastStart].Value, out DateTime dtStart)) ? dtStart : CurrentClub.CreationDate; dateEnd.Date = (Request.Cookies[szCookieLastEnd] != null && DateTime.TryParse(Request.Cookies[szCookieLastEnd].Value, out DateTime dtEnd)) ? dtEnd : DateTime.Now; dateEnd.DefaultDate = DateTime.Now; RefreshAircraft(); lblManageheader.Text = String.Format(CultureInfo.CurrentCulture, Resources.Club.LabelManageThisClub, CurrentClub.Name); lnkReturnToClub.NavigateUrl = String.Format(CultureInfo.InvariantCulture, "~/Member/ClubDetails.aspx/{0}", CurrentClub.ID); vcEdit.ActiveClub = CurrentClub; // do this at the end so that all of the above (like ShowDelete) are captured } } else { throw new MyFlightbookException(Resources.Club.errNoClubSpecified); } } catch (MyFlightbookException ex) { lblErr.Text = ex.Message; lnkReturnToClub.Visible = tabManage.Visible = false; } }
/// <summary> /// Service method to update club member /// </summary> /// <param name="clubMember">club member</param> /// <returns>true / false</returns> public bool Update(ClubMember clubMember) { using (var context = new SocialClubDbContext()) { context.ClubMembers.Attach(clubMember); context.Entry(clubMember).State = EntityState.Modified; return(context.SaveChanges() > 0); } }
//Implement sort method -used by Sort delegate private static int CompareTwoMembers(ClubMember clubMem1, ClubMember clubMem2) { return clubMem1.FirstName.CompareTo(clubMem2.FirstName); }
void MainPage_Loaded(object sender, RoutedEventArgs e) { member = new ClubMember(); member.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(member_PropertyChanged); /* Info Page */ fees_comboBox.SelectedIndex = 0; /* Register Page */ updateFeesOwed(); LayoutRoot.DataContext = member; LayoutRoot.BindingValidationError += new EventHandler<ValidationErrorEventArgs>(member.BindingValidationError); }