예제 #1
0
 static bool Update(Contact j)
 {
     return UpdateByID(j);
 }
예제 #2
0
 public Contact(Contact o)
 {
     Copy(o);
 }
예제 #3
0
 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;
 }
예제 #4
0
 static Contact LoadFromModel(pmanAPI.App_Data.pmanDB.ContactRow row)
 {
     Contact d = new Contact();
     LoadContact(row, d);
     return d;
 }
예제 #5
0
 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;
 }
예제 #6
0
 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;
 }
예제 #7
0
 public static bool Save(Contact j)
 {
     if (!Contact.isValid(j))
         return false;
     if (Exists(j))
     {
         return Contact.Update(j);
     }
     return Contact.Insert(j);
 }
예제 #8
0
        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;
        }
예제 #9
0
 public static bool Remove(Contact j)
 {
     if (Exists(j))
     {
         return Delete(j);
     }
     return false;
 }
예제 #10
0
        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) { }
        }
예제 #11
0
 public static bool isValid(Contact o)
 {
     //if (o.id == 0)
     //    return false;
     return true;
 }
예제 #12
0
        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;
        }
예제 #13
0
 public static bool Exists(Contact o)
 {
     return Exists(o.id);
 }