Beispiel #1
0
        public static DanhMuc SelectByMa(string DM_Ma)
        {
            var Item = new DanhMuc();
            var obj  = new SqlParameter[1];

            if (!string.IsNullOrEmpty(DM_Ma))
            {
                obj[0] = new SqlParameter("DM_Ma", DM_Ma);
            }
            else
            {
                obj[0] = new SqlParameter("DM_Ma", DBNull.Value);
            }
            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblDanhMuc_Select_SelectByMa_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
Beispiel #2
0
        public static DanhMuc getFromReader(IDataReader rd)
        {
            var Item = new DanhMuc();

            if (rd.FieldExists("DM_ID"))
            {
                Item.ID = (Guid)(rd["DM_ID"]);
            }
            if (rd.FieldExists("DM_GH_ID"))
            {
                Item.GH_ID = (Guid)(rd["DM_GH_ID"]);
            }
            if (rd.FieldExists("DM_PID"))
            {
                Item.PID = (Guid)(rd["DM_PID"]);
            }
            if (rd.FieldExists("DM_LDM_ID"))
            {
                Item.LDM_ID = (Guid)(rd["DM_LDM_ID"]);
            }
            if (rd.FieldExists("DM_Lang"))
            {
                Item.Lang = (String)(rd["DM_Lang"]);
            }
            if (rd.FieldExists("DM_LangBased"))
            {
                Item.LangBased = (Boolean)(rd["DM_LangBased"]);
            }
            if (rd.FieldExists("DM_LangBased_ID"))
            {
                Item.LangBased_ID = (Guid)(rd["DM_LangBased_ID"]);
            }
            if (rd.FieldExists("DM_Alias"))
            {
                Item.Alias = (String)(rd["DM_Alias"]);
            }
            if (rd.FieldExists("DM_KyHieu"))
            {
                Item.KyHieu = (String)(rd["DM_KyHieu"]);
            }
            if (rd.FieldExists("DM_Ten"))
            {
                Item.Ten = (String)(rd["DM_Ten"]);
            }
            if (rd.FieldExists("DM_Anh"))
            {
                Item.Anh = (String)(rd["DM_Anh"]);
            }
            if (rd.FieldExists("DM_Ma"))
            {
                Item.Ma = (String)(rd["DM_Ma"]);
            }
            if (rd.FieldExists("DM_GiaTri"))
            {
                Item.GiaTri = (String)(rd["DM_GiaTri"]);
            }
            if (rd.FieldExists("DM_ThuTu"))
            {
                Item.ThuTu = (Int32)(rd["DM_ThuTu"]);
            }
            if (rd.FieldExists("DM_NgayTao"))
            {
                Item.NgayTao = (DateTime)(rd["DM_NgayTao"]);
            }
            if (rd.FieldExists("DM_NguoiTao"))
            {
                Item.NguoiTao = (String)(rd["DM_NguoiTao"]);
            }
            if (rd.FieldExists("DM_NguoiSua"))
            {
                Item.NguoiSua = (String)(rd["DM_NguoiSua"]);
            }
            if (rd.FieldExists("DM_NgayCapNhat"))
            {
                Item.NgayCapNhat = (DateTime)(rd["DM_NgayCapNhat"]);
            }
            if (rd.FieldExists("DM_KeyWords"))
            {
                Item.KeyWords = (String)(rd["DM_KeyWords"]);
            }
            if (rd.FieldExists("DM_Description"))
            {
                Item.Description = (String)(rd["DM_Description"]);
            }
            if (rd.FieldExists("DM_RowId"))
            {
                Item.RowId = (Guid)(rd["DM_RowId"]);
            }
            if (rd.FieldExists("DM_Deleted"))
            {
                Item.Deleted = (Boolean)(rd["DM_Deleted"]);
            }

            if (rd.FieldExists("LDM_Ten"))
            {
                Item.LDM_Ten = (String)(rd["LDM_Ten"]);
            }
            if (rd.FieldExists("DM_Level"))
            {
                Item.Level = (Int32)(rd["DM_Level"]);
            }
            if (rd.FieldExists("PID_Ten"))
            {
                Item.PID_Ten = (String)(rd["PID_Ten"]);
            }
            return(Item);
        }