示例#1
0
        private void BindData()
        {
            txtTenHang.Text = matHang.TenMatHang;
            //txtSoLuongHop.Text =
            txtSoLuong.Text                 = matHang.SoLuong.HasValue ? matHang.SoLuong.Value.ToString() : "";
            txtSoLop.Text                   = matHang.SoLop.HasValue ? matHang.SoLop.Value.ToString() : "";
            txtSong.Text                    = matHang.TenSong;
            txtChieuDai.Text                = matHang.ChieuDai.HasValue ? matHang.ChieuDai.Value.ToString() : "";
            txtChieuRong.Text               = matHang.ChieuRong.HasValue ? matHang.ChieuRong.Value.ToString() : "";
            txtChieuCao.Text                = matHang.ChieuCao.HasValue ? matHang.ChieuCao.Value.ToString() : "";
            dropLoaiHop.SelectedValue       = matHang.IDLoaiSanPham.HasValue ? matHang.IDLoaiSanPham.Value.ToString() : "";
            dropLoaiKichThuoc.SelectedValue = matHang.IDLoaiKichThuoc.HasValue ? matHang.IDLoaiKichThuoc.Value.ToString() : "";
            int solop = matHang.SoLop.HasValue ? matHang.SoLop.Value : 0;



            dropLoaiSong.DataSource = (from t in dts.Sp_Qlsx_PhanLoaiSong_Select(0, (int?)null, null, 0, true, null)
                                       where t.SoLop == matHang.SoLop
                                       select new
            {
                ID = t.ID,
                MoTaCoCauGiay = t.KiHieuCoCauGiay.Trim() + "-" + t.MoTaCoCauGiay
            });
            dropLoaiSong.DataTextField  = "MoTaCoCauGiay";
            dropLoaiSong.DataValueField = "ID";
            dropLoaiSong.DataBind();

            if (matHang.IDLoaiKichThuoc.HasValue)
            {
                var loaiKT = dts.Sp_Qldh_LoaiKichThuoc_Select(1, matHang.IDLoaiKichThuoc.Value, (int?)null, (int?)null, "").FirstOrDefault();
                MaLoaiKichThuoc = loaiKT == null ? "" : loaiKT.MaHieuKichThuoc.ToUpper().Trim();
                if (loaiKT != null && loaiKT.HeSoChatDai.HasValue)
                {
                    this.HeSoChatDai = loaiKT.HeSoChatDai.Value;
                }
            }
            var x = (from t in dts.Sp_Qldh_HeSoTongDao_Select(0, (int?)null, (int?)null, (int?)null, "") where t.IDLoaiKichThuoc == matHang.IDLoaiKichThuoc && t.SoLop == matHang.SoLop select t).FirstOrDefault();

            HeSoTongDao = x == null || !x.HeSoTongDao.HasValue ? 0 : x.HeSoTongDao.Value;
        }
示例#2
0
 protected void BindData(string key)
 {
     if (!string.IsNullOrEmpty(key))
     {
         xRPDataContext dataContext = new xRPDataContext();
         CollectionPager1.MaxPages      = 10000;
         CollectionPager1.PageSize      = 10;
         CollectionPager1.DataSource    = dataContext.Sp_Qlsx_PhanLoaiSong_Select(-1, null, null, 0, null, key).ToList();
         CollectionPager1.BindToControl = rptPhanLoaiSong;
         rptPhanLoaiSong.DataSource     = CollectionPager1.DataSourcePaged;
         rptPhanLoaiSong.DataBind();
     }
     else
     {
         xRPDataContext dataContext = new xRPDataContext();
         CollectionPager1.MaxPages      = 10000;
         CollectionPager1.PageSize      = 10;
         CollectionPager1.DataSource    = dataContext.Sp_Qlsx_PhanLoaiSong_Select(0, null, null, 0, null, "").ToList();
         CollectionPager1.BindToControl = rptPhanLoaiSong;
         rptPhanLoaiSong.DataSource     = CollectionPager1.DataSourcePaged;
         rptPhanLoaiSong.DataBind();
     }
 }