public Project_Location(Project_Location o)
 {
     Copy(o);
 }
 public static bool Delete(Project_Location o)
 {
     pmanAPI.App_Data.pmanDBTableAdapters.Project_LocationTableAdapter ta = new pmanAPI.App_Data.pmanDBTableAdapters.Project_LocationTableAdapter();
     return ta.DeleteByID(o.id) == 0 ? false : true;
 }
 static Project_Location LoadFromModel(pmanAPI.App_Data.pmanDB.Project_LocationRow row)
 {
     Project_Location d = new Project_Location();
     LoadProject_Location(row, d);
     return d;
 }
 static bool Update(Project_Location j)
 {
     return UpdateByID(j);
 }
 public void Copy(Project_Location o)
 {
     this.id = o.id;
      this.location_id = o.location_id;
      this.details = o.details;
      this.createdate = o.createdate;
      this.modifydate = o.modifydate;
 }
 public bool Equals(Project_Location o)
 {
     if(this.id != o.id)return false;
      if(this.location_id != o.location_id)return false;
      if(this.details != o.details)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(Project_Location j)
 {
     if (!Project_Location.isValid(j))
         return false;
     if (Exists(j))
     {
         return Project_Location.Update(j);
     }
     return Project_Location.Insert(j);
 }
        public static bool UpdateByID(Project_Location o)
        {
            DateTime? d = null;
            o.modifydate = DateTime.Now;
            pmanAPI.App_Data.pmanDBTableAdapters.Project_LocationTableAdapter ta = new pmanAPI.App_Data.pmanDBTableAdapters.Project_LocationTableAdapter();
            int ret  = ta.UpdateByID(
              o.location_id,
              o.details,
              o.createdate,
              o.modifydate,
              o.id

               );
               if(ret == 1) return true;
               return false;
        }
 public static bool Remove(Project_Location j)
 {
     if (Exists(j))
     {
         return Delete(j);
     }
     return false;
 }
        public static void LoadProject_Location(pmanAPI.App_Data.pmanDB.Project_LocationRow row, Project_Location d)
        {
            try { d.id = row.id; }
            catch (Exception) { }

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

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

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

            try { d.modifydate = row.modifydate; }
            catch (Exception) { }
        }
 public static bool isValid(Project_Location o)
 {
     //if (o.id == 0)
     //    return false;
     return true;
 }
        public static bool Insert(Project_Location o)
        {
            o.createdate = o.modifydate = DateTime.Now;
            pmanAPI.App_Data.pmanDBTableAdapters.Project_LocationTableAdapter ta = new pmanAPI.App_Data.pmanDBTableAdapters.Project_LocationTableAdapter();
            o.id = Convert.ToInt32(ta.InsertQuery(
              o.id,
              o.location_id,
              o.details,
              o.createdate,
              o.modifydate

               ));
               return true;
        }
 public static bool Exists(Project_Location o)
 {
     return Exists(o.id);
 }