示例#1
0
        private void LoadList()
        {
            cmbWebTypeId.Items.Clear();
            var webTypeList = DbEntityAccess.GetList <WebType>(" and EnumDic=" + (int)EnumDic.WebType);

            cmbWebTypeId.Items.AddRange(webTypeList.ToArray());
            if (cmbWebTypeId.Items.Count > 0)
            {
                cmbWebTypeId.SelectedIndex = 0;
            }
            cmbData.Items.Clear();
            string[] tempList = Config.SuitTblName.Split(',').Where(m => !string.IsNullOrEmpty(m)).ToArray();
            cmbData.Items.AddRange(tempList);
            if (cmbData.Items.Count > 0)
            {
                cmbData.SelectedIndex = 0;
            }

            lsbMain.Items.Clear();
            lsbMain.Items.Add("加载中...");
            this.Refresh();
            lsbMain.Items.Clear();
            List <StepSetting> list = DbEntityAccess.GetList <StepSetting>();

            foreach (StepSetting item in list)
            {
                item.StepDetailSetting = DbEntityAccess.GetList <StepDetailSetting>(" and StepSettingId=" + item.Id);
            }
            lsbMain.Items.AddRange(list.ToArray());
            if (lsbMain.Items.Count > 0)
            {
                lsbMain.SelectedIndex = 0;
            }
        }
示例#2
0
        /// <summary>
        /// 测试数据库方法
        /// </summary>
        /// <param name="args"></param>
        static void Main2222(string[] args)
        {
            ////新增
            //StepSetting ss = new StepSetting();
            //ss.Name = "必应6";
            //ss.CreateDate = DateTime.Now;
            //ss.Url = "www.bing.com6";
            //ss.Remark = "111";
            //DbEntityAccess.Add(ss);
            //Console.WriteLine("主键ID:" + ss.Id);

            //var newModel = DbEntityAccess.GetModel<StepSetting>(2);
            //Console.WriteLine(@"更改前的值:" + newModel.ToJson());
            ////编辑
            //StepSetting ss = new StepSetting();
            //ss.Id = 2;
            //ss.Name = "必应3213312";
            //ss.CreateDate = DateTime.Now;
            //ss.Url = "cn.bing.com32131231";
            //DbEntityAccess.Update(ss);
            //newModel = DbEntityAccess.GetModel<StepSetting>(2);
            //Console.WriteLine(@"更改后的值:" + newModel.ToJson());

            //删除
            //StepSetting ss = new StepSetting();
            //ss.Name = "测试";
            //ss.CreateDate = DateTime.Now;
            //ss.Url = "www.bing.com";
            //DbEntityAccess.Add(ss);
            //Console.WriteLine(@"新增入的:" + ss.ToJson());
            //DbEntityAccess.Delete<StepSetting>(ss.Id);
            //Console.WriteLine(@"删除刚添加入的主键ID:" + ss.Id);

            var list = DbEntityAccess.GetList <StepSetting>();

            Console.WriteLine(@"总条数:" + list.Count);
            Console.WriteLine(list.ToJson());
            int count = 0;
            var list2 = DbEntityAccess.GetListByPage <StepSetting>(ref count, null, 3, 2, "OpDate", true);

            Console.WriteLine(@"总条数2:" + count);
            Console.WriteLine(list2.ToJson());
            Console.Read();
        }