public override string SetProperty(CookDBDataContext db, string prop, string value) { string msg = ""; bool add = true; if (prop.Equals("hours")) { decimal h = Decimal.Parse(value); if (!h.Equals(this.hours)) { msg += this.hours + " -> " + h; this.hours = h; } } else if (prop.Equals("contact_id")) { if (!DatabaseHandler.isNull(value)) { int cid = int.Parse(value); if (cid != this.contact_id) { msg += (this.Contact != null ? this.Contact.contact_name : "") + " -> " + Contact.getContactName(db, cid); this.contact_id = cid; } } } else if (prop.Equals("hour_type")) { int ht = int.Parse(value); if (ht != this.hour_type) { msg += (this.AssessmentHourType != null ? this.AssessmentHourType.assessment_hour_type : "") + " -> " + db.AssessmentHourTypes.Single(a => a.assessment_hour_type_id == ht).assessment_hour_type; this.hour_type = ht; } } else { //description add = false; msg = base.SetProperty(db, prop, value); } if (add && msg.Length > 0) { msg = prop + ": " + msg + "\n"; } return(msg); }
public override string SetProperty(CookDBDataContext db, string prop, string value) { string msg = prop + ": "; if (prop.Equals("contact_id")) { if (!DatabaseHandler.isNull(value)) { int cid = int.Parse(value); if (cid != this.contact_id) { msg += (this.Contact != null ? this.Contact.contact_name : "") + " -> " + Contact.getContactName(db, cid); this.contact_id = cid; } } } return(msg); }