static bool Update(Project_Cast j)
 {
     return UpdateByID(j);
 }
 public Project_Cast(Project_Cast o)
 {
     Copy(o);
 }
 static bool Delete(Project_Cast p)
 {
     pmanAPI.App_Data.pmanDBTableAdapters.Project_CastTableAdapter ta = new pmanAPI.App_Data.pmanDBTableAdapters.Project_CastTableAdapter();
     return ta.DeleteByID(p.id) == 0 ?  false:true;
 }
 static Project_Cast LoadFromModel(pmanAPI.App_Data.pmanDB.Project_CastRow row)
 {
     Project_Cast d = new Project_Cast();
     LoadProject_Cast(row, d);
     return d;
 }
 public void Copy(Project_Cast o)
 {
     this.id = o.id;
      this.project_id = o.project_id;
      this.contact_id = o.contact_id;
      this.character_description = o.character_description;
      this.wardrobe_description = o.wardrobe_description;
      this.calltime_description = o.calltime_description;
      this.notes = o.notes;
      this.createdate = o.createdate;
      this.modifydate = o.modifydate;
 }
 public bool Equals(Project_Cast o)
 {
     if(this.id != o.id)return false;
      if(this.project_id != o.project_id)return false;
      if(this.contact_id != o.contact_id)return false;
      if(this.character_description != o.character_description)return false;
      if(this.wardrobe_description != o.wardrobe_description)return false;
      if(this.calltime_description != o.calltime_description)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(Project_Cast j)
 {
     if (!Project_Cast.isValid(j))
         return false;
     if (Exists(j))
     {
         return Project_Cast.Update(j);
     }
     return Project_Cast.Insert(j);
 }
        public static bool UpdateByID(Project_Cast o)
        {
            o.modifydate = DateTime.Now;
            pmanAPI.App_Data.pmanDBTableAdapters.Project_CastTableAdapter ta = new pmanAPI.App_Data.pmanDBTableAdapters.Project_CastTableAdapter();
            int ret  = ta.UpdateByID(
              o.project_id,
              o.contact_id,
              o.character_description,
              o.wardrobe_description,
              o.calltime_description,
              o.notes,
              o.createdate,
              o.modifydate,
              o.id

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

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

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

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

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

            try { d.calltime_description = row.calltime_description; }
            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(Project_Cast o)
 {
     //if (o.id == 0)
     //    return false;
     return true;
 }
        public static bool Insert(Project_Cast o)
        {
            o.createdate = o.modifydate = DateTime.Now;
            pmanAPI.App_Data.pmanDBTableAdapters.Project_CastTableAdapter ta = new pmanAPI.App_Data.pmanDBTableAdapters.Project_CastTableAdapter();
            o.id = Convert.ToInt32(ta.InsertQuery(
              o.project_id,
              o.contact_id,
              o.character_description,
              o.wardrobe_description,
              o.calltime_description,
              o.notes,
              o.createdate,
              o.modifydate

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