/// <summary> /// /// </summary> /// <param name="needWaterID"></param> /// <returns></returns> static public NeedWaterClass CreateByID(int needWaterID) { DataTable t = NeedWaterDBI.GetNeedWaterByID(needWaterID); if (t.Rows.Count == 0) { return(null); } else { DataRow row = t.Rows[0]; int waterUserID = Convert.ToInt32(row[DBNames.tblNeedWater.WaterUserID]); NeedWaterClass n = new NeedWaterClass(); n.WaterUserClass = WaterUserFactory.CreateWaterUserByID(waterUserID); n.NeedWaterID = Convert.ToInt32(row[DBNames.tblNeedWater.WaterUserID]); n.Begin = Convert.ToDateTime(row[DBNames.tblNeedWater.NeedBeginDT]); n.End = Convert.ToDateTime(row[DBNames.tblNeedWater.NeedEndDT]); n.NeedAmount = Convert.ToInt32(row[DBNames.tblNeedWater.NeedAmount]); n.Reamrk = Convert.ToString(row[DBNames.tblNeedWater.Remark]); return(n); } }
/// <summary> /// /// </summary> public void Save(int waterUserID) { if (IsEdit()) { NeedWaterDBI.Update(this.NeedWaterID, this.NeedName, this.Begin, this.End, this.NeedAmount, this.Reamrk); } else { NeedWaterDBI.Insert(waterUserID, this.NeedName, this.Begin, this.End, this.NeedAmount, this.Reamrk); } }
/// <summary> /// /// </summary> /// <param name="b"></param> /// <param name="e"></param> /// <returns></returns> public DataTable GetNeedWaterDataTable(DateTime b, DateTime e) { DataTable r = null; foreach (WaterUserClass wu in this) { DataTable tbl = NeedWaterDBI.GetNeedWaterByWaterUser(wu.WaterUserID, b, e); if (r == null) { r = tbl; } else { r.Merge(tbl); } } return(r); }
/// <summary> /// /// </summary> /// <param name="begin"></param> /// <param name="end"></param> public DataTable GetNeedWaterDataTable(DateTime begin, DateTime end) { return(NeedWaterDBI.GetNeedWaterByWaterUser(this.WaterUserID, begin, end)); }