/// <summary> /// /// </summary> /// <param name="level"></param> /// <returns></returns> internal static WaterUserType GetDefaultWaterUserType(WaterUserLevel level) { if (level == null) { throw new ArgumentNullException("level"); } return(CreateDefaultWaterUserType()); }
/// <summary> /// /// </summary> /// <returns></returns> static public WaterUserClass GetNoneWaterUserClass() { WaterUserClass w = new WaterUserClass(WaterUserLevel.GetNoneLevel()); w.WaterUserID = 0; w.Name = "<无>"; w.Remark = ""; return(w); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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; }
//#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); }
/// <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); }
/// <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); }
/// <summary> /// /// </summary> public WaterUserClass(WaterUserLevel waterUserLevel) { // TODO: // //this.WaterUserLevelEnum = waterUserLevel; }
/// <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; }
/// <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; }
/// <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; }
/// <summary> /// /// </summary> /// <param name="level"></param> /// <returns></returns> internal static WaterUserType GetDefaultWaterUserType(WaterUserLevel level) { if (level == null) { throw new ArgumentNullException("level"); } return CreateDefaultWaterUserType(); }
/// <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; }
/// <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); }
/// <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); }