Beispiel #1
0
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public List <Entity.PlanEntity> getpage(int pageSize, int pageNum, out int count, string str)
        {
            string select, table, where, order;

            select = " * ";

            table = "[OA_Plan] ";

            StringBuilder sb = new StringBuilder();

            sb.Append(" ( 1 = 1 ) " + str);

            where = sb.ToString();

            order = "Pwid";

            string sql = "exec Pagination @select, @table, @where, @orderField, @orderType, @pageSize, @pageNum ";

            SqlParameter[] paras =
            {
                new SqlParameter("@select",     select),
                new SqlParameter("@table",      table),
                new SqlParameter("@where",      where),
                new SqlParameter("@orderField", order),
                new SqlParameter("@orderType",  '1'),
                new SqlParameter("@pageSize",   pageSize),
                new SqlParameter("@pageNum",    pageNum)
            };

            DataSet ds = DbHelperSQL.Query(sql, paras);

            count = Convert.ToInt32(ds.Tables[1].Rows[0][0]);

            List <Entity.PlanEntity> list = new List <Entity.PlanEntity>();

            Entity.PlanEntity model;

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                model = new Entity.PlanEntity();

                if (ds.Tables[0].Rows[i]["Pwid"].ToString() != "")
                {
                    model.Pwid = int.Parse(ds.Tables[0].Rows[i]["Pwid"].ToString());
                }
                model.Locked  = ds.Tables[0].Rows[i]["Locked"].ToString();
                model.Pwtitle = ds.Tables[0].Rows[i]["Pwtitle"].ToString();
                model.Pwdate  = Convert.ToDateTime(ds.Tables[0].Rows[i]["Pwdate"].ToString());
                model.Manager = ds.Tables[0].Rows[i]["Manager"].ToString();
                model.Uid     = Convert.ToInt32(ds.Tables[0].Rows[i]["Uid"].ToString());
                model.Pwpath  = ds.Tables[0].Rows[i]["Pwpath"].ToString();
                list.Add(model);
            }

            return(list);
        }
Beispiel #2
0
        public static PlanEntity Detailplan(string Id)
        {
            PlanEntity planEntity = new Entity.PlanEntity();

            using (fitnessEntities dbe = new fitnessEntities())
            {
                plan plan = dbe.plans.Where(o => o.plan_id.Equals(Id)).SingleOrDefault();
                planEntity.plan_id     = plan.plan_id;
                planEntity.plan_name   = plan.plan_name;
                planEntity.plan_cost   = plan.plan_cost;
                planEntity.plan_period = plan.plan_period;
            }
            return(planEntity);
        }
Beispiel #3
0
        public static List <PlanEntity> Getplans()
        {
            List <PlanEntity> plans = new List <Entity.PlanEntity>();

            using (fitnessEntities dbe = new fitnessEntities())
            {
                PlanEntity planEntity;
                var        planList = dbe.plans.ToList();
                foreach (var plan in planList)
                {
                    planEntity             = new Entity.PlanEntity();
                    planEntity.plan_id     = plan.plan_id;
                    planEntity.plan_name   = plan.plan_name;
                    planEntity.plan_cost   = plan.plan_cost;
                    planEntity.plan_period = plan.plan_period;


                    plans.Add(planEntity);
                }
            }
            return(plans);
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public List<Entity.PlanEntity> getpage(int pageSize, int pageNum, out int count, string str)
        {
            string select, table, where, order;

            select = " * ";

            table = "[OA_Plan] ";

            StringBuilder sb = new StringBuilder();
            sb.Append(" ( 1 = 1 ) " + str);

            where = sb.ToString();

            order = "Pwid";

            string sql = "exec Pagination @select, @table, @where, @orderField, @orderType, @pageSize, @pageNum ";

            SqlParameter[] paras ={
                new SqlParameter("@select",     select),
                new SqlParameter("@table",      table),
                new SqlParameter("@where",      where),
                new SqlParameter("@orderField", order),
                new SqlParameter("@orderType",  '1'),
                new SqlParameter("@pageSize",   pageSize),
                new SqlParameter("@pageNum",    pageNum)
            };

            DataSet ds = DbHelperSQL.Query(sql, paras);

            count = Convert.ToInt32(ds.Tables[1].Rows[0][0]);

            List<Entity.PlanEntity> list = new List<Entity.PlanEntity>();
            Entity.PlanEntity model;

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                model = new Entity.PlanEntity();

                if (ds.Tables[0].Rows[i]["Pwid"].ToString() != "")
                {
                    model.Pwid = int.Parse(ds.Tables[0].Rows[i]["Pwid"].ToString());
                }
                model.Locked = ds.Tables[0].Rows[i]["Locked"].ToString();
                model.Pwtitle = ds.Tables[0].Rows[i]["Pwtitle"].ToString();
                model.Pwdate = Convert.ToDateTime(ds.Tables[0].Rows[i]["Pwdate"].ToString());
                model.Manager = ds.Tables[0].Rows[i]["Manager"].ToString();
                model.Uid = Convert.ToInt32(ds.Tables[0].Rows[i]["Uid"].ToString());
                model.Pwpath = ds.Tables[0].Rows[i]["Pwpath"].ToString();
                list.Add(model);
            }

            return list;
        }