예제 #1
0
        //数据绑定
        private void BindData()
        {
            Hashtable ht = new Hashtable();

            ht.Add("strKey", tbxSearchKey.Text.ToString());
            gvHospitalitem.AutoGenerateColumns = false;
            //实现List排序,否则无法点击表头按列重新排序
            BindingCollection <VDAListests> list = new BindingCollection <VDAListests>();

            foreach (VDAListests vdaListtest in dalisttestsBll.GetDaListestsList(ht))
            {
                list.Add(vdaListtest);
            }
            bsHospitalitem.DataSource = list;
            lblRecord.Text            = string.Format("共 {0} 条记录", list.Count);
        }
예제 #2
0
        public FrmItemHospitalAndDaanSetting2(DataTable _cacheGroupTestdetail)
        {
            InitializeComponent();


            cacheGroupTestdetail = _cacheGroupTestdetail;

            gvGroupHospital.AutoGenerateColumns = false;
            gvItemHospital.AutoGenerateColumns  = false;
            gvGroupDaan.AutoGenerateColumns     = false;
            gvItemDaan.AutoGenerateColumns      = false;

            //获取基础数据
            cacheVDAList = dalisttestsBll.GetDaListestsList(null);
            cacheDaList  = dicttestitemBll.SelectDADicttestitem(null);
        }
        //数据绑定
        private void BindData()
        {
            Hashtable ht = new Hashtable();

            ht.Add("strKey", tbxSearchKey.Text.ToString());
            gvItemHospitalAndDaan.AutoGenerateColumns = false;
            #region 把存在对应关系的数据合并到序列里,再绑定
            //获取数据
            cacheVDAList = dalisttestsBll.GetDaListestsList(ht);
            List <VDAListests> List = cacheVDAList;
            cacheMapList = new DATestmapBLL().GetDATestmapList(ht);
            //保存多个对照的列表
            List <VDAListests> mulVL = new List <VDAListests>();
            int cacheCount           = cacheVDAList.Count;
            for (int j = 0; j < cacheCount; j++)
            {
                VDAListests vdl = cacheVDAList[j];
                //选择存在对应关系的序列值
                var result = (from a in cacheMapList
                              where a.Customertestcode == vdl.Testcode
                              group a by new { a.Testmapid, a.Datestname, a.Datestcode, a.Customertestcode, a.Customertestname } into g
                              select new
                {
                    g.Key.Testmapid,
                    g.Key.Datestname,
                    g.Key.Datestcode,
                    g.Key.Customertestcode,
                    g.Key.Customertestname
                }).ToArray();
                if (result.Length > 0)
                {
                    for (int i = 0; i < result.Length; i++)
                    {
                        //if (i != 0)
                        //{
                        //    VDAListests dl = new VDAListests();
                        //    dl.Testmapid = vdl.Testmapid;
                        //    dl.Testcode = vdl.Testcode;
                        //    dl.Testname = vdl.Testname;
                        //    dl.Isgroup = vdl.Isgroup;
                        //    dl.Shortname = vdl.Shortname;
                        //    dl.Fastcode = vdl.Fastcode;
                        //    dl.Englishname = vdl.Englishname;
                        //    dl.Engshortname = vdl.Engshortname;
                        //    dl.Testtype = vdl.Testtype;
                        //    dl.Testmethod = vdl.Testmethod;
                        //    dl.Testmapid = result[i].Testmapid;
                        //    dl.Datestcode = result[i].Datestcode.ToString();
                        //    dl.Datestname = result[i].Datestname.ToString();
                        //    dl.Customertestcode = result[i].Customertestcode.ToString();
                        //    dl.Customertestname = result[i].Customertestname.ToString();
                        //    cacheVDAList.Add(dl);
                        //}
                        //else
                        //{
                        //    vdl.Testmapid = result[i].Testmapid;
                        //    vdl.Datestcode = result[i].Datestcode.ToString();
                        //    vdl.Datestname = result[i].Datestname.ToString();
                        //    vdl.Customertestcode = result[i].Customertestcode.ToString();
                        //    vdl.Customertestname = result[i].Customertestname.ToString();
                        //}

                        vdl.Testmapid        = result[i].Testmapid;
                        vdl.Datestcode      += i == result.Length - 1 ? result[i].Datestcode.ToString() : result[i].Datestcode.ToString() + " ,";
                        vdl.Datestname      += i == result.Length - 1 ? result[i].Datestname.ToString() : result[i].Datestname.ToString() + " ,";
                        vdl.Customertestcode = result[i].Customertestcode.ToString();
                        vdl.Customertestname = result[i].Customertestname.ToString();
                    }
                }
            }
            #endregion
            //默认对序列按项目名字排序
            var v = from c in cacheVDAList orderby c.Testname select c;
            cacheVDAList = v.ToList();
            //实现List排序,否则无法点击表头按列重新排序
            BindingCollection <VDAListests> list = new BindingCollection <VDAListests>();
            foreach (VDAListests vdl in cacheVDAList)
            {
                list.Add(vdl);
            }
            bsItemHospitalAndDaan.DataSource        = list;
            gvItemHospitalAndDaan.Columns[0].Frozen = true;
            lblRecord.Text = string.Format("共 {0} 条记录", list.Count);
        }