Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="wu"></param>
        /// <returns></returns>
        private TreeNode CreateNode(YongShuiGuanLiDBI.WaterUserClass wu)
        {
            TreeNode node = new TreeNode(wu.Name, wu.WaterUserID.ToString());

            CreateLowLevelWaterUser(node, wu.LowLevelWaterUserCollection);
            return(node);
        }
Esempio n. 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="wu"></param>
        public void Bind(WaterUserClass wu)
        {
            this._wu = wu;

            Bind();
            OutputDebugInfo();
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lbAdd_Click(object sender, EventArgs e)
        {
            WaterUserSession ws = SessionManager.WaterUserSession;

            WaterUserLevel newWaterUserLevel = GetSelectedWaterUserLevel();

            YongShuiGuanLiDBI.WaterUserClass newWaterUser = WaterUserFactory.CreateWaterUser(newWaterUserLevel);
            ws.WaterUser = newWaterUser;

            Response.Redirect("WaterUser.aspx");
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
        {
            int index = e.NewEditIndex;

            if (index != -1)
            {
                object obj         = this.GridView1.DataKeys[index].Value;
                int    waterUserID = Convert.ToInt32(obj);
                YongShuiGuanLiDBI.WaterUserClass wu = WaterUserFactory.CreateWaterUserByID(waterUserID);
                SessionManager.WaterUserSession.WaterUser = wu;
                Response.Redirect("~/WaterUser.aspx");
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static WaterUserClass CreateWaterUser(WaterUserLevel level)
        {
            if( level == null )
            {
                throw new ArgumentNullException("level");
            }

            WaterUserClass wu = new WaterUserClass();
            wu.WaterUserLevel = level;
            //wu.WaterUserType = WaterUserTypeFactory.CreateDefaultWaterUserType(level);
            //WaterUserType.GetManagerWaterUserType
            wu.WaterUserType = WaterUserTypeFactory.GetDefaultWaterUserType(level);
            return wu;
        }
Esempio n. 6
0
        //#region CreateJu
        ///// <summary>
        /////
        ///// </summary>
        ///// <returns></returns>
        //static public WaterUser CreateJu()
        //{
        //    // TODO:
        //    //
        //    return new WaterUser(null);
        //}
        //#endregion //CreateJu

        // TODO:
        // chu
        //


        #region CreateWaterUser
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        static public WaterUserClass CreateWaterUser(WaterUserLevel level)
        {
            if (level == null)
            {
                throw new ArgumentNullException("level");
            }

            WaterUserClass wu = new WaterUserClass();

            wu.WaterUserLevel = level;
            //wu.WaterUserType = WaterUserTypeFactory.CreateDefaultWaterUserType(level);
            //WaterUserType.GetManagerWaterUserType
            wu.WaterUserType = WaterUserTypeFactory.GetDefaultWaterUserType(level);
            return(wu);
        }
Esempio n. 7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="wu"></param>
 /// <param name="ddl"></param>
 public static void DataBind(WaterUserClass wu, DropDownList ddlChannel)
 {
     ListItemCollection ds = new ListItemCollection();
     foreach (ChannelClass c in wu.ChannelCollection)
     {
         string id = c.ChannelID.ToString();
         string name = c.ChannelName;
         ListItem li = new ListItem();
         li.Text = name;
         li.Value = id;
         ds.Add(li);
     }
     ddlChannel.DataTextField = "Text";
     ddlChannel.DataValueField = "Value";
     ddlChannel.DataSource = ds;
     ddlChannel.DataBind();
 }
Esempio n. 8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="waterUserID"></param>
        /// <returns></returns>
        static public WaterUserClass CreateWaterUserByID(int waterUserID)
        {
            WaterUserClass wu = null;

            DataTable tbl = WaterUserDBI.GetWaterUserDataTable(waterUserID);

            if (tbl.Rows.Count > 0)
            {
                DataRow row = tbl.Rows[0];
                //int waterUserID = Convert.ToInt32(row["WaterUserID"]);
                wu = CreateWaterUser(row);
            }
            else
            {
                string err = string.Format("not find water user by id '{0}'", waterUserID);
                log.Error(err);
            }
            return(wu);
        }
Esempio n. 9
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="cbl"></param>
        public static void DataBind(WaterUserClass parentWaterUser, CheckBoxList cbl)
        {
            if (parentWaterUser == null)
            {
                return;
            }

            object ds = parentWaterUser.LowLevelWaterUserCollection;
            cbl.DataSource = ds;
            cbl.DataTextField = "Name";
            cbl.DataValueField = "WaterUserID";
            cbl.DataBind();
        }
Esempio n. 10
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        private static WaterUserClass CreateWaterUser(DataRow row)
        {
            int waterUserID = Convert.ToInt32(row["WaterUserID"]);
            int waterUserLevelID = Convert.ToInt32(row["WaterUserLevelID"]);
            int wuTypeID = Convert.ToInt32(row["WaterUserTypeID"]);
            string name = row["WaterUserName"].ToString();
            string remark = row["remark"].ToString();
            float unitPrice = GetUnitPriceFromDataRow(row);

            // TODO: 2011-04-08
            // parent wateruser, wulevel, indevice ...
            // init at get property
            //
            // 2. dead loop
            //
            //WaterUserClass parentWaterUser = null;
            //object parentObject = row["ParentWaterUserID"];
            //if (parentObject != DBNull.Value)
            //{
            //    int parentID = Convert.ToInt32(row["ParentWaterUserID"]);
            //    if (parentID != waterUserID)
            //    {
            //        parentWaterUser = CreateWaterUserByID(parentID);
            //    }
            //}
            //wu.ParentWaterUser = CreateWaterUserByID(parentID);
            //wu.ParentWaterUser = parentWaterUser;

            WaterUserLevel wuLevel = WaterUserLevelFactory.CreateWaterUserLevelByID(waterUserLevelID);
            //WaterUserType
            WaterUserType wuType = WaterUserTypeFactory.CreateWaterUserTypeByID(wuTypeID);

            WaterUserClass wu = new WaterUserClass();
            wu.Name = name;
            wu.WaterUserID = waterUserID;
            wu.WaterUserLevel = wuLevel;
            wu.WaterUserType = wuType;
            wu.Remark = remark;
            wu.UnitPrice = unitPrice;

            wu.ChannelCollection = ChannelFactory.CreateChannelCollection(waterUserID);

            //wu.InStationCollection
            //wu.InDeviceCollection = CreateInDevice
            //wu.OutStationCollection

            //wu.InDeviceCollection = DeviceFactory.CreateInDeviceCollection(waterUserID);
            //wu.OutDeviceCollection = DeviceFactory.CreateOutDeviceCollection(waterUserID);

            return wu;
        }
Esempio n. 11
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="w"></param>
 /// <param name="b"></param>
 /// <param name="e"></param>
 internal NeedDistributeCalculator(WaterUserClass w, DateTime b, DateTime e)
 {
     _w = w;
     _b = b;
     _e = e;
 }
Esempio n. 12
0
 public DitchDataDayCreater(WaterUserClass w, DateTime day)
 {
     _w = w;
     _day = day;
 }
Esempio n. 13
0
 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 public static WaterUserClass GetNoneWaterUserClass()
 {
     WaterUserClass w = new WaterUserClass(WaterUserLevel.GetNoneLevel());
     w.WaterUserID = 0;
     w.Name = "<无>";
     w.Remark = "";
     return w;
 }
Esempio n. 14
0
 public DitchDataDayCreater(WaterUserClass w, DateTime day)
 {
     _w   = w;
     _day = day;
 }
Esempio n. 15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="u"></param>
        private void BindTree(YongShuiGuanLiDBI.WaterUserClass u)
        {
            TreeNode node = CreateNode(u);

            this.TreeView1.Nodes.Add(node);
        }
Esempio n. 16
0
 /// <summary>
 ///
 /// </summary>
 private void BindTree()
 {
     YongShuiGuanLiDBI.WaterUserClass u = SessionManager.LoginSession.WaterUser;
     BindTree(u);
 }
Esempio n. 17
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="parentWaterUser"></param>
        /// <param name="ddl"></param>
        public static void DataBind(WaterUserClass parentWaterUser, DropDownList ddl)
        {
            if (parentWaterUser == null)
            {
                return;
            }

            object ds = parentWaterUser.LowLevelWaterUserCollection;
            ddl.DataSource = ds;
            ddl.DataTextField = "Name";
            ddl.DataValueField = "WaterUserID";
            ddl.DataBind();
        }
Esempio n. 18
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="cbl"></param>
        public static void BindLowLevelWaterUser(WaterUserClass parent, CheckBoxList cbl)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }
            if (cbl == null)
            {
                throw new ArgumentNullException("ddl");
            }

            NameIDPairCollection nips = new NameIDPairCollection();
            foreach (WaterUserClass w in parent.LowLevelWaterUserCollection)
            {
                NameIDPair ni = new NameIDPair(w.Name, w.WaterUserID);
                nips.Add(ni);
            }

            cbl.DataSource = nips;
            cbl.DataTextField = "Name";
            cbl.DataValueField = "id";
            cbl.DataBind();
        }
Esempio n. 19
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="w"></param>
 /// <param name="b"></param>
 /// <param name="e"></param>
 internal NeedDistributeCalculator(WaterUserClass w, DateTime b, DateTime e)
 {
     _w = w;
     _b = b;
     _e = e;
 }