/// <summary> /// /// </summary> /// <param name="needWater"></param> /// <returns></returns> static public DistributeClass CreateByNeedWater(NeedWaterClass needWater) { if (needWater == null) { throw new ArgumentNullException("needWater"); } DistributeClass d = new DistributeClass(); d.NeedWaterClass = needWater; return(d); }
/// <summary> /// /// </summary> /// <param name="distributeID"></param> /// <returns></returns> static public DistributeClass CreateByID(int distributeID) { DataTable tbl = DistributeDBI.GetDistributeDataTableByID(distributeID); if (tbl.Rows.Count > 0) { DataRow row = tbl.Rows[0]; DistributeClass d = new DistributeClass(); d.Begin = Convert.ToDateTime(row[DBNames.tblDistributeWater.DistributeBeginDT]); d.End = Convert.ToDateTime(row[DBNames.tblDistributeWater.DistributeEndDT]); d.DistributeAmount = Convert.ToInt32(row[DBNames.tblDistributeWater.DistributeAmount]); d.DistributeWaterID = Convert.ToInt32(row[DBNames.tblDistributeWater.DistributeWaterID]); d.Remark = row[DBNames.tblDistributeWater.Remark].ToString(); int needID = Convert.ToInt32(row[DBNames.tblDistributeWater.NeedWaterID]); d.NeedWaterClass = NeedWaterClass.CreateByID(needID); return(d); } else { return(null); } }
/// <summary> /// /// </summary> /// <param name="needWater"></param> /// <returns></returns> public static DistributeClass CreateByNeedWater(NeedWaterClass needWater) { if (needWater == null) { throw new ArgumentNullException("needWater"); } DistributeClass d = new DistributeClass(); d.NeedWaterClass = needWater; return d; }
/// <summary> /// /// </summary> /// <param name="distributeID"></param> /// <returns></returns> public static DistributeClass CreateByID(int distributeID) { DataTable tbl = DistributeDBI.GetDistributeDataTableByID(distributeID); if (tbl.Rows.Count > 0) { DataRow row = tbl.Rows[0]; DistributeClass d = new DistributeClass(); d.Begin = Convert.ToDateTime(row[DBNames.tblDistributeWater.DistributeBeginDT]); d.End = Convert.ToDateTime(row[DBNames.tblDistributeWater.DistributeEndDT]); d.DistributeAmount = Convert.ToInt32(row[DBNames.tblDistributeWater.DistributeAmount]); d.DistributeWaterID = Convert.ToInt32(row[DBNames.tblDistributeWater.DistributeWaterID]); d.Remark = row[DBNames.tblDistributeWater.Remark].ToString(); int needID = Convert.ToInt32(row[DBNames.tblDistributeWater.NeedWaterID]); d.NeedWaterClass = NeedWaterClass.CreateByID(needID); return d; } else { return null; } }