Beispiel #1
0
        /// <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);
            }
        }
Beispiel #2
0
        /// <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);
        }
Beispiel #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOK_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                //string wuName = this.txtWaterUser.Text;
                //WaterUserClass wu = WaterUserFactory.CreateWaterUserByID
                WaterUserClass wu = SessionManager.LoginSession.WaterUser;
                if (wu != null)
                {
                    int waterUserID = wu.WaterUserID;

                    NeedWaterClass n = new NeedWaterClass();
                    n.NeedWaterID = this.NeedWaterID;
                    n.Begin = Convert.ToDateTime(this.txtBegin.Text);
                    n.End = Convert.ToDateTime(this.txtEnd.Text);
                    n.NeedAmount = Convert.ToInt32(this.txtUsedAmount.Text);
                    n.Reamrk = this.txtRemark.Text.Trim();

                    n.Save(waterUserID);

                    Response.Redirect("pNeedWaterList.aspx");
                }
            }
        }
Beispiel #4
0
        /// <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);
            }
        }
Beispiel #5
0
        /// <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;
        }
Beispiel #6
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="needWaterID"></param>
        /// <returns></returns>
        public static 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;
            }
        }