예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="level"></param>
        /// <returns></returns>
        internal static WaterUserType GetDefaultWaterUserType(WaterUserLevel level)
        {
            if (level == null)
            {
                throw new ArgumentNullException("level");
            }

            return(CreateDefaultWaterUserType());
        }
예제 #2
0
파일: WaterUser.cs 프로젝트: wwkkww1983/yh
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        static public WaterUserClass GetNoneWaterUserClass()
        {
            WaterUserClass w = new WaterUserClass(WaterUserLevel.GetNoneLevel());

            w.WaterUserID = 0;
            w.Name        = "<无>";
            w.Remark      = "";
            return(w);
        }
예제 #3
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);
        }
예제 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="waterUserLevelID"></param>
        /// <param name="l"></param>
        /// <param name="r"></param>
        /// <returns></returns>
        private static WaterUserLevel CreateWaterUserLevel(DataRow r)
        {
            int    id      = Convert.ToInt32(r["WaterUserLevelID"]);
            string n       = r["WaterUserLevelName"].ToString();
            int    ordinal = Convert.ToInt32(r["Ordinal"]);
            string remark  = r["Remark"].ToString();

            WaterUserLevel wul = new WaterUserLevel(id, n, remark, ordinal);

            //wul.WaterUserLevelID = id;
            return(wul);
        }
예제 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        internal static WaterUserLevelCollection CreateWaterUserLevelCollection()
        {
            WaterUserLevelCollection wulc = new WaterUserLevelCollection();
            DataTable tbl = WaterUserLevelDBI.GetWaterUserLevelDataTable();

            foreach (DataRow row in tbl.Rows)
            {
                WaterUserLevel wul = CreateWaterUserLevel(row);
                wulc.Add(wul);
            }
            return(wulc);
        }
예제 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="wulEnum"></param>
        /// <returns></returns>
        static public WaterUserLevel CreateWaterLevel(WaterUserLevelEnum wulEnum)
        {
            DataTable tbl = WaterUserLevelDBI.GetWaterUserLevelDataTableByOrdinal((int)wulEnum);

            if (tbl.Rows.Count > 0)
            {
                int            wulID = Convert.ToInt32(tbl.Rows[0]["WaterUserlevelID"]);
                WaterUserLevel l     = WaterUserLevelFactory.CreateWaterUserLevelByID(wulID);
                return(l);
            }
            return(null);
        }
예제 #7
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;
        }
예제 #8
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);
        }
예제 #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="waterUserLevelID"></param>
        /// <returns></returns>
        static public WaterUserLevel CreateWaterUserLevelByID(int waterUserLevelID)
        {
            WaterUserLevel l   = null;
            DataTable      tbl = WaterUserLevelDBI.GetWaterUserLevelDataTable(waterUserLevelID);

            if (tbl.Rows.Count > 0)
            {
                DataRow r = tbl.Rows[0];
                l = CreateWaterUserLevel(r);
            }
            else
            {
                string err = string.Format("not find waterUserLevel by id '{0}'", waterUserLevelID);
                log.Error(err);
            }
            return(l);
        }
예제 #10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="l1"></param>
 /// <param name="l2"></param>
 /// <returns></returns>
 static public bool Less(WaterUserLevel l1, WaterUserLevel l2)
 {
     return(l1.LevelOrdinal < l2.LevelOrdinal);
 }
예제 #11
0
파일: WaterUser.cs 프로젝트: hkiaipc/yh
 /// <summary>
 /// 
 /// </summary>
 public WaterUserClass(WaterUserLevel waterUserLevel)
 {
     // TODO:
     //
     //this.WaterUserLevelEnum = waterUserLevel;
 }
예제 #12
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="l1"></param>
 /// <param name="l2"></param>
 /// <returns></returns>
 public static bool Less(WaterUserLevel l1, WaterUserLevel l2)
 {
     return l1.LevelOrdinal < l2.LevelOrdinal;
 }
예제 #13
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="l1"></param>
 /// <param name="l2"></param>
 /// <returns></returns>
 public static bool Greater(WaterUserLevel l1, WaterUserLevel l2)
 {
     return l1.LevelOrdinal > l2.LevelOrdinal;
 }
예제 #14
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="l1"></param>
 /// <param name="l2"></param>
 /// <returns></returns>
 public static bool Equal(WaterUserLevel l1, WaterUserLevel l2)
 {
     return l1.LevelOrdinal == l2.LevelOrdinal;
 }
예제 #15
0
파일: WaterUser.cs 프로젝트: wwkkww1983/yh
 /// <summary>
 ///
 /// </summary>
 public WaterUserClass(WaterUserLevel waterUserLevel)
 {
     // TODO:
     //
     //this.WaterUserLevelEnum = waterUserLevel;
 }
예제 #16
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="level"></param>
        /// <returns></returns>
        internal static WaterUserType GetDefaultWaterUserType(WaterUserLevel level)
        {
            if (level == null)
            {
                throw new ArgumentNullException("level");
            }

            return CreateDefaultWaterUserType();
        }
예제 #17
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="waterUserLevelID"></param>
        /// <param name="l"></param>
        /// <param name="r"></param>
        /// <returns></returns>
        private static WaterUserLevel CreateWaterUserLevel(DataRow r)
        {
            int id = Convert.ToInt32(r["WaterUserLevelID"]);
            string n = r["WaterUserLevelName"].ToString();
            int ordinal = Convert.ToInt32(r["Ordinal"]);
            string remark = r["Remark"].ToString();

            WaterUserLevel wul = new WaterUserLevel(id, n, remark, ordinal);
            //wul.WaterUserLevelID = id;
            return wul;
        }
예제 #18
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="l1"></param>
 /// <param name="l2"></param>
 /// <returns></returns>
 static public bool Equal(WaterUserLevel l1, WaterUserLevel l2)
 {
     return(l1.LevelOrdinal == l2.LevelOrdinal);
 }
예제 #19
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="l1"></param>
 /// <param name="l2"></param>
 /// <returns></returns>
 static public bool Greater(WaterUserLevel l1, WaterUserLevel l2)
 {
     return(l1.LevelOrdinal > l2.LevelOrdinal);
 }