static bool Update(Contact j) { return UpdateByID(j); }
public Contact(Contact o) { Copy(o); }
static bool Delete(Contact p) { pmanAPI.App_Data.pmanDBTableAdapters.ContactTableAdapter ta = new pmanAPI.App_Data.pmanDBTableAdapters.ContactTableAdapter(); return ta.DeleteByID(p.id) == 0 ? false : true; }
static Contact LoadFromModel(pmanAPI.App_Data.pmanDB.ContactRow row) { Contact d = new Contact(); LoadContact(row, d); return d; }
public void Copy(Contact o) { this.id = o.id; this.firstname = o.firstname; this.lastname = o.lastname; this.address_id = o.address_id; this.phone = o.phone; this.email = o.email; this.notes = o.notes; this.createdate = o.createdate; this.modifydate = o.modifydate; }
public bool Equals(Contact o) { if(this.id != o.id)return false; if(this.firstname != o.firstname)return false; if(this.lastname != o.lastname)return false; if(this.address_id != o.address_id)return false; if(this.phone != o.phone)return false; if(this.email != o.email)return false; if(this.notes != o.notes)return false; if(this.createdate.ToString() != o.createdate.ToString())return false; if(this.modifydate.ToString() != o.modifydate.ToString())return false; return true; }
public static bool Save(Contact j) { if (!Contact.isValid(j)) return false; if (Exists(j)) { return Contact.Update(j); } return Contact.Insert(j); }
public static bool UpdateByID(Contact o) { o.modifydate = DateTime.Now; pmanAPI.App_Data.pmanDBTableAdapters.ContactTableAdapter ta = new pmanAPI.App_Data.pmanDBTableAdapters.ContactTableAdapter(); int ret = ta.UpdateByID( o.firstname, o.lastname, o.address_id, o.phone, o.email, o.notes, o.createdate, o.modifydate, o.id ); if(ret == 1) return true; return false; }
public static bool Remove(Contact j) { if (Exists(j)) { return Delete(j); } return false; }
public static void LoadContact(pmanAPI.App_Data.pmanDB.ContactRow row, Contact d) { try { d.id = row.id; } catch (Exception) { } try { d.firstname = row.firstname; } catch (Exception) { } try { d.lastname = row.lastname; } catch (Exception) { } try { d.address_id = row.address_id; } catch (Exception) { } try { d.phone = row.phone; } catch (Exception) { } try { d.email = row.email; } catch (Exception) { } try { d.notes = row.notes; } catch (Exception) { } try { d.createdate = row.createdate; } catch (Exception) { } try { d.modifydate = row.modifydate; } catch (Exception) { } }
public static bool isValid(Contact o) { //if (o.id == 0) // return false; return true; }
public static bool Insert(Contact o) { o.createdate = o.modifydate = DateTime.Now; pmanAPI.App_Data.pmanDBTableAdapters.ContactTableAdapter ta = new pmanAPI.App_Data.pmanDBTableAdapters.ContactTableAdapter(); o.id = Convert.ToInt32(ta.InsertQuery( o.firstname, o.lastname, o.address_id, o.phone, o.email, o.notes, o.createdate, o.modifydate )); return true; }
public static bool Exists(Contact o) { return Exists(o.id); }