示例#1
0
        public List <Page> Get()
        {
            // 세션이 끊긴 상태
            if (DWUserInfo == null || DWUserInfo.ID == 0)
            {
                Response.StatusCode = 600;

                return(null);
            }

            try
            {
                using (var db = new DWContext())
                {
                    List <Page>   list = new List <Page>();
                    KPIController kpi  = new KPIController();

                    using (MySqlConnection conn = new MySqlConnection(db.ConnectionString))
                    {
                        conn.Open();
                        MySqlCommand cmd = new MySqlCommand("select * from pages where userID = '" + DWUserInfo.UserID + "' and companyCode = '" + DWUserInfo.CompanyCode + "' order by seq asc", conn);

                        using (var reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                list.Add(new Page()
                                {
                                    ID     = Convert.ToInt32(reader["Id"]),
                                    Seq    = Convert.ToInt32(reader["Seq"]),
                                    KPIs   = kpi.GetKpiByPage(Convert.ToInt32(reader["Id"]), DWUserInfo.CompanyCode.ToString()),
                                    Title  = reader["Title"].ToString(),
                                    Layout = reader["Layout"].ToString()
                                });
                            }
                        }
                    }

                    return(list);
                }
            }
            catch (Exception ex)
            {
                List <Page> p  = new List <Page>();
                Page        p1 = new Page();
                p1.Title = ex.Message;
                p.Add(p1);

                Page p2 = new Page();
                p2.Title = ex.InnerException.Message;
                p.Add(p2);
                return(p);
            }
        }
示例#2
0
 private List <KPI> GetKPIs(int v, KPIController c, DWBIUser user, string companyCode)
 {
     return(c.GetKpiByPage(v, companyCode));
 }