private static string GetDescriptionFor(Changelog item, Member member, Contact contact) { switch (item.action) { case DBConstants.NewContact: return String.Format("Lisätty uusi yhteystieto jäsenelle {0} {1} ({2})", member.firstname, member.lastname, member.MemberDetais.membergroup); case DBConstants.DeleteContact: return String.Format("Yhteystieto poistettu jäseneltä {0} {1}", member.firstname, member.lastname); case DBConstants.EditContact: return String.Format("Yhteystiedolta {0} {1} ({2} {3}) muutettu {4}", contact.firstname, contact.lastname, member.firstname, member.lastname, item.oldvalue); case DBConstants.NewMember: return String.Format("Lisätty uusi jäsen {0} {1} ({2})", member.firstname, member.lastname, member.MemberDetais.membergroup); case DBConstants.EditMember: return String.Format("Muokattu jäsentä {0} {1} ({2}) tietoa {3}", member.firstname, member.lastname, member.MemberDetais.membergroup, item.oldvalue); case DBConstants.NewNonMember: return String.Format("Jäsen eronnut {0} {1} ({2}) syy: {3}", member.firstname, member.lastname, item.oldvalue, member.MemberDetais.membergroup); default: Debug.Assert(false, "Should not be reached"); return "<Empty>"; } }
private static int AppendMember(StringBuilder sb, Properties.Export export, int counter, Member member) { var col1Builder = new StringBuilder(); col1Builder.AppendFormat(export.FoFirstBlock, member.lastname + " " + member.firstname); var col2Builder = new StringBuilder(); col2Builder.AppendFormat(export.FoBlock, member.Address.city); string foTableRow = ++counter % 2 == 0 ? export.Fo2ColumnTableOddRow : export.Fo2ColumnTableEvenRow; sb.AppendFormat(foTableRow, col1Builder, col2Builder); return counter; }
private static void AppendMember(StringBuilder sb, Properties.Export export, int counter, Member member) { var col1Builder = new StringBuilder(); col1Builder.AppendFormat(export.FoFirstBoldBlock, member.lastname + " " + member.firstname); col1Builder.AppendFormat(export.FoBlock, DateTime.Parse(member.birthdate, CultureInfo.CurrentCulture).AsDate()); col1Builder.AppendFormat(export.FoBlock, member.mobile); col1Builder.AppendFormat(export.FoBlock, member.email); var col2Builder = new StringBuilder(); col2Builder.AppendFormat(export.FoFirstBlock, member.Address.address); col2Builder.AppendFormat(export.FoBlock, member.Address.postalcode + " " + member.Address.city); if (counter % 2 == 0) sb.AppendFormat(export.Fo2ColumnTableOddRow, col1Builder, col2Builder); else sb.AppendFormat(export.Fo2ColumnTableEvenRow, col1Builder, col2Builder); }
/// <summary> /// Extension for finding a MemberViewModel from collection by Member. /// </summary> public static MemberViewModel FindSame(this ObservableCollection<MemberViewModel> collection, Member member) { return collection.Where(m => m.Equals(member)).FirstOrDefault(); }
private void ConstructMemberAndUpdate(Member member, IDataRecord reader) { member.Address.address = reader.Get<string>("Address2"); member.Address.city = reader.Get<string>("City"); member.Address.postalcode = reader.Get<string>("PostalCode1"); member.Address.country = ""; int membid = reader.Get<int>("MembId"); member.firstname = reader.Get<string>("NameFirst"); member.middlenames = ""; member.lastname = reader.Get<string>("NameFamily"); member.email = GetEmail(membid, _connection); member.phone = GetPhoneNumber(membid, _connection); member.mobile = GetMobileNumber(membid, _connection); member.birthdate = reader.Get<DateTime>("DateOfBirth").ToString(); member.sex = reader.Get<string>("Sex"); // keep resigned/inactive members unchanged if(!DBConstants.IsSpecialGroup(member.MemberDetais.membergroup)) member.MemberDetais.membergroup = reader.Get<string>("DepName"); member.MemberDetais.memberjob = ""; member.MemberDetais.memberno = reader.Get<string>("MembNo"); member.MemberDetais.memberclass = ""; member.MemberDetais.joindate = reader.Get<DateTime>("EnterDate").ToString(); member.MemberDetais.changeddate = reader.Get<DateTime>("DateChange").ToString(); member.MemberDetais.exitdate = ""; member.MemberDetais.paymentstatus = GetPaymentStatus(reader); }
private static bool MemberExistsInDatabase(Member member, IDbConnection connection) { IDbCommand cmd = connection.CreateCommand(); cmd.CommandText = "SELECT Memb.MembId FROM Memb WHERE Memb.NameFirst = @FirstName AND Memb.NameFamily = @LastName"; cmd.Parameters.Add(new OleDbParameter("@FirstName", member.firstname)); cmd.Parameters.Add(new OleDbParameter("@LastName", member.lastname)); return cmd.ExecuteReader().Read(); }
/// <summary> /// Create a new Member object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="firstname">Initial value of the firstname property.</param> /// <param name="lastname">Initial value of the lastname property.</param> /// <param name="middlenames">Initial value of the middlenames property.</param> /// <param name="mobile">Initial value of the mobile property.</param> /// <param name="email">Initial value of the email property.</param> /// <param name="phone">Initial value of the phone property.</param> /// <param name="sex">Initial value of the sex property.</param> /// <param name="birthdate">Initial value of the birthdate property.</param> public static Member CreateMember(global::System.Int64 id, global::System.String firstname, global::System.String lastname, global::System.String middlenames, global::System.String mobile, global::System.String email, global::System.String phone, global::System.String sex, global::System.String birthdate) { Member member = new Member(); member.Id = id; member.firstname = firstname; member.lastname = lastname; member.middlenames = middlenames; member.mobile = mobile; member.email = email; member.phone = phone; member.sex = sex; member.birthdate = birthdate; return member; }
/// <summary> /// Deprecated Method for adding a new object to the MemberSet EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToMemberSet(Member member) { base.AddObject("MemberSet", member); }