// GET: Default
        public ActionResult Index()
        {
            /*
             * string sql = "select distinct(线长工号)+',' from 线长人员设置 where rtrim(在职状态)='在职在岗' for xml path('')";
             * string result = client.GetModel<string>(sql);
             * result = "'" + result.TrimEnd(',').Replace(",", "','") + "'";
             * ViewBag.Test = result;*/
            /*
             * DataTable dt = new DataTable();
             * dt.Columns.Add("自动", typeof(string));
             * dt.Columns.Add("工号1", typeof(string));
             * dt.Columns.Add("打卡时间1", typeof(DateTime));
             *
             * for (int i = 0; i < 100; i++)
             * {
             *  DataRow dr = dt.NewRow();
             *  dr[0] = "";
             *  dr[1] = "aa" + i;
             *  dr[2] = System.DateTime.Now;
             *  dt.Rows.Add(dr);
             * }
             * DBHelper.BulkInsert(dt, "任务_考勤");*/

            ViewBag.List = client.GetList <UserInfo>();
            return(View());
        }
        public ActivityModel GetActivityById(int actid)
        {
            string sql = string.Format(@" select ActId,ActName,ActStartTime,ActEndTime,ActIsWechat,ActMustSubscribe,ActMustLogin,ActIsEnable,ActMemo,Design_Introduce
                                    From Fct_Activity where ActId={0} and Disabled=0 ", actid);
            List <ActivityModel> list = dapper.GetList <ActivityModel>(sql).Result;

            return(list == null ? null : list.FirstOrDefault());
        }
        /// <summary>
        /// 获取数据源
        /// </summary>
        /// <param name="Page"></param>
        /// <param name="Rows"></param>
        /// <param name="Search"></param>
        /// <returns></returns>
        public async Task <TableViewModel> FindListAsync(int Page, int Rows, Fct_Activity act)
        {
            PagerModel model    = new PagerModel();
            string     strWhere = "  Disabled=0 ";

            if (act == null)
            {
                act = new Fct_Activity();
            }
            if (!string.IsNullOrEmpty(act.ActName))
            {
                strWhere += " and  ( ActId=" + ConvertUtils.ConvertToInt(act.ActName) + " or  ActName=" + act.ActName + " ) ";
            }
            model.SortField = " ActId ";
            string table  = @" dbo.Fct_Activity  ";
            string fields = @"     [ActId]
                                      ,[ActGuId]
                                      ,[ActName]
                                      ,[ActStartTime]
                                      ,[ActEndTime]
                                      ,[ActIsWechat]
                                      ,[ActMustSubscribe]
                                      ,[ActMustLogin]
                                      ,[ActIsEnable]
                                      ,[ActMemo]
                                      ,[Disabled]
                                      ,[CreateTime]
                                      ,[CreateBy]
                                      ,[ModifyTime]
                                      ,[ModifyBy]
                                      ,[Design_Introduce]";
            var    param  = new DynamicParameters();

            param.Add("@PageIndex", model.PageIndex);
            param.Add("@PageSize", model.PageSize);
            param.Add("@TableName", table);
            param.Add("@OrderFields", model.SortField);
            param.Add("@Fields", fields);
            param.Add("@Where", strWhere);
            //param.Add("@OrderType", model.SortDirection);
            //param.Add("@IsDistinct", 1);
            param.Add("@RecordCount", 0, DbType.Int32, ParameterDirection.Output);
            //var data = base.dapper.GetList<Fct_Activity>("Page_Query", param, CommandType.StoredProcedure);

            var data = await dapper.GetList <Fct_Activity>("Page_Query", param, CommandType.StoredProcedure);

            model.RecordCount = param.Get <int>("@RecordCount");
            return(this.db.DataAsTableViewModel(data, Page, Rows, model.RecordCount, typeof(Fct_Activity)));
        }