Example #1
0
        public bool SaveLanding(LandingPublishDO lp)
        {
            try
            {
                //int publishId = 0;

                //if (lp.PublishId == 0)
                int publishId = _objLandingDAL.SaveLandingPublish(lp.PublishId, lp.AccountId, lp.AccountTypeId, lp.BannerId, lp.DefaultVersion);
                //else
                //publishId = lp.PublishId;

                if (publishId > 0)
                {
                    lp.PublishId = publishId;

                    int landingId = _objLandingDAL.SaveLanding(lp.Landing.LandingId, lp.Landing.Version, lp.PublishId, lp.Landing.DepartmentId, lp.Landing.Forms);

                    if (landingId > 0)
                    {
                        lp.Landing.LandingId = landingId;

                        _objLandingDAL.DeleteMainTab(lp.Landing.LandingId);

                        foreach (MainTabDO item in lp.Landing.MainTabs)
                        {
                            item.LandingId = landingId;

                            int mainTabId = _objLandingDAL.SaveMainTab(item.MainTabId, item.MainTabName, item.MainTabContent, item.LandingId);

                            if (mainTabId > 0)
                            {
                                item.MainTabId = mainTabId;

                                foreach (SubTabDO subitem in item.SubTabs)
                                {
                                    subitem.MainTabId = mainTabId;

                                    _objLandingDAL.SaveSubTab(subitem.SubTabId, subitem.SubTabName, subitem.SubTabContent, subitem.MainTabId);
                                }
                            }
                        }
                    }
                }

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Example #2
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);
        }
Example #3
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;
        }
Example #4
0
        public bool SaveLanding(LandingPublishDO lp)
        {
            try
            {
                //int publishId = 0;

                //if (lp.PublishId == 0)
                 int publishId = _objLandingDAL.SaveLandingPublish(lp.PublishId, lp.AccountId, lp.AccountTypeId, lp.BannerId, lp.DefaultVersion);
                //else
                    //publishId = lp.PublishId;

                if (publishId > 0)
                {
                    lp.PublishId = publishId;

                    int landingId = _objLandingDAL.SaveLanding(lp.Landing.LandingId, lp.Landing.Version, lp.PublishId, lp.Landing.DepartmentId, lp.Landing.Forms);

                    if (landingId > 0)
                    {
                        lp.Landing.LandingId = landingId;

                        _objLandingDAL.DeleteMainTab(lp.Landing.LandingId);

                        foreach (MainTabDO item in lp.Landing.MainTabs)
                        {
                            item.LandingId = landingId;

                            int mainTabId = _objLandingDAL.SaveMainTab(item.MainTabId, item.MainTabName, item.MainTabContent, item.LandingId);

                            if (mainTabId > 0)
                            {
                                item.MainTabId = mainTabId;

                                foreach (SubTabDO subitem in item.SubTabs)
                                {
                                    subitem.MainTabId = mainTabId;

                                    _objLandingDAL.SaveSubTab(subitem.SubTabId, subitem.SubTabName, subitem.SubTabContent, subitem.MainTabId);
                                }
                            }
                        }
                    }
                }

                return true;
            }
            catch
            {
                return false;
            }
        }