Esempio n. 1
0
        protected override void OnLoad(EventArgs e)
        {
            #region GridControl中特殊字段绑定
            DataTable dicDpt = Tmo_FakeEntityClient.Instance.GetData("tmo_department", new[] { "dpt_id", "dpt_name", "dpt_parent" }, "dpt_id in (" + TmoComm.login_docInfo.children_department + "," + TmoComm.login_docInfo.doc_department + ")");
            DataRow   dr1    = dicDpt.NewRow();
            dr1["dpt_id"] = -1; dr1["dpt_name"] = "无部门";
            dicDpt.Rows.Add(dr1);
            TSCommon.BindRepositoryImageComboBox(rp_doc_department, dicDpt, "dpt_name", "dpt_id");

            DataTable dicGroup   = MemoryCacheHelper.GetCacheItem <DataTable>("tmo_docgroup", () => Tmo_FakeEntityClient.Instance.GetData("tmo_docgroup", new[] { "group_id", "group_name" }, "group_level>=" + TmoComm.login_docInfo.doc_group_level), DateTime.Now.AddMinutes(5));
            DataTable dicGroupCp = dicGroup.Copy();
            DataRow   dr2        = dicGroupCp.NewRow();
            dr2["group_id"] = -1; dr2["group_name"] = "无群组";
            dicGroupCp.Rows.Add(dr2);
            TSCommon.BindRepositoryImageComboBox(rp_doc_group, dicGroupCp, "group_name", "group_id");
            #endregion

            #region 查询条件绑定
            UCTreeListSelector selCheck = new UCTreeListSelector(false);
            DataRow[]          drs      = dicDpt.Select("dpt_id=" + TmoComm.login_docInfo.doc_department);
            for (int i = 0; i < drs.Length; i++)
            {
                dicDpt.Rows.Remove(drs[i]);
            }
            selCheck.InitData(doc_department, dicDpt, "dpt_id", "dpt_parent", "dpt_name", true);

            TSCommon.BindImageComboBox(doc_group, dicGroup, "", "group_name", "group_id", true);
            #endregion

            base.OnLoad(e);
        }
Esempio n. 2
0
        protected override void OnFirstLoad()
        {
            #region GridControl中特殊字段绑定

            //读取民族数据
            DataTable dicNation = MemoryCacheHelper.GetCacheItem <DataTable>("nationality",
                                                                             () => { return(Tmo_FakeEntityClient.Instance.GetData("tmo_nationality", new[] { "code", "name" })); },
                                                                             DateTime.Now.AddHours(24)); //由于民族数据基本不变 24小时过期
            TSCommon.BindRepositoryImageComboBox(rp_nation, dicNation, "name", "code");
            //绑定职业类型
            DataTable dicOccupation = MemoryCacheHelper.GetCacheItem <DataTable>("occupation",
                                                                                 () => { return(Tmo_FakeEntityClient.Instance.GetData("tmo_occupation")); }, DateTime.Now.AddHours(24));
            TSCommon.BindRepositoryImageComboBox(rp_occupagtion, dicOccupation, "name", "code");
            //绑定文化程度
            DataTable dicEducation = MemoryCacheHelper.GetCacheItem <DataTable>("education",
                                                                                () => { return(Tmo_FakeEntityClient.Instance.GetData("tmo_education")); }, DateTime.Now.AddHours(24));
            TSCommon.BindRepositoryImageComboBox(rp_education, dicEducation, "name", "code");
            //绑定婚姻状况
            DataTable dicMarital = MemoryCacheHelper.GetCacheItem <DataTable>("marital", () => { return(Tmo_FakeEntityClient.Instance.GetData("tmo_marital")); },
                                                                              DateTime.Now.AddHours(24));
            TSCommon.BindRepositoryImageComboBox(rp_marital, dicMarital, "name", "code");

            #endregion

            #region 查询条件绑定

            //绑定省数据
            DataTable dicProvincecode = MemoryCacheHelper.GetCacheItem <DataTable>("provincecode",
                                                                                   () => Tmo_FakeEntityClient.Instance.GetData("tmo_provincecode"), DateTime.Now.AddHours(24));
            province_id.SelectedValueChanged += (object sender0, EventArgs e0) =>
            {
                //绑定市数据
                city_id.Enabled = province_id.EditValue != null;
                DataTable dicCitycode = MemoryCacheHelper.GetCacheItem <DataTable>("citycode", () => Tmo_FakeEntityClient.Instance.GetData("tmo_citycode"),
                                                                                   DateTime.Now.AddHours(24));
                TSCommon.BindImageComboBox(city_id, dicCitycode, "province_id='" + province_id.EditValue + "'", "city_name", "city_id", true);
            };
            city_id.SelectedValueChanged += (object sender0, EventArgs e0) =>
            {
                //绑定区数据
                eare_id.Enabled = city_id.EditValue != null;
                DataTable dicAreacode = MemoryCacheHelper.GetCacheItem <DataTable>("areacode", () => Tmo_FakeEntityClient.Instance.GetData("tmo_areacode"),
                                                                                   DateTime.Now.AddHours(24));
                TSCommon.BindImageComboBox(eare_id, dicAreacode, "city_id='" + city_id.EditValue + "'", "area_name", "area_id", true);
            };
            TSCommon.BindImageComboBox(province_id, dicProvincecode, null, "province_name", "province_id", true);

            dteBirthdayBegin.DateTime  = TmoShare.TodayBegin;
            dteBirthdayEnd.DateTime    = TmoShare.TodayEnd;
            dteInputTimeBegin.DateTime = TmoShare.TodayBegin;
            dteInputTimeEnd.DateTime   = TmoShare.TodayEnd;
            ckInputTime_CheckedChanged(null, null);
            ckBirthday_CheckedChanged(null, null);

            #endregion

            DataTable dicDpt = Tmo_FakeEntityClient.Instance.GetData("tmo_department", new[] { "dpt_id", "dpt_name", "dpt_parent" },
                                                                     "dpt_id in (" + TmoComm.login_docInfo.children_department + ")");
            selCheck.InitData(dpt_id, dicDpt, "dpt_id", "dpt_parent", "dpt_name", true);

            base.OnFirstLoad();
        }