/// <summary> /// クローン用コンストラクタ /// </summary> /// <param name="pesticideContent"></param> public PesticideContent(PesticideContent pesticideContent) { this.Id = pesticideContent.Id; this.PestcideMaster = pesticideContent.pestcideMaster; this.PesticideId = pesticideContent.PesticideId; this.Used = pesticideContent.Used; }
/// <summary> /// 農薬内容リスト取得 /// </summary> /// <param name="work_content_id"></param> /// <returns></returns> public List <PesticideContent> GetPesticideContents(int work_content_id) { List <PesticideContent> result = new List <PesticideContent>(); try { PrepareCommandParameter("SELECT * FROM T_PesticideContent WHERE work_content_id = ?", new List <object> { work_content_id }); using (var reader = command.ExecuteReader()) { while (reader.Read()) { PesticideContent tmp = new PesticideContent { Id = int.Parse(reader["id"].ToString()), WorkContentId = int.Parse(reader["work_content_id"].ToString()), PesticideId = int.Parse(reader["pesticide_id"].ToString()), Used = double.Parse(reader["used"].ToString()), }; result.Add(tmp); } } foreach (PesticideContent pc in result) { List <PesticideMaster> master_list = GetPesticideMasters(pc.PesticideId); pc.PestcideMaster = new PesticideMaster(master_list[0]); } } catch (Exception ex) { throw new SQLiteException(ex.ToString()); } return(result); }