예제 #1
0
        public static MauTaiLieu Insert(MauTaiLieu Inserted)
        {
            MauTaiLieu Item = new MauTaiLieu();

            SqlParameter[] obj = new SqlParameter[13];
            obj[0]  = new SqlParameter("MTL_DM_ID", Inserted.DM_ID);
            obj[1]  = new SqlParameter("MTL_DM_Ten", Inserted.DM_Ten);
            obj[2]  = new SqlParameter("MTL_DM_Ma", Inserted.DM_Ma);
            obj[3]  = new SqlParameter("MTL_DM_KyHieu", Inserted.DM_KyHieu);
            obj[4]  = new SqlParameter("MTL_Ten", Inserted.Ten);
            obj[5]  = new SqlParameter("MTL_Check", Inserted.Check);
            obj[6]  = new SqlParameter("MTL_RowId", Inserted.RowId);
            obj[7]  = new SqlParameter("MTL_NguoiTao", Inserted.NguoiTao);
            obj[8]  = new SqlParameter("MTL_NguoiSua", Inserted.NguoiSua);
            obj[9]  = new SqlParameter("MTL_NgayTao", Inserted.NgayTao);
            obj[10] = new SqlParameter("MTL_NgayCapNhat", Inserted.NgayCapNhat);
            obj[11] = new SqlParameter("MTL_Loai", Inserted.Loai);
            obj[12] = new SqlParameter("MTL_SoLuong", Inserted.SoLuong);
            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblMauTaiLieu_Insert_InsertNormal_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
예제 #2
0
        public static MauTaiLieu SelectById(Int32 MTL_ID)
        {
            MauTaiLieu Item = new MauTaiLieu();

            SqlParameter[] obj = new SqlParameter[1];
            obj[0] = new SqlParameter("MTL_ID", MTL_ID);
            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblMauTaiLieu_Select_SelectById_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
예제 #3
0
        public static MauTaiLieu getFromReader(IDataReader rd)
        {
            MauTaiLieu Item = new MauTaiLieu();

            if (rd.FieldExists("MTL_ID"))
            {
                Item.ID = (Int32)(rd["MTL_ID"]);
            }
            if (rd.FieldExists("MTL_DM_ID"))
            {
                Item.DM_ID = (Int32)(rd["MTL_DM_ID"]);
            }
            if (rd.FieldExists("MTL_DM_Ten"))
            {
                Item.DM_Ten = (String)(rd["MTL_DM_Ten"]);
            }
            if (rd.FieldExists("MTL_SoLuong"))
            {
                Item.SoLuong = (Int32)(rd["MTL_SoLuong"]);
            }
            if (rd.FieldExists("MTL_DM_Check"))
            {
                Item.DM_Check = (Int32)(rd["MTL_DM_Check"]);
            }
            if (rd.FieldExists("MTL_DM_Ma"))
            {
                Item.DM_Ma = (String)(rd["MTL_DM_Ma"]);
            }
            if (rd.FieldExists("MTL_DM_KyHieu"))
            {
                Item.DM_KyHieu = (String)(rd["MTL_DM_KyHieu"]);
            }
            if (rd.FieldExists("MTL_Ten"))
            {
                Item.Ten = (String)(rd["MTL_Ten"]);
            }
            if (rd.FieldExists("MTL_Check"))
            {
                Item.Check = (Boolean)(rd["MTL_Check"]);
            }
            if (rd.FieldExists("MTL_RowId"))
            {
                Item.RowId = (Guid)(rd["MTL_RowId"]);
            }
            if (rd.FieldExists("MTL_NguoiTao"))
            {
                Item.NguoiTao = (String)(rd["MTL_NguoiTao"]);
            }
            if (rd.FieldExists("MTL_NguoiSua"))
            {
                Item.NguoiSua = (String)(rd["MTL_NguoiSua"]);
            }
            if (rd.FieldExists("MTL_NgayTao"))
            {
                Item.NgayTao = (DateTime)(rd["MTL_NgayTao"]);
            }
            if (rd.FieldExists("MTL_NgayCapNhat"))
            {
                Item.NgayCapNhat = (DateTime)(rd["MTL_NgayCapNhat"]);
            }
            if (rd.FieldExists("MTL_Loai"))
            {
                Item.Loai = (Int32)(rd["MTL_Loai"]);
            }
            return(Item);
        }