Esempio n. 1
0
        private void UpdateDataView()
        {
            #region Populate Languages Check box list
            //using (HyperCatalog.Business.LanguageList languageList = HyperCatalog.Business.Language.GetAll("LanguageCode NOT IN (Select LanguageCode FROM Cultures WHERE CultureTypeId = 0) AND LanguageCode NOT IN (Select LanguageCode FROM Cultures L, Countries C WHERE L.CountryCode = C.CountryCode AND L.CultureTypeId = 2 AND C.PLCDrivenTranslation=1)"))
            //{
            //    languageList.Sort("Name");
            //    cblLanguageScope.DataSource = languageList;
            //    cblLanguageScope.DataBind();
            //}
            #endregion

            string sSql   = string.Empty;
            string filter = txtFilter.Text;
            if (filter != string.Empty)
            {
                string cleanFilter = filter.Replace("'", "''").ToLower();
                sSql  = " LOWER(ScopeName) like '%" + cleanFilter + "%' ";
                sSql += " OR LOWER(ScopeComment) like '%" + cleanFilter + "%' ";
            }
            using (TRScopeList trScopes = TRScope.GetAll(sSql))
            {
                trScopes.Sort("Name");

                dg.DataSource = trScopes;
                Utils.InitGridSort(ref dg);
                dg.DataBind();
                if (trScopes.Count == 0)
                {
                    lbTitle.Text = "No Language Scopes in the System";
                }
                else
                {
                    lbTitle.Text = "Language Scopes list";
                }
            }
            panelGrid.Visible = true;
        }
Esempio n. 2
0
        private void InitItem()
        {
            #region Populate Languages Check box list
            string filter = "LanguageCode <> dbo.GetLanguageCode('" + HyperCatalog.Shared.SessionState.Culture.Code + "') AND LanguageCode NOT IN (SELECT LanguageCode FROM Cultures Cu, Countries C WHERE Cu.CountryCode = C.CountryCode AND C.PLCDrivenTranslation = 1)";
            cblLanguageScope.DataSource = HyperCatalog.Business.Language.GetByCulture(HyperCatalog.Shared.SessionState.Culture.Code, filter);
            cblLanguageScope.DataBind();
            #endregion

            #region Populate Scopes combo box
            if (cblLanguageScope.Items.Count > 0)
            {
                //Modified by Sateesh for Language Scope Management (PCF: ACQ 3.6) - 27/05/2009
                using (TRScopeList trScopeAll = TRScope.GetAll("RegionCode = '" + SessionState.Culture.Code + "'"))
                {
                    ddlScopes.DataSource = trScopeAll;
                    ddlScopes.DataBind();
                    ddlScopes.Items.Insert(0, new ListItem("---> Please make your choice <---", string.Empty));
                    panelScopeTitle.Visible     = true;
                    panelScopeLanguages.Visible = true;
                }
                //Modified by Sateesh for Language Scope Management (PCF: ACQ 3.6) - 27/05/2009
            }
            else
            {
                panelScopeTitle.Visible     = false;
                panelScopeLanguages.Visible = false;
            }
            #endregion

            //Modified by Prabhu for ACQ 3.0 (PCF1: Regional Project Management)-- 18/May/09
            SessionState.CurrentItem.RegionCode = SessionState.Culture.Code;
            if (Item.Milestones.InheritedItem != null)
            {
                SessionState.CurrentItem.Milestones.InheritedItem.RegionCode = SessionState.Culture.Code;
            }
            Enabled = true;
            //Modified by Prabhu for ACQ 3.0 (PCF1: Regional Project Management)-- 22/Jul/09
            //Fix for QC 2765 - UAT: Beginning of Regionalization Date when setting a new project does not default to today's date
            // SET BOR date same as BOP for new Projects
            wdBop.Value = wdEoa.Value = DateTime.Now;
            wdEov.Value = wdBot.Value = wdEot.Value = null;
            if (Item != null && Item.Milestones != null && Item.Milestones.BeginningOfRegionalization.HasValue)
            {
                panelScopeLanguages.Visible = panelScopeTitle.Visible = Item.TranslationMode == TRClassTranslationMode.Standard;
                wdBop.Value = Item.Milestones.CreationDate;
                //wdBop.Value = Item.CreateDate.Value;
                if (Item.Milestones.InheritedItem != null && Item.Milestones.InheritedItem.Milestones.CreationDate.HasValue)
                {
                    wdBop.Value = Item.Milestones.InheritedItem.Milestones.CreationDate.Value;
                }
                if (Item.Milestones.BeginningOfRegionalization != null)
                {
                    wdEoa.Value = Item.Milestones.BeginningOfRegionalization.Value;
                }
                if (Item.Milestones.EndOfRegionalization != null)
                {
                    wdEov.Value = Item.Milestones.EndOfRegionalization.Value;
                }
                if (Item.Milestones.BeginningOfTranslation != null)
                {
                    wdBot.Value = Item.Milestones.BeginningOfTranslation.Value;
                }
                if (Item.Milestones.EndOfTranslation != null)
                {
                    wdEot.Value = Item.Milestones.EndOfTranslation.Value;
                }

                cblLanguageScope.ClearSelection();
                foreach (HyperCatalog.Business.Language cul in Item.Translations)
                {
                    foreach (ListItem item in cblLanguageScope.Items)
                    {
                        if (item.Value == cul.Code)
                        {
                            item.Selected = true;
                        }
                    }
                }
                if (Item.Milestones.Inherited)
                {
                    // Propose to the user to create its own project.
                    // In the meantime, disable everything
                    Enabled             = false;
                    lnkOverride.Visible = true;
                }
            }
            else
            {
                wdBop.Value = DateTime.UtcNow;
            }

            // if it is not region, then user cannot modify master publishing date, beginning of project,
            // end of translation, beginning of localization and end of localization
            //Modified by Prabhu for ACQ 3.0 (PCF1: Regional Project Management)-- 26/May/09 -- check
            //if (HyperCatalog.Shared.SessionState.Culture.Type != HyperCatalog.Business.CultureType.Master)
            if (HyperCatalog.Shared.SessionState.Culture.Type != HyperCatalog.Business.CultureType.Regionale)
            {
                panelBOP.Visible = panelEOT.Visible = false;
                wdEoa.Enabled    = ddlScopes.Enabled = lnkOverride.Visible = wBtnAdd.Enabled = wBtnReplace.Enabled = false;

                if (HyperCatalog.Shared.SessionState.Culture.Type == HyperCatalog.Business.CultureType.Locale)
                {
                    cblLanguageScope.Enabled = false;
                }
            }
            if (cblLanguageScope.Items.Count == 0)
            {
                //Modified by Prabhu for ACQ 3.0 (PCF1: Regional Project Management)-- 26/May/09 -- check
                panelScopeLanguages.Visible = panelScopeTitle.Visible = false;
            }
            if (Item != null && Item.IsMinimizedByCulture(SessionState.Culture.Code))
            {
                wdEoa.Enabled         = wdBop.Enabled = wdEot.Enabled = wdEov.Enabled = wdBot.Enabled =
                    ddlScopes.Enabled = lnkOverride.Visible = wBtnAdd.Enabled = wBtnReplace.Enabled = cblLanguageScope.Enabled = false;
            }
            // Item is a roll, then scope of language is disable
            //if (Item != null && Item.IsRoll)
            //{
            //  ddlScopes.Enabled = cblLanguageScope.Enabled = panelScopeLanguages.Enabled = false;
            //  wBtnAdd.Enabled = wBtnReplace.Enabled = false;
            //}
        }