/// <summary> /// Make a LabelWriter with Avery 5168 dimensions: /// ============= /// Cell Height: 5.276" /// Cell Width: 3.5" /// Padding Width: 0.5" /// Left and Right Margins: 0.5" /// /// Also specify a BackgroundWorker, DBWrapper, Donor, /// request type, and year. /// </summary> public BagLabelWriter(BackgroundWorker wk, DBWrapper ctx, Donor d, string request_type, int year) : base( wk, ctx, year, label_height: (int)(5.0 * (int)DocPartUnits.CellHeight), // Avery 5168 label_width: (int)(3.5 * (int)DocPartUnits.CellWidth), horizontal_padding: (int)(0.5 * (int)DocPartUnits.CellWidth), left_margin: (int)(0.5 * (int)DocPartUnits.Margins), right_margin: (int)(0.5 * (int)DocPartUnits.Margins), num_label_cols: 2, label_rows_per_page: 2 ) { this.Dnr = d; this.RequestType = request_type; this.Year = year; this.SetItemList(); }
//public void AddNewDonor(Donor d) //{ // this._donorcoll.Insert(d); //} public Donor AddOrUpdateDonor(Donor d) { Donor dbd = this.MatchingDonor(d); if (dbd == null) { // not found -- insert the one passed // to us. As a side effect, the Insert() // method updates the Id property of the // Donor. this._donorcoll.Insert(d); } else { // found -- set the id of the passed-in Donor to // that of the found Donor. d.Id = dbd.Id; // Now replace the Donor in the database with // the one passed in. this._donorcoll.Update(d); } return d; }
public Donor MatchingDonor(Donor other) { return FindDonorByName(other.name); }