Exemple #1
0
        public LandingPublishDO GetLandingPublish(int accountId, int accountTypeId, int version)
        {
            LandingPublishDO lp = null;

            DataTable dtLandingPublish = _objLandingDAL.GetLandingPublish(accountId, accountTypeId);

            if (dtLandingPublish.Rows.Count > 0)
            {
                lp                = new LandingPublishDO();
                lp.PublishId      = Convert.ToInt32(dtLandingPublish.Rows[0]["PublishId"]);
                lp.AccountId      = Convert.ToInt32(dtLandingPublish.Rows[0]["AccountId"]);
                lp.AccountTypeId  = Convert.ToInt32(dtLandingPublish.Rows[0]["AccountTypeId"]);
                lp.BannerId       = Convert.ToInt32(dtLandingPublish.Rows[0]["BannerId"]);
                lp.DefaultVersion = Convert.ToInt32(dtLandingPublish.Rows[0]["DefaultVersion"]);

                if (version == 0)
                {
                    version = 1; //lp.DefaultVersion;
                }
                DataTable dtLanding = _objLandingDAL.GetLanding(lp.PublishId, version);
                LandingDO l         = new LandingDO();

                if (dtLanding.Rows.Count > 0)
                {
                    l.LandingId    = Convert.ToInt32(dtLanding.Rows[0]["LandingId"]);
                    l.PublishId    = Convert.ToInt32(dtLanding.Rows[0]["PublishId"]);
                    l.DepartmentId = (String.IsNullOrEmpty(dtLanding.Rows[0]["DepartmentId"].ToString())) ? 0 : Convert.ToInt32(dtLanding.Rows[0]["DepartmentId"]);
                    l.Forms        = dtLanding.Rows[0]["Forms"].ToString();
                    //l.CreatedOn = Convert.ToDateTime(dtLanding.Rows[0]["CreatedOn"]);
                    //l.ModifiedOn = Convert.ToDateTime(dtLanding.Rows[0]["ModifiedOn"]);
                    l.Version  = Convert.ToInt32(dtLanding.Rows[0]["Version"]);
                    l.MainTabs = new List <MainTabDO>();

                    lp.Landing = l;

                    DataTable dtMainTabs = _objLandingDAL.GetMainTabs(l.LandingId);
                    MainTabDO m;
                    foreach (DataRow dr in dtMainTabs.Rows)
                    {
                        m                = new MainTabDO();
                        m.MainTabId      = Convert.ToInt32(dr["MainTabId"]);
                        m.MainTabName    = dr["MainTabName"].ToString();
                        m.MainTabContent = dr["MainTabContent"].ToString();
                        m.LandingId      = Convert.ToInt32(dr["LandingId"]);
                        m.SubTabs        = new List <SubTabDO>();

                        DataTable dtSubTabs = _objLandingDAL.GetSubTabs(m.MainTabId);
                        SubTabDO  s;
                        foreach (DataRow subdr in dtSubTabs.Rows)
                        {
                            s               = new SubTabDO();
                            s.SubTabId      = Convert.ToInt32(subdr["SubTabId"]);
                            s.SubTabName    = subdr["SubTabName"].ToString();
                            s.SubTabContent = subdr["SubTabContent"].ToString();
                            s.MainTabId     = Convert.ToInt32(subdr["MainTabId"]);
                            m.SubTabs.Add(s);
                        }

                        l.MainTabs.Add(m);
                    }
                }
                else
                {
                    lp.Landing = null;
                }
            }

            return(lp);
        }
        public LandingPublishDO GetLandingPublish(int accountId, int accountTypeId, int version)
        {
            LandingPublishDO lp = null;

            DataTable dtLandingPublish = _objLandingDAL.GetLandingPublish(accountId, accountTypeId);
            if (dtLandingPublish.Rows.Count > 0)
            {
                lp = new LandingPublishDO();
                lp.PublishId = Convert.ToInt32(dtLandingPublish.Rows[0]["PublishId"]);
                lp.AccountId = Convert.ToInt32(dtLandingPublish.Rows[0]["AccountId"]);
                lp.AccountTypeId = Convert.ToInt32(dtLandingPublish.Rows[0]["AccountTypeId"]);
                lp.BannerId = Convert.ToInt32(dtLandingPublish.Rows[0]["BannerId"]);
                lp.DefaultVersion = Convert.ToInt32(dtLandingPublish.Rows[0]["DefaultVersion"]);

                if (version == 0)
                    version = 1; //lp.DefaultVersion;

                DataTable dtLanding = _objLandingDAL.GetLanding(lp.PublishId, version);
                LandingDO l = new LandingDO();

                if (dtLanding.Rows.Count > 0)
                {
                    l.LandingId = Convert.ToInt32(dtLanding.Rows[0]["LandingId"]);
                    l.PublishId = Convert.ToInt32(dtLanding.Rows[0]["PublishId"]);
                    l.DepartmentId = (String.IsNullOrEmpty(dtLanding.Rows[0]["DepartmentId"].ToString())) ? 0 : Convert.ToInt32(dtLanding.Rows[0]["DepartmentId"]);
                    l.Forms = dtLanding.Rows[0]["Forms"].ToString();
                    //l.CreatedOn = Convert.ToDateTime(dtLanding.Rows[0]["CreatedOn"]);
                    //l.ModifiedOn = Convert.ToDateTime(dtLanding.Rows[0]["ModifiedOn"]);
                    l.Version = Convert.ToInt32(dtLanding.Rows[0]["Version"]);
                    l.MainTabs = new List<MainTabDO>();

                    lp.Landing = l;

                    DataTable dtMainTabs = _objLandingDAL.GetMainTabs(l.LandingId);
                    MainTabDO m;
                    foreach (DataRow dr in dtMainTabs.Rows)
                    {
                        m = new MainTabDO();
                        m.MainTabId = Convert.ToInt32(dr["MainTabId"]);
                        m.MainTabName = dr["MainTabName"].ToString();
                        m.MainTabContent = dr["MainTabContent"].ToString();
                        m.LandingId = Convert.ToInt32(dr["LandingId"]);
                        m.SubTabs = new List<SubTabDO>();

                        DataTable dtSubTabs = _objLandingDAL.GetSubTabs(m.MainTabId);
                        SubTabDO s;
                        foreach (DataRow subdr in dtSubTabs.Rows)
                        {
                            s = new SubTabDO();
                            s.SubTabId = Convert.ToInt32(subdr["SubTabId"]);
                            s.SubTabName = subdr["SubTabName"].ToString();
                            s.SubTabContent = subdr["SubTabContent"].ToString();
                            s.MainTabId = Convert.ToInt32(subdr["MainTabId"]);
                            m.SubTabs.Add(s);
                        }

                        l.MainTabs.Add(m);
                    }
                }
                else
                {
                    lp.Landing = null;
                }
            }

            return lp;
        }