예제 #1
0
 static bool Update(Address j)
 {
     return UpdateByID(j);
 }
예제 #2
0
 public Address(Address o)
 {
     Copy(o);
 }
예제 #3
0
 static bool Delete(Address p)
 {
     pmanAPI.App_Data.pmanDBTableAdapters.AddressTableAdapter ta = new pmanAPI.App_Data.pmanDBTableAdapters.AddressTableAdapter();
     return ta.DeleteByID(p.id) == 0 ? false : true;
 }
예제 #4
0
 static Address LoadFromModel(pmanAPI.App_Data.pmanDB.AddressRow row)
 {
     Address d = new Address();
     LoadAddress(row, d);
     return d;
 }
예제 #5
0
 public void Copy(Address o)
 {
     this.id = o.id;
      this.name = o.name;
      this.address_1 = o.address_1;
      this.address_2 = o.address_2;
      this.city = o.city;
      this.state = o.state;
      this.zip = o.zip;
      this.contact_id = o.contact_id;
      this.createdate = o.createdate;
      this.modifydate = o.modifydate;
 }
예제 #6
0
 public bool Equals(Address o)
 {
     if(this.id != o.id)return false;
      if(this.name != o.name)return false;
      if(this.address_1 != o.address_1)return false;
      if(this.address_2 != o.address_2)return false;
      if(this.city != o.city)return false;
      if(this.state != o.state)return false;
      if(this.zip != o.zip)return false;
      if(this.contact_id != o.contact_id)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(Address j)
 {
     if (!Address.isValid(j))
         return false;
     if (Exists(j))
     {
         return Address.Update(j);
     }
     return Address.Insert(j);
 }
예제 #8
0
        public static bool UpdateByID(Address o)
        {
            o.modifydate = DateTime.Now;
            pmanAPI.App_Data.pmanDBTableAdapters.AddressTableAdapter ta = new pmanAPI.App_Data.pmanDBTableAdapters.AddressTableAdapter();
            int ret  = ta.UpdateByID(
              o.name,
              o.address_1,
              o.address_2,
              o.city,
              o.state,
              o.zip,
              o.contact_id,
              o.createdate ,
              o.modifydate,
              o.id

               );
               if(ret == 1) return true;
               return false;
        }
예제 #9
0
 public static bool Remove(Address j)
 {
     if (Exists(j))
     {
         return Delete(j);
     }
     return false;
 }
예제 #10
0
        public static void LoadAddress(pmanAPI.App_Data.pmanDB.AddressRow row, Address d)
        {
            try { d.id = row.id; }
            catch (Exception) { }

            try { d.name = row.name; }
            catch (Exception) { }

            try { d.address_1 = row.address_1; }
            catch (Exception) { }

            try { d.address_2 = row.address_2; }
            catch (Exception) { }

            try { d.city = row.city; }
            catch (Exception) { }

            try { d.state = row.state; }
            catch (Exception) { }

            try { d.zip = row.zip; }
            catch (Exception) { }

            try { d.contact_id = row.contact_id; }
            catch (Exception) { }

            try { d.createdate = row.createdate; }
            catch (Exception) { }

            try { d.modifydate = row.modifydate; }
            catch (Exception) { }
        }
예제 #11
0
 public static bool isValid(Address o)
 {
     //if (o.id == 0)
     //    return false;
     return true;
 }
예제 #12
0
        public static bool Insert(Address o)
        {
            o.createdate = o.modifydate = DateTime.Now;
            pmanAPI.App_Data.pmanDBTableAdapters.AddressTableAdapter ta = new pmanAPI.App_Data.pmanDBTableAdapters.AddressTableAdapter();
            o.id = Convert.ToInt32(ta.InsertQuery(
              o.name,
              o.address_1,
              o.address_2,
              o.city,
              o.state,
              o.zip,
              o.contact_id,
              o.createdate,
              o.modifydate

               ));
               return true;
        }
예제 #13
0
 public static bool Exists(Address o)
 {
     return Exists(o.id);
 }