コード例 #1
0
        public static IList <UnitEntity> GetByBusinessType(string rootId, UnitBusinessType businessType)
        {
            var sql = string.Format("select {0} from units where root_id=@p_root_id and business_type=@p_business_type order by name", COLUMN_SQL);

            var db = DatabaseFactory.CreateDatabase();

            var dc = db.GetSqlStringCommand(sql);

            db.AddInParameter(dc, "p_root_id", DbType.String, rootId);
            db.AddInParameter(dc, "p_business_type", DbType.Int32, (int)businessType);

            var list = new List <UnitEntity>();

            using (var reader = db.ExecuteReader(dc))
            {
                while (reader.Read())
                {
                    var entity = new UnitEntity();
                    entity.Init(reader);

                    list.Add(entity);
                }
            }

            return(list);
        }
コード例 #2
0
ファイル: Constant.cs プロジェクト: zhangzhg0508/LIMS.NEW
        public static string GetName(UnitBusinessType businessType)
        {
            string name;

            if (ms_StatusName.TryGetValue(businessType, out name))
            {
                return(name);
            }
            else
            {
                return(ms_StatusName[UnitBusinessType.None]);
            }
        }
コード例 #3
0
        public override void Init(IDataReader reader)
        {
            base.Init(reader);

            this.Id               = reader["id"].ToString();
            this.Name             = reader["name"].ToString();
            this.Description      = reader["description"].ToString();
            this.ShortCode        = reader["short_code"].ToString();
            this.ContactId        = reader["contact_id"].ToString();
            this.Type             = (UnitType)(reader.GetInt32(reader.GetOrdinal("type")));
            this.DefaultReceiptId = reader["default_receipt_id"].ToString();
            this.ParentId         = reader["parent_id"].ToString();
            this.RootId           = reader["root_id"].ToString();
            this.BusinessType     = (UnitBusinessType)(reader.GetInt32(reader.GetOrdinal("business_type")));
        }