예제 #1
0
 internal static Person AddPerson(this TypedTable<Person> table, PersonData data, string source)
 {
     var retVal = new Person { Source = source };
     retVal.Set(data);
     table.Rows.Add(retVal);
     return retVal;
 }
 public virtual bool Matches(Person person)
 {
     if (String.IsNullOrEmpty(person.LastName))
         return false;
     if (String.IsNullOrEmpty(person.HisName))
         return person.LastName == Name;
     return person.HisName[0] == Name[0] && person.LastName == Name.Substring(2);
 }
예제 #3
0
 public int MergePerson(DbTransaction transaction, PersonRowData oldPerson, Person newPerson)
 {
     return
         transaction.ExecuteNonQuery(
             tables.Join(";\n\n\n", t => t.UpdateSql)
           + ";\n\n\nUPDATE Data.MasterDirectory SET StripeId = @oldStripeId WHERE Id = @newId AND StripeId IS NULL"
           + ";\n\n\nDELETE FROM Data.MasterDirectory WHERE Id = @oldId", new { oldId = oldPerson.Person.Id, newId = newPerson.Id, oldStripeId = oldPerson.StripeId });
 }
예제 #4
0
			public ImportingPayment(PaymentInfo payment) {
				comments = "\n" + payment.Comments;
				pledgeAmount = payment.Amount;

				writableMatches = new ObservableCollection<Person>(Matcher.FindMatches(payment));
				matchingPeople = new ReadOnlyObservableCollection<Person>(writableMatches);
				person = writableMatches.Count == 1 ? writableMatches.First() : null;
			}
예제 #5
0
        public PersonDetails(Person person)
        {
            InitializeComponent();
            this.person = person;

            exportEmail.Caption = exportWord.Caption = (person.FullName ?? person.VeryFullName).Replace("&", "&&");

            relativesGrid.DataMember = null;
            SetPerson();
        }
예제 #6
0
 void AddRecentMenuItem(Person person)
 {
     if (recentMenu.Items.Cast<DXMenuItem>().Any(m => m.Tag == person))
         return;
     recentMenu.Items.Insert(0,
         new DXMenuItem(person.FullName, delegate { personSelector.EditValue = person; }) {
             ShowHotKeyPrefix = false,
             Tag = person
         }
     );
     recentButton.Visible = true;
 }
예제 #7
0
 void AddRecentMenuItem(Person person)
 {
     if (recentMenu.Items.Cast<DXMenuItem>().Any(m => m.Tag == person))
         return;
     recentMenu.Items.Insert(0,
         new DXMenuItem(person.FullName, delegate { personSelector.EditValue = person; }) {
             Appearance = {
                 TextOptions = { HotkeyPrefix = HKeyPrefix.None }
             },
             Tag = person
         }
     );
     recentButton.Visible = true;
 }
        public void BeginAddNew(Person person)
        {
            pledgesBindingSource.CancelEdit();
            seatingReservationsBindingSource.CancelEdit();
            var pledge = (Pledge)pledgesBindingSource.AddNew();
            var seatRes = (SeatingReservation)seatingReservationsBindingSource.AddNew();

            pledge.Account = "Operating Fund";
            pledge.Date = DateTime.Now;
            pledge.Person = person;
            seatRes.Pledge = pledge;
            pledgeTypeEditor.Focus();

            oldCalculatedPrice = CalculatePrice();
        }
예제 #9
0
        public PledgeMigrator(Person payee, IList<Pledge> pledges)
        {
            InitializeComponent();

            this.payee = payee;
            this.pledges = pledges;

            selection = new BitArray(pledges.Count);	//This must happen before the grid calls CustomUnboundColumnData

            grid.DataMember = null;
            grid.DataSource = new RowListBinder(Program.Table<Pledge>(), pledges.ToArray());	//Array covariance

            WinForms.CheckableGridController.Handle(colCheck);

            UpdateLabel();
        }
예제 #10
0
 public PersonRowData GetPerson(Person person)
 {
     using (var adapter = db.Factory.CreateDataAdapter(Connection, tables.Join(";\n", t => t.SelectSql))) {
         adapter.SelectCommand.AddParameter("personId", person.Id);
         var ds = new DataSet();
         adapter.Fill(ds);
         // Copy the collection before removing items
         foreach (var t in ds.Tables.Cast<DataTable>().Zip(tables, (Table, et) => new { Table, et.Schema, et.Name }).ToList()) {
             if (t.Table.Rows.Count == 0)
                 ds.Tables.Remove(t.Table);
             else
                 t.Table.TableName = t.Schema + "." + t.Name;
         }
         return new PersonRowData(this, person, ds, Connection.Sql<string>("SELECT StripeId FROM Data.MasterDirectory WHERE Id = @Id").Execute(new { person.Id }));
     }
 }
예제 #11
0
        public static void Execute(Person member = null, Person relative = null)
        {
            using (var dialog = new RelationCreator()) {
                dialog.memberSelector.SelectedPerson = member;
                dialog.relativeSelector.SelectedPerson = relative;

                if (dialog.ShowDialog() == DialogResult.Cancel)
                    return;

                Program.Table<RelativeLink>().Rows.Add(new RelativeLink {
                    Member = dialog.memberSelector.SelectedPerson,
                    Relative = dialog.relativeSelector.SelectedPerson,
                    RelationType = dialog.relationType.Text
                });
            }
        }
예제 #12
0
        internal AuctionItem(Person person, DateTime date, string auctionName, string itemName, bool includeמישברך)
        {
            Person = person;
            Date = date;
            AuctionName = auctionName;

            ItemName = itemName;
            ItemIndex = SortedOrder.IndexOf(itemName);
            Debug.Assert(ItemIndex >= 0, itemName + " is not a subtype!");

            BidPledge = new AuctionPledge(this, "Auction");
            BidPledge.PropertyChanged += (sender, e) => OnPropertyChanged("Bid" + e.PropertyName);
            if (includeמישברך) {
                MBPledge = new AuctionPledge(this, "מי שברך");
                MBPledge.PropertyChanged += (sender, e) => OnPropertyChanged("MB" + e.PropertyName);
            }
        }
예제 #13
0
        public StatementMessage CreateMessage(Person person, string templateName, DateTime startDate)
        {
            var page = (StatementPage)TemplateService.Resolve(templateName, null);
            page.SetInfo(person, startDate);

            var images = new EmailAttachmentImageService(ImagesPath);
            var content = page.RenderPage(images);
            if (!page.ShouldSend) return null;

            var message = new StatementMessage(page, templateName) { From = BillingAddress, SubjectEncoding = Email.DefaultEncoding };

            var htmlContent = AlternateView.CreateAlternateViewFromString(content, Email.DefaultEncoding, "text/html");

            htmlContent.TransferEncoding = TransferEncoding.QuotedPrintable;
            htmlContent.LinkedResources.AddRange(images.Attachments);
            message.AlternateViews.Add(htmlContent);

            message.Subject = page.EmailSubject;

            return message;
        }
예제 #14
0
        public static IEnumerable<Regex> GetNameRegexes(Person person)
        {
            if (!String.IsNullOrWhiteSpace(person.FullName))
                yield return new Regex(String.Format(@"\b{0}\b", Regex.Escape(person.FullName)));

            if (!String.IsNullOrWhiteSpace(person.Salutation))
                yield return new Regex(String.Format(@"\b{0}\b", Regex.Escape(person.Salutation)));

            yield return new Regex(String.Format(@"\b{0} Family\b", Regex.Escape(person.LastName)));
            yield return new Regex(String.Format(@"\bThe {0}s\b", Regex.Escape(person.LastName)));

            if (!String.IsNullOrWhiteSpace(person.HisName))
                yield return new Regex(String.Format(@"\b{0} {1}\b", Regex.Escape(person.HisName), Regex.Escape(person.LastName)));

            if (!String.IsNullOrWhiteSpace(person.HerName))
                yield return new Regex(String.Format(@"\b{0} {1}\b", Regex.Escape(person.HerName), Regex.Escape(person.LastName)));

            yield return new Regex(String.Format(@"\b{0} & {1}\W(.*?\W)?{2}\b",
                                   Regex.Escape(person.HisName ?? ""), Regex.Escape(person.HerName ?? ""), Regex.Escape(person.LastName)));

            yield return new Regex(String.Format(@"\b{1} & {0}\W(.*?\W)?{2}\b",
                                   Regex.Escape(person.HisName ?? ""), Regex.Escape(person.HerName ?? ""), Regex.Escape(person.LastName)));
        }
예제 #15
0
        EmailExporter(Person[] people, StatementBuilder pageBuilder)
        {
            InitializeComponent();
            this.people = people;

            if (people.Length == 1)
                gridCaption.Text = "The following person will receive emails:";
            else
                gridCaption.Text = "The following " + people.Length.ToString(CultureInfo.CurrentCulture) + " people will receive emails:";

            sendPreviewButton = buttonEdit.Buttons[1];
            showPreviewButton = buttonEdit.Buttons[0];

            startDate.DateTime = new DateTime(DateTime.Today.AddDays(-80).Year, 1, 1);
            startDate.Properties.MaxValue = DateTime.Today;

            grid.DataSource = new RowListBinder(Program.Table<Person>(), (Row[])people);
            gridView.BestFitColumns();

            PageBuilder = pageBuilder;
            emailTemplate.Properties.Items.AddRange(pageBuilder.Templates.ToList());
            emailTemplate.Properties.DropDownRows = Math.Max(emailTemplate.Properties.Items.Count, 7);
            SetEnabled();
        }
 public void Populate(Range range, Person person)
 {
     Person = person; base.Populate(range);
 }
예제 #17
0
        public StatementInfo(Person person, DateTime startDate, StatementKind kind)
        {
            if (person == null) throw new ArgumentNullException("person");

            Person = person;
            data = person.Table.Context;
            if (data == null)
                throw new ArgumentException("The person must be attached to a DataContext (for now)", "person");

            switch (kind) {
                case StatementKind.Bill:
                    if (person.Pledges.Any()
                     && !person.Pledges.Any(p => p.Date >= startDate))
                        startDate = new DateTime(person.Pledges.OrderBy(p => p.Date).Last().Date.Year, 1, 1);
                    StartDate = startDate;
                    EndDate = DateTime.MaxValue;
                    break;
                case StatementKind.Receipt:
                    StartDate = new DateTime(startDate.Year, 1, 1);
                    EndDate = new DateTime(startDate.Year + 1, 1, 1).AddTicks(-1);
                    break;
            }

            Kind = kind;

            Recalculate();
        }
예제 #18
0
 ///<summary>Called by the host to set the basic information about the statement being generated.</summary>
 ///<remarks>This information is consumed when the template sets the Kind property.</remarks>
 public void SetInfo(Person person, DateTime startDate)
 {
     this.person = person;
     this.startDate = startDate;
 }
예제 #19
0
			public void AppendPerson(Person person) => writableMatches.Add(person);
예제 #20
0
partial         void ValidatePerson(Person newValue, Action<string> error);
예제 #21
0
partial         void OnPersonChanged(Person oldValue, Person newValue);
예제 #22
0
partial         void OnHonoreeChanged(Person oldValue, Person newValue);
예제 #23
0
partial         void ValidateHonoree2(Person newValue, Action<string> error);
예제 #24
0
 public int DeletePerson(DbTransaction transaction, Person person)
 {
     return transaction.ExecuteNonQuery(tables.Join(";\n", t => t.DeleteSql) + ";\n\nDELETE FROM Data.MasterDirectory WHERE Id = @Id", new { person.Id });
 }
예제 #25
0
 public PersonRowData(ExternalDataManager owner, Person person, DataSet dataSet, string stripeId)
 {
     Owner = owner;
     Person = person;
     DataSet = dataSet;
     StripeId = stripeId;
 }
예제 #26
0
        int FindChartCount(Person person)
        {
            int retVal;
            if (seatGroups.TryGetValue(person, out retVal))
                return retVal;

            retVal = chart.AllSeats.Where(s => s.Matches(person)).Sum(s => s.SeatCount);
            seatGroups.Add(person, retVal);

            return retVal;
        }
예제 #27
0
partial         void OnMemberChanged(Person oldValue, Person newValue);
예제 #28
0
partial         void OnRelativeChanged(Person oldValue, Person newValue);
예제 #29
0
partial         void ValidateRelative(Person newValue, Action<string> error);
예제 #30
0
        void SetState(Person person)
        {
            selector.EditValue = person;
            if (person == null) {
                SetHeight(selector.Height);
                selector.Properties.Buttons[1].Visible = false;
            } else {
                selector.Properties.Buttons[1].Visible = true;
                map.Text = person.FullName;

                var address = new StringBuilder();
                if (!String.IsNullOrEmpty(person.Address)) address.AppendLine(person.Address);
                if (!String.IsNullOrEmpty(person.City)
                 && !String.IsNullOrEmpty(person.State)) {
                    address.Append(person.City).Append(", ").Append(person.State);
                    if (!String.IsNullOrEmpty(person.Zip)) address.Append(" ").Append(person.Zip);
                }
                map.AddressString = address.ToString();

                string body = person.VeryFullName + Environment.NewLine + Environment.NewLine + person.MailingAddress;
                if (!string.IsNullOrEmpty(person.Phone))
                    body += Environment.NewLine + Environment.NewLine + person.Phone;
                personDetails.Text = body;
                SetHeight(175);
            }
        }